From 3e4fdeddbb516f5f749e434545903d00556abcff Mon Sep 17 00:00:00 2001 From: Kim Kibum Date: Mon, 30 Apr 2012 17:47:01 +0900 Subject: [PATCH] update tizen source --- AUTHORS | 6 + CMakeLists.txt | 76 + SLP_MessagingFW_PG.h | 869 ++ TC/_export_env.sh | 15 + TC/_export_target_env.sh | 16 + TC/build.sh | 18 + TC/execute.sh | 17 + TC/making_new_tet_scen.py | 69 + TC/msgTC/MapiControl/Makefile | 53 + TC/msgTC/MapiControl/tslist | 2 + TC/msgTC/MapiControl/utc_msg_close_msg_handle.c | 76 + TC/msgTC/MapiControl/utc_msg_close_msg_handle.h | 48 + TC/msgTC/MapiControl/utc_msg_open_msg_handle.c | 77 + TC/msgTC/MapiControl/utc_msg_open_msg_handle.h | 48 + TC/msgTC/MapiMessage/Makefile | 296 + TC/msgTC/MapiMessage/tslist | 62 + TC/msgTC/MapiMessage/utc_msg_add_address.c | 80 + TC/msgTC/MapiMessage/utc_msg_add_address.h | 49 + TC/msgTC/MapiMessage/utc_msg_get_address_count.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_address_count.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_dest_port.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_dest_port.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_direction_info.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_direction_info.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_encode_type.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_encode_type.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_folder_id.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_folder_id.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_ith_address.c | 84 + TC/msgTC/MapiMessage/utc_msg_get_ith_address.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.c | 82 + TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_ith_name.c | 84 + TC/msgTC/MapiMessage/utc_msg_get_ith_name.h | 48 + .../MapiMessage/utc_msg_get_ith_recipient_type.c | 82 + .../MapiMessage/utc_msg_get_ith_recipient_type.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.c | 82 + TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.h | 48 + .../MapiMessage/utc_msg_get_message_body_size.c | 82 + .../MapiMessage/utc_msg_get_message_body_size.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_message_id.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_message_id.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_message_type.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_message_type.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_network_status.c | 82 + TC/msgTC/MapiMessage/utc_msg_get_network_status.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_priority_info.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_priority_info.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.c | 84 + TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_src_port.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_src_port.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_storage_id.c | 80 + TC/msgTC/MapiMessage/utc_msg_get_storage_id.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_subject.c | 84 + TC/msgTC/MapiMessage/utc_msg_get_subject.h | 48 + TC/msgTC/MapiMessage/utc_msg_get_time.c | 83 + TC/msgTC/MapiMessage/utc_msg_get_time.h | 48 + TC/msgTC/MapiMessage/utc_msg_is_in_sim.c | 82 + TC/msgTC/MapiMessage/utc_msg_is_in_sim.h | 49 + TC/msgTC/MapiMessage/utc_msg_is_mms.c | 82 + TC/msgTC/MapiMessage/utc_msg_is_mms.h | 48 + TC/msgTC/MapiMessage/utc_msg_is_protected.c | 80 + TC/msgTC/MapiMessage/utc_msg_is_protected.h | 48 + TC/msgTC/MapiMessage/utc_msg_is_read.c | 80 + TC/msgTC/MapiMessage/utc_msg_is_read.h | 48 + TC/msgTC/MapiMessage/utc_msg_is_sms.c | 80 + TC/msgTC/MapiMessage/utc_msg_is_sms.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.c | 89 + TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_add_media.c | 91 + TC/msgTC/MapiMessage/utc_msg_mms_add_media.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_add_meta.c | 93 + TC/msgTC/MapiMessage/utc_msg_mms_add_meta.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_add_page.c | 85 + TC/msgTC/MapiMessage/utc_msg_mms_add_page.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_add_region.c | 89 + TC/msgTC/MapiMessage/utc_msg_mms_add_region.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_add_transition.c | 93 + TC/msgTC/MapiMessage/utc_msg_mms_add_transition.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_create_message.c | 86 + TC/msgTC/MapiMessage/utc_msg_mms_create_message.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.c | 84 + TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.c | 112 + TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_get_media.c | 113 + TC/msgTC/MapiMessage/utc_msg_mms_get_media.h | 48 + .../MapiMessage/utc_msg_mms_get_message_body.c | 119 + .../MapiMessage/utc_msg_mms_get_message_body.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_get_meta.c | 113 + TC/msgTC/MapiMessage/utc_msg_mms_get_meta.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_get_page.c | 118 + TC/msgTC/MapiMessage/utc_msg_mms_get_page.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.c | 109 + TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.h | 48 + TC/msgTC/MapiMessage/utc_msg_mms_get_transition.c | 115 + TC/msgTC/MapiMessage/utc_msg_mms_get_transition.h | 48 + .../MapiMessage/utc_msg_mms_set_message_body.c | 111 + .../MapiMessage/utc_msg_mms_set_message_body.h | 47 + TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.c | 85 + TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.h | 48 + TC/msgTC/MapiMessage/utc_msg_new_message.c | 78 + TC/msgTC/MapiMessage/utc_msg_new_message.h | 49 + TC/msgTC/MapiMessage/utc_msg_release_message.c | 80 + TC/msgTC/MapiMessage/utc_msg_release_message.h | 48 + TC/msgTC/MapiMessage/utc_msg_reset_address.c | 80 + TC/msgTC/MapiMessage/utc_msg_reset_address.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_direction_info.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_direction_info.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_encode_type.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_encode_type.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_folder_id.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_folder_id.h | 49 + TC/msgTC/MapiMessage/utc_msg_set_message_id.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_message_id.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_message_type.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_message_type.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_network_status.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_network_status.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_port.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_port.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_priority_info.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_priority_info.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_protect_status.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_protect_status.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_read_status.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_read_status.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.c | 86 + TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_storage_id.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_storage_id.h | 49 + TC/msgTC/MapiMessage/utc_msg_set_subject.c | 80 + TC/msgTC/MapiMessage/utc_msg_set_subject.h | 48 + TC/msgTC/MapiMessage/utc_msg_set_time.c | 84 + TC/msgTC/MapiMessage/utc_msg_set_time.h | 47 + .../MapiMessage/utc_msg_sms_get_message_body.c | 84 + .../MapiMessage/utc_msg_sms_get_message_body.h | 48 + .../MapiMessage/utc_msg_sms_set_message_body.c | 80 + .../MapiMessage/utc_msg_sms_set_message_body.h | 48 + TC/msgTC/MapiSetting/Makefile | 52 + TC/msgTC/MapiSetting/tslist | 2 + TC/msgTC/MapiSetting/utc_msg_get_config.c | 81 + TC/msgTC/MapiSetting/utc_msg_get_config.h | 48 + TC/msgTC/MapiSetting/utc_msg_set_config.c | 83 + TC/msgTC/MapiSetting/utc_msg_set_config.h | 48 + TC/msgTC/MapiStorage/Makefile | 195 + TC/msgTC/MapiStorage/tslist | 40 + TC/msgTC/MapiStorage/utc_msg_add_folder.c | 105 + TC/msgTC/MapiStorage/utc_msg_add_folder.h | 50 + TC/msgTC/MapiStorage/utc_msg_add_message.c | 87 + TC/msgTC/MapiStorage/utc_msg_add_message.h | 50 + TC/msgTC/MapiStorage/utc_msg_add_syncml_message.c | 98 + TC/msgTC/MapiStorage/utc_msg_add_syncml_message.h | 50 + TC/msgTC/MapiStorage/utc_msg_count_message.c | 91 + TC/msgTC/MapiStorage/utc_msg_count_message.h | 50 + .../MapiStorage/utc_msg_count_msg_by_contact.c | 99 + .../MapiStorage/utc_msg_count_msg_by_contact.h | 50 + TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.c | 91 + TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.h | 50 + .../utc_msg_delete_all_msgs_in_folder.c | 89 + .../utc_msg_delete_all_msgs_in_folder.h | 50 + TC/msgTC/MapiStorage/utc_msg_delete_folder.c | 89 + TC/msgTC/MapiStorage/utc_msg_delete_folder.h | 50 + TC/msgTC/MapiStorage/utc_msg_delete_message.c | 96 + TC/msgTC/MapiStorage/utc_msg_delete_message.h | 50 + .../utc_msg_delete_thread_message_list.c | 89 + .../utc_msg_delete_thread_message_list.h | 50 + TC/msgTC/MapiStorage/utc_msg_generate_message.c | 79 + TC/msgTC/MapiStorage/utc_msg_generate_message.h | 50 + .../utc_msg_get_conversation_view_list.c | 96 + .../utc_msg_get_conversation_view_list.h | 50 + TC/msgTC/MapiStorage/utc_msg_get_folder_list.c | 97 + TC/msgTC/MapiStorage/utc_msg_get_folder_list.h | 50 + .../MapiStorage/utc_msg_get_folder_view_list.c | 100 + .../MapiStorage/utc_msg_get_folder_view_list.h | 50 + TC/msgTC/MapiStorage/utc_msg_get_mem_size.c | 91 + TC/msgTC/MapiStorage/utc_msg_get_mem_size.h | 50 + TC/msgTC/MapiStorage/utc_msg_get_message.c | 96 + TC/msgTC/MapiStorage/utc_msg_get_message.h | 50 + .../MapiStorage/utc_msg_get_quick_panel_data.c | 90 + .../MapiStorage/utc_msg_get_quick_panel_data.h | 50 + .../MapiStorage/utc_msg_get_thread_view_list.c | 101 + .../MapiStorage/utc_msg_get_thread_view_list.h | 50 + TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.c | 89 + TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.h | 50 + TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.c | 89 + TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.h | 50 + TC/msgTC/MapiStorage/utc_msg_release_folder_list.c | 97 + TC/msgTC/MapiStorage/utc_msg_release_folder_list.h | 50 + .../MapiStorage/utc_msg_release_thread_view_list.c | 97 + .../MapiStorage/utc_msg_release_thread_view_list.h | 50 + TC/msgTC/MapiStorage/utc_msg_reset_database.c | 89 + TC/msgTC/MapiStorage/utc_msg_reset_database.h | 50 + .../MapiStorage/utc_msg_thread_view_get_address.c | 105 + .../MapiStorage/utc_msg_thread_view_get_address.h | 50 + .../utc_msg_thread_view_get_contact_id.c | 103 + .../utc_msg_thread_view_get_contact_id.h | 50 + .../MapiStorage/utc_msg_thread_view_get_data.c | 105 + .../MapiStorage/utc_msg_thread_view_get_data.h | 50 + .../utc_msg_thread_view_get_direction.c | 103 + .../utc_msg_thread_view_get_direction.h | 50 + .../utc_msg_thread_view_get_image_path.c | 105 + .../utc_msg_thread_view_get_image_path.h | 50 + .../MapiStorage/utc_msg_thread_view_get_mms_cnt.c | 103 + .../MapiStorage/utc_msg_thread_view_get_mms_cnt.h | 50 + .../MapiStorage/utc_msg_thread_view_get_name.c | 105 + .../MapiStorage/utc_msg_thread_view_get_name.h | 50 + .../MapiStorage/utc_msg_thread_view_get_sms_cnt.c | 103 + .../MapiStorage/utc_msg_thread_view_get_sms_cnt.h | 50 + .../utc_msg_thread_view_get_thread_id.c | 103 + .../utc_msg_thread_view_get_thread_id.h | 50 + .../MapiStorage/utc_msg_thread_view_get_time.c | 105 + .../MapiStorage/utc_msg_thread_view_get_time.h | 50 + .../utc_msg_thread_view_get_unread_cnt.c | 103 + .../utc_msg_thread_view_get_unread_cnt.h | 50 + TC/msgTC/MapiStorage/utc_msg_update_folder.c | 105 + TC/msgTC/MapiStorage/utc_msg_update_folder.h | 50 + TC/msgTC/MapiStorage/utc_msg_update_message.c | 89 + TC/msgTC/MapiStorage/utc_msg_update_message.h | 50 + .../MapiStorage/utc_msg_update_protected_status.c | 89 + .../MapiStorage/utc_msg_update_protected_status.h | 50 + TC/msgTC/MapiStorage/utc_msg_update_read_status.c | 98 + TC/msgTC/MapiStorage/utc_msg_update_read_status.h | 50 + TC/msgTC/MapiTransport/Makefile | 108 + TC/msgTC/MapiTransport/tslist | 13 + .../MapiTransport/utc_msg_mms_forward_message.c | 140 + .../MapiTransport/utc_msg_mms_forward_message.h | 51 + .../MapiTransport/utc_msg_mms_reject_message.c | 138 + .../MapiTransport/utc_msg_mms_reject_message.h | 51 + .../MapiTransport/utc_msg_mms_retrieve_message.c | 138 + .../MapiTransport/utc_msg_mms_retrieve_message.h | 51 + TC/msgTC/MapiTransport/utc_msg_mms_send_message.c | 140 + TC/msgTC/MapiTransport/utc_msg_mms_send_message.h | 51 + .../MapiTransport/utc_msg_mms_send_read_report.c | 79 + .../MapiTransport/utc_msg_mms_send_read_report.h | 50 + .../utc_msg_reg_lbs_message_callback.c | 83 + .../utc_msg_reg_lbs_message_callback.h | 51 + .../utc_msg_reg_mms_conf_message_callback.c | 83 + .../utc_msg_reg_mms_conf_message_callback.h | 51 + .../utc_msg_reg_sent_status_callback.c | 83 + .../utc_msg_reg_sent_status_callback.h | 51 + .../utc_msg_reg_sms_message_callback.c | 84 + .../utc_msg_reg_sms_message_callback.h | 51 + .../utc_msg_reg_syncml_message_callback.c | 83 + .../utc_msg_reg_syncml_message_callback.h | 51 + TC/msgTC/MapiTransport/utc_msg_sms_send.c | 75 + TC/msgTC/MapiTransport/utc_msg_sms_send.h | 51 + TC/msgTC/MapiTransport/utc_msg_sms_send_message.c | 111 + TC/msgTC/MapiTransport/utc_msg_sms_send_message.h | 51 + TC/msgTC/MapiTransport/utc_msg_submit_req.c | 112 + TC/msgTC/MapiTransport/utc_msg_submit_req.h | 51 + TC/tet_scen | 126 + TC/tetbuild.cfg | 5 + TC/tetclean.cfg | 5 + TC/tetexec.cfg | 5 + TC/tslist.txt | 5 + config/.msg_service.db | Bin 0 -> 21504 bytes config/.msg_service.db-journal | Bin 0 -> 4640 bytes config/alert_on_call.mp3 | Bin 0 -> 50369 bytes config/kdb-setting.sh | 54 + config/message_tone/Sherbet.wav | Bin 0 -> 121140 bytes config/plugin.cfg | 7 + debian/changelog | 57 + debian/compat | 1 + debian/control | 44 + debian/dirs | 2 + debian/docs | 0 debian/libslp-mms-plugin.install.in | 2 + debian/libslp-msg-service-0.install.in | 9 + debian/libslp-msg-service-dev.install.in | 2 + debian/libslp-sms-plugin.install.in | 1 + debian/msg-service-tools.install.in | 5 + debian/msg-service-tools.postinst | 208 + debian/rules | 132 + framework/CMakeLists.txt | 152 + framework/deliver-handler/MsgDeliverHandler.cpp | 353 + framework/main.cpp | 338 + framework/plugin-manager/MsgPluginConfig.cpp | 251 + framework/plugin-manager/MsgPluginManager.cpp | 727 ++ framework/setting-handler/MsgSettingHandler.cpp | 1104 +++ framework/storage-handler/MsgStorageFolder.cpp | 175 + framework/storage-handler/MsgStorageManager.cpp | 828 ++ framework/storage-handler/MsgStorageMessage.cpp | 3327 ++++++++ framework/storage-handler/MsgStorageMms.cpp | 553 ++ framework/storage-handler/MsgStorageSim.cpp | 182 + framework/storage-handler/MsgStorageUtil.cpp | 398 + framework/submit-handler/MsgSubmitHandler.cpp | 463 ++ .../transaction-manager/MsgCmdHandlerSetting.cpp | 105 + .../transaction-manager/MsgCmdHandlerStorage.cpp | 1080 +++ .../transaction-manager/MsgCmdHandlerTransport.cpp | 662 ++ framework/transaction-manager/MsgTransManager.cpp | 876 ++ image/messaging_image001.png | Bin 0 -> 70483 bytes include/common/MsgCmdTypes.h | 235 + include/common/MsgCppTypes.h | 65 + include/common/MsgInternalTypes.h | 526 ++ include/common/MsgMmsTypes.h | 692 ++ include/common/MsgPluginInterface.h | 1108 +++ include/common/MsgQueue.h | 112 + include/common/MsgSettingTypes.h | 685 ++ include/common/MsgStorageTypes.h | 381 + include/common/MsgThread.h | 90 + include/common/MsgTransportTypes.h | 191 + include/common/MsgTypes.h | 743 ++ include/framework/MsgCmdHandler.h | 109 + include/framework/MsgDeliverHandler.h | 55 + include/framework/MsgPluginConfig.h | 108 + include/framework/MsgPluginManager.h | 128 + include/framework/MsgSettingHandler.h | 75 + include/framework/MsgStorageHandler.h | 140 + include/framework/MsgSubmitHandler.h | 54 + include/framework/MsgTransManager.h | 137 + include/mapi/MapiControl.h | 207 + include/mapi/MapiMessage.h | 4937 +++++++++++ include/mapi/MapiSetting.h | 176 + include/mapi/MapiStorage.h | 3043 +++++++ include/mapi/MapiTransport.h | 997 +++ include/msg_helper/MsgHelper.h | 65 + include/proxy/MsgHandle.h | 137 + include/proxy/MsgProxyListener.h | 164 + include/utils/MsgContact.h | 66 + include/utils/MsgDebug.h | 186 + include/utils/MsgDrmWrapper.h | 92 + include/utils/MsgException.h | 99 + include/utils/MsgGconfWrapper.h | 72 + include/utils/MsgIpcSocket.h | 130 + include/utils/MsgMemory.h | 90 + include/utils/MsgMmsMessage.h | 74 + include/utils/MsgMutex.h | 100 + include/utils/MsgNotificationWrapper.h | 74 + include/utils/MsgSoundPlayer.h | 46 + include/utils/MsgSqliteWrapper.h | 107 + include/utils/MsgUtilFile.h | 77 + include/utils/MsgUtilFunction.h | 115 + include/utils/MsgUtilStorage.h | 69 + mapi/CMakeLists.txt | 54 + mapi/MapiControl.cpp | 104 + mapi/MapiMessage.cpp | 1485 ++++ mapi/MapiSetting.cpp | 90 + mapi/MapiStorage.cpp | 1366 ++++ mapi/MapiTransport.cpp | 616 ++ msg-server | 9 + msg-service.pc.in | 10 + msg_helper/CMakeLists.txt | 46 + msg_helper/MsgSoundPlayer.cpp | 424 + msg_helper/main.cpp | 103 + packaging/msg-service.spec | 306 + plugin/mms_plugin/CMakeLists.txt | 100 + .../LanguagePack/MmsPluginWmLngLatinUni.cpp | 1145 +++ .../LanguagePack/MmsPluginWmLngString.cpp | 52 + .../LanguagePack/MmsPluginWmLngUTF8Uni.cpp | 215 + .../LanguagePack/MmsPluginWmLngUniUTF8.cpp | 156 + plugin/mms_plugin/MmsPluginAvCodec.cpp | 225 + plugin/mms_plugin/MmsPluginCodec.cpp | 639 ++ plugin/mms_plugin/MmsPluginConnManWrapper.cpp | 461 ++ plugin/mms_plugin/MmsPluginContentCodec.cpp | 1082 +++ plugin/mms_plugin/MmsPluginDebug.cpp | 1379 ++++ plugin/mms_plugin/MmsPluginDecode.cpp | 8592 ++++++++++++++++++++ plugin/mms_plugin/MmsPluginDrm.cpp | 180 + plugin/mms_plugin/MmsPluginEncode.cpp | 3322 ++++++++ plugin/mms_plugin/MmsPluginEventHandler.cpp | 179 + plugin/mms_plugin/MmsPluginHttp.cpp | 645 ++ plugin/mms_plugin/MmsPluginInternal.cpp | 912 +++ plugin/mms_plugin/MmsPluginMIME.cpp | 1329 +++ plugin/mms_plugin/MmsPluginMain.cpp | 342 + plugin/mms_plugin/MmsPluginMessage.cpp | 1479 ++++ plugin/mms_plugin/MmsPluginSMILValidate.cpp | 506 ++ plugin/mms_plugin/MmsPluginSmil.cpp | 2174 +++++ plugin/mms_plugin/MmsPluginStorage.cpp | 1696 ++++ plugin/mms_plugin/MmsPluginTransport.cpp | 152 + plugin/mms_plugin/MmsPluginUserAgent.cpp | 672 ++ plugin/mms_plugin/include/MmsPluginAvCodec.h | 106 + plugin/mms_plugin/include/MmsPluginCodec.h | 393 + .../mms_plugin/include/MmsPluginConnManWrapper.h | 87 + plugin/mms_plugin/include/MmsPluginData.h | 56 + plugin/mms_plugin/include/MmsPluginDebug.h | 79 + plugin/mms_plugin/include/MmsPluginDrm.h | 53 + plugin/mms_plugin/include/MmsPluginEventHandler.h | 65 + plugin/mms_plugin/include/MmsPluginHttp.h | 112 + plugin/mms_plugin/include/MmsPluginInternal.h | 72 + plugin/mms_plugin/include/MmsPluginMIME.h | 298 + plugin/mms_plugin/include/MmsPluginMain.h | 76 + plugin/mms_plugin/include/MmsPluginMessage.h | 574 ++ plugin/mms_plugin/include/MmsPluginSMILValidate.h | 191 + plugin/mms_plugin/include/MmsPluginSetup.h | 164 + plugin/mms_plugin/include/MmsPluginSmil.h | 290 + plugin/mms_plugin/include/MmsPluginStorage.h | 97 + plugin/mms_plugin/include/MmsPluginTransport.h | 67 + plugin/mms_plugin/include/MmsPluginTypes.h | 306 + plugin/mms_plugin/include/MmsPluginUserAgent.h | 81 + plugin/mms_plugin/include/MmsPluginWmLngPack.h | 108 + plugin/sms_plugin/CMakeLists.txt | 59 + plugin/sms_plugin/SmsPluginCallback.cpp | 876 ++ plugin/sms_plugin/SmsPluginCbMsgHandler.cpp | 790 ++ plugin/sms_plugin/SmsPluginConcatHandler.cpp | 416 + plugin/sms_plugin/SmsPluginEventHandler.cpp | 737 ++ plugin/sms_plugin/SmsPluginMain.cpp | 477 ++ plugin/sms_plugin/SmsPluginParamCodec.cpp | 532 ++ plugin/sms_plugin/SmsPluginSatHandler.cpp | 621 ++ plugin/sms_plugin/SmsPluginSetting.cpp | 887 ++ plugin/sms_plugin/SmsPluginSimMsg.cpp | 741 ++ plugin/sms_plugin/SmsPluginStorage.cpp | 1070 +++ plugin/sms_plugin/SmsPluginTextConvert.cpp | 910 +++ plugin/sms_plugin/SmsPluginTpduCodec.cpp | 624 ++ plugin/sms_plugin/SmsPluginTransport.cpp | 791 ++ plugin/sms_plugin/SmsPluginUAManager.cpp | 107 + plugin/sms_plugin/SmsPluginUDCodec.cpp | 820 ++ plugin/sms_plugin/SmsPluginWapPushHandler.cpp | 3030 +++++++ plugin/sms_plugin/include/SmsPluginCallback.h | 97 + plugin/sms_plugin/include/SmsPluginCbMsgHandler.h | 109 + plugin/sms_plugin/include/SmsPluginConcatHandler.h | 122 + plugin/sms_plugin/include/SmsPluginEventHandler.h | 91 + plugin/sms_plugin/include/SmsPluginMain.h | 88 + plugin/sms_plugin/include/SmsPluginParamCodec.h | 66 + plugin/sms_plugin/include/SmsPluginSatHandler.h | 79 + plugin/sms_plugin/include/SmsPluginSetting.h | 99 + plugin/sms_plugin/include/SmsPluginSimMsg.h | 105 + plugin/sms_plugin/include/SmsPluginStorage.h | 92 + plugin/sms_plugin/include/SmsPluginTextConvert.h | 261 + plugin/sms_plugin/include/SmsPluginTpduCodec.h | 65 + plugin/sms_plugin/include/SmsPluginTransport.h | 87 + plugin/sms_plugin/include/SmsPluginTypes.h | 953 +++ plugin/sms_plugin/include/SmsPluginUAManager.h | 73 + plugin/sms_plugin/include/SmsPluginUDCodec.h | 71 + .../sms_plugin/include/SmsPluginWapPushHandler.h | 116 + proxy/CMakeLists.txt | 49 + proxy/MsgHandleControl.cpp | 502 ++ proxy/MsgHandleSetting.cpp | 115 + proxy/MsgHandleStorage.cpp | 1206 +++ proxy/MsgHandleTransport.cpp | 555 ++ proxy/MsgProxyListener.cpp | 766 ++ test_app/CMakeLists.txt | 48 + test_app/MsgTestConvert.cpp | 409 + test_app/MsgTestConvert.h | 50 + test_app/MsgTestSetting.cpp | 1096 +++ test_app/MsgTestSetting.h | 153 + test_app/MsgTestStorage.cpp | 1925 +++++ test_app/MsgTestStorage.h | 278 + test_app/MsgTestThreadView.cpp | 616 ++ test_app/MsgTestThreadView.h | 81 + test_app/MsgTestTransport.cpp | 153 + test_app/MsgTestTransport.h | 213 + test_app/main.cpp | 519 ++ test_app/main.h | 217 + test_app/mms_files/A.smi | 26 + test_app/mms_files/P091120_104633.jpg | Bin 0 -> 123365 bytes test_app/mms_files/Temp0_2.txt | 1 + test_app/mms_files/Temp1_0.txt | 1 + test_app/mms_files/V091120_104905.3gp | Bin 0 -> 53258 bytes test_app/mms_files/audio.amr | Bin 0 -> 8710 bytes utils/CMakeLists.txt | 58 + utils/MsgContact.cpp | 474 ++ utils/MsgDebug.cpp | 304 + utils/MsgDrmWrapper.cpp | 617 ++ utils/MsgException.cpp | 57 + utils/MsgGconfWrapper.cpp | 185 + utils/MsgIpcSocket.cpp | 519 ++ utils/MsgMemory.cpp | 55 + utils/MsgMmsMessage.cpp | 1179 +++ utils/MsgMutex.cpp | 45 + utils/MsgNotificationWrapper.cpp | 643 ++ utils/MsgSoundPlayer.cpp | 272 + utils/MsgSqliteWrapper.cpp | 486 ++ utils/MsgUtilFile.cpp | 924 +++ utils/MsgUtilFunction.cpp | 703 ++ utils/MsgUtilStorage.cpp | 1009 +++ version.sh | 1 + 467 files changed, 115422 insertions(+) create mode 100755 AUTHORS create mode 100755 CMakeLists.txt create mode 100755 SLP_MessagingFW_PG.h create mode 100755 TC/_export_env.sh create mode 100755 TC/_export_target_env.sh create mode 100755 TC/build.sh create mode 100755 TC/execute.sh create mode 100755 TC/making_new_tet_scen.py create mode 100755 TC/msgTC/MapiControl/Makefile create mode 100755 TC/msgTC/MapiControl/tslist create mode 100755 TC/msgTC/MapiControl/utc_msg_close_msg_handle.c create mode 100755 TC/msgTC/MapiControl/utc_msg_close_msg_handle.h create mode 100755 TC/msgTC/MapiControl/utc_msg_open_msg_handle.c create mode 100755 TC/msgTC/MapiControl/utc_msg_open_msg_handle.h create mode 100755 TC/msgTC/MapiMessage/Makefile create mode 100755 TC/msgTC/MapiMessage/tslist create mode 100755 TC/msgTC/MapiMessage/utc_msg_add_address.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_add_address.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_address_count.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_address_count.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_dest_port.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_dest_port.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_direction_info.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_direction_info.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_encode_type.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_encode_type.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_folder_id.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_folder_id.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_address.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_address.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_name.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_name.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_recipient_type.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_recipient_type.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_message_body_size.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_message_body_size.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_message_id.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_message_id.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_message_type.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_message_type.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_network_status.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_network_status.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_priority_info.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_priority_info.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_src_port.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_src_port.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_storage_id.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_storage_id.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_subject.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_subject.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_time.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_get_time.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_in_sim.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_in_sim.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_mms.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_mms.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_protected.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_protected.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_read.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_read.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_sms.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_is_sms.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_media.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_media.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_meta.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_meta.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_page.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_page.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_region.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_region.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_transition.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_add_transition.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_create_message.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_create_message.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_media.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_media.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_message_body.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_message_body.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_meta.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_meta.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_page.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_page.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_transition.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_get_transition.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_set_message_body.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_set_message_body.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_new_message.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_new_message.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_release_message.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_release_message.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_reset_address.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_reset_address.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_direction_info.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_direction_info.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_encode_type.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_encode_type.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_folder_id.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_folder_id.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_message_id.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_message_id.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_message_type.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_message_type.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_network_status.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_network_status.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_port.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_port.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_priority_info.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_priority_info.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_protect_status.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_protect_status.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_read_status.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_read_status.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_storage_id.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_storage_id.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_subject.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_subject.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_time.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_set_time.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_sms_get_message_body.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_sms_get_message_body.h create mode 100755 TC/msgTC/MapiMessage/utc_msg_sms_set_message_body.c create mode 100755 TC/msgTC/MapiMessage/utc_msg_sms_set_message_body.h create mode 100755 TC/msgTC/MapiSetting/Makefile create mode 100755 TC/msgTC/MapiSetting/tslist create mode 100755 TC/msgTC/MapiSetting/utc_msg_get_config.c create mode 100755 TC/msgTC/MapiSetting/utc_msg_get_config.h create mode 100755 TC/msgTC/MapiSetting/utc_msg_set_config.c create mode 100755 TC/msgTC/MapiSetting/utc_msg_set_config.h create mode 100755 TC/msgTC/MapiStorage/Makefile create mode 100755 TC/msgTC/MapiStorage/tslist create mode 100755 TC/msgTC/MapiStorage/utc_msg_add_folder.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_add_folder.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_add_message.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_add_message.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_add_syncml_message.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_add_syncml_message.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_count_message.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_count_message.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_count_msg_by_contact.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_count_msg_by_contact.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_delete_folder.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_delete_folder.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_delete_message.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_delete_message.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_delete_thread_message_list.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_delete_thread_message_list.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_generate_message.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_generate_message.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_conversation_view_list.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_conversation_view_list.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_folder_list.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_folder_list.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_folder_view_list.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_folder_view_list.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_mem_size.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_mem_size.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_message.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_message.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_quick_panel_data.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_quick_panel_data.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_thread_view_list.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_get_thread_view_list.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_release_folder_list.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_release_folder_list.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_release_thread_view_list.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_release_thread_view_list.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_reset_database.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_reset_database.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_address.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_address.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_contact_id.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_contact_id.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_data.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_data.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_direction.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_direction.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_image_path.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_image_path.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_name.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_name.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_thread_id.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_thread_id.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_time.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_time.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_update_folder.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_update_folder.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_update_message.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_update_message.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_update_protected_status.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_update_protected_status.h create mode 100755 TC/msgTC/MapiStorage/utc_msg_update_read_status.c create mode 100755 TC/msgTC/MapiStorage/utc_msg_update_read_status.h create mode 100755 TC/msgTC/MapiTransport/Makefile create mode 100755 TC/msgTC/MapiTransport/tslist create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_forward_message.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_forward_message.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_reject_message.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_reject_message.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_retrieve_message.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_retrieve_message.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_send_message.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_send_message.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_send_read_report.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_mms_send_read_report.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_lbs_message_callback.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_lbs_message_callback.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_sent_status_callback.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_sent_status_callback.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_sms_message_callback.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_sms_message_callback.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_syncml_message_callback.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_reg_syncml_message_callback.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_sms_send.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_sms_send.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_sms_send_message.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_sms_send_message.h create mode 100755 TC/msgTC/MapiTransport/utc_msg_submit_req.c create mode 100755 TC/msgTC/MapiTransport/utc_msg_submit_req.h create mode 100755 TC/tet_scen create mode 100644 TC/tetbuild.cfg create mode 100644 TC/tetclean.cfg create mode 100644 TC/tetexec.cfg create mode 100755 TC/tslist.txt create mode 100755 config/.msg_service.db create mode 100755 config/.msg_service.db-journal create mode 100755 config/alert_on_call.mp3 create mode 100755 config/kdb-setting.sh create mode 100755 config/message_tone/Sherbet.wav create mode 100755 config/plugin.cfg create mode 100755 debian/changelog create mode 100644 debian/compat create mode 100755 debian/control create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100755 debian/libslp-mms-plugin.install.in create mode 100755 debian/libslp-msg-service-0.install.in create mode 100755 debian/libslp-msg-service-dev.install.in create mode 100755 debian/libslp-sms-plugin.install.in create mode 100755 debian/msg-service-tools.install.in create mode 100755 debian/msg-service-tools.postinst create mode 100755 debian/rules create mode 100755 framework/CMakeLists.txt create mode 100755 framework/deliver-handler/MsgDeliverHandler.cpp create mode 100755 framework/main.cpp create mode 100755 framework/plugin-manager/MsgPluginConfig.cpp create mode 100755 framework/plugin-manager/MsgPluginManager.cpp create mode 100755 framework/setting-handler/MsgSettingHandler.cpp create mode 100755 framework/storage-handler/MsgStorageFolder.cpp create mode 100755 framework/storage-handler/MsgStorageManager.cpp create mode 100755 framework/storage-handler/MsgStorageMessage.cpp create mode 100755 framework/storage-handler/MsgStorageMms.cpp create mode 100755 framework/storage-handler/MsgStorageSim.cpp create mode 100755 framework/storage-handler/MsgStorageUtil.cpp create mode 100755 framework/submit-handler/MsgSubmitHandler.cpp create mode 100755 framework/transaction-manager/MsgCmdHandlerSetting.cpp create mode 100755 framework/transaction-manager/MsgCmdHandlerStorage.cpp create mode 100755 framework/transaction-manager/MsgCmdHandlerTransport.cpp create mode 100755 framework/transaction-manager/MsgTransManager.cpp create mode 100755 image/messaging_image001.png create mode 100755 include/common/MsgCmdTypes.h create mode 100755 include/common/MsgCppTypes.h create mode 100755 include/common/MsgInternalTypes.h create mode 100755 include/common/MsgMmsTypes.h create mode 100755 include/common/MsgPluginInterface.h create mode 100755 include/common/MsgQueue.h create mode 100755 include/common/MsgSettingTypes.h create mode 100755 include/common/MsgStorageTypes.h create mode 100755 include/common/MsgThread.h create mode 100755 include/common/MsgTransportTypes.h create mode 100755 include/common/MsgTypes.h create mode 100755 include/framework/MsgCmdHandler.h create mode 100755 include/framework/MsgDeliverHandler.h create mode 100755 include/framework/MsgPluginConfig.h create mode 100755 include/framework/MsgPluginManager.h create mode 100755 include/framework/MsgSettingHandler.h create mode 100755 include/framework/MsgStorageHandler.h create mode 100755 include/framework/MsgSubmitHandler.h create mode 100755 include/framework/MsgTransManager.h create mode 100755 include/mapi/MapiControl.h create mode 100755 include/mapi/MapiMessage.h create mode 100755 include/mapi/MapiSetting.h create mode 100755 include/mapi/MapiStorage.h create mode 100755 include/mapi/MapiTransport.h create mode 100755 include/msg_helper/MsgHelper.h create mode 100755 include/proxy/MsgHandle.h create mode 100755 include/proxy/MsgProxyListener.h create mode 100755 include/utils/MsgContact.h create mode 100755 include/utils/MsgDebug.h create mode 100755 include/utils/MsgDrmWrapper.h create mode 100755 include/utils/MsgException.h create mode 100755 include/utils/MsgGconfWrapper.h create mode 100755 include/utils/MsgIpcSocket.h create mode 100755 include/utils/MsgMemory.h create mode 100755 include/utils/MsgMmsMessage.h create mode 100755 include/utils/MsgMutex.h create mode 100755 include/utils/MsgNotificationWrapper.h create mode 100755 include/utils/MsgSoundPlayer.h create mode 100755 include/utils/MsgSqliteWrapper.h create mode 100755 include/utils/MsgUtilFile.h create mode 100755 include/utils/MsgUtilFunction.h create mode 100755 include/utils/MsgUtilStorage.h create mode 100755 mapi/CMakeLists.txt create mode 100755 mapi/MapiControl.cpp create mode 100755 mapi/MapiMessage.cpp create mode 100755 mapi/MapiSetting.cpp create mode 100755 mapi/MapiStorage.cpp create mode 100755 mapi/MapiTransport.cpp create mode 100755 msg-server create mode 100755 msg-service.pc.in create mode 100755 msg_helper/CMakeLists.txt create mode 100755 msg_helper/MsgSoundPlayer.cpp create mode 100755 msg_helper/main.cpp create mode 100755 packaging/msg-service.spec create mode 100755 plugin/mms_plugin/CMakeLists.txt create mode 100755 plugin/mms_plugin/LanguagePack/MmsPluginWmLngLatinUni.cpp create mode 100755 plugin/mms_plugin/LanguagePack/MmsPluginWmLngString.cpp create mode 100755 plugin/mms_plugin/LanguagePack/MmsPluginWmLngUTF8Uni.cpp create mode 100755 plugin/mms_plugin/LanguagePack/MmsPluginWmLngUniUTF8.cpp create mode 100755 plugin/mms_plugin/MmsPluginAvCodec.cpp create mode 100755 plugin/mms_plugin/MmsPluginCodec.cpp create mode 100755 plugin/mms_plugin/MmsPluginConnManWrapper.cpp create mode 100755 plugin/mms_plugin/MmsPluginContentCodec.cpp create mode 100755 plugin/mms_plugin/MmsPluginDebug.cpp create mode 100755 plugin/mms_plugin/MmsPluginDecode.cpp create mode 100755 plugin/mms_plugin/MmsPluginDrm.cpp create mode 100755 plugin/mms_plugin/MmsPluginEncode.cpp create mode 100755 plugin/mms_plugin/MmsPluginEventHandler.cpp create mode 100755 plugin/mms_plugin/MmsPluginHttp.cpp create mode 100755 plugin/mms_plugin/MmsPluginInternal.cpp create mode 100755 plugin/mms_plugin/MmsPluginMIME.cpp create mode 100755 plugin/mms_plugin/MmsPluginMain.cpp create mode 100755 plugin/mms_plugin/MmsPluginMessage.cpp create mode 100755 plugin/mms_plugin/MmsPluginSMILValidate.cpp create mode 100755 plugin/mms_plugin/MmsPluginSmil.cpp create mode 100755 plugin/mms_plugin/MmsPluginStorage.cpp create mode 100755 plugin/mms_plugin/MmsPluginTransport.cpp create mode 100755 plugin/mms_plugin/MmsPluginUserAgent.cpp create mode 100755 plugin/mms_plugin/include/MmsPluginAvCodec.h create mode 100755 plugin/mms_plugin/include/MmsPluginCodec.h create mode 100755 plugin/mms_plugin/include/MmsPluginConnManWrapper.h create mode 100755 plugin/mms_plugin/include/MmsPluginData.h create mode 100755 plugin/mms_plugin/include/MmsPluginDebug.h create mode 100755 plugin/mms_plugin/include/MmsPluginDrm.h create mode 100755 plugin/mms_plugin/include/MmsPluginEventHandler.h create mode 100755 plugin/mms_plugin/include/MmsPluginHttp.h create mode 100755 plugin/mms_plugin/include/MmsPluginInternal.h create mode 100755 plugin/mms_plugin/include/MmsPluginMIME.h create mode 100755 plugin/mms_plugin/include/MmsPluginMain.h create mode 100755 plugin/mms_plugin/include/MmsPluginMessage.h create mode 100755 plugin/mms_plugin/include/MmsPluginSMILValidate.h create mode 100755 plugin/mms_plugin/include/MmsPluginSetup.h create mode 100755 plugin/mms_plugin/include/MmsPluginSmil.h create mode 100755 plugin/mms_plugin/include/MmsPluginStorage.h create mode 100755 plugin/mms_plugin/include/MmsPluginTransport.h create mode 100755 plugin/mms_plugin/include/MmsPluginTypes.h create mode 100755 plugin/mms_plugin/include/MmsPluginUserAgent.h create mode 100755 plugin/mms_plugin/include/MmsPluginWmLngPack.h create mode 100755 plugin/sms_plugin/CMakeLists.txt create mode 100755 plugin/sms_plugin/SmsPluginCallback.cpp create mode 100755 plugin/sms_plugin/SmsPluginCbMsgHandler.cpp create mode 100755 plugin/sms_plugin/SmsPluginConcatHandler.cpp create mode 100755 plugin/sms_plugin/SmsPluginEventHandler.cpp create mode 100755 plugin/sms_plugin/SmsPluginMain.cpp create mode 100755 plugin/sms_plugin/SmsPluginParamCodec.cpp create mode 100755 plugin/sms_plugin/SmsPluginSatHandler.cpp create mode 100755 plugin/sms_plugin/SmsPluginSetting.cpp create mode 100755 plugin/sms_plugin/SmsPluginSimMsg.cpp create mode 100755 plugin/sms_plugin/SmsPluginStorage.cpp create mode 100755 plugin/sms_plugin/SmsPluginTextConvert.cpp create mode 100755 plugin/sms_plugin/SmsPluginTpduCodec.cpp create mode 100755 plugin/sms_plugin/SmsPluginTransport.cpp create mode 100755 plugin/sms_plugin/SmsPluginUAManager.cpp create mode 100755 plugin/sms_plugin/SmsPluginUDCodec.cpp create mode 100755 plugin/sms_plugin/SmsPluginWapPushHandler.cpp create mode 100755 plugin/sms_plugin/include/SmsPluginCallback.h create mode 100755 plugin/sms_plugin/include/SmsPluginCbMsgHandler.h create mode 100755 plugin/sms_plugin/include/SmsPluginConcatHandler.h create mode 100755 plugin/sms_plugin/include/SmsPluginEventHandler.h create mode 100755 plugin/sms_plugin/include/SmsPluginMain.h create mode 100755 plugin/sms_plugin/include/SmsPluginParamCodec.h create mode 100755 plugin/sms_plugin/include/SmsPluginSatHandler.h create mode 100755 plugin/sms_plugin/include/SmsPluginSetting.h create mode 100755 plugin/sms_plugin/include/SmsPluginSimMsg.h create mode 100755 plugin/sms_plugin/include/SmsPluginStorage.h create mode 100755 plugin/sms_plugin/include/SmsPluginTextConvert.h create mode 100755 plugin/sms_plugin/include/SmsPluginTpduCodec.h create mode 100755 plugin/sms_plugin/include/SmsPluginTransport.h create mode 100755 plugin/sms_plugin/include/SmsPluginTypes.h create mode 100755 plugin/sms_plugin/include/SmsPluginUAManager.h create mode 100755 plugin/sms_plugin/include/SmsPluginUDCodec.h create mode 100755 plugin/sms_plugin/include/SmsPluginWapPushHandler.h create mode 100755 proxy/CMakeLists.txt create mode 100755 proxy/MsgHandleControl.cpp create mode 100755 proxy/MsgHandleSetting.cpp create mode 100755 proxy/MsgHandleStorage.cpp create mode 100755 proxy/MsgHandleTransport.cpp create mode 100755 proxy/MsgProxyListener.cpp create mode 100755 test_app/CMakeLists.txt create mode 100755 test_app/MsgTestConvert.cpp create mode 100755 test_app/MsgTestConvert.h create mode 100755 test_app/MsgTestSetting.cpp create mode 100755 test_app/MsgTestSetting.h create mode 100755 test_app/MsgTestStorage.cpp create mode 100755 test_app/MsgTestStorage.h create mode 100755 test_app/MsgTestThreadView.cpp create mode 100755 test_app/MsgTestThreadView.h create mode 100755 test_app/MsgTestTransport.cpp create mode 100755 test_app/MsgTestTransport.h create mode 100755 test_app/main.cpp create mode 100755 test_app/main.h create mode 100755 test_app/mms_files/A.smi create mode 100755 test_app/mms_files/P091120_104633.jpg create mode 100755 test_app/mms_files/Temp0_2.txt create mode 100755 test_app/mms_files/Temp1_0.txt create mode 100755 test_app/mms_files/V091120_104905.3gp create mode 100755 test_app/mms_files/audio.amr create mode 100755 utils/CMakeLists.txt create mode 100755 utils/MsgContact.cpp create mode 100755 utils/MsgDebug.cpp create mode 100755 utils/MsgDrmWrapper.cpp create mode 100755 utils/MsgException.cpp create mode 100755 utils/MsgGconfWrapper.cpp create mode 100755 utils/MsgIpcSocket.cpp create mode 100755 utils/MsgMemory.cpp create mode 100755 utils/MsgMmsMessage.cpp create mode 100755 utils/MsgMutex.cpp create mode 100755 utils/MsgNotificationWrapper.cpp create mode 100755 utils/MsgSoundPlayer.cpp create mode 100755 utils/MsgSqliteWrapper.cpp create mode 100755 utils/MsgUtilFile.cpp create mode 100755 utils/MsgUtilFunction.cpp create mode 100755 utils/MsgUtilStorage.cpp create mode 100755 version.sh diff --git a/AUTHORS b/AUTHORS new file mode 100755 index 0000000..6ce40ef --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +Jaeyun Jeong +Sangkoo Kim +Seunghwan Lee +SoonMin Jung +Jae-Young Lee +KeeBum Kim \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..16400fd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,76 @@ + +########################################################## +# Set Variables +########################################################## +SET(UTILS-LIB msg_utils) +SET(PLUGIN-MANAGER-LIB msg_plugin_manager) +SET(FW-HANDLER-LIB msg_framework_handler) +SET(TRANS-MANAGER-LIB msg_transaction_manager) +SET(TRANS-PROXY-LIB msg_transaction_proxy) +SET(MAPI-LIB msg_mapi) +SET(SMS-PLUGIN-LIB msg_sms_plugin) +SET(MMS-PLUGIN-LIB msg_mms_plugin) +SET(MMS-LANGUAGE-PACK-LIB msg_mms_language_pack) + +########################################################## +# Add Subdirectories +########################################################## +ADD_SUBDIRECTORY(utils) +ADD_SUBDIRECTORY(framework) +ADD_SUBDIRECTORY(proxy) +ADD_SUBDIRECTORY(mapi) +ADD_SUBDIRECTORY(test_app) +ADD_SUBDIRECTORY(plugin/sms_plugin) +ADD_SUBDIRECTORY(plugin/mms_plugin) +ADD_SUBDIRECTORY(msg_helper) + + +########################################################## +# Install Header Files +########################################################## +SET(MAPI-HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/include/mapi/MapiControl.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/mapi/MapiSetting.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/mapi/MapiStorage.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/mapi/MapiTransport.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/mapi/MapiMessage.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/common/MsgTypes.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/common/MsgMmsTypes.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/common/MsgSettingTypes.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/common/MsgStorageTypes.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/common/MsgTransportTypes.h + ${CMAKE_CURRENT_SOURCE_DIR}/SLP_MessagingFW_PG.h ) +INSTALL(FILES ${MAPI-HEADERS} DESTINATION include/msg-service) + + +########################################################## +# Install etc Files +########################################################## + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config/plugin.cfg DESTINATION /usr/share/msg-service) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config/alert_on_call.mp3 DESTINATION /opt/etc/msg-service) + +SET(MMS-FILES + ${CMAKE_CURRENT_SOURCE_DIR}/test_app/mms_files/A.smi + ${CMAKE_CURRENT_SOURCE_DIR}/test_app/mms_files/audio.amr + ${CMAKE_CURRENT_SOURCE_DIR}/test_app/mms_files/P091120_104633.jpg + ${CMAKE_CURRENT_SOURCE_DIR}/test_app/mms_files/Temp0_2.txt + ${CMAKE_CURRENT_SOURCE_DIR}/test_app/mms_files/Temp1_0.txt + ${CMAKE_CURRENT_SOURCE_DIR}/test_app/mms_files/V091120_104905.3gp +) + +INSTALL(FILES ${MMS-FILES} DESTINATION /opt/etc/msg-service) + +SET(RINGTONE-FILES + ${CMAKE_CURRENT_SOURCE_DIR}/config/message_tone/Sherbet.wav +) + +INSTALL(FILES ${RINGTONE-FILES} DESTINATION /usr/share/media/) + +CONFIGURE_FILE(msg-service.pc.in msg-service.pc @ONLY) +INSTALL(FILES ${CMAKE_BINARY_DIR}/msg-service.pc DESTINATION lib/pkgconfig) + +SET(RC_LOCAL_SCRIPT msg-server) +INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION /etc/rc.d/init.d) + diff --git a/SLP_MessagingFW_PG.h b/SLP_MessagingFW_PG.h new file mode 100755 index 0000000..25a0c04 --- /dev/null +++ b/SLP_MessagingFW_PG.h @@ -0,0 +1,869 @@ +/** + * + * @ingroup SLP_PG + * @defgroup MESSAGE MessagingFW +@{ +

Introduction

+

Purpose

+The purpose of this document is to describe how applications can use the Messaging Framework APIs to send and receive SMS and MMS messages. This document gives programming guidelines to application engineers. + +

Scope

+The scope of this document is limited to Messaging Framework APIs usage. + +

Abbreviations

+ + +
APIApplication Programming Interface
+@} + +@defgroup Message_Architecture 1.Archtecture +@ingroup MESSAGE +@{ +

Messaging Framework Architecture

+The Messaging framework supports various messaging services such as SMS, MMS, Cell Broadcast, WAP Push, and Provisioning message. The Messaging framework architecture consists of a Messaging daemon and a library. The messaging library works on application process and provides various APIs to support transport, control, storage, filter and setting services for application. The messaging daemon has three components (transaction manager, transaction handler, and plug-in manager) to provide message services. The socket IPC is used to communicate (request & event) between Messaging daemon and library. +@image html messaging_image001.png + +- Transaction Manager + - Receive the IPC message (request) on socket. + - Manage list of pairs (request ID, transaction proxy) for synchronous return. + - Determine the transaction flow based on request/event information. (Mapping the request to one of the handlers) + - Store the transaction information for asynchronous events (Find which transaction proxy want to receive SMS) +- Transaction Handler + - Submit handler deals with submit requests. + - Deliver handler deals with the incoming message from plug-ins. + - Storage handler deals with the messages, accounts and folder requests + - Filter handler deals with the filter requests + - Setting handler deals with the service-specific attributes +- Plug-in Manager + - Initialize all plug-ins after loading plug-in configuration files + - Holding the list of plug-ins and the state of plug-ins + - Providing the interface between handlers and plug-ins +- Transaction Handlers + - Initialize all plug-ins after loading plug-in configuration files + - Receiving IPC messages from messaging daemon. + - Handling synchronous calls + - Condition variable is used for waiting the return from msg. server) + - Handling asynchronous calls or events + - Proxy listener is a component of transaction proxy + - Proxy listener is waiting for the event + - Invoking callback function in the msg. handle list + - i.e. calling incoming callback function of MSG APP handle, when incoming msg + - Holding list of message handles + - Message handle is created by MsgOpenMsgHandle(msgHandle) + - Message handle holds some info such as callback func +- Message API + - Transport & control API + - Storage API + - Filter API + - Setting API +@} + +@defgroup Message_Feature 2.Feature +@ingroup MESSAGE +@{ +

Messaging Framework Features

+-# Message Control Features: + -# Open/Close message handle +-# Message Transport Features: + -# Submit request to send, forward, reply, retrieve message. + -# Register callback functions to listen to invoked events from messaging daemon. (message status callback, incoming message callback) +-# Message Storage Features: + -# Add / Update / Move / Delete / Count / Get message or message list. + -# Add / Update / Delete / Get folder or folder list. +-# Message Filter Features: + -# Add / Update / Delete filter or filter list. +-# Message Setting Features: + -# Set / Get various message setting (i.e. whether to send read/delivery report or not) +@} + +@defgroup MESSAGE_USECASES_1 Initialize/Finalization +@ingroup MESSAGE_USECASES +@{ +

Messaging Framework Functions

+ +

Initialization / Finalization to use Messaging Service

+- int msg_open_msg_handle(MSG_HANDLE_T *handle); +@n msg_open_msg_handle() should be called before using the messaging service. This function opens a channel between the application and the messaging framework. +- int msg_close_msg_handle(MSG_HANDLE_T *handle); +@n msg_close_msg_handle() should be called after using the messaging service. This function closes a channel between the application and the messaging framework. +- int msg_reg_sent_status_callback(MSG_HANDLE_T handle, msg_sent_status_cb cb); +@n Application should implement a msg_sent_status_cb function and register it into message handle. If the application sends a message, this callback function will be called to report its sending status. msg_reg_set_status_callback function should be called after creation of message handle. +- int msg_reg_sms_message_callback(MSG_HANDLE_T handle, msg_sms_incoming_cb cb, unsigned short port); +@n Application should implement a msg_sms_incoming_cb function and register it into message handle. It?™s used to listen to the SMS incoming event invoked by messaging daemon. The incoming message information structure (MSG_MESSAGE_S) can be delivered as a parameter of the callback function. +- int msg_reg_mms_conf_message_callback(MSG_HANDLE_T handle, msg_mms_conf_msg_incoming_cb cb, char *app_id); +@n Application should implement a msg_mms_conf_msg_incoming_cb function and register it into message handle. It?™s used to listen to the MMS incoming event invoked by messaging daemon. The incoming message information structure (MSG_MESSAGE_S) can be delivered as a parameter of the callback function. +@code +#include +#include +#include +#include + +void sentStatusCB(MSG_HANDLE_T hMsgHandle, MSG_SENT_STATUS_S *pMsgStatus, void *user_param) +{ + // Application can handle message sent status event +} + +void incomingSmsMessageCB (MSG_HANDLE_T hMsgHandle, msg_message_t msg, void *user_param) +{ + // Application can handle SMS incoming message. +} + +void incomingMmsConfMessageCB(MSG_HANDLE_T hMsgHandle, msg_message_t msg, void *user_param) +{ + // Application can handle MMS incoming message. +} + +int main(void) +{ + MSG_HANDLE_T msgHandle = NULL; + + err = msg_open_msg_handle(&msgHandle); + + if (err != MSG_SUCCESS) + { + printf("msg_open_msg_handle() Fail [%d]", err); + return err; + } + + // Register sent status handler + err = msg_reg_sent_status_callback(msgHandle, &sentStatusCB, NULL); + + if (err != MSG_SUCCESS) + { + printf("msg_reg_sent_status_callback() Fail [%d]", err); + return err; + } + + // Register SMS incoming message handler + err = msg_reg_sms_message_callback(msgHandle, &incomingSmsMessageCB, 0, NULL); + + if (err != MSG_SUCCESS) + { + printf("msg_reg_sms_message_callback() Fail [%d]", err); + return err; + } + + // Register MMS incoming message handler + err = msg_reg_mms_conf_message_callback(msgHandle, &incomingMmsConfMessageCB, NULL, NULL); + + if (err != MSG_SUCCESS) + { + printf("msg_reg_mms_conf_message_callback() Fail [%d]", err); + return err; + } + + // g_main_loop should be used to listen CB event from messaging daemon + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + msg_close_msg_handle(&msgHandle); + + return err; +} +@endcode +@} + +@defgroup MESSAGE_USECASES_2 Adding a SMS Message +@ingroup MESSAGE_USECASES +@{ +

Adding a SMS Message

+- msg_message_t msg_new_message(); +@n msg_new_message() is a function to create a message object which can store the message information. You should call this function to set the message that you want to add or send. +- int msg_set_message_type(msg_message_t msg, MSG_MESSAGE_TYPE_T msg_type); +@n msg_set_message_type() is a function to set the message type such as SMS or MMS. The first parameter is the message object which is created by msg_new_message(). The second parameter is the message type you want to set. It should be one of enum type ( _MSG_MESSAGE_TYPE_E). If setting is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). +- int msg_sms_set_message_body(msg_message_t msg, const char* mdata, int size); +@n msg_sms_set_message_body() is a function to set the SMS body data. The first parameter is the message object which is created by msg_new_message(). The second parameter is the SMS body data you want to set. The third parameter is the length of SMS body data. If setting is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). +- int msg_add_address(msg_message_t msg, const char* phone_num_list, MSG_RECIPIENT_TYPE_T to_type); +@n msg_add_address() is a function to add the phone numbers for the message. The first parameter is the message object which is created by msg_new_message(). The second parameter is the list of phone number you want to set. You can add several phone numbers at once. The phone numbers should be separated by ','. The third parameter is the recipient type of phone number. It should be one of enum type (_MSG_RECIPIENT_TYPE_E). If setting is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). +- int msg_add_message(MSG_HANDLE_T handle, const msg_message_t msg, const MSG_SENDINGOPT_S *send_opt); +@n msg_add_message() is a function to add a composed message into the database of messaging framework. Before calling this function, the application should set the message object and the sending option structure and then pass them as parameters. If you don't want to change the current sending option, set the variable 'bSetting' to false. If saving a message is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). +- int msg_release_message(msg_message_t *msg); +@n msg_release_message() is a function to free the memory of a message object which is create by msg_new_message(). If freeing the memory is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). +@code +#include +#include +#include + +void test_add_sms_message(MSG_HANDLE_T hMsgHandle) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_SENDINGOPT_S sendOpt = {0, }; + sendOpt.bSetting = false; + + msg_message_t msgInfo = msg_new_message(); + + // Set Message Type + err = msg_set_message_type(msgInfo, MSG_TYPE_SMS); + + if (err != MSG_SUCCESS) goto free_memory; + + char msgText[1024]; + + memset(msgText, 0x00, 1024); + strncpy(msgText, "Test SMS Message", sizeof(msgText)-1); + int dataSize = strlen(msgText); + + // Set SMS text + err = msg_sms_set_message_body(msgInfo, msgText, dataSize); + + if (err != MSG_SUCCESS) goto free_memory; + + char number[MAX_ADDRESS_VAL_LEN]; + + memset(number, 0x00, MAX_ADDRESS_VAL_LEN); + strncpy(number, "+821030011234", sizeof(number)-1); + + // Set Recipient Address + err = msg_add_address(msgInfo, number, MSG_RECIPIENTS_TYPE_TO); + + if (err != MSG_SUCCESS) goto free_memory; + + err = msg_add_message(hMsgHandle, msgInfo, &sendOpt); + + if (err == MSG_SUCCESS) + printf("Saving Message is OK!"); + else + printf("Saving Message is failed!"); + +free_memory: + msg_release_message(&msgInfo); +} +@endcode +@} + +@defgroup MESSAGE_USECASES_3 Adding a MMS Message +@ingroup MESSAGE_USECASES +@{ +

Adding a MMS Message

+- int msg_set_subject(msg_message_t msg, const char* subject); +@n msg_set_subject() is a function to set the subject of MMS. The first parameter is the message object which is created by msg_new_message(). The second parameter is the subject you want to set. If setting is successful, the function returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). + +- MMS_MESSAGE_DATA_S* msg_mms_create_message(void); +@n msg_mms_create_message() allocates a MMS_MESSAGE_DATA_S structure and returns it?™s address. MMS_MESSAGE_DATA_S is needed to represent mms specific data and transfer it to the messaging daemon in the pData parameter of the MSG_MESSAGE_S structure. + +- MMS_SMIL_ROOTLAYOUT* msg_mms_set_rootlayout(MMS_MESSAGE_DATA_S* msg, const int width, const int height, const int bgcolor); +@n msg_mms_set_rootlayout() is a function to set smil root layout. The parameters representing the size and background color of smil root layout should be set. + +- MMS_SMIL_REGION* msg_mms_add_region(MMS_MESSAGE_DATA_S *msg_data, const char* szID, const int x, const int y, const int width, const int height, const int bgcolor); +@n msg_mms_add_region() is a function to add a smil region. Smil region is needed to display text message, image, and video data (Each content has its own region). This function is called to allocate a region for each contents. + +- MMS_PAGE_S* msg_mms_add_page(MMS_MESSAGE_DATA_S *msg_data, const int duration); +@n msg_mms_add_page() is a function to add a smil page. + +- MMS_MEDIA_S* msg_mms_add_media(MMS_PAGE_S *page, const MmsSmilMediaType mediatype, const char* regionid, char* filepath); +@n msg_mms_add_media() is a function to add multimedia content to a mms message. If some content should be played with smil player, this function can be used. + +- MMS_ATTACH_S* msg_mms_add_attachment(MMS_MESSAGE_DATA_S *msg_data, char *filepath); +@n msg_mms_add_attachment() is a function to add a content as an attached file. With this function a content might be attached as a multipart mixed type. + +- int msg_mms_set_message_body(msg_message_t msg, const MMS_MESSAGE_DATA_S *msg_data); +@n msg_mms_set_message_body() is a function to set the MMS body data. The first parameter is the message object which is created by msg_new_message(). The second parameter is the structure which is allocated by msg_mms_create_message() and is set by the APIs for MMS. + +- int msg_mms_destroy_message(MMS_MESSAGE_DATA_S* msg); +@n msg_mms_destroy_message() should be called to deallocate the MMS_MESSAGE_DATA_S structure and internal region, page, media, and attach list. +@code +#include +#include +#include + +void test_add_mms_message(MSG_HANDLE_T hMsgHandle) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_SENDINGOPT_S sendOpt = {0, }; + sendOpt.bSetting = false; + + msg_message_t msgInfo = msg_new_message(); + + // Set Message Type + err = msg_set_message_type(msgInfo, MSG_TYPE_MMS); + + if (err != MSG_SUCCESS) goto free_memory; + + MMS_MESSAGE_DATA_S* data; + MMS_PAGE_S* page; + MMS_MEDIA_S* media[3]; + MMS_ATTACH_S* attach; + int nSize = 0; + + // Set MMS subject + char subject[MAX_SUBJECT_LEN]; + + memset(subject, 0x00, MAX_SUBJECT_LEN); + strncpy(subject, "hello mms", sizeof(subject)-1); + + err = msg_set_subject(msgInfo, subject); + + if (err != MSG_SUCCESS) goto free_memory; + + // Set MMS Body data + data = msg_mms_create_message(); + msg_mms_set_rootlayout(data, 100, 100, 0xffffff); + msg_mms_add_region(data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(data, "Text", 0, 0, 100, 50, 0xffffff); + page = msg_mms_add_page(data, 5000); + media[0] = msg_mms_add_media(page, MMS_SMIL_MEDIA_IMG, "Image", "/tmp/image.jpg"); + media[1] = msg_mms_add_media(page, MMS_SMIL_MEDIA_AUDIO, NULL, "/tmp/audio.amr"); + media[2] = msg_mms_add_media(page, MMS_SMIL_MEDIA_TEXT, "Text", "/tmp/message.txt"); + attach = msg_mms_add_attachment(data, "attachment.3gp"); + + err = msg_mms_set_message_body(msgInfo, data); + + if (err != MSG_SUCCESS) + { + msg_mms_destroy_message(data); + goto free_memory; + } + + msg_mms_destroy_message(data); + + // Set Recipient Address + char number[MAX_ADDRESS_VAL_LEN]; + + memset(number, 0x00, MAX_ADDRESS_VAL_LEN); + strncpy(number, "+821030011234", sizeof(number)-1); + + err = msg_add_address(msgInfo, number, MSG_RECIPIENTS_TYPE_TO); + + if (err != MSG_SUCCESS) goto free_memory; + + err = msg_add_message(hMsgHandle, msgInfo, &sendOpt); + + if (err == MSG_SUCCESS) + printf("Saving Message is OK!"); + else + printf("Saving Message is failed!"); + +free_memory: + msg_release_message(&msgInfo); +} +@endcode +@} + +@defgroup MESSAGE_USECASES_4 Sending a SMS/MMS Message +@ingroup MESSAGE_USECASES +@{ +

Sending a SMS/MMS Message

+ +- bool msg_is_sms(msg_message_t msg); +@n msg_is_sms() is a function to check whether the message type of message object is SMS or not. The first parameter is the message object which is created by msg_new_message(). The function returns true if the message object is a SMS message. Otherwise, it returns false. + +- bool msg_is_mms(msg_message_t msg); +@n msg_is_mms() is a function to check whether the message type of message object is MMS or not. The first parameter is the message object which is created by msg_new_message(). The function returns true if the message object is a MMS message. Otherwise, it returns false. + +- int msg_sms_send_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); +@n msg_sms_send_message() is a function to send SMS through messaging framework. The first parameter is the handle which is created by msg_open_msg_handle (). The second parameter is the structure that includes the message information to send. You can get the result of sending on sent status callback. + +- int msg_mms_send_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); +@n msg_sms_send_message() is a function to send SMS through messaging framework. The first parameter is the handle which is created by msg_open_msg_handle (). The second parameter is the structure that includes the message information to send. You can get the result of sending on sent status callback. +@code +#include +#include + +int MsgTestSendMsg(MSG_HANDLE_T hMsgHandle, msg_message_t pMsg) +{ + if (hMsgHandle == NULL) + { + printf("Handle is NULL\n"); + return MSG_ERR_NULL_MSGHANDLE; + } + + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_REQUEST_S req = {0}; + + if (pMsg == NULL) + { + printf("Message is NULL\n"); + return MSG_ERR_NULL_MESSAGE; + } + + req.msg = pMsg; + + if (msg_is_sms(req.msg)) + err = msg_sms_send_message(hMsgHandle, &req); + else if (msg_is_mms(req.msg)) + err = msg_mms_send_message(hMsgHandle, &req); + + if (err == MSG_SUCCESS) + printf("Request to Send Message is successful!!!"); + else + printf("Request to Send Message is failed!!!"); + + return err; +} +@endcode +@} + +@defgroup MESSAGE_USECASES_5 Sending Simple SMS Message +@ingroup MESSAGE_USECASES +@{ +

Simple SMS Sending

+- int msg_sms_send(const char *phone_num_list, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param); +@n msg_sms_send() is a simple function to send an SMS message. Without this API, in order to send a message the application should allocate a channel with messaging daemon for IPC, register sent-status callback function to monitor the sending result, and fulfill many member variables of MSG_MESSAGE_S. This function implicitly makes a connection with messaging daemon and registers the callback function. In addition, member variables of the MSG_MESSAGE_S structure are filled with default values except for the recipient phone_number and sms_text. +@code +#include +#include +#include +#include + +GMainLoop *mainloop; + +typedef struct { + char number[256]; + char text[256]; + char userdata[256]; +} send_data; + +void sent_status_cb(MSG_SENT_STATUS_S *pMsgStatus, void *userData) +{ + if (pMsgStatus->status == MSG_NETWORK_SEND_SUCCESS) + printf("reqId : %d MSG SENT SUCCESS !!!\n", pMsgStatus->reqId); + else + printf("reqId : %d MSG SENT FAIL !!! [%d]\n", pMsgStatus->reqId, pMsgStatus->status); +} + +// count from here +gboolean send_func(gpointer data) +{ + send_data* sms_input = (send_data*)data; + + printf("Begin to send [%s] to [%s]\n", sms_input->number, sms_input->text); + MSG_ERROR_T err = msg_sms_send(sms_input->number, sms_input->text, &sent_status_cb, (void*)sms_input->userdata); + + if (err != MSG_SUCCESS) + printf("Send failed [%d]\n", err); + + return FALSE; +} +// end + +int main(int argc, char* argv[]) +{ + if (argc != 3 && argc != 4) + { + printf("Usage: %s {phone_num_list} {sms_text} [user_data]\n", argv[0]); + printf("phone_num_list: phone_num1, phone_num2, ..., phone_numN\n"); + return 0; + } + + // Set sms input parameters : phone numbers and text + send_data sms_input = {}; + strncpy(sms_input.number, argv[1], sizeof(sms_input.number)-1); + strncpy(sms_input.text, argv[2], sizeof(sms_input.text)-1); + if (argc == 4) + strncpy(sms_input.userdata, argv[3], sizeof(sms_input.userdata)-1); + + // Add Sending Function to GMainLoop + g_idle_add(&send_func, (gpointer) &sms_input); + + // start GMainLoop + mainloop = g_main_loop_new(NULL, FALSE); + + printf("Entering GMain Loop to Receive Notifications in Thread...\n"); + + g_main_loop_run(mainloop); + + printf("==== End Test App. Bye...===\n"); + + return 0; +} +@endcode +@} + +@defgroup MESSAGE_USECASES_6 Retrieving a MMS Message +@ingroup MESSAGE_USECASES +@{ +

Retrieving a MMS Message

+- int msg_mms_retrieve_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); +@n msg_mms_retrieve_message() is a function to submit a retrieve MMS request. +@code +void MsgTestRetrieveMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId) +{ + if (hMsgHandle == NULL) + { + printf("Handle is NULL"); + return; + } + + MSG_ERROR_T err = MSG_SUCCESS; + + msg_message_t msg = msg_new_message(); + MSG_SENDINGOPT_S sendOpt = {0, }; + + err = msg_get_message(hMsgHandle, (MSG_MESSAGE_ID_T)nMsgId, msg, &sendOpt); + + if (err != MSG_SUCCESS) + printf("Get Message Failed!"); + + MSG_REQUEST_S req = {0, msg, sendOpt}; + + err = msg_mms_retrieve_message(hMsgHandle, &req); + + if (err != MSG_SUCCESS) + printf("Retrieve MMS Message Failed!"); + + msg_release_message(&msg); +} +@endcode +@} + +@defgroup MESSAGE_USECASES_7 Getting a SMS Message +@ingroup MESSAGE_USECASES +@{ +

Getting a SMS Message

+- int msg_get_message(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, msg_message_t msg, MSG_SENDINGOPT_S *send_opt); +@n msg_get_message() is a function to get a message. The first parameter is the handle which is created by msg_open_msg_handle (). The second parameter is the message ID you want to get. The third parameter is the message object to receive the message information. The last parameter is the structure to receive the message sending options. + +- int msg_get_message_id(msg_message_t msg); +@n msg_get_message_id() is a function to get the message ID. The parameter is the message object. If the function is successful, it returns the message ID. Otherwise it returns an error in enum type (_MSG_ERROR_E). + +- int msg_get_folder_id(msg_message_t msg); +@n msg_get_folder_id() is a function to get the ID of the folder that the message is saved within. The parameter is the message object. If the function is successful, it returns one of the enum type in (_MSG_FOLDER_ID_E) . Otherwise it returns an error in enum type (_MSG_ERROR_E). + +- int msg_get_message_type(msg_message_t msg); +@n msg_get_message_type() is a function to get the message type. The parameter is the message object. If the function is successful, it returns one of the enum type in (_MSG_MESSAGE_TYPE_E). Otherwise it returns an error in enum type (_MSG_ERROR_E). + +- int msg_get_address_count(msg_message_t msg); +@n msg_get_address_count() is a function to get the number of addresses. The parameter is the message object. If the function is successful, it returns the number of addresses. Otherwise it returns an error in enum type (_MSG_ERROR_E). + +- const char* msg_get_ith_address(msg_message_t msg, int ith); +@n msg_get_ith_address() is a function to get the ith address of message. The first parameter is the message object. The second parameter is the index of address you want to get. If the function is successful, it returns the address string. Otherwise it returns NULL. + +- time_t* msg_get_time(msg_message_t msg); +@n msg_get_time() is a function to get the time value of message. The parameter is the message object. If the function is successful, it returns the time value. Otherwise it returns NULL. + +- int msg_get_network_status(msg_message_t msg); +@n msg_get_network_status() is a function to get the network status of message. The parameter is the message object. If the function is successful, it returns one of the enum type in (_MSG_NETWORK_STATUS_E). Otherwise it returns an error in enum type (_MSG_ERROR_E). + +- bool msg_is_read(msg_message_t msg); +@n msg_is_read() is a function to check whether the message was read or not. The parameter is the message object. If the message was read, it returns true. Otherwise it returns false. + +- bool msg_is_protected(msg_message_t msg); +@n msg_is_protected() is a function to check whether the message is protected or not. The parameter is the message object. If the the message was protected, it returns true. Otherwise it returns false. + +- int msg_get_message_body_size(msg_message_t msg); +@n msg_get_message_body_size() is a function to get the byte size of message. The parameter is the message object. If the function is successful, it returns the byte size of message. Otherwise it returns an error in enum type (_MSG_ERROR_E). + +- const char* msg_sms_get_message_body(msg_message_t msg); +@n msg_sms_get_message_body() is a function to get the body data of message. The first parameter is the message object. If the function is successful, it returns the body data. Otherwise it returns NULL. +@code +void MsgTestGetSmsMessage(MSG_HANDLE_T hMsgHandle, int MsgId) +{ + if (hMsgHandle == NULL) + { + printf("Handle is NULL\n"); + return; + } + + MSG_ERROR_T err = MSG_SUCCESS; + + msg_message_t msg = msg_new_message(); + MSG_SENDINGOPT_S sendOpt = {0, }; + + // Get Message + err = msg_get_message(hMsgHandle, (MSG_MESSAGE_ID_T)MsgId, msg, &sendOpt); + + if (err != MSG_SUCCESS) goto free_memory; + + printf("msgId = %d\n", msg_get_message_id(msg)); + printf("folderId = %d\n", msg_get_folder_id(msg)); + printf("msgType = %d\n", msg_get_message_type(msg)); + printf("phone number = %s\n", msg_get_ith_address(msg, 0)); + printf("displayTime = %s\n", ctime(msg_get_time(msg))); + printf("networkStatus = %d\n", msg_get_network_status(msg)); + printf("bRead = %d\n", msg_is_read(msg)); + printf("bProtected = %d\n", msg_is_protected(msg)); + printf("dataSize = %d\n", msg_get_message_body_size(msg)); + printf("msgData = %s\n", msg_sms_get_message_body(msg)); + +free_memory: + msg_release_message(&msg); +} +@endcode +@} + +@defgroup MESSAGE_USECASES_8 Getting a MMS Message +@ingroup MESSAGE_USECASES +@{ +

Getting a MMS Message

+- int msg_mms_get_message_body(msg_message_t msg, MMS_MESSAGE_DATA_S *body); +@n msg_get_address_count. The parameter is the message object. The second parameter is the structure to receive MMS data as output. If the function is successful, it returns MSG_SUCCESS. Otherwise it returns an error in enum type (_MSG_ERROR_E). +- MMS_SMIL_REGION* msg_mms_get_smil_region(MMS_MESSAGE_DATA_S msgBody, int region_idx); +@n msg_mms_get_smil_region() is a function to get a SMIL region information. The first parameter is the structure of MMS data. The second parameter is the index of SMIL region you want to get. If the function is successful, it returns the structure which contains the SMIL region information. Otherwise it returns NULL. +- MMS_PAGE_S* msg_mms_get_page(MMS_MESSAGE_DATA_S msgBody, int page_idx); +@n msg_mms_get_page() is a function to get a SMIL page information. The first parameter is the structure of MMS data. The second parameter is the index of SMIL page you want to get. If the function is successful, it returns the structure which contains the SMIL page information. Otherwise it returns NULL. +- MMS_MEDIA_S* msg_mms_get_media(MMS_PAGE_S *page, int media_idx); +@n msg_mms_get_media() is a function to get a media information in a SMIL page. The first parameter is the structure of SMIL page you want to get the media from. The second parameter is the index of media you want to get. If the function is successful, it returns the structure which contains the media information. Otherwise it returns NULL. +- MMS_ATTACH_S* msg_mms_get_attachment(MMS_MESSAGE_DATA_S msgBody, int attach_idx); +@n msg_mms_get_attachment() is a function to get the file information of an attachment. The first parameter is the structure of MMS data. The second parameter is the index of attachment you want to get. If the function is successful, it returns the structure which contains the attachment file information. Otherwise it returns NULL. +- const char* msg_get_subject(msg_message_t msg); +@n msg_get_subject() is a function to get the subject of MMS. The parameter is the message object. If the function is successful, it returns the subject string. Otherwise it returns NULL. +@code +void MsgTestGetMmsMessage(MSG_HANDLE_T hMsgHandle, int MsgId) +{ + if (hMsgHandle == NULL) + { + printf("Handle is NULL\n"); + return; + } + + MSG_ERROR_T err = MSG_SUCCESS; + + msg_message_t msg = msg_new_message(); + MSG_SENDINGOPT_S sendOpt = {0, }; + + // Get Message + err = msg_get_message(hMsgHandle, (MSG_MESSAGE_ID_T)MsgId, msg, &sendOpt); + + if (err != MSG_SUCCESS) goto free_memory; + + if (msg_is_mms(msg) == false) + { + printf("It is not MMS Message!"); + goto free_memory; + } + + MMS_MESSAGE_DATA_S* msgBody = msg_mms_create_message(); + + // Get MMS Body Data + msg_mms_get_message_body(msg, msgBody); + + //Print root-layout info + printf("width: %d \n + height: %d \n + nbgColor:%x \n", + msgBody->rootlayout.width.value, + msgBody->rootlayout.height.value, + msgBody->rootlayout.bgColor); + + // Print Region Info + for (int i = 0; i < msgBody->regionCnt; ++i) + { + MMS_SMIL_REGION* pRegion = msg_mms_get_smil_region(msgBody, i); + + printf("region id: %s\n + region left : %d\n + region top : %d\n + region width : %d\n + region height : %d\n + region bgColor : %x\n + region fit : %d\n", + pRegion->szID,pRegion->nLeft.value, + pRegion->nTop.value,pRegion->width.value, + pRegion->height.value, pRegion->bgColor, + pRegion->fit); + } + + // Print Page info + for (int i = 0; i< msgBody->pageCnt; ++i) + { + MMS_PAGE_S* pPage = msg_mms_get_page(msgBody, i); + + printf("page's duration: %d msec\n + page's media count: %d\n", + pPage->nDur, pPage->mediaCnt); + + // Print Contents Info + for(int j = 0; j < pPage->mediaCnt; ++j) + { + MMS_MEDIA_S* pMedia = msg_mms_get_media(pPage, j); + printf("media's filename: %s\n + media's filepath: %s\n + media's regionId: %s\n + Bold: %d Italic: %d\n", + pMedia->szFileName, + pMedia->szFilePath, + pMedia->regionId, + pMedia->sMedia.sText.bBold, + pMedia->sMedia.sText.bItalic); + + if(pMedia->drmType != MSG_DRM_TYPE_NONE) + { + printf("media's drmtype: %d\n + media's drmpath: %s\n", + pMedia->drmType, pMedia->szDrm2FullPath); + } + } + } + + for (int i = 0; i < msgBody->attachCnt; ++i) + { + MMS_ATTACH_S* pAttach = msg_mms_get_attachment(msgBody, i); + + printf("Attachment file Name: %s\n + Attachment file Path: %s\n + Attached file size: %d\n", + pAttach->szFileName, + pAttach->szFilePath, + pAttach->fileSize); + + if(pAttach->drmType != MSG_DRM_TYPE_NONE) + printf("media's drmtype: %d\n + media's drmpath: %s\n", + pAttach->drmType, pAttach->szDrm2FullPath); + } + + printf("Subject: %s\n", msg_get_subject(pMsg)); + + printf("msgId = %d", msg_get_message_id(msg)); + printf("folderId = %d", msg_get_folder_id(msg)); + printf("phone number = %s", msg_get_ith_address(msg, 0)); + printf("displayTime = %s", ctime(msg_get_time(msg))); + printf("networkStatus = %d", msg_get_network_status(msg)); + printf("bRead = %d", msg_is_read(msg)); + printf("bProtected = %d", msg_is_protected(msg)); + +free_memory: + msg_mms_destroy_message(msgBody); + + msg_release_message(&msg); +} +@endcode +@} + +@defgroup MESSAGE_USECASES_9 Delete a Message +@ingroup MESSAGE_USECASES +@{ +

Delete a Message

+- int msg_delete_message(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id); +@n msg_delete_message() is a function to delete a message from message box by msg_id. +@code +void MsgTestDeleteMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId) +{ + MSG_ERROR_T err; + + if (msg_delete_message(hMsgHandle, nMsgId) != MSG_SUCCESS) + printf("Failed to delete Message"); + +} +@endcode +@} + +@defgroup MESSAGE_USECASES_10 Set/Get Message Setting +@ingroup MESSAGE_USECASES +@{ +

Set / Get Message setting

+msg_set_config() and msg_get_cofig() is used to set or to get the message setting options. MSG_SETTING_S structure includes various setting information and is shared between message application and messaging daemon. + +- int msg_set_config(MSG_HANDLE_T handle, const MSG_SETTING_S *setting); +@n msg_set_config() sets a message option. +- int msg_get_config(MSG_HANDLE_T handle, MSG_SETTING_S *setting); +@n msg_get_config() gets a message option. +@code +void MsgTestSetGeneralOpt(MSG_HANDLE_T hMsgHandle) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SETTING_S setting = {0, }; + + setting.type = MSG_GENERAL_OPT; + + setting.option.generalOpt.bKeepCopy = true; + setting.option.generalOpt.alertTone = MSG_ALERT_TONE_ONCE; + + err = msg_set_config(hMsgHandle, &setting); + + if (err == MSG_SUCCESS) + printf("Setting Config Data is OK!"); + else + printf("Setting Config Data is failed!"); +} + +void MsgTestGetGeneralOpt(MSG_HANDLE_T hMsgHandle) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SETTING_S setting = {0, }; + + err = msg_get_config(hMsgHandle, &setting); + + if (err == MSG_SUCCESS) + { + printf("Setting Config Data is OK!\n"); + printf("bKeepCopy : [%d], AlertTone : [%d]\n", setting.option.generalOpt.bKeepCopy, setting.option.generalOpt.alertTone); + } + else + printf("Setting Config Data is failed!\n"); +} +@endcode +@} + +@defgroup MESSAGE_USECASES_11 Filtering a Message +@ingroup MESSAGE_USECASES +@{ +

Filtering a Message

+Messaging framework provides a filtering function for incoming message. New incoming message can be blocked (Move to spam-box or discard) by adding a filtering rule. A incoming message can be blocked by its originating address or by subject matching. If address matching filter rule is applied, only messages with exactly the same phone number can be blocked. Whereas, if a subject matching filter rule is applied, all messages that include the registered subject string might be blocked. An application can add or remove a filtering rule by calling msg_add_filter() or msg_delete_filter(). + +- int msg_add_filter(MSG_HANDLE_T handle, const MSG_FILTER_S *filter); +@n msg_add_filter() inserts a filtering rule to filter list and returns filter id. +- int msg_delete_filter(MSG_HANDLE_T handle, MSG_FILTER_ID_T filter_id); +@n msg_delete_filter()removes a filtering rule from filter list by filter id +@code +void MsgTestAddFilter(MSG_HANDLE_T hMsgHandle) +{ + if (hMsgHandle == NULL) + { + printf("Handle is NULL"); + return; + } + + MSG_ERROR_T err = MSG_SUCCESS; + MSG_FILTER_S filter[2]= {0, }; + + // Add filter by address + filter[0].filterType = MSG_FILTER_BY_ADDRESS; + strncpy(filter[0].filterValue, "+821234567890", MAX_FILTER_VALUE_LEN); + + err = msg_add_filter(hMsgHandle, &filter[0]); + + if (err == MSG_SUCCESS) + printf("msg_add_filter success"); + else + printf("msg_add_filter fail - err [%d]", err); + + // Add filter by subject + filter[1].filterType = MSG_FILTER_BY_SUBJECT; + strncpy(filter[1].filterValue, "test filter", MAX_FILTER_VALUE_LEN); + + err = msg_add_filter(hMsgHandle, &filter[1]); + + if (err == MSG_SUCCESS) + printf("msg_add_filter success"); + else + printf("msg_add_filter fail - err [%d]", err); + + return; +} + +void MsgTestDeleteFilter(MSG_HANDLE_T hMsgHandle, MSG_FILTER_ID_T filterId) +{ + if (hMsgHandle == NULL) + { + printf("Handle is NULL"); + return; + } + + MSG_ERROR_T err = MSG_SUCCESS; + err = msg_delete_filter(hMsgHandle, filterId); + + if (MSG_SUCCESS == err) + { + printf("msg_delete_filter success"); + } + else + { + printf("msg_delete_filter fail - err [%d]", err); + } + + return; +} +@endcode +@} +*/ + +/** +@addtogroup MESSAGE +@{ + @defgroup MESSAGE_USECASES Use Cases +@} +*/ diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100755 index 0000000..6dd507a --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,15 @@ +export ARCH=target + +export TET_INSTALL_PATH=/home/givme/share/tetware/TETware # tetware root path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +set $(pwd) +export TET_SUITE_ROOT=$1 + +set $(date +%s) +FILE_NAME_EXTENSION=$1 + diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh new file mode 100755 index 0000000..89ea16c --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,16 @@ + +export ARCH=target + +export TET_INSTALL_PATH=/opt/slp/TETware # path to mount +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +set $(pwd) +export TET_SUITE_ROOT=$1 + +set $(date +%s) +FILE_NAME_EXTENSION=$1 + diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..ce8f642 --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,18 @@ +. ./_export_env.sh # setting environment variables + +echo PATH=$PATH +echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH +echo TET_ROOT=$TET_ROOT +echo TET_SUITE_ROOT=$TET_SUITE_ROOT +echo ARCH=$ARCH + +RESULT_DIR=results-$ARCH +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir $RESULT_DIR + +tcc -c -p ./ # executing tcc, with clean option (-c) +tcc -b -j $JOURNAL_RESULT -p ./ # executing tcc to build test cases (-b) +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT # reporting the result + diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..e1ed207 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,17 @@ +. ./_export_target_env.sh # setting environment variables + +echo PATH=$PATH +echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH +echo TET_ROOT=$TET_ROOT +echo TET_SUITE_ROOT=$TET_SUITE_ROOT +echo ARCH=$ARCH + +RESULT_DIR=results-$ARCH +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ # executing tcc, with –e option +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT # reporting the result + diff --git a/TC/making_new_tet_scen.py b/TC/making_new_tet_scen.py new file mode 100755 index 0000000..6c5b845 --- /dev/null +++ b/TC/making_new_tet_scen.py @@ -0,0 +1,69 @@ +#!/usr/bin/python + +############################################# +# tet_scen auto generator +# +# ** argv[1] = TC root +############################################# + +import sys,string,os + + +write_file = open("tet_scen", 'w') + +# +# making new tet_scen +# +def making_tet_scen (filename): + #tmp_list = filename.strip().split('/') + n_filename = filename.replace(' ', '\\ ') + #print n_filename + #new_path = "/"+ sys.argv[1] +"/"+n_filename[2:-6] + new_path = "/"+n_filename[:-6] + #print new_path + file = open(filename, 'r') + lines = file.readlines() + for line in lines: + if len(line.strip()) > 1: + list = line.strip().split('/') + #print new_path + list[-1] + write_file.write("\t"+new_path+list[-1]+"\n") + +# +# usage() +# +def usage(): + print(" ") + print("./making_new_tet_scen.py tc_root") + print("Put the Test Case's root directory.") + print("Do not include '/' at the end") + print(" ") + +# +# main() +# +def main(): + if len(sys.argv) < 2: + usage() + sys.exit(0) + + os.system('find '+ sys.argv[1] +' -name "tslist" > tslist.txt') + + #write_file = open("tetscen", w) + write_file.write("# auto generated tet_scen\n") + write_file.write("all\n") + write_file.write("\t\"Starting Full Test Suite\"\n") + + for file in open("tslist.txt", 'r'): + #print file.strip() + making_tet_scen(file.strip()) + + write_file.write("\t\"Completed Full Test Suite\"\n") + write_file.write("# EOF\n") + write_file.close() + print(" ") + print("==============================") + print("New tet_scen file is made~~~~") + print("==============================") + print(" ") +main() diff --git a/TC/msgTC/MapiControl/Makefile b/TC/msgTC/MapiControl/Makefile new file mode 100755 index 0000000..40d0ec2 --- /dev/null +++ b/TC/msgTC/MapiControl/Makefile @@ -0,0 +1,53 @@ +################################################### +# add your TestCase List Here +# +# e.g., +# TC1 = utc_frameworkName_apiName_func +# TC2 = utc_ApplicationLib_recurGetDayOfWeek_func +TC1 = utc_msg_open_msg_handle +TC2 = utc_msg_close_msg_handle + +################################################### +# add your Package Config Info Here +# +# e.g., +# PKGS=calendar +PKGS=msg-service + +LIBS = `pkg-config --libs $(PKGS)` +LIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o +LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s +LIBS +=-L$(TET_ROOT)/lib/tet3 -lapi_s + +INCS = -I. `pkg-config --cflags $(PKGS)` +INCS += -I$(TET_ROOT)/inc/tet3 + +CFLAGS = $(INCS) +CFLAGS += -D_TETWARE_MODE +#CC +=$(CFLAGS) +LDFLAGS = $(LIBS) + +################################################### +# Modify here +# depending on the Test Case you want to build +# +# e.g., +# TCLIST = $(TC1) $(TC2) +TCLIST = $(TC1) $(TC2) + +all : + for testcase in $(TCLIST) do\ + $(CC) -o $$(testcase) $$(testcase).c $(LDFLAGS) $(CFLAGS) + done + +clean : + rm -rf *~ *.o $(TCLIST) + + +$(TC1) : + $(CC) -o $(TC1) $(TC1).c $(CFLAGS) $(LDFLAGS) + + +$(TC2) : + $(CC) -o $(TC2) $(TC2).c $(CFLAGS) $(LDFLAGS) + diff --git a/TC/msgTC/MapiControl/tslist b/TC/msgTC/MapiControl/tslist new file mode 100755 index 0000000..b2d987c --- /dev/null +++ b/TC/msgTC/MapiControl/tslist @@ -0,0 +1,2 @@ +utc_msg_open_msg_handle +utc_msg_close_msg_handle \ No newline at end of file diff --git a/TC/msgTC/MapiControl/utc_msg_close_msg_handle.c b/TC/msgTC/MapiControl/utc_msg_close_msg_handle.c new file mode 100755 index 0000000..9ca71f1 --- /dev/null +++ b/TC/msgTC/MapiControl/utc_msg_close_msg_handle.c @@ -0,0 +1,76 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + + +#include "utc_msg_close_msg_handle.h" + +void startup(void) +{ +} +void cleanup(void) +{ +} + +void utc_msg_close_msg_handle_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_HANDLE_T msgHandle = NULL; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + err = msg_close_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_close_msg_handle_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_HANDLE_T msgHandle = NULL; + + err = msg_close_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiControl/utc_msg_close_msg_handle.h b/TC/msgTC/MapiControl/utc_msg_close_msg_handle.h new file mode 100755 index 0000000..67705ce --- /dev/null +++ b/TC/msgTC/MapiControl/utc_msg_close_msg_handle.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiControl.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_close_msg_handle_001(void); + static void utc_msg_close_msg_handle_001(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_close_msg_handle_001,1}, + { utc_msg_close_msg_handle_001,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiControl/utc_msg_open_msg_handle.c b/TC/msgTC/MapiControl/utc_msg_open_msg_handle.c new file mode 100755 index 0000000..4ba35f4 --- /dev/null +++ b/TC/msgTC/MapiControl/utc_msg_open_msg_handle.c @@ -0,0 +1,77 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + + +#include "utc_msg_open_msg_handle.h" + +void startup(void) +{ +} +void cleanup(void) +{ +} + +void utc_msg_open_msg_handle_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_HANDLE_T msgHandle = NULL; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_printf("utc_msg_open_msg_handle_001 failed"); + tet_result(TET_FAIL); + } + else + { + tet_printf("utc_msg_open_msg_handle_001 passed"); + tet_result(TET_PASS); + } + + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_open_msg_handle_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(NULL); + if (err != MSG_SUCCESS) + { + tet_printf("utc_msg_open_msg_handle_001 passed"); + tet_result(TET_PASS); + } + else + { + tet_printf("utc_msg_open_msg_handle_001 failed"); + tet_result(TET_FAIL); + } + +} diff --git a/TC/msgTC/MapiControl/utc_msg_open_msg_handle.h b/TC/msgTC/MapiControl/utc_msg_open_msg_handle.h new file mode 100755 index 0000000..255eb62 --- /dev/null +++ b/TC/msgTC/MapiControl/utc_msg_open_msg_handle.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiControl.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_open_msg_handle_001(void); + static void utc_msg_open_msg_handle_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_open_msg_handle_001,1}, + { utc_msg_open_msg_handle_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/Makefile b/TC/msgTC/MapiMessage/Makefile new file mode 100755 index 0000000..5ceb348 --- /dev/null +++ b/TC/msgTC/MapiMessage/Makefile @@ -0,0 +1,296 @@ +################################################### +# add your TestCase List Here +# +# e.g., +# TC1 = utc_frameworkName_apiName_func +# TC2 = utc_ApplicationLib_recurGetDayOfWeek_func +TC1 = utc_msg_add_address +TC2 = utc_msg_get_time +TC3 = utc_msg_new_message +TC4 = utc_msg_mms_create_message +TC5 = utc_msg_is_in_sim +TC6 = utc_msg_release_message +TC7 = utc_msg_get_address_count +TC8 = utc_msg_is_mms +TC9 = utc_msg_reset_address +TC10 = utc_msg_get_dest_port +TC11 = utc_msg_is_protected +TC12 = utc_msg_set_direction_info +TC13 = utc_msg_get_direction_info +TC14 = utc_msg_is_read +TC15 = utc_msg_set_encode_type +TC16 = utc_msg_get_encode_type +TC17 = utc_msg_is_sms +TC18 = utc_msg_set_folder_id +TC19 = utc_msg_get_folder_id +TC10 = utc_msg_mms_add_attachment +TC21 = utc_msg_set_message_id +TC22 = utc_msg_get_ith_address +TC23 = utc_msg_mms_add_media +TC24 = utc_msg_set_message_type +TC25 = utc_msg_get_ith_contact_id +TC26 = utc_msg_mms_add_page +TC27 = utc_msg_set_network_status +TC28 = utc_msg_get_ith_name +TC29 = utc_msg_mms_add_region +TC30 = utc_msg_set_port +TC31 = utc_msg_get_ith_recipient_type +TC32 = utc_msg_mms_add_transition +TC33 = utc_msg_set_priority_info +TC34 = utc_msg_get_ith_thread_id +TC35 = utc_msg_mms_destroy_message +TC36 = utc_msg_set_protect_status +TC37 = utc_msg_get_message_body_size +TC38 = utc_msg_mms_get_attachment +TC39 = utc_msg_set_read_status +TC40 = utc_msg_get_message_id +TC41 = utc_msg_mms_get_media +TC42 = utc_msg_set_scheduled_time +TC43 = utc_msg_get_message_type +TC44 = utc_msg_mms_get_message_body +TC45 = utc_msg_set_storage_id +TC46 = utc_msg_get_network_status +TC47 = utc_msg_mms_get_meta +TC48 = utc_msg_set_subject +TC49 = utc_msg_get_priority_info +TC50 = utc_msg_mms_get_page +TC51 = utc_msg_set_time +TC52 = utc_msg_get_scheduled_time +TC53 = utc_msg_mms_get_smil_region +TC54 = utc_msg_sms_get_message_body +TC55 = utc_msg_get_src_port +TC56 = utc_msg_mms_get_transition +TC57 = utc_msg_sms_set_message_body +TC58 = utc_msg_get_storage_id +TC59 = utc_msg_mms_set_message_body +TC60 = utc_msg_get_subject +TC61 = utc_msg_mms_set_rootlayout +TC62 = utc_msg_mms_add_meta +TC63 = utc_msg_get_dest_port + + +################################################### +# add your Package Config Info Here +# +# e.g., +# PKGS=calendar +PKGS=msg-service + +LIBS = `pkg-config --libs $(PKGS)` +LIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o +LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s +LIBS +=-L$(TET_ROOT)/lib/tet3 -lapi_s + +INCS = -I. `pkg-config --cflags $(PKGS)` +INCS += -I$(TET_ROOT)/inc/tet3 + +CFLAGS = $(INCS) +CFLAGS += -D_TETWARE_MODE +#CC +=$(CFLAGS) +LDFLAGS = $(LIBS) + +################################################### +# Modify here +# depending on the Test Case you want to build +# +# e.g., +# TCLIST = $(TC1) $(TC2) +TCLIST = $(TC1) $(TC2) $(TC3) $(TC4) $(TC5) $(TC6) $(TC7) $(TC8) $(TC9) $(TC10) $(TC11) $(TC12) $(TC13) $(TC14) $(TC15) $(TC16) $(TC17) $(TC18) $(TC19) $(TC20) $(TC21) $(TC22) $(TC23) $(TC24) $(TC25) $(TC26) $(TC27) $(TC28) $(TC29) $(TC30) $(TC31) $(TC32) $(TC33) $(TC34) $(TC35) $(TC36) $(TC37) $(TC38) $(TC39) $(TC40) $(TC41) $(TC42) $(TC43) $(TC44) $(TC45) $(TC46) $(TC47) $(TC48) $(TC49) $(TC50) $(TC51) $(TC52) $(TC53) $(TC54) $(TC55) $(TC56) $(TC57) $(TC58) $(TC59) $(TC60) $(TC61) $(TC62) $(TC63) + +all : + for testcase in $(TCLIST) do\ + $(CC) -o $$(testcase) $$(testcase).c $(CFLAGS) $(LDFLAGS) + done + +clean : + rm -rf *~ *.o $(TCLIST) + + +$(TC1) : + $(CC) -o $(TC1) $(TC1).c $(CFLAGS) $(LDFLAGS) + +$(TC2) : + $(CC) -o $(TC2) $(TC2).c $(CFLAGS) $(LDFLAGS) + +$(TC3) : + $(CC) -o $(TC3) $(TC3).c $(CFLAGS) $(LDFLAGS) + +$(TC4) : + $(CC) -o $(TC4) $(TC4).c $(CFLAGS) $(LDFLAGS) + +$(TC5) : + $(CC) -o $(TC5) $(TC5).c $(CFLAGS) $(LDFLAGS) + +$(TC6) : + $(CC) -o $(TC6) $(TC6).c $(CFLAGS) $(LDFLAGS) + +$(TC7) : + $(CC) -o $(TC7) $(TC7).c $(CFLAGS) $(LDFLAGS) + +$(TC8) : + $(CC) -o $(TC8) $(TC8).c $(CFLAGS) $(LDFLAGS) + +$(TC9) : + $(CC) -o $(TC9) $(TC9).c $(CFLAGS) $(LDFLAGS) + +$(TC10) : + $(CC) -o $(TC10) $(TC10).c $(CFLAGS) $(LDFLAGS) + +$(TC11) : + $(CC) -o $(TC11) $(TC11).c $(CFLAGS) $(LDFLAGS) + +$(TC12) : + $(CC) -o $(TC12) $(TC12).c $(CFLAGS) $(LDFLAGS) + +$(TC13) : + $(CC) -o $(TC13) $(TC13).c $(CFLAGS) $(LDFLAGS) + +$(TC14) : + $(CC) -o $(TC14) $(TC14).c $(CFLAGS) $(LDFLAGS) + +$(TC15) : + $(CC) -o $(TC15) $(TC15).c $(CFLAGS) $(LDFLAGS) + +$(TC16) : + $(CC) -o $(TC16) $(TC16).c $(CFLAGS) $(LDFLAGS) + +$(TC17) : + $(CC) -o $(TC17) $(TC17).c $(CFLAGS) $(LDFLAGS) + +$(TC18) : + $(CC) -o $(TC18) $(TC18).c $(CFLAGS) $(LDFLAGS) + +$(TC19) : + $(CC) -o $(TC19) $(TC19).c $(CFLAGS) $(LDFLAGS) + +$(TC20) : + $(CC) -o $(TC20) $(TC20).c $(CFLAGS) $(LDFLAGS) + +$(TC21) : + $(CC) -o $(TC21) $(TC21).c $(CFLAGS) $(LDFLAGS) + +$(TC22) : + $(CC) -o $(TC22) $(TC22).c $(CFLAGS) $(LDFLAGS) + +$(TC23) : + $(CC) -o $(TC23) $(TC23).c $(CFLAGS) $(LDFLAGS) + +$(TC24) : + $(CC) -o $(TC24) $(TC24).c $(CFLAGS) $(LDFLAGS) + +$(TC25) : + $(CC) -o $(TC25) $(TC25).c $(CFLAGS) $(LDFLAGS) + +$(TC26) : + $(CC) -o $(TC26) $(TC26).c $(CFLAGS) $(LDFLAGS) + +$(TC27) : + $(CC) -o $(TC27) $(TC27).c $(CFLAGS) $(LDFLAGS) + +$(TC28) : + $(CC) -o $(TC28) $(TC28).c $(CFLAGS) $(LDFLAGS) + +$(TC29) : + $(CC) -o $(TC29) $(TC29).c $(CFLAGS) $(LDFLAGS) + +$(TC30) : + $(CC) -o $(TC30) $(TC30).c $(CFLAGS) $(LDFLAGS) + +$(TC31) : + $(CC) -o $(TC31) $(TC31).c $(CFLAGS) $(LDFLAGS) + +$(TC32) : + $(CC) -o $(TC32) $(TC32).c $(CFLAGS) $(LDFLAGS) + +$(TC33) : + $(CC) -o $(TC33) $(TC33).c $(CFLAGS) $(LDFLAGS) + +$(TC34) : + $(CC) -o $(TC34) $(TC34).c $(CFLAGS) $(LDFLAGS) + +$(TC35) : + $(CC) -o $(TC35) $(TC35).c $(CFLAGS) $(LDFLAGS) + +$(TC36) : + $(CC) -o $(TC36) $(TC36).c $(CFLAGS) $(LDFLAGS) + +$(TC37) : + $(CC) -o $(TC37) $(TC37).c $(CFLAGS) $(LDFLAGS) + +$(TC38) : + $(CC) -o $(TC38) $(TC38).c $(CFLAGS) $(LDFLAGS) + +$(TC39) : + $(CC) -o $(TC39) $(TC39).c $(CFLAGS) $(LDFLAGS) + +$(TC40) : + $(CC) -o $(TC40) $(TC40).c $(CFLAGS) $(LDFLAGS) + +$(TC41) : + $(CC) -o $(TC41) $(TC41).c $(CFLAGS) $(LDFLAGS) + +$(TC42) : + $(CC) -o $(TC42) $(TC42).c $(CFLAGS) $(LDFLAGS) + +$(TC43) : + $(CC) -o $(TC43) $(TC43).c $(CFLAGS) $(LDFLAGS) + +$(TC44) : + $(CC) -o $(TC44) $(TC44).c $(CFLAGS) $(LDFLAGS) + +$(TC45) : + $(CC) -o $(TC45) $(TC45).c $(CFLAGS) $(LDFLAGS) + +$(TC46) : + $(CC) -o $(TC46) $(TC46).c $(CFLAGS) $(LDFLAGS) + +$(TC47) : + $(CC) -o $(TC47) $(TC47).c $(CFLAGS) $(LDFLAGS) + +$(TC48) : + $(CC) -o $(TC48) $(TC48).c $(CFLAGS) $(LDFLAGS) + +$(TC49) : + $(CC) -o $(TC49) $(TC49).c $(CFLAGS) $(LDFLAGS) + +$(TC50) : + $(CC) -o $(TC50) $(TC50).c $(CFLAGS) $(LDFLAGS) + +$(TC51) : + $(CC) -o $(TC51) $(TC51).c $(CFLAGS) $(LDFLAGS) + +$(TC52) : + $(CC) -o $(TC52) $(TC52).c $(CFLAGS) $(LDFLAGS) + +$(TC53) : + $(CC) -o $(TC53) $(TC53).c $(CFLAGS) $(LDFLAGS) + +$(TC54) : + $(CC) -o $(TC54) $(TC54).c $(CFLAGS) $(LDFLAGS) + +$(TC55) : + $(CC) -o $(TC55) $(TC55).c $(CFLAGS) $(LDFLAGS) + +$(TC56) : + $(CC) -o $(TC56) $(TC56).c $(CFLAGS) $(LDFLAGS) + +$(TC57) : + $(CC) -o $(TC57) $(TC57).c $(CFLAGS) $(LDFLAGS) + +$(TC58) : + $(CC) -o $(TC58) $(TC58).c $(CFLAGS) $(LDFLAGS) + +$(TC59) : + $(CC) -o $(TC59) $(TC59).c $(CFLAGS) $(LDFLAGS) + +$(TC60) : + $(CC) -o $(TC60) $(TC60).c $(CFLAGS) $(LDFLAGS) + +$(TC61) : + $(CC) -o $(TC61) $(TC61).c $(CFLAGS) $(LDFLAGS) + +$(TC62) : + $(CC) -o $(TC62) $(TC62).c $(CFLAGS) $(LDFLAGS) + +$(TC63) : + $(CC) -o $(TC63) $(TC63).c $(CFLAGS) $(LDFLAGS) \ No newline at end of file diff --git a/TC/msgTC/MapiMessage/tslist b/TC/msgTC/MapiMessage/tslist new file mode 100755 index 0000000..8127178 --- /dev/null +++ b/TC/msgTC/MapiMessage/tslist @@ -0,0 +1,62 @@ +utc_msg_add_address +utc_msg_get_time +utc_msg_new_message +utc_msg_mms_create_message +utc_msg_is_in_sim +utc_msg_release_message +utc_msg_get_address_count +utc_msg_is_mms +utc_msg_reset_address +utc_msg_get_dest_port +utc_msg_is_protected +utc_msg_set_direction_info +utc_msg_get_direction_info +utc_msg_is_read +utc_msg_set_encode_type +utc_msg_get_encode_type +utc_msg_is_sms +utc_msg_set_folder_id +utc_msg_get_folder_id +utc_msg_mms_add_attachment +utc_msg_set_message_id +utc_msg_get_ith_address +utc_msg_mms_add_media +utc_msg_set_message_type +utc_msg_get_ith_contact_id +utc_msg_mms_add_page +utc_msg_set_network_status +utc_msg_get_ith_name +utc_msg_mms_add_region +utc_msg_set_port +utc_msg_get_ith_recipient_type +utc_msg_mms_add_transition +utc_msg_mms_add_meta +utc_msg_set_priority_info +utc_msg_get_ith_thread_id +utc_msg_mms_destroy_message +utc_msg_set_protect_status +utc_msg_get_message_body_size +utc_msg_mms_get_attachment +utc_msg_set_read_status +utc_msg_get_message_id +utc_msg_mms_get_media +utc_msg_set_scheduled_time +utc_msg_get_message_type +utc_msg_mms_get_message_body +utc_msg_set_storage_id +utc_msg_get_network_status +utc_msg_mms_get_meta +utc_msg_set_subject +utc_msg_get_priority_info +utc_msg_mms_get_page +utc_msg_set_time +utc_msg_get_scheduled_time +utc_msg_mms_get_smil_region +utc_msg_sms_get_message_body +utc_msg_get_src_port +utc_msg_mms_get_transition +utc_msg_sms_set_message_body +utc_msg_get_storage_id +utc_msg_mms_set_message_body +utc_msg_get_subject +utc_msg_mms_set_rootlayout diff --git a/TC/msgTC/MapiMessage/utc_msg_add_address.c b/TC/msgTC/MapiMessage/utc_msg_add_address.c new file mode 100755 index 0000000..610086e --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_add_address.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_add_address.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_add_address_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_add_address(msgInfo, "01030015078", MSG_RECIPIENTS_TYPE_TO); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_add_address_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_add_address(NULL, "01030015078", MSG_RECIPIENTS_TYPE_TO); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_add_address.h b/TC/msgTC/MapiMessage/utc_msg_add_address.h new file mode 100755 index 0000000..54d2db3 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_add_address.h @@ -0,0 +1,49 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_add_address_001(void); +static void utc_msg_add_address_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_add_address_001,1}, + { utc_msg_add_address_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_address_count.c b/TC/msgTC/MapiMessage/utc_msg_get_address_count.c new file mode 100755 index 0000000..4d1fc90 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_address_count.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_address_count.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_address_count_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_address_count(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_address_count_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_address_count(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_address_count.h b/TC/msgTC/MapiMessage/utc_msg_get_address_count.h new file mode 100755 index 0000000..2ff3779 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_address_count.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_address_count_001(void); + static void utc_msg_get_address_count_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_address_count_001,1}, + { utc_msg_get_address_count_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_dest_port.c b/TC/msgTC/MapiMessage/utc_msg_get_dest_port.c new file mode 100755 index 0000000..58dd84b --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_dest_port.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_dest_port.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_dest_port_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_dest_port(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_dest_port_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_dest_port(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_dest_port.h b/TC/msgTC/MapiMessage/utc_msg_get_dest_port.h new file mode 100755 index 0000000..2accabb --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_dest_port.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_dest_port_001(void); + static void utc_msg_get_dest_port_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_dest_port_001,1}, + { utc_msg_get_dest_port_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_direction_info.c b/TC/msgTC/MapiMessage/utc_msg_get_direction_info.c new file mode 100755 index 0000000..ee2d6ba --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_direction_info.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_direction_info.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_direction_info_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_direction_info(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_direction_info_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_direction_info(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_direction_info.h b/TC/msgTC/MapiMessage/utc_msg_get_direction_info.h new file mode 100755 index 0000000..94652c3 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_direction_info.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_direction_info_001(void); + static void utc_msg_get_direction_info_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_direction_info_001,1}, + { utc_msg_get_direction_info_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_encode_type.c b/TC/msgTC/MapiMessage/utc_msg_get_encode_type.c new file mode 100755 index 0000000..b40aad9 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_encode_type.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_encode_type.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_encode_type_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_encode_type(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_encode_type_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_encode_type(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_encode_type.h b/TC/msgTC/MapiMessage/utc_msg_get_encode_type.h new file mode 100755 index 0000000..a125603 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_encode_type.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_encode_type_001(void); + static void utc_msg_get_encode_type_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_encode_type_001,1}, + { utc_msg_get_encode_type_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_folder_id.c b/TC/msgTC/MapiMessage/utc_msg_get_folder_id.c new file mode 100755 index 0000000..de8eea4 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_folder_id.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_folder_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_folder_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_folder_id(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_folder_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_folder_id(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_folder_id.h b/TC/msgTC/MapiMessage/utc_msg_get_folder_id.h new file mode 100755 index 0000000..558a9e7 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_folder_id.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_folder_id_001(void); + static void utc_msg_get_folder_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_folder_id_001,1}, + { utc_msg_get_folder_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_address.c b/TC/msgTC/MapiMessage/utc_msg_get_ith_address.c new file mode 100755 index 0000000..bb631d8 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_address.c @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_ith_address.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_add_address(msgInfo, "01030015078", MSG_RECIPIENTS_TYPE_TO); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_ith_address_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + char * address = NULL; + + address = msg_get_ith_address(msgInfo, 0); + if (address == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_ith_address_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + char * address = NULL; + + address = msg_get_ith_address(NULL, 0); + if (address == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_address.h b/TC/msgTC/MapiMessage/utc_msg_get_ith_address.h new file mode 100755 index 0000000..546f0a5 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_address.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_ith_address_001(void); + static void utc_msg_get_ith_address_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_ith_address_001,1}, + { utc_msg_get_ith_address_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.c b/TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.c new file mode 100755 index 0000000..2f55b23 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.c @@ -0,0 +1,82 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_ith_contact_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_add_address(msgInfo, "01030015078", MSG_RECIPIENTS_TYPE_TO); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_ith_contact_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_ith_contact_id(msgInfo, 0); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_ith_contact_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_ith_contact_id(NULL, 0); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.h b/TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.h new file mode 100755 index 0000000..5aafbc4 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_contact_id.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_ith_contact_id_001(void); + static void utc_msg_get_ith_contact_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_ith_contact_id_001,1}, + { utc_msg_get_ith_contact_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_name.c b/TC/msgTC/MapiMessage/utc_msg_get_ith_name.c new file mode 100755 index 0000000..fcad32f --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_name.c @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_ith_name.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_add_address(msgInfo, "01030015078", MSG_RECIPIENTS_TYPE_TO); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_ith_name_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + char * address = NULL; + + address = msg_get_ith_name(msgInfo, 0); + if (address == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_ith_name_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + char * address = NULL; + + address = msg_get_ith_name(NULL, 0); + if (address == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_name.h b/TC/msgTC/MapiMessage/utc_msg_get_ith_name.h new file mode 100755 index 0000000..af733ec --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_name.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_ith_name_001(void); + static void utc_msg_get_ith_name_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_ith_name_001,1}, + { utc_msg_get_ith_name_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_recipient_type.c b/TC/msgTC/MapiMessage/utc_msg_get_ith_recipient_type.c new file mode 100755 index 0000000..f274333 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_recipient_type.c @@ -0,0 +1,82 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_ith_recipient_type.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_add_address(msgInfo, "01030015078", MSG_RECIPIENTS_TYPE_TO); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_ith_recipient_type_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_ith_recipient_type(msgInfo, 0); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_ith_recipient_type_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_ith_recipient_type(NULL, 0); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_recipient_type.h b/TC/msgTC/MapiMessage/utc_msg_get_ith_recipient_type.h new file mode 100755 index 0000000..9c58153 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_recipient_type.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_ith_recipient_type_001(void); + static void utc_msg_get_ith_recipient_type_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_ith_recipient_type_001,1}, + { utc_msg_get_ith_recipient_type_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.c b/TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.c new file mode 100755 index 0000000..2a81bc8 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.c @@ -0,0 +1,82 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_ith_thread_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_add_address(msgInfo, "01030015078", MSG_RECIPIENTS_TYPE_TO); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_ith_thread_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_ith_thread_id(msgInfo, 0); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_ith_thread_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_ith_thread_id(NULL, 0); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.h b/TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.h new file mode 100755 index 0000000..fb409e4 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_ith_thread_id.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_ith_thread_id_001(void); + static void utc_msg_get_ith_thread_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_ith_thread_id_001,1}, + { utc_msg_get_ith_thread_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_message_body_size.c b/TC/msgTC/MapiMessage/utc_msg_get_message_body_size.c new file mode 100755 index 0000000..1d06131 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_message_body_size.c @@ -0,0 +1,82 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_message_body_size.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_sms_set_message_body(msgInfo, "test message", 12); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_message_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_message_body_size(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_message_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_message_body_size(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_message_body_size.h b/TC/msgTC/MapiMessage/utc_msg_get_message_body_size.h new file mode 100755 index 0000000..6ebd6a1 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_message_body_size.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_message_id_001(void); + static void utc_msg_get_message_id_001(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_message_id_001,1}, + { utc_msg_get_message_id_001,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_message_id.c b/TC/msgTC/MapiMessage/utc_msg_get_message_id.c new file mode 100755 index 0000000..1415a61 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_message_id.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_message_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_message_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_message_id(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_message_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_message_id(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_message_id.h b/TC/msgTC/MapiMessage/utc_msg_get_message_id.h new file mode 100755 index 0000000..c088520 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_message_id.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_message_id_001(void); + static void utc_msg_get_message_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_message_id_001,1}, + { utc_msg_get_message_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_message_type.c b/TC/msgTC/MapiMessage/utc_msg_get_message_type.c new file mode 100755 index 0000000..11a8937 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_message_type.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_message_type.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_message_type_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_message_type(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_message_type_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_message_type(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_message_type.h b/TC/msgTC/MapiMessage/utc_msg_get_message_type.h new file mode 100755 index 0000000..40fe75d --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_message_type.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_message_type_001(void); + static void utc_msg_get_message_type_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_message_type_001,1}, + { utc_msg_get_message_type_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_network_status.c b/TC/msgTC/MapiMessage/utc_msg_get_network_status.c new file mode 100755 index 0000000..b8d3133 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_network_status.c @@ -0,0 +1,82 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_network_status.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_set_network_status(msgInfo, MSG_NETWORK_SEND_SUCCESS); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_network_status_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_network_status(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_network_status_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_network_status(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_network_status.h b/TC/msgTC/MapiMessage/utc_msg_get_network_status.h new file mode 100755 index 0000000..d4b94ea --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_network_status.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_network_status_001(void); + static void utc_msg_get_network_status_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_network_status_001,1}, + { utc_msg_get_network_status_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_priority_info.c b/TC/msgTC/MapiMessage/utc_msg_get_priority_info.c new file mode 100755 index 0000000..0136a6e --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_priority_info.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_priority_info.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_priority_info_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_priority_info(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_priority_info_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_priority_info(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_priority_info.h b/TC/msgTC/MapiMessage/utc_msg_get_priority_info.h new file mode 100755 index 0000000..9717aee --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_priority_info.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_priority_info_001(void); + static void utc_msg_get_priority_info_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_priority_info_001,1}, + { utc_msg_get_priority_info_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.c b/TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.c new file mode 100755 index 0000000..0d71356 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.c @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_scheduled_time.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_scheduled_time_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + time_t scheduledTime = NULL; + + scheduledTime = msg_get_scheduled_time(msgInfo); + if (scheduledTime == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_scheduled_time_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + time_t scheduledTime = NULL; + + scheduledTime = msg_get_scheduled_time(NULL); + if (scheduledTime == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.h b/TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.h new file mode 100755 index 0000000..61cb602 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_scheduled_time.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_scheduled_time_001(void); + static void utc_msg_get_scheduled_time_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_scheduled_time_001,1}, + { utc_msg_get_scheduled_time_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_src_port.c b/TC/msgTC/MapiMessage/utc_msg_get_src_port.c new file mode 100755 index 0000000..6e5d0f2 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_src_port.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_src_port.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_src_port_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_src_port(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_src_port_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_src_port(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_src_port.h b/TC/msgTC/MapiMessage/utc_msg_get_src_port.h new file mode 100755 index 0000000..64a6356 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_src_port.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_src_port_001(void); + static void utc_msg_get_src_port_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_src_port_001,1}, + { utc_msg_get_src_port_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_storage_id.c b/TC/msgTC/MapiMessage/utc_msg_get_storage_id.c new file mode 100755 index 0000000..8d54110 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_storage_id.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_storage_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_storage_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_storage_id(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_storage_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_storage_id(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_storage_id.h b/TC/msgTC/MapiMessage/utc_msg_get_storage_id.h new file mode 100755 index 0000000..c53bd1f --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_storage_id.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_storage_id_001(void); + static void utc_msg_get_storage_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_storage_id_001,1}, + { utc_msg_get_storage_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_subject.c b/TC/msgTC/MapiMessage/utc_msg_get_subject.c new file mode 100755 index 0000000..8fe6bf1 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_subject.c @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_subject.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_set_subject(msgInfo, "test subject"); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_subject_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + char* subject = NULL; + + subject = msg_get_subject(msgInfo); + if (subject == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_subject_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + char* subject = NULL; + + subject = msg_get_subject(NULL); + if (subject == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_subject.h b/TC/msgTC/MapiMessage/utc_msg_get_subject.h new file mode 100755 index 0000000..3b27c53 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_subject.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_subject_001(void); + static void utc_msg_get_subject_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_subject_001,1}, + { utc_msg_get_subject_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_get_time.c b/TC/msgTC/MapiMessage/utc_msg_get_time.c new file mode 100755 index 0000000..7dcd92c --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_time.c @@ -0,0 +1,83 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_time.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + time_t curTime = time(NULL); + msg_set_time(msgInfo, curTime); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_time_001() +{ + time_t* curTime; + + curTime = msg_get_time(msgInfo); + if (curTime == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_time_002() +{ + time_t* curTime; + + curTime = msg_get_time(NULL); + if (curTime == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_get_time.h b/TC/msgTC/MapiMessage/utc_msg_get_time.h new file mode 100755 index 0000000..dbba3fd --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_get_time.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_time_001(void); + static void utc_msg_get_time_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_time_001,1}, + { utc_msg_get_time_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_is_in_sim.c b/TC/msgTC/MapiMessage/utc_msg_is_in_sim.c new file mode 100755 index 0000000..632e1a8 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_in_sim.c @@ -0,0 +1,82 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_is_in_sim.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_is_in_sim_001() +{ + bool bIsInSim = false; + + msg_set_storage_id(msgInfo, MSG_STORAGE_SIM); + + bIsInSim = msg_is_in_sim(msgInfo); + if (!bIsInSim) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_is_in_sim_002() +{ + bool bIsInSim = false; + + bIsInSim = msg_is_in_sim(NULL); + if (!bIsInSim) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_is_in_sim.h b/TC/msgTC/MapiMessage/utc_msg_is_in_sim.h new file mode 100755 index 0000000..76b9211 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_in_sim.h @@ -0,0 +1,49 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MsgStorageTypes.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_is_in_sim_001(void); + static void utc_msg_is_in_sim_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_is_in_sim_001,1}, + { utc_msg_is_in_sim_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_is_mms.c b/TC/msgTC/MapiMessage/utc_msg_is_mms.c new file mode 100755 index 0000000..93a2dcb --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_mms.c @@ -0,0 +1,82 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_is_mms.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_set_message_type(msgInfo, MSG_TYPE_MMS); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_is_mms_001() +{ + bool bIsMMS = true; + + bIsMMS = msg_is_mms(msgInfo); + if (!bIsMMS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_is_mms_002() +{ + bool bIsMMS = true; + + bIsMMS = msg_is_mms(NULL); + if (!bIsMMS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_is_mms.h b/TC/msgTC/MapiMessage/utc_msg_is_mms.h new file mode 100755 index 0000000..fae0dad --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_mms.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_is_mms_001(void); + static void utc_msg_is_mms_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_is_mms_001,1}, + { utc_msg_is_mms_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_is_protected.c b/TC/msgTC/MapiMessage/utc_msg_is_protected.c new file mode 100755 index 0000000..2152ccc --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_protected.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_is_protected.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_is_protected_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_is_protected(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_is_protected_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_is_protected(NULL); + if (err <= MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_is_protected.h b/TC/msgTC/MapiMessage/utc_msg_is_protected.h new file mode 100755 index 0000000..aabc00f --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_protected.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_is_protected_001(void); + static void utc_msg_is_protected_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_is_protected_001,1}, + { utc_msg_is_protected_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_is_read.c b/TC/msgTC/MapiMessage/utc_msg_is_read.c new file mode 100755 index 0000000..a216306 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_read.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_is_read.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_is_read_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_is_read(msgInfo); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_is_read_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_is_read(NULL); + if (err <= MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_is_read.h b/TC/msgTC/MapiMessage/utc_msg_is_read.h new file mode 100755 index 0000000..c81cbfd --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_read.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_is_read_001(void); + static void utc_msg_is_read_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_is_read_001,1}, + { utc_msg_is_read_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_is_sms.c b/TC/msgTC/MapiMessage/utc_msg_is_sms.c new file mode 100755 index 0000000..b79ea1e --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_sms.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_is_sms.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_is_sms_001() +{ + bool bIsSMS = false; + + bIsSMS = msg_is_sms(msgInfo); + if (!bIsSMS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_is_sms_002() +{ + bool bIsSMS = false; + + bIsSMS = msg_is_sms(NULL); + if (!bIsSMS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_is_sms.h b/TC/msgTC/MapiMessage/utc_msg_is_sms.h new file mode 100755 index 0000000..ef0e98c --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_is_sms.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_is_sms_001(void); + static void utc_msg_is_sms_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_is_sms_001,1}, + { utc_msg_is_sms_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.c b/TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.c new file mode 100755 index 0000000..92d1416 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_add_attachment.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + MMS_ATTACH_S* attachment[5]; + int nSize; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_add_attachment_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_ATTACH_S* attach = NULL; + + attach = msg_mms_add_attachment(mms_data, (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + if (attach == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_add_attachment_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_ATTACH_S* attach = NULL; + + attach = msg_mms_add_attachment(NULL, (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + if (attach == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.h b/TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.h new file mode 100755 index 0000000..619c190 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_attachment.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_add_attachment_001(void); + static void utc_msg_mms_add_attachment_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_add_attachment_001,1}, + { utc_msg_mms_add_attachment_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_media.c b/TC/msgTC/MapiMessage/utc_msg_mms_add_media.c new file mode 100755 index 0000000..ba48385 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_media.c @@ -0,0 +1,91 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_add_media.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; +MMS_PAGE_S* page = NULL; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MEDIA_S* media[5]; + MMS_ATTACH_S* attachment[5]; + int nSize; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + page = msg_mms_add_page(mms_data, 5440); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_add_media_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MEDIA_S* media = NULL; + + media = msg_mms_add_media(page, MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + if (media == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_add_media_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MEDIA_S* media = NULL; + + media = msg_mms_add_media(NULL, MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + if (media == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_media.h b/TC/msgTC/MapiMessage/utc_msg_mms_add_media.h new file mode 100755 index 0000000..be83629 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_media.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_add_media_001(void); + static void utc_msg_mms_add_media_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_add_media_001,1}, + { utc_msg_mms_add_media_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_meta.c b/TC/msgTC/MapiMessage/utc_msg_mms_add_meta.c new file mode 100755 index 0000000..4dd7198 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_meta.c @@ -0,0 +1,93 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_add_meta.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; +MMS_SMIL_META meta; +MMS_PAGE_S* page = NULL; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MEDIA_S* media[5]; + MMS_ATTACH_S* attachment[5]; + int nSize; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + memset(&meta, 0x00, sizeof(MMS_SMIL_META)); + + page = msg_mms_add_page(mms_data, 5440); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_add_meta_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_mms_add_meta(mms_data, &meta); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_add_meta_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MEDIA_S* media = NULL; + + err = msg_mms_add_meta(NULL, &meta); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_meta.h b/TC/msgTC/MapiMessage/utc_msg_mms_add_meta.h new file mode 100755 index 0000000..a5cc624 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_meta.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_add_meta_001(void); + static void utc_msg_mms_add_meta_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_add_meta_001,1}, + { utc_msg_mms_add_meta_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_page.c b/TC/msgTC/MapiMessage/utc_msg_mms_add_page.c new file mode 100755 index 0000000..30e7af3 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_page.c @@ -0,0 +1,85 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_add_page.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_set_message_body_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page; + + page = msg_mms_add_page(mms_data, 5440); + if (page == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_set_message_body_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page; + + page = msg_mms_add_page(NULL, 5440); + if (page == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_page.h b/TC/msgTC/MapiMessage/utc_msg_mms_add_page.h new file mode 100755 index 0000000..d5bba90 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_page.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_set_message_body_001(void); + static void utc_msg_mms_set_message_body_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_set_message_body_001,1}, + { utc_msg_mms_set_message_body_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_region.c b/TC/msgTC/MapiMessage/utc_msg_mms_add_region.c new file mode 100755 index 0000000..e0b8c8c --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_region.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_add_region.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + MMS_ATTACH_S* attachment[5]; + int nSize; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_add_region_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_SMIL_REGION* region = NULL; + + region = msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + if (region == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_add_region_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_SMIL_REGION* region = NULL; + + region = msg_mms_add_region(NULL, "Image", 0, 50, 100, 50, 0xffffff); + if (region == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_region.h b/TC/msgTC/MapiMessage/utc_msg_mms_add_region.h new file mode 100755 index 0000000..48cbccf --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_region.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_add_region_001(void); + static void utc_msg_mms_add_region_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_add_region_001,1}, + { utc_msg_mms_add_region_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_transition.c b/TC/msgTC/MapiMessage/utc_msg_mms_add_transition.c new file mode 100755 index 0000000..1d5ae10 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_transition.c @@ -0,0 +1,93 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_add_transition.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + MMS_ATTACH_S* attachment[5]; + int nSize; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_add_transition_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_SMIL_TRANSITION transition; + + memset(&transition, 0x00, sizeof(transition)); + + err = msg_mms_add_transition(mms_data, &transition); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_add_transition_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_SMIL_TRANSITION transition; + + memset(&transition, 0x00, sizeof(transition)); + + err = msg_mms_add_transition(NULL, &transition); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_add_transition.h b/TC/msgTC/MapiMessage/utc_msg_mms_add_transition.h new file mode 100755 index 0000000..ef97fdb --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_add_transition.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_add_transition_001(void); + static void utc_msg_mms_add_transition_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_add_transition_001,1}, + { utc_msg_mms_add_transition_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_create_message.c b/TC/msgTC/MapiMessage/utc_msg_mms_create_message.c new file mode 100755 index 0000000..492fe02 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_create_message.c @@ -0,0 +1,86 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_create_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_create_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S* mms_data = NULL; + + mms_data = msg_mms_create_message(); + if (mms_data == NULL) + { + tet_result(TET_FAIL); + msg_mms_destroy_message(mms_data); + return; + } + + tet_result(TET_PASS); + msg_mms_destroy_message(mms_data); +} + +void utc_msg_mms_create_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S* mms_data = NULL; + + //mms_data = msg_mms_create_message(); + if (mms_data == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_create_message.h b/TC/msgTC/MapiMessage/utc_msg_mms_create_message.h new file mode 100755 index 0000000..c11080f --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_create_message.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_create_message_001(void); + static void utc_msg_mms_create_message_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_create_message_001,1}, + { utc_msg_mms_create_message_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.c b/TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.c new file mode 100755 index 0000000..cd2ad1c --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.c @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_destroy_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_destroy_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_mms_destroy_message(mms_data); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_destroy_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_mms_destroy_message(NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.h b/TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.h new file mode 100755 index 0000000..5e8bba4 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_destroy_message.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_destroy_message_001(void); + static void utc_msg_mms_destroy_message_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_destroy_message_001,1}, + { utc_msg_mms_destroy_message_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.c b/TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.c new file mode 100755 index 0000000..f6e9b3e --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.c @@ -0,0 +1,112 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_get_attachment.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_mms_add_attachment(mms_data, "/opt/etc/msg-service/Temp1_0.txt"); + +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_get_attachment_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_ATTACH_S* pAttach = msg_mms_get_attachment(mms_data, 0); + if (pAttach == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_get_attachment_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_ATTACH_S* pAttach = msg_mms_get_attachment(mms_data, -1); + if (pAttach == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.h b/TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.h new file mode 100755 index 0000000..ae6908d --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_attachment.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_get_attachment_001(void); + static void utc_msg_mms_get_attachment_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_get_attachment_001,1}, + { utc_msg_mms_get_attachment_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_media.c b/TC/msgTC/MapiMessage/utc_msg_mms_get_media.c new file mode 100755 index 0000000..95c44f7 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_media.c @@ -0,0 +1,113 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_get_media.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; +MMS_PAGE_S* page[2]; +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_set_message_type(msgInfo, MSG_TYPE_MMS); + +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_get_media_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MEDIA_S* tmpMedia = NULL; + + tmpMedia = msg_mms_get_media(page[0], 0); + if (tmpMedia == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_get_media_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MEDIA_S* tmpMedia = NULL; + + tmpMedia = msg_mms_get_media(page[0], -1); + if (tmpMedia == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_media.h b/TC/msgTC/MapiMessage/utc_msg_mms_get_media.h new file mode 100755 index 0000000..dec60f3 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_media.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_get_media_001(void); + static void utc_msg_mms_get_media_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_get_media_001,1}, + { utc_msg_mms_get_media_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_message_body.c b/TC/msgTC/MapiMessage/utc_msg_mms_get_message_body.c new file mode 100755 index 0000000..abe80a5 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_message_body.c @@ -0,0 +1,119 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_get_message_body.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + MMS_ATTACH_S* attachment[5]; + int nSize; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_set_message_type(msgInfo, MSG_TYPE_MMS); + + msg_mms_set_message_body(msgInfo, mms_data); + +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_message_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S body; + + err = msg_mms_get_message_body(msgInfo, &body); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_message_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S body; + + err = msg_mms_get_message_body(NULL, &body); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_message_body.h b/TC/msgTC/MapiMessage/utc_msg_mms_get_message_body.h new file mode 100755 index 0000000..c088520 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_message_body.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_message_id_001(void); + static void utc_msg_get_message_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_message_id_001,1}, + { utc_msg_get_message_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_meta.c b/TC/msgTC/MapiMessage/utc_msg_mms_get_meta.c new file mode 100755 index 0000000..70ae054 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_meta.c @@ -0,0 +1,113 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_get_meta.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + MMS_SMIL_META meta = {"id", "name", "content"}; + msg_mms_add_meta(mms_data, &meta); + +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_get_meta_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_SMIL_META* pMeta = msg_mms_get_meta(mms_data, 0); + if(pMeta == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_get_meta_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_SMIL_META* pMeta = msg_mms_get_meta(mms_data, -1); + if(pMeta == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_meta.h b/TC/msgTC/MapiMessage/utc_msg_mms_get_meta.h new file mode 100755 index 0000000..0868d97 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_meta.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_get_meta_001(void); + static void utc_msg_mms_get_meta_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_get_meta_001,1}, + { utc_msg_mms_get_meta_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_page.c b/TC/msgTC/MapiMessage/utc_msg_mms_get_page.c new file mode 100755 index 0000000..dd6a5ae --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_page.c @@ -0,0 +1,118 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_get_page.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); +} + +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_get_page_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* tmpPage = NULL; + MMS_MESSAGE_DATA_S msgBody; + + msg_mms_get_message_body(msgInfo, &msgBody); + + tmpPage = msg_mms_get_page(mms_data, 0); + if (tmpPage == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_get_page_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* tmpPage = NULL; + MMS_MESSAGE_DATA_S msgBody; + + msg_mms_get_message_body(NULL, &msgBody); + + tmpPage = msg_mms_get_page(mms_data, -1); + if (tmpPage == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_page.h b/TC/msgTC/MapiMessage/utc_msg_mms_get_page.h new file mode 100755 index 0000000..a6c6065 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_page.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_get_page_001(void); + static void utc_msg_mms_get_page_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_get_page_001,1}, + { utc_msg_mms_get_page_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.c b/TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.c new file mode 100755 index 0000000..843f9f4 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.c @@ -0,0 +1,109 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_get_smil_region.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_get_smil_region_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_SMIL_REGION* pRegion = msg_mms_get_smil_region(mms_data, 0); + if (pRegion == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_get_smil_region_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_SMIL_REGION* pRegion = msg_mms_get_smil_region(mms_data, -1); + if (pRegion == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.h b/TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.h new file mode 100755 index 0000000..c5c4d49 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_smil_region.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_get_smil_region_001(void); + static void utc_msg_mms_get_smil_region_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_get_smil_region_001,1}, + { utc_msg_mms_get_smil_region_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_transition.c b/TC/msgTC/MapiMessage/utc_msg_mms_get_transition.c new file mode 100755 index 0000000..86a41ea --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_transition.c @@ -0,0 +1,115 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_get_transition.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + MMS_SMIL_TRANSITION transition; + + memset(&transition, 0x00, sizeof(transition)); + + msg_mms_add_transition(mms_data, &transition); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_get_transition_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_SMIL_TRANSITION* pTrans = msg_mms_get_transition(mms_data, 0); + if (pTrans == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_get_transition_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_SMIL_TRANSITION* pTrans = msg_mms_get_transition(mms_data, -1); + if (pTrans == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_get_transition.h b/TC/msgTC/MapiMessage/utc_msg_mms_get_transition.h new file mode 100755 index 0000000..e256a92 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_get_transition.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_get_transition_001(void); + static void utc_msg_mms_get_transition_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_get_transition_001,1}, + { utc_msg_mms_get_transition_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_set_message_body.c b/TC/msgTC/MapiMessage/utc_msg_mms_set_message_body.c new file mode 100755 index 0000000..626c52d --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_set_message_body.c @@ -0,0 +1,111 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_set_message_body.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_set_message_type(msgInfo, MSG_TYPE_MMS); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_set_message_body_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_mms_set_message_body(msgInfo, mms_data); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_set_message_body_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_mms_set_message_body(NULL, mms_data); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_set_message_body.h b/TC/msgTC/MapiMessage/utc_msg_mms_set_message_body.h new file mode 100755 index 0000000..cd00f1f --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_set_message_body.h @@ -0,0 +1,47 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_set_message_body_001(void); + static void utc_msg_mms_set_message_body_002(void); + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_set_message_body_001,1}, + { utc_msg_mms_set_message_body_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.c b/TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.c new file mode 100755 index 0000000..dc0a002 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.c @@ -0,0 +1,85 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_set_rootlayout.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MMS_MESSAGE_DATA_S* mms_data; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); +} +void cleanup(void) +{ + msg_mms_destroy_message(mms_data); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_set_rootlayout_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_SMIL_ROOTLAYOUT* pLayout = msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + if (pLayout == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_set_rootlayout_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_SMIL_ROOTLAYOUT* pLayout = msg_mms_set_rootlayout(NULL, 100, 100, 0xffffff); + if (pLayout == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.h b/TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.h new file mode 100755 index 0000000..91491fe --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_mms_set_rootlayout.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_mms_set_rootlayout_001(void); + static void utc_msg_mms_set_rootlayout_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_mms_set_rootlayout_001,1}, + { utc_msg_mms_set_rootlayout_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_new_message.c b/TC/msgTC/MapiMessage/utc_msg_new_message.c new file mode 100755 index 0000000..a58bd39 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_new_message.c @@ -0,0 +1,78 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_new_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_new_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + msgInfo = msg_new_message(); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_new_message_002() +{ + MSG_ERROR_T err = -1; + + msgInfo = msg_new_message(); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_new_message.h b/TC/msgTC/MapiMessage/utc_msg_new_message.h new file mode 100755 index 0000000..7e1fe12 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_new_message.h @@ -0,0 +1,49 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_new_message_001(void); +static void utc_msg_new_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_new_message_001,1}, + { utc_msg_new_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiMessage/utc_msg_release_message.c b/TC/msgTC/MapiMessage/utc_msg_release_message.c new file mode 100755 index 0000000..ebbb6c9 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_release_message.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_release_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_release_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_release_message(msgInfo); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_release_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_release_message(NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_release_message.h b/TC/msgTC/MapiMessage/utc_msg_release_message.h new file mode 100755 index 0000000..615ae3e --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_release_message.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_release_message_001(void); + static void utc_msg_release_message_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_release_message_001,1}, + { utc_msg_release_message_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_reset_address.c b/TC/msgTC/MapiMessage/utc_msg_reset_address.c new file mode 100755 index 0000000..d66849a --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_reset_address.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_reset_address.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_reset_address_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_reset_address(msgInfo); + if (err) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_reset_address_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_reset_address(NULL); + if (err) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_reset_address.h b/TC/msgTC/MapiMessage/utc_msg_reset_address.h new file mode 100755 index 0000000..e9adf38 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_reset_address.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_reset_address_001(void); + static void utc_msg_reset_address_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_reset_address_001,1}, + { utc_msg_reset_address_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_direction_info.c b/TC/msgTC/MapiMessage/utc_msg_set_direction_info.c new file mode 100755 index 0000000..92c1608 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_direction_info.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_direction_info.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_direction_info_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_direction_info(msgInfo, MSG_DIRECTION_TYPE_MT); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_direction_info_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_direction_info(NULL, MSG_DIRECTION_TYPE_MT); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_direction_info.h b/TC/msgTC/MapiMessage/utc_msg_set_direction_info.h new file mode 100755 index 0000000..2aa0c70 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_direction_info.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_direction_info_001(void); + static void utc_msg_set_direction_info_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_direction_info_001,1}, + { utc_msg_set_direction_info_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_encode_type.c b/TC/msgTC/MapiMessage/utc_msg_set_encode_type.c new file mode 100755 index 0000000..f55961e --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_encode_type.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_encode_type.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_encode_type_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_encode_type(msgInfo, MSG_ENCODE_GSM7BIT); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_encode_type_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_encode_type(NULL, MSG_ENCODE_GSM7BIT); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_encode_type.h b/TC/msgTC/MapiMessage/utc_msg_set_encode_type.h new file mode 100755 index 0000000..0b3ce66 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_encode_type.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_encode_type_001(void); + static void utc_msg_set_encode_type_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_encode_type_001,1}, + { utc_msg_set_encode_type_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_folder_id.c b/TC/msgTC/MapiMessage/utc_msg_set_folder_id.c new file mode 100755 index 0000000..cd83ecc --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_folder_id.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_folder_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_folder_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_folder_id(msgInfo, MSG_INBOX_ID); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_folder_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_folder_id(NULL, MSG_INBOX_ID); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_folder_id.h b/TC/msgTC/MapiMessage/utc_msg_set_folder_id.h new file mode 100755 index 0000000..27d3db3 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_folder_id.h @@ -0,0 +1,49 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MsgStorageTypes.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_folder_id_001(void); + static void utc_msg_set_folder_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_folder_id_001,1}, + { utc_msg_set_folder_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_message_id.c b/TC/msgTC/MapiMessage/utc_msg_set_message_id.c new file mode 100755 index 0000000..2ec05e6 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_message_id.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_message_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_message_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_message_id(msgInfo, 1); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_message_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_message_id(NULL, 1); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_message_id.h b/TC/msgTC/MapiMessage/utc_msg_set_message_id.h new file mode 100755 index 0000000..49f888e --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_message_id.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_message_id_001(void); + static void utc_msg_set_message_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_message_id_001,1}, + { utc_msg_set_message_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_message_type.c b/TC/msgTC/MapiMessage/utc_msg_set_message_type.c new file mode 100755 index 0000000..0ef00e3 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_message_type.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_message_type.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_message_type_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_message_type(msgInfo, MSG_TYPE_SMS); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_message_type_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_message_type(NULL, MSG_TYPE_SMS); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_message_type.h b/TC/msgTC/MapiMessage/utc_msg_set_message_type.h new file mode 100755 index 0000000..daad3b0 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_message_type.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_message_type_001(void); + static void utc_msg_set_message_type_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_message_type_001,1}, + { utc_msg_set_message_type_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_network_status.c b/TC/msgTC/MapiMessage/utc_msg_set_network_status.c new file mode 100755 index 0000000..fb66092 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_network_status.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_network_status.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_network_status_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_network_status(msgInfo, MSG_NETWORK_SEND_SUCCESS); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_network_status_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_network_status(NULL, MSG_NETWORK_SEND_SUCCESS); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_network_status.h b/TC/msgTC/MapiMessage/utc_msg_set_network_status.h new file mode 100755 index 0000000..36a7ce4 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_network_status.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_network_status_001(void); + static void utc_msg_set_network_status_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_network_status_001,1}, + { utc_msg_set_network_status_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_port.c b/TC/msgTC/MapiMessage/utc_msg_set_port.c new file mode 100755 index 0000000..91faa0d --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_port.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_port.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_port_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_port(msgInfo, 656, 656); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_port_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_port(NULL, 656, 656); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_port.h b/TC/msgTC/MapiMessage/utc_msg_set_port.h new file mode 100755 index 0000000..7465602 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_port.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_port_001(void); + static void utc_msg_set_port_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_port_001,1}, + { utc_msg_set_port_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_priority_info.c b/TC/msgTC/MapiMessage/utc_msg_set_priority_info.c new file mode 100755 index 0000000..457196f --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_priority_info.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_priority_info.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_priority_info_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_priority_info(msgInfo, MSG_MESSAGE_PRIORITY_NORMAL); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_priority_info_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_priority_info(NULL, MSG_MESSAGE_PRIORITY_NORMAL); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_priority_info.h b/TC/msgTC/MapiMessage/utc_msg_set_priority_info.h new file mode 100755 index 0000000..2909137 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_priority_info.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_priority_info_001(void); + static void utc_msg_set_priority_info_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_priority_info_001,1}, + { utc_msg_set_priority_info_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_protect_status.c b/TC/msgTC/MapiMessage/utc_msg_set_protect_status.c new file mode 100755 index 0000000..af73c10 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_protect_status.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_protect_status.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_protect_status_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_protect_status(msgInfo, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_protect_status_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_protect_status(NULL, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_protect_status.h b/TC/msgTC/MapiMessage/utc_msg_set_protect_status.h new file mode 100755 index 0000000..41dbc58 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_protect_status.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_protect_status_001(void); + static void utc_msg_set_protect_status_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_protect_status_001,1}, + { utc_msg_set_protect_status_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_read_status.c b/TC/msgTC/MapiMessage/utc_msg_set_read_status.c new file mode 100755 index 0000000..3b70692 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_read_status.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_read_status.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_read_status_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_read_status(msgInfo, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_read_status_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_read_status(NULL, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_read_status.h b/TC/msgTC/MapiMessage/utc_msg_set_read_status.h new file mode 100755 index 0000000..590f483 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_read_status.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_read_status_001(void); + static void utc_msg_set_read_status_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_read_status_001,1}, + { utc_msg_set_read_status_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.c b/TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.c new file mode 100755 index 0000000..0ab09f2 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.c @@ -0,0 +1,86 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_scheduled_time.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_scheduled_time_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + time_t scheduledTime; + time(&scheduledTime); + + err = msg_set_scheduled_time(msgInfo, scheduledTime); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_scheduled_time_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + time_t scheduledTime; + time(&scheduledTime); + + err = msg_set_scheduled_time(NULL, scheduledTime); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.h b/TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.h new file mode 100755 index 0000000..8431c4d --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_scheduled_time.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_scheduled_time_001(void); + static void utc_msg_set_scheduled_time_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_scheduled_time_001,1}, + { utc_msg_set_scheduled_time_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_storage_id.c b/TC/msgTC/MapiMessage/utc_msg_set_storage_id.c new file mode 100755 index 0000000..5e9b4cf --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_storage_id.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_storage_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_storage_id_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_storage_id(msgInfo, MSG_STORAGE_PHONE); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_storage_id_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_storage_id(NULL, MSG_STORAGE_PHONE); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_storage_id.h b/TC/msgTC/MapiMessage/utc_msg_set_storage_id.h new file mode 100755 index 0000000..ddbd2d8 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_storage_id.h @@ -0,0 +1,49 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MsgStorageTypes.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_storage_id_001(void); + static void utc_msg_set_storage_id_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_storage_id_001,1}, + { utc_msg_set_storage_id_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_subject.c b/TC/msgTC/MapiMessage/utc_msg_set_subject.c new file mode 100755 index 0000000..fed3eb0 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_subject.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_subject.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_subject_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_subject(msgInfo, "test subject"); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_subject_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_subject(NULL, "test subject"); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_subject.h b/TC/msgTC/MapiMessage/utc_msg_set_subject.h new file mode 100755 index 0000000..a69c2fa --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_subject.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_subject_001(void); + static void utc_msg_set_subject_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_subject_001,1}, + { utc_msg_set_subject_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_set_time.c b/TC/msgTC/MapiMessage/utc_msg_set_time.c new file mode 100755 index 0000000..988278e --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_time.c @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_time.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_time_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + time_t curTime = time(NULL); + + err = msg_set_time(msgInfo, curTime); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_time_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + time_t curTime = time(NULL); + + err = msg_set_time(NULL, curTime); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_set_time.h b/TC/msgTC/MapiMessage/utc_msg_set_time.h new file mode 100755 index 0000000..7d4c014 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_set_time.h @@ -0,0 +1,47 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_time_001(void); + static void utc_msg_set_time_002(void); + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_time_001,1}, + { utc_msg_set_time_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_sms_get_message_body.c b/TC/msgTC/MapiMessage/utc_msg_sms_get_message_body.c new file mode 100755 index 0000000..f955d79 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_sms_get_message_body.c @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_sms_get_message_body.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + msg_sms_set_message_body(msgInfo, "test message", 12); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_sms_get_message_body_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + char * address = NULL; + + address = msg_sms_get_message_body(msgInfo); + if (address == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_sms_get_message_body_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + char * address = NULL; + + address = msg_sms_get_message_body(NULL); + if (address == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_sms_get_message_body.h b/TC/msgTC/MapiMessage/utc_msg_sms_get_message_body.h new file mode 100755 index 0000000..f1e18f6 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_sms_get_message_body.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_sms_get_message_body_001(void); + static void utc_msg_sms_get_message_body_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_sms_get_message_body_001,1}, + { utc_msg_sms_get_message_body_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiMessage/utc_msg_sms_set_message_body.c b/TC/msgTC/MapiMessage/utc_msg_sms_set_message_body.c new file mode 100755 index 0000000..3dfb799 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_sms_set_message_body.c @@ -0,0 +1,80 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_sms_set_message_body.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_sms_set_message_body_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_sms_set_message_body(msgInfo, "test message", 12); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_sms_set_message_body_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_sms_set_message_body(NULL, "test message", 12); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiMessage/utc_msg_sms_set_message_body.h b/TC/msgTC/MapiMessage/utc_msg_sms_set_message_body.h new file mode 100755 index 0000000..0314b23 --- /dev/null +++ b/TC/msgTC/MapiMessage/utc_msg_sms_set_message_body.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_sms_set_message_body_001(void); + static void utc_msg_sms_set_message_body_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_sms_set_message_body_001,1}, + { utc_msg_sms_set_message_body_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiSetting/Makefile b/TC/msgTC/MapiSetting/Makefile new file mode 100755 index 0000000..1be4616 --- /dev/null +++ b/TC/msgTC/MapiSetting/Makefile @@ -0,0 +1,52 @@ +################################################### +# add your TestCase List Here +# +# e.g., +# TC1 = utc_frameworkName_apiName_func +# TC2 = utc_ApplicationLib_recurGetDayOfWeek_func +TC1 = utc_msg_get_config +TC2 = utc_msg_set_config + +################################################### +# add your Package Config Info Here +# +# e.g., +# PKGS=calendar +PKGS=msg-service + +LIBS = `pkg-config --libs $(PKGS)` +LIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o +LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s +LIBS +=-L$(TET_ROOT)/lib/tet3 -lapi_s + +INCS = -I. `pkg-config --cflags $(PKGS)` +INCS += -I$(TET_ROOT)/inc/tet3 + +CFLAGS = $(INCS) +CFLAGS += -D_TETWARE_MODE +#CC +=$(CFLAGS) +LDFLAGS = $(LIBS) + +################################################### +# Modify here +# depending on the Test Case you want to build +# +# e.g., +# TCLIST = $(TC1) $(TC2) +TCLIST = $(TC1) $(TC2) + +all : + for testcase in $(TCLIST) do\ + $(CC) -o $$(testcase) $$(testcase).c $(CFLAGS) $(LDFLAGS) + done + +clean : + rm -rf *~ *.o $(TCLIST) + + +$(TC1) : + $(CC) -o $(TC1) $(TC1).c $(CFLAGS) $(LDFLAGS) + + +$(TC2) : + $(CC) -o $(TC2) $(TC2).c $(CFLAGS) $(LDFLAGS) diff --git a/TC/msgTC/MapiSetting/tslist b/TC/msgTC/MapiSetting/tslist new file mode 100755 index 0000000..00c37f8 --- /dev/null +++ b/TC/msgTC/MapiSetting/tslist @@ -0,0 +1,2 @@ +utc_msg_get_config +utc_msg_set_config \ No newline at end of file diff --git a/TC/msgTC/MapiSetting/utc_msg_get_config.c b/TC/msgTC/MapiSetting/utc_msg_get_config.c new file mode 100755 index 0000000..10959c1 --- /dev/null +++ b/TC/msgTC/MapiSetting/utc_msg_get_config.c @@ -0,0 +1,81 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_config.h" + +static MSG_HANDLE_T msgHandle = NULL; +MSG_SETTING_S setting; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_GENERAL_OPT_S)); + + setting.type = MSG_GENERAL_OPT; +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_config_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_config(msgHandle, &setting); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_config_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_config(NULL, &setting); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiSetting/utc_msg_get_config.h b/TC/msgTC/MapiSetting/utc_msg_get_config.h new file mode 100755 index 0000000..4139674 --- /dev/null +++ b/TC/msgTC/MapiSetting/utc_msg_get_config.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiSetting.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_get_config_001(void); + static void utc_msg_get_config_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_get_config_001,1}, + { utc_msg_get_config_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiSetting/utc_msg_set_config.c b/TC/msgTC/MapiSetting/utc_msg_set_config.c new file mode 100755 index 0000000..111c61d --- /dev/null +++ b/TC/msgTC/MapiSetting/utc_msg_set_config.c @@ -0,0 +1,83 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_set_config.h" + +static MSG_HANDLE_T msgHandle = NULL; +MSG_SETTING_S setting; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_GENERAL_OPT_S)); + + setting.type = MSG_GENERAL_OPT; + + msg_get_config(msgHandle, &setting); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_set_config_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_config(msgHandle, &setting); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_set_config_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_set_config(NULL, &setting); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiSetting/utc_msg_set_config.h b/TC/msgTC/MapiSetting/utc_msg_set_config.h new file mode 100755 index 0000000..399ec01 --- /dev/null +++ b/TC/msgTC/MapiSetting/utc_msg_set_config.h @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiSetting.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + + static void utc_msg_set_config_001(void); + static void utc_msg_set_config_002(void); + + + + struct tet_testlist tet_testlist[] = { + { utc_msg_set_config_001,1}, + { utc_msg_set_config_002,2}, + {NULL,0} + }; diff --git a/TC/msgTC/MapiStorage/Makefile b/TC/msgTC/MapiStorage/Makefile new file mode 100755 index 0000000..c2ce1d9 --- /dev/null +++ b/TC/msgTC/MapiStorage/Makefile @@ -0,0 +1,195 @@ +################################################### +# add your TestCase List Here +# +# e.g., +# TC1 = utc_frameworkName_apiName_func +# TC2 = utc_ApplicationLib_recurGetDayOfWeek_func +TC1 = utc_msg_add_folder +TC2 = utc_msg_add_message +TC3 = utc_msg_get_conversation_view_list +TC4 = utc_msg_add_syncml_message +TC5 = utc_msg_get_folder_list +TC7 = utc_msg_get_folder_view_list +TC8 = utc_msg_get_mem_size +TC9 = utc_msg_get_message +TC10 = utc_msg_get_quick_panel_data +TC11 = utc_msg_get_thread_view_list +TC12 = utc_msg_move_msg_to_folder +TC13 = utc_msg_move_msg_to_storage +TC14 = utc_msg_release_folder_list +TC15 = utc_msg_release_thread_view_list +TC16 = utc_msg_reset_database +TC17 = utc_msg_count_message +TC19 = utc_msg_count_msg_by_contact +TC20 = utc_msg_thread_view_get_address +TC21 = utc_msg_count_msg_by_type +TC22 = utc_msg_thread_view_get_contact_id +TC23 = utc_msg_delete_all_msgs_in_folder +TC24 = utc_msg_thread_view_get_data +TC25 = utc_msg_delete_folder +TC26 = utc_msg_thread_view_get_direction +TC27 = utc_msg_delete_message +TC28 = utc_msg_thread_view_get_image_path +TC29 = utc_msg_delete_thread_message_list +TC30 = utc_msg_thread_view_get_mms_cnt +TC31 = utc_msg_thread_view_get_name +TC32 = utc_msg_thread_view_get_sms_cnt +TC33 = utc_msg_thread_view_get_thread_id +TC34 = utc_msg_thread_view_get_time +TC35 = utc_msg_thread_view_get_unread_cnt +TC36 = utc_msg_update_folder +TC37 = utc_msg_update_message +TC38 = utc_msg_update_protected_status +TC39 = utc_msg_update_read_status +TC40 = utc_msg_generate_message + +################################################### +# add your Package Config Info Here +# +# e.g., +# PKGS=calendar +PKGS=msg-service + +LIBS = `pkg-config --libs $(PKGS)` +LIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o +LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s +LIBS +=-L$(TET_ROOT)/lib/tet3 -lapi_s + +INCS = -I. `pkg-config --cflags $(PKGS)` +INCS += -I$(TET_ROOT)/inc/tet3 + +CFLAGS = $(INCS) +CFLAGS += -D_TETWARE_MODE +#CC +=$(CFLAGS) +LDFLAGS = $(LIBS) + +################################################### +# Modify here +# depending on the Test Case you want to build +# +# e.g., +# TCLIST = $(TC1) $(TC2) +TCLIST = $(TC1) $(TC2) $(TC3) $(TC4) $(TC5) $(TC7) $(TC8) $(TC9) $(TC10) $(TC11) $(TC12) $(TC13) $(TC14) $(TC15) $(TC16) $(TC17) $(TC19) $(TC20) $(TC21) $(TC22) $(TC23) $(TC24) $(TC25) $(TC26) $(TC27) $(TC28) $(TC29) $(TC30) $(TC31) $(TC32) $(TC33) $(TC34) $(TC35) $(TC36) $(TC37) $(TC38) $(TC39) $(TC40) + +all : + for testcase in $(TCLIST) do\ + $(CC) -o $$(testcase) $$(testcase).c $(CFLAGS) $(LDFLAGS) + done + +clean : + rm -rf *~ *.o $(TCLIST) + + +$(TC1) : + $(CC) -o $(TC1) $(TC1).c $(CFLAGS) $(LDFLAGS) + +$(TC2) : + $(CC) -o $(TC2) $(TC2).c $(CFLAGS) $(LDFLAGS) + +$(TC3) : + $(CC) -o $(TC3) $(TC3).c $(CFLAGS) $(LDFLAGS) + +$(TC4) : + $(CC) -o $(TC4) $(TC4).c $(CFLAGS) $(LDFLAGS) + +$(TC5) : + $(CC) -o $(TC5) $(TC5).c $(CFLAGS) $(LDFLAGS) + +$(TC7) : + $(CC) -o $(TC7) $(TC7).c $(CFLAGS) $(LDFLAGS) + +$(TC8) : + $(CC) -o $(TC8) $(TC8).c $(CFLAGS) $(LDFLAGS) + +$(TC9) : + $(CC) -o $(TC9) $(TC9).c $(CFLAGS) $(LDFLAGS) + +$(TC10) : + $(CC) -o $(TC10) $(TC10).c $(CFLAGS) $(LDFLAGS) + +$(TC11) : + $(CC) -o $(TC11) $(TC11).c $(CFLAGS) $(LDFLAGS) + +$(TC12) : + $(CC) -o $(TC12) $(TC12).c $(CFLAGS) $(LDFLAGS) + +$(TC13) : + $(CC) -o $(TC13) $(TC13).c $(CFLAGS) $(LDFLAGS) + +$(TC14) : + $(CC) -o $(TC14) $(TC14).c $(CFLAGS) $(LDFLAGS) + +$(TC15) : + $(CC) -o $(TC15) $(TC15).c $(CFLAGS) $(LDFLAGS) + +$(TC16) : + $(CC) -o $(TC16) $(TC16).c $(CFLAGS) $(LDFLAGS) + +$(TC17) : + $(CC) -o $(TC17) $(TC17).c $(CFLAGS) $(LDFLAGS) + +$(TC19) : + $(CC) -o $(TC19) $(TC19).c $(CFLAGS) $(LDFLAGS) + +$(TC20) : + $(CC) -o $(TC20) $(TC20).c $(CFLAGS) $(LDFLAGS) + +$(TC21) : + $(CC) -o $(TC21) $(TC21).c $(CFLAGS) $(LDFLAGS) + +$(TC22) : + $(CC) -o $(TC22) $(TC22).c $(CFLAGS) $(LDFLAGS) + +$(TC23) : + $(CC) -o $(TC23) $(TC23).c $(CFLAGS) $(LDFLAGS) + +$(TC24) : + $(CC) -o $(TC24) $(TC24).c $(CFLAGS) $(LDFLAGS) + +$(TC25) : + $(CC) -o $(TC25) $(TC25).c $(CFLAGS) $(LDFLAGS) + +$(TC26) : + $(CC) -o $(TC26) $(TC26).c $(CFLAGS) $(LDFLAGS) + +$(TC27) : + $(CC) -o $(TC27) $(TC27).c $(CFLAGS) $(LDFLAGS) + +$(TC28) : + $(CC) -o $(TC28) $(TC28).c $(CFLAGS) $(LDFLAGS) + +$(TC29) : + $(CC) -o $(TC29) $(TC29).c $(CFLAGS) $(LDFLAGS) + +$(TC30) : + $(CC) -o $(TC30) $(TC30).c $(CFLAGS) $(LDFLAGS) + +$(TC31) : + $(CC) -o $(TC31) $(TC31).c $(CFLAGS) $(LDFLAGS) + +$(TC32) : + $(CC) -o $(TC32) $(TC32).c $(CFLAGS) $(LDFLAGS) + +$(TC33) : + $(CC) -o $(TC33) $(TC33).c $(CFLAGS) $(LDFLAGS) + +$(TC34) : + $(CC) -o $(TC34) $(TC34).c $(CFLAGS) $(LDFLAGS) + +$(TC35) : + $(CC) -o $(TC35) $(TC35).c $(CFLAGS) $(LDFLAGS) + +$(TC36) : + $(CC) -o $(TC36) $(TC36).c $(CFLAGS) $(LDFLAGS) + +$(TC37) : + $(CC) -o $(TC37) $(TC37).c $(CFLAGS) $(LDFLAGS) + +$(TC38) : + $(CC) -o $(TC38) $(TC38).c $(CFLAGS) $(LDFLAGS) + +$(TC39) : + $(CC) -o $(TC39) $(TC39).c $(CFLAGS) $(LDFLAGS) + +$(TC40) : + $(CC) -o $(TC40) $(TC40).c $(CFLAGS) $(LDFLAGS) diff --git a/TC/msgTC/MapiStorage/tslist b/TC/msgTC/MapiStorage/tslist new file mode 100755 index 0000000..b515aea --- /dev/null +++ b/TC/msgTC/MapiStorage/tslist @@ -0,0 +1,40 @@ +utc_msg_add_folder +utc_msg_add_message +utc_msg_get_conversation_view_list +utc_msg_add_syncml_message +utc_msg_get_folder_list +utc_msg_backup_message +utc_msg_get_folder_view_list +utc_msg_get_mem_size +utc_msg_get_message +utc_msg_get_quick_panel_data +utc_msg_get_thread_view_list +utc_msg_move_msg_to_folder +utc_msg_move_msg_to_storage +utc_msg_release_folder_list +utc_msg_release_thread_view_list +utc_msg_reset_database +utc_msg_generate_message +utc_msg_count_message +utc_msg_restore_message +utc_msg_count_msg_by_contact +utc_msg_thread_view_get_address +utc_msg_count_msg_by_type +utc_msg_thread_view_get_contact_id +utc_msg_delete_all_msgs_in_folder +utc_msg_thread_view_get_data +utc_msg_delete_folder +utc_msg_thread_view_get_direction +utc_msg_delete_message +utc_msg_thread_view_get_image_path +utc_msg_delete_thread_message_list +utc_msg_thread_view_get_mms_cnt +utc_msg_thread_view_get_name +utc_msg_thread_view_get_sms_cnt +utc_msg_thread_view_get_thread_id +utc_msg_thread_view_get_time +utc_msg_thread_view_get_unread_cnt +utc_msg_update_folder +utc_msg_update_message +utc_msg_update_protected_status +utc_msg_update_read_status \ No newline at end of file diff --git a/TC/msgTC/MapiStorage/utc_msg_add_folder.c b/TC/msgTC/MapiStorage/utc_msg_add_folder.c new file mode 100755 index 0000000..92b3469 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_add_folder.c @@ -0,0 +1,105 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_add_folder.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_add_folder_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_FOLDER_INFO_S folderInfo; + + memset(&folderInfo, 0x00, sizeof(folderInfo)); + + folderInfo.folderId = 10; + folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; + + strncpy(folderInfo.folderName, "Test folder", MAX_FOLDER_NAME_SIZE); + + err = msg_add_folder(msgHandle, &folderInfo); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_add_folder_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_FOLDER_INFO_S folderInfo; + + memset(&folderInfo, 0x00, sizeof(folderInfo)); + + folderInfo.folderId = 10; + folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; + + strncpy(folderInfo.folderName, "Test folder", MAX_FOLDER_NAME_SIZE); + + err = msg_add_folder(NULL, &folderInfo); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_add_folder.h b/TC/msgTC/MapiStorage/utc_msg_add_folder.h new file mode 100755 index 0000000..7510aba --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_add_folder.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_add_folder_001(void); +static void utc_msg_add_folder_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_add_folder_001,1}, + { utc_msg_add_folder_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_add_message.c b/TC/msgTC/MapiStorage/utc_msg_add_message.c new file mode 100755 index 0000000..c7e0c8e --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_add_message.c @@ -0,0 +1,87 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_add_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_add_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_add_message(msgHandle, msgInfo, &sendOpt); + if (err < MSG_SUCCESS) + { + tet_printf("msg_add_message fail [%d]", err); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_add_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_add_message(NULL, msgInfo, &sendOpt); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_printf("msg_add_message success [%d]", err); + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_add_message.h b/TC/msgTC/MapiStorage/utc_msg_add_message.h new file mode 100755 index 0000000..f751385 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_add_message.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_add_message_001(void); +static void utc_msg_add_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_add_message_001,1}, + { utc_msg_add_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_add_syncml_message.c b/TC/msgTC/MapiStorage/utc_msg_add_syncml_message.c new file mode 100755 index 0000000..b94409a --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_add_syncml_message.c @@ -0,0 +1,98 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_add_syncml_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SYNCML_MESSAGE_S syncMLMsg; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&syncMLMsg, 0x00, sizeof(MSG_SYNCML_MESSAGE_S)); + + syncMLMsg.extId = 11; + syncMLMsg.pinCode = 1111; + + syncMLMsg.msg = msg_new_message(); + + msg_set_folder_id(syncMLMsg.msg, MSG_INBOX_ID); + msg_set_message_type(syncMLMsg.msg, MSG_TYPE_SMS_SYNCML); + msg_set_network_status(syncMLMsg.msg, MSG_NETWORK_RECEIVED); + msg_set_direction_info(syncMLMsg.msg, MSG_DIRECTION_TYPE_MT); + + msg_add_address(syncMLMsg.msg, "+1004", MSG_RECIPIENTS_TYPE_TO); + + char msg_body[]="SyncML Message"; + msg_sms_set_message_body(syncMLMsg.msg, msg_body, strlen(msg_body)); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_add_syncml_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_add_syncml_message(msgHandle, &syncMLMsg); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_add_syncml_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_add_syncml_message(NULL, &syncMLMsg); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_add_syncml_message.h b/TC/msgTC/MapiStorage/utc_msg_add_syncml_message.h new file mode 100755 index 0000000..38c578a --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_add_syncml_message.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_add_syncml_message_001(void); +static void utc_msg_add_syncml_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_add_syncml_message_001,1}, + { utc_msg_add_syncml_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_count_message.c b/TC/msgTC/MapiStorage/utc_msg_count_message.c new file mode 100755 index 0000000..8d9f868 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_count_message.c @@ -0,0 +1,91 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_count_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_COUNT_INFO_S count_info; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + memset(&count_info, 0x00, sizeof(count_info)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_count_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_count_message(msgHandle, MSG_DRAFT_ID, &count_info); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_count_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_count_message(NULL, MSG_DRAFT_ID, &count_info); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_count_message.h b/TC/msgTC/MapiStorage/utc_msg_count_message.h new file mode 100755 index 0000000..ddb5d6c --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_count_message.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_count_message_001(void); +static void utc_msg_count_message_001(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_count_message_001,1}, + { utc_msg_count_message_001,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_count_msg_by_contact.c b/TC/msgTC/MapiStorage/utc_msg_count_msg_by_contact.c new file mode 100755 index 0000000..25683f3 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_count_msg_by_contact.c @@ -0,0 +1,99 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_count_msg_by_contact.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_count_msg_by_contact_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_THREAD_LIST_INDEX_S addr_info; + MSG_THREAD_COUNT_INFO_S msg_thread_count_list; + + memset(&addr_info, 0x00, sizeof(addr_info)); + memset(&msg_thread_count_list, 0x00, sizeof(msg_thread_count_list)); + + err = msg_count_msg_by_contact(msgHandle, &addr_info, &msg_thread_count_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_count_msg_by_contact_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_THREAD_LIST_INDEX_S addr_info; + MSG_THREAD_COUNT_INFO_S msg_thread_count_list; + + memset(&addr_info, 0x00, sizeof(addr_info)); + memset(&msg_thread_count_list, 0x00, sizeof(msg_thread_count_list)); + + err = msg_count_msg_by_contact(NULL, &addr_info, &msg_thread_count_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_count_msg_by_contact.h b/TC/msgTC/MapiStorage/utc_msg_count_msg_by_contact.h new file mode 100755 index 0000000..268d67c --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_count_msg_by_contact.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_count_msg_by_contact_001(void); +static void utc_msg_count_msg_by_contact_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_count_msg_by_contact_001,1}, + { utc_msg_count_msg_by_contact_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.c b/TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.c new file mode 100755 index 0000000..8a65965 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.c @@ -0,0 +1,91 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_count_msg_by_type.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_update_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + int count = 0; + + err = msg_count_msg_by_type(msgHandle, MSG_TYPE_SMS, &count); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_update_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + int count = 0; + + err = msg_count_msg_by_type(NULL, MSG_TYPE_SMS, &count); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.h b/TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.h new file mode 100755 index 0000000..bad318b --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_count_msg_by_type.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_update_message_001(void); +static void utc_msg_update_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_update_message_001,1}, + { utc_msg_update_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder.c b/TC/msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder.c new file mode 100755 index 0000000..43179cc --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_delete_all_msgs_in_folder.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_delete_all_msgs_in_folder_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_delete_all_msgs_in_folder(msgHandle, MSG_DRAFT_ID, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_delete_all_msgs_in_folder_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_delete_all_msgs_in_folder(NULL, MSG_DRAFT_ID, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder.h b/TC/msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder.h new file mode 100755 index 0000000..b1aaaff --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_delete_all_msgs_in_folder_001(void); +static void utc_msg_delete_all_msgs_in_folder_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_delete_all_msgs_in_folder_001,1}, + { utc_msg_delete_all_msgs_in_folder_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_delete_folder.c b/TC/msgTC/MapiStorage/utc_msg_delete_folder.c new file mode 100755 index 0000000..a656d23 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_delete_folder.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_delete_folder.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_delete_folder_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_delete_folder(msgHandle, 10); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_delete_folder_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_delete_folder(NULL, 10); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_delete_folder.h b/TC/msgTC/MapiStorage/utc_msg_delete_folder.h new file mode 100755 index 0000000..00dbbae --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_delete_folder.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_delete_folder_001(void); +static void utc_msg_delete_folder_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_delete_folder_001,1}, + { utc_msg_delete_folder_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_delete_message.c b/TC/msgTC/MapiStorage/utc_msg_delete_message.c new file mode 100755 index 0000000..5e21311 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_delete_message.c @@ -0,0 +1,96 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_delete_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +int msgId = 0; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_LIST_S folder_list; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + msg_get_folder_view_list(msgHandle, MSG_DRAFT_ID, NULL, &folder_list); + + msgId = msg_get_message_id(folder_list.msgInfo[0]); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_delete_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_delete_message(msgHandle, msgId); + if (err != MSG_SUCCESS) + { + tet_printf("err is [%d]", err); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_delete_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_delete_message(NULL, msgId); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_delete_message.h b/TC/msgTC/MapiStorage/utc_msg_delete_message.h new file mode 100755 index 0000000..963a268 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_delete_message.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_delete_message_001(void); +static void utc_msg_delete_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_delete_message_001,1}, + { utc_msg_delete_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_delete_thread_message_list.c b/TC/msgTC/MapiStorage/utc_msg_delete_thread_message_list.c new file mode 100755 index 0000000..d4f0456 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_delete_thread_message_list.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_delete_thread_message_list.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_delete_thread_message_list_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_delete_thread_message_list(msgHandle, 0); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_delete_thread_message_list_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_delete_thread_message_list(NULL, 0); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_delete_thread_message_list.h b/TC/msgTC/MapiStorage/utc_msg_delete_thread_message_list.h new file mode 100755 index 0000000..ff4a17c --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_delete_thread_message_list.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_delete_thread_message_list_001(void); +static void utc_msg_delete_thread_message_list_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_delete_thread_message_list_001,1}, + { utc_msg_delete_thread_message_list_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_generate_message.c b/TC/msgTC/MapiStorage/utc_msg_generate_message.c new file mode 100755 index 0000000..db15d2d --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_generate_message.c @@ -0,0 +1,79 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_generate_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_generate_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_generate_message(msgHandle, MSG_TYPE_SMS, MSG_DRAFT_ID, 10); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_generate_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_generate_message(NULL, MSG_TYPE_SMS, MSG_DRAFT_ID, 10); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_generate_message.h b/TC/msgTC/MapiStorage/utc_msg_generate_message.h new file mode 100755 index 0000000..199b484 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_generate_message.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_generate_message_001(void); +static void utc_msg_generate_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_generate_message_001,1}, + { utc_msg_generate_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_get_conversation_view_list.c b/TC/msgTC/MapiStorage/utc_msg_get_conversation_view_list.c new file mode 100755 index 0000000..5acdeb4 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_conversation_view_list.c @@ -0,0 +1,96 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_conversation_view_list.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_conversation_view_list_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_LIST_S msg_conv_view_list; + + memset(&msg_conv_view_list, 0x00, sizeof(msg_conv_view_list)); + + err = msg_get_conversation_view_list(msgHandle, 0, &msg_conv_view_list); + msg_release_message_list(&msg_conv_view_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_conversation_view_list_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_LIST_S msg_conv_view_list; + + memset(&msg_conv_view_list, 0x00, sizeof(msg_conv_view_list)); + + err = msg_get_conversation_view_list(NULL, 0, &msg_conv_view_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_get_conversation_view_list.h b/TC/msgTC/MapiStorage/utc_msg_get_conversation_view_list.h new file mode 100755 index 0000000..cd934e1 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_conversation_view_list.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_get_conversation_view_list_001(void); +static void utc_msg_get_conversation_view_list_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_get_conversation_view_list_001,1}, + { utc_msg_get_conversation_view_list_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_get_folder_list.c b/TC/msgTC/MapiStorage/utc_msg_get_folder_list.c new file mode 100755 index 0000000..12b601f --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_folder_list.c @@ -0,0 +1,97 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_folder_list.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_folder_list_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_FOLDER_LIST_S folder_list; + + memset(&folder_list, 0x00, sizeof(folder_list)); + + err = msg_get_folder_list(msgHandle, &folder_list); + msg_release_folder_list(&folder_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_folder_list_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_FOLDER_LIST_S folder_list; + + memset(&folder_list, 0x00, sizeof(folder_list)); + + err = msg_get_folder_list(NULL, &folder_list); + msg_release_folder_list(&folder_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_get_folder_list.h b/TC/msgTC/MapiStorage/utc_msg_get_folder_list.h new file mode 100755 index 0000000..bc1bbbf --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_folder_list.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_get_folder_list_001(void); +static void utc_msg_get_folder_list_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_get_folder_list_001,1}, + { utc_msg_get_folder_list_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_get_folder_view_list.c b/TC/msgTC/MapiStorage/utc_msg_get_folder_view_list.c new file mode 100755 index 0000000..d9edaec --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_folder_view_list.c @@ -0,0 +1,100 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_folder_view_list.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_folder_view_list_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + MSG_LIST_S msg_folder_view_list; + + memset(&sort_rule, 0x00, sizeof(sort_rule)); + memset(&msg_folder_view_list, 0x00, sizeof(msg_folder_view_list)); + + err = msg_get_folder_view_list(msgHandle, MSG_DRAFT_ID, &sort_rule, &msg_folder_view_list); + msg_release_message_list(&msg_folder_view_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_folder_view_list_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + MSG_LIST_S msg_folder_view_list; + + memset(&sort_rule, 0x00, sizeof(sort_rule)); + memset(&msg_folder_view_list, 0x00, sizeof(msg_folder_view_list)); + + err = msg_get_folder_view_list(NULL, MSG_DRAFT_ID, &sort_rule, &msg_folder_view_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_get_folder_view_list.h b/TC/msgTC/MapiStorage/utc_msg_get_folder_view_list.h new file mode 100755 index 0000000..f9c005a --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_folder_view_list.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_get_folder_view_list_001(void); +static void utc_msg_get_folder_view_list_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_get_folder_view_list_001,1}, + { utc_msg_get_folder_view_list_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_get_mem_size.c b/TC/msgTC/MapiStorage/utc_msg_get_mem_size.c new file mode 100755 index 0000000..9d3af3c --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_mem_size.c @@ -0,0 +1,91 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_mem_size.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_mem_size_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + int memsize = 0; + + err = msg_get_mem_size(msgHandle, &memsize); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_mem_size_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + int memsize = 0; + + err = msg_get_mem_size(NULL, &memsize); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_get_mem_size.h b/TC/msgTC/MapiStorage/utc_msg_get_mem_size.h new file mode 100755 index 0000000..7c07ee4 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_mem_size.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_get_mem_size_001(void); +static void utc_msg_get_mem_size_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_get_mem_size_001,1}, + { utc_msg_get_mem_size_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_get_message.c b/TC/msgTC/MapiStorage/utc_msg_get_message.c new file mode 100755 index 0000000..35b03ed --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_message.c @@ -0,0 +1,96 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +int msgId = 0; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_LIST_S folder_list; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + msg_get_folder_view_list(msgHandle, MSG_DRAFT_ID, NULL, &folder_list); + + msgId = msg_get_message_id(folder_list.msgInfo[0]); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_message(msgHandle, msgId, msgInfo, &sendOpt); + if (err != MSG_SUCCESS) + { + tet_printf("err is [%d]", err); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_message(NULL, msgId, msgInfo, &sendOpt); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_get_message.h b/TC/msgTC/MapiStorage/utc_msg_get_message.h new file mode 100755 index 0000000..8b72a2a --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_message.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_get_message_001(void); +static void utc_msg_get_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_get_message_001,1}, + { utc_msg_get_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_get_quick_panel_data.c b/TC/msgTC/MapiStorage/utc_msg_get_quick_panel_data.c new file mode 100755 index 0000000..5abe218 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_quick_panel_data.c @@ -0,0 +1,90 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_quick_panel_data.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_quick_panel_data_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + //err = msg_get_quick_panel_data(msgHandle, MSG_QUICKPANEL_SMS, msgInfo); + if (err != MSG_SUCCESS) + { + tet_printf("err is [%d]", err); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_quick_panel_data_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_get_quick_panel_data(NULL, MSG_QUICKPANEL_SMS, msgInfo); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_get_quick_panel_data.h b/TC/msgTC/MapiStorage/utc_msg_get_quick_panel_data.h new file mode 100755 index 0000000..f5dbc1b --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_quick_panel_data.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_get_quick_panel_data_001(void); +static void utc_msg_get_quick_panel_data_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_get_quick_panel_data_001,1}, + { utc_msg_get_quick_panel_data_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_get_thread_view_list.c b/TC/msgTC/MapiStorage/utc_msg_get_thread_view_list.c new file mode 100755 index 0000000..f89258c --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_thread_view_list.c @@ -0,0 +1,101 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_get_thread_view_list.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_get_thread_view_list_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + + memset(&sort_rule, 0x00, sizeof(sort_rule)); + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + + err = msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); + msg_release_thread_view_list(&msg_thread_view_list); + if (err != MSG_SUCCESS) + { + tet_printf("err is [%d]", err); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_get_thread_view_list_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + + memset(&sort_rule, 0x00, sizeof(sort_rule)); + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + + err = msg_get_thread_view_list(NULL, &sort_rule, &msg_thread_view_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_get_thread_view_list.h b/TC/msgTC/MapiStorage/utc_msg_get_thread_view_list.h new file mode 100755 index 0000000..b3c3c72 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_get_thread_view_list.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_get_thread_view_list_001(void); +static void utc_msg_get_thread_view_list_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_get_thread_view_list_001,1}, + { utc_msg_get_thread_view_list_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.c b/TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.c new file mode 100755 index 0000000..e4052f3 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_move_msg_to_folder.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_move_msg_to_folder_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_move_msg_to_folder(msgHandle, 0, MSG_DRAFT_ID); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_move_msg_to_folder_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_move_msg_to_folder(NULL, 0, MSG_DRAFT_ID); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.h b/TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.h new file mode 100755 index 0000000..25220de --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_move_msg_to_folder.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_move_msg_to_folder_001(void); +static void utc_msg_move_msg_to_folder_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_move_msg_to_folder_001,1}, + { utc_msg_move_msg_to_folder_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.c b/TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.c new file mode 100755 index 0000000..d4fbd71 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_move_msg_to_storage.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_move_msg_to_storage_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_update_message(msgHandle, msgInfo, &sendOpt); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_move_msg_to_storage_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_update_message(NULL, msgInfo, &sendOpt); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.h b/TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.h new file mode 100755 index 0000000..2b57cfe --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_move_msg_to_storage.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_move_msg_to_storage_001(void); +static void utc_msg_move_msg_to_storage_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_move_msg_to_storage_001,1}, + { utc_msg_move_msg_to_storage_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_release_folder_list.c b/TC/msgTC/MapiStorage/utc_msg_release_folder_list.c new file mode 100755 index 0000000..eb7a0be --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_release_folder_list.c @@ -0,0 +1,97 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_release_folder_list.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_release_folder_list_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_FOLDER_LIST_S folder_list; + + memset(&folder_list, 0x00, sizeof(folder_list)); + + msg_get_folder_list(msgHandle, &folder_list); + msg_release_folder_list(&folder_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_release_folder_list_002() +{ + MSG_ERROR_T err = -1; + MSG_FOLDER_LIST_S folder_list; + + memset(&folder_list, 0x00, sizeof(folder_list)); + + //err = msg_get_folder_list(NULL, &folder_list); + //msg_release_folder_list(&folder_list); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_release_folder_list.h b/TC/msgTC/MapiStorage/utc_msg_release_folder_list.h new file mode 100755 index 0000000..7e428a2 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_release_folder_list.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_release_folder_list_001(void); +static void utc_msg_release_folder_list_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_release_folder_list_001,1}, + { utc_msg_release_folder_list_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_release_thread_view_list.c b/TC/msgTC/MapiStorage/utc_msg_release_thread_view_list.c new file mode 100755 index 0000000..07411cf --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_release_thread_view_list.c @@ -0,0 +1,97 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_release_thread_view_list.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_release_thread_view_list_001() +{ + int err = MSG_SUCCESS; + + //msg_release_thread_view_list(&msg_thread_view_list); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_release_thread_view_list_002() +{ + int err = -1; + + //msg_release_thread_view_list(&msg_thread_view_list); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_release_thread_view_list.h b/TC/msgTC/MapiStorage/utc_msg_release_thread_view_list.h new file mode 100755 index 0000000..a7543cb --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_release_thread_view_list.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_release_thread_view_list_001(void); +static void utc_msg_release_thread_view_list_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_release_thread_view_list_001,1}, + { utc_msg_release_thread_view_list_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_reset_database.c b/TC/msgTC/MapiStorage/utc_msg_reset_database.c new file mode 100755 index 0000000..44ae225 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_reset_database.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_reset_database.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_reset_database_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_reset_database(msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_reset_database_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_reset_database(NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_reset_database.h b/TC/msgTC/MapiStorage/utc_msg_reset_database.h new file mode 100755 index 0000000..bc6c832 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_reset_database.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_reset_database_001(void); +static void utc_msg_reset_database_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_reset_database_001,1}, + { utc_msg_reset_database_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_address.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_address.c new file mode 100755 index 0000000..b48ba8e --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_address.c @@ -0,0 +1,105 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_address.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_address_001() +{ + int err = MSG_SUCCESS; + char* addr = NULL; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + addr = msg_thread_view_get_address(msg_thread_view_list.msgThreadInfo[0]); + if (addr == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_address_002() +{ + int err = MSG_SUCCESS; + char* addr = NULL; + + addr = msg_thread_view_get_address(NULL); + if (addr == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_address.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_address.h new file mode 100755 index 0000000..ae1fc2f --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_address.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_address_001(void); +static void utc_msg_thread_view_get_address_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_address_001,1}, + { utc_msg_thread_view_get_address_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_contact_id.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_contact_id.c new file mode 100755 index 0000000..6b4f6a8 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_contact_id.c @@ -0,0 +1,103 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_contact_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_contact_id_001() +{ + int err = MSG_SUCCESS; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + err = msg_thread_view_get_contact_id(msg_thread_view_list.msgThreadInfo[0]); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_contact_id_002() +{ + int err = MSG_SUCCESS; + + err = msg_thread_view_get_contact_id(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_contact_id.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_contact_id.h new file mode 100755 index 0000000..cba7ba5 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_contact_id.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_contact_id_001(void); +static void utc_msg_thread_view_get_contact_id_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_contact_id_001,1}, + { utc_msg_thread_view_get_contact_id_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_data.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_data.c new file mode 100755 index 0000000..f750d29 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_data.c @@ -0,0 +1,105 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_data.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_data_001() +{ + int err = MSG_SUCCESS; + char* data = NULL; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + data = msg_thread_view_get_data(msg_thread_view_list.msgThreadInfo[0]); + if (data == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_data_002() +{ + int err = MSG_SUCCESS; + char* data = NULL; + + data = msg_thread_view_get_data(NULL); + if (data == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_data.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_data.h new file mode 100755 index 0000000..73d8b74 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_data.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_data_001(void); +static void utc_msg_thread_view_get_data_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_data_001,1}, + { utc_msg_thread_view_get_data_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_direction.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_direction.c new file mode 100755 index 0000000..c26f4de --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_direction.c @@ -0,0 +1,103 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_direction.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_direction_001() +{ + int err = MSG_SUCCESS; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + err = msg_thread_view_get_direction(msg_thread_view_list.msgThreadInfo[0]); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_direction_002() +{ + int err = MSG_SUCCESS; + + err = msg_thread_view_get_direction(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_direction.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_direction.h new file mode 100755 index 0000000..9f4a4c1 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_direction.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_direction_001(void); +static void utc_msg_thread_view_get_direction_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_direction_001,1}, + { utc_msg_thread_view_get_direction_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_image_path.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_image_path.c new file mode 100755 index 0000000..aab8e89 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_image_path.c @@ -0,0 +1,105 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_image_path.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_image_path_001() +{ + int err = MSG_SUCCESS; + char* path = NULL; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + path = msg_thread_view_get_image_path(msg_thread_view_list.msgThreadInfo[0]); + if (path == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_image_path_002() +{ + int err = MSG_SUCCESS; + char* path = NULL; + + path = msg_thread_view_get_image_path(NULL); + if (path == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_image_path.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_image_path.h new file mode 100755 index 0000000..c9db1a1 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_image_path.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_image_path_001(void); +static void utc_msg_thread_view_get_image_path_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_image_path_001,1}, + { utc_msg_thread_view_get_image_path_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt.c new file mode 100755 index 0000000..8923efb --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt.c @@ -0,0 +1,103 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_mms_cnt.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_mms_cnt_001() +{ + int err = MSG_SUCCESS; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + err = msg_thread_view_get_mms_cnt(msg_thread_view_list.msgThreadInfo[0]); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_mms_cnt_002() +{ + int err = MSG_SUCCESS; + + err = msg_thread_view_get_mms_cnt(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt.h new file mode 100755 index 0000000..0239710 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_mms_cnt_001(void); +static void utc_msg_thread_view_get_mms_cnt_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_mms_cnt_001,1}, + { utc_msg_thread_view_get_mms_cnt_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_name.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_name.c new file mode 100755 index 0000000..73f4813 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_name.c @@ -0,0 +1,105 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_name.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_name_001() +{ + int err = MSG_SUCCESS; + char* name = NULL; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + name = msg_thread_view_get_name(msg_thread_view_list.msgThreadInfo[0]); + if (name == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_name_002() +{ + int err = MSG_SUCCESS; + char* name = NULL; + + name = msg_thread_view_get_name(NULL); + if (name == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_name.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_name.h new file mode 100755 index 0000000..0c0150e --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_name.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_name_001(void); +static void utc_msg_thread_view_get_name_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_name_001,1}, + { utc_msg_thread_view_get_name_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt.c new file mode 100755 index 0000000..0ececc0 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt.c @@ -0,0 +1,103 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_sms_cnt.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_sms_cnt_001() +{ + int err = MSG_SUCCESS; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + err = msg_thread_view_get_sms_cnt(msg_thread_view_list.msgThreadInfo[0]); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_sms_cnt_002() +{ + int err = MSG_SUCCESS; + + err = msg_thread_view_get_sms_cnt(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt.h new file mode 100755 index 0000000..f3a2a78 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_sms_cnt_001(void); +static void utc_msg_thread_view_get_sms_cnt_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_sms_cnt_001,1}, + { utc_msg_thread_view_get_sms_cnt_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_thread_id.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_thread_id.c new file mode 100755 index 0000000..48b49b0 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_thread_id.c @@ -0,0 +1,103 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_thread_id.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_thread_id_001() +{ + int err = MSG_SUCCESS; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + err = msg_thread_view_get_thread_id(msg_thread_view_list.msgThreadInfo[0]); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_thread_id_002() +{ + int err = MSG_SUCCESS; + + err = msg_thread_view_get_thread_id(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_thread_id.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_thread_id.h new file mode 100755 index 0000000..af95bc4 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_thread_id.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_thread_id_001(void); +static void utc_msg_thread_view_get_thread_id_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_thread_id_001,1}, + { utc_msg_thread_view_get_thread_id_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_time.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_time.c new file mode 100755 index 0000000..db81961 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_time.c @@ -0,0 +1,105 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_time.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_time_001() +{ + int err = MSG_SUCCESS; + time_t* time = NULL; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + time = msg_thread_view_get_time(msg_thread_view_list.msgThreadInfo[0]); + if (time == NULL) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_time_002() +{ + int err = MSG_SUCCESS; + time_t* time = NULL; + + time = msg_thread_view_get_time(NULL); + if (time == NULL) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_time.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_time.h new file mode 100755 index 0000000..c5dee20 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_time.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_time_001(void); +static void utc_msg_thread_view_get_time_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_time_001,1}, + { utc_msg_thread_view_get_time_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt.c b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt.c new file mode 100755 index 0000000..bec6c06 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt.c @@ -0,0 +1,103 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_thread_view_get_unread_cnt.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +MSG_THREAD_VIEW_LIST_S msg_thread_view_list; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); + + memset(&msg_thread_view_list, 0x00, sizeof(msg_thread_view_list)); + memset(&sort_rule, 0x00, sizeof(sort_rule)); + + msg_get_thread_view_list(msgHandle, NULL, &msg_thread_view_list); +} +void cleanup(void) +{ + msg_release_thread_view_list(&msg_thread_view_list); + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_thread_view_get_unread_cnt_001() +{ + int err = MSG_SUCCESS; + + if(msg_thread_view_list.nCount == 0) + { + tet_result(TET_PASS); + return; + } + + err = msg_thread_view_get_unread_cnt(msg_thread_view_list.msgThreadInfo[0]); + if (err < MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_thread_view_get_unread_cnt_002() +{ + int err = MSG_SUCCESS; + + err = msg_thread_view_get_unread_cnt(NULL); + if (err < MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt.h b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt.h new file mode 100755 index 0000000..14e2014 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_thread_view_get_unread_cnt_001(void); +static void utc_msg_thread_view_get_unread_cnt_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_thread_view_get_unread_cnt_001,1}, + { utc_msg_thread_view_get_unread_cnt_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_update_folder.c b/TC/msgTC/MapiStorage/utc_msg_update_folder.c new file mode 100755 index 0000000..806fa79 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_update_folder.c @@ -0,0 +1,105 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_update_folder.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_update_folder_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_FOLDER_INFO_S folderInfo; + + memset(&folderInfo, 0x00, sizeof(folderInfo)); + + folderInfo.folderId = 0; + folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; + + strncpy(folderInfo.folderName, "Test folder", MAX_FOLDER_NAME_SIZE); + + err = msg_update_folder(msgHandle, &folderInfo); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_update_folder_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_FOLDER_INFO_S folderInfo; + + memset(&folderInfo, 0x00, sizeof(folderInfo)); + + folderInfo.folderId = 0; + folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; + + strncpy(folderInfo.folderName, "Test folder", MAX_FOLDER_NAME_SIZE); + + err = msg_update_folder(NULL, &folderInfo); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_update_folder.h b/TC/msgTC/MapiStorage/utc_msg_update_folder.h new file mode 100755 index 0000000..76f53bb --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_update_folder.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_update_folder_001(void); +static void utc_msg_update_folder_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_update_folder_001,1}, + { utc_msg_update_folder_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_update_message.c b/TC/msgTC/MapiStorage/utc_msg_update_message.c new file mode 100755 index 0000000..e7b8b69 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_update_message.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_update_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_update_message_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_update_message(msgHandle, msgInfo, &sendOpt); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_update_message_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_update_message(NULL, msgInfo, &sendOpt); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_update_message.h b/TC/msgTC/MapiStorage/utc_msg_update_message.h new file mode 100755 index 0000000..bad318b --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_update_message.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_update_message_001(void); +static void utc_msg_update_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_update_message_001,1}, + { utc_msg_update_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_update_protected_status.c b/TC/msgTC/MapiStorage/utc_msg_update_protected_status.c new file mode 100755 index 0000000..36caa95 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_update_protected_status.c @@ -0,0 +1,89 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_update_protected_status.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_message(msgHandle, msgInfo, &sendOpt); + + msg_set_message_id(msgInfo, 0); +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_update_protected_status_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_update_protected_status(msgHandle, 0, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_update_protected_status_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_update_protected_status(NULL, 0, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_update_protected_status.h b/TC/msgTC/MapiStorage/utc_msg_update_protected_status.h new file mode 100755 index 0000000..390a8c0 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_update_protected_status.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_update_protected_status_001(void); +static void utc_msg_update_protected_status_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_update_protected_status_001,1}, + { utc_msg_update_protected_status_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiStorage/utc_msg_update_read_status.c b/TC/msgTC/MapiStorage/utc_msg_update_read_status.c new file mode 100755 index 0000000..c41da01 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_update_read_status.c @@ -0,0 +1,98 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_update_read_status.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; +int msgId = 0; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msgInfo = msg_new_message(); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; + + msg_add_address(msgInfo, "01000000000", MSG_RECIPIENTS_TYPE_TO); + + msgId = msg_add_message(msgHandle, msgInfo, &sendOpt); + + tet_printf("msgId is [%d]", msgId); + + //msg_get_folder_view_list(msgHandle, MSG_DRAFT_ID, NULL, &folder_list); + + //msgId = msg_folder_view_get_message_id(folder_list.msgCommInfo[0]); + +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_update_read_status_001() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_update_read_status(msgHandle, msgId, true); + if (err != MSG_SUCCESS) + { + tet_printf("err is [%d]", err); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_update_read_status_002() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_update_read_status(NULL, msgId, true); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiStorage/utc_msg_update_read_status.h b/TC/msgTC/MapiStorage/utc_msg_update_read_status.h new file mode 100755 index 0000000..878ace1 --- /dev/null +++ b/TC/msgTC/MapiStorage/utc_msg_update_read_status.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiStorage.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_update_read_status_001(void); +static void utc_msg_update_read_status_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_update_read_status_001,1}, + { utc_msg_update_read_status_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/Makefile b/TC/msgTC/MapiTransport/Makefile new file mode 100755 index 0000000..50ea736 --- /dev/null +++ b/TC/msgTC/MapiTransport/Makefile @@ -0,0 +1,108 @@ +################################################### +# add your TestCase List Here +# +# e.g., +# TC1 = utc_frameworkName_apiName_func +# TC2 = utc_ApplicationLib_recurGetDayOfWeek_func +TC1 = utc_msg_mms_forward_message +TC2 = utc_msg_reg_lbs_message_callback +TC3 = utc_msg_sms_send +TC4 = utc_msg_mms_reject_message +TC5 = utc_msg_reg_mms_conf_message_callback +TC6 = utc_msg_sms_send_message +TC7 = utc_msg_mms_retrieve_message +TC8 = utc_msg_reg_sent_status_callback +TC9 = utc_msg_submit_req +TC10 = utc_msg_mms_send_message +TC11 = utc_msg_reg_sms_message_callback +TC12 = utc_msg_mms_send_read_report +TC13 = utc_msg_reg_syncml_message_callback + + +################################################### +# add your Package Config Info Here +# +# e.g., +# PKGS=calendar +PKGS=msg-service + +LIBS = `pkg-config --libs $(PKGS)` +LIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o +LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s +LIBS +=-L$(TET_ROOT)/lib/tet3 -lapi_s + +INCS = -I. `pkg-config --cflags $(PKGS)` +INCS += -I$(TET_ROOT)/inc/tet3 + +CFLAGS = $(INCS) +CFLAGS += -D_TETWARE_MODE +#CC +=$(CFLAGS) +LDFLAGS = $(LIBS) + +################################################### +# Modify here +# depending on the Test Case you want to build +# +# e.g., +# TCLIST = $(TC1) $(TC2) +TCLIST = $(TC1) $(TC2) $(TC3) $(TC4) $(TC5) $(TC6) $(TC7) $(TC8) $(TC9) $(TC10) $(TC11) $(TC12) $(TC13) + +all : + for testcase in $(TCLIST) do\ + $(CC) -o $$(testcase) $$(testcase).c $(CFLAGS) $(LDFLAGS) + done + +clean : + rm -rf *~ *.o $(TCLIST) + + +$(TC1) : + $(CC) -o $(TC1) $(TC1).c $(CFLAGS) $(LDFLAGS) + + +$(TC2) : + $(CC) -o $(TC2) $(TC2).c $(CFLAGS) $(LDFLAGS) + + +$(TC3) : + $(CC) -o $(TC3) $(TC3).c $(CFLAGS) $(LDFLAGS) + + +$(TC4) : + $(CC) -o $(TC4) $(TC4).c $(CFLAGS) $(LDFLAGS) + + +$(TC5) : + $(CC) -o $(TC5) $(TC5).c $(CFLAGS) $(LDFLAGS) + + +$(TC6) : + $(CC) -o $(TC6) $(TC6).c $(CFLAGS) $(LDFLAGS) + + +$(TC7) : + $(CC) -o $(TC7) $(TC7).c $(CFLAGS) $(LDFLAGS) + + +$(TC8) : + $(CC) -o $(TC8) $(TC8).c $(CFLAGS) $(LDFLAGS) + + +$(TC9) : + $(CC) -o $(TC9) $(TC9).c $(CFLAGS) $(LDFLAGS) + + +$(TC10) : + $(CC) -o $(TC10) $(TC10).c $(CFLAGS) $(LDFLAGS) + + +$(TC11) : + $(CC) -o $(TC11) $(TC11).c $(CFLAGS) $(LDFLAGS) + + +$(TC12) : + $(CC) -o $(TC12) $(TC12).c $(CFLAGS) $(LDFLAGS) + + +$(TC13) : + $(CC) -o $(TC13) $(TC13).c $(CFLAGS) $(LDFLAGS) \ No newline at end of file diff --git a/TC/msgTC/MapiTransport/tslist b/TC/msgTC/MapiTransport/tslist new file mode 100755 index 0000000..46d803f --- /dev/null +++ b/TC/msgTC/MapiTransport/tslist @@ -0,0 +1,13 @@ +utc_msg_mms_forward_message +utc_msg_reg_lbs_message_callback +utc_msg_sms_send +utc_msg_mms_reject_message +utc_msg_reg_mms_conf_message_callback +utc_msg_sms_send_message +utc_msg_mms_retrieve_message +utc_msg_reg_sent_status_callback +utc_msg_submit_req +utc_msg_mms_send_message +utc_msg_reg_sms_message_callback +utc_msg_mms_send_read_report +utc_msg_reg_syncml_message_callback diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_forward_message.c b/TC/msgTC/MapiTransport/utc_msg_mms_forward_message.c new file mode 100755 index 0000000..a8fc4aa --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_forward_message.c @@ -0,0 +1,140 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_forward_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S* mms_data; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_set_message_type(msgInfo, MSG_TYPE_MMS); + + msg_mms_set_message_body(msgInfo, mms_data); + + msg_mms_destroy_message(mms_data); + + msg_add_address(msgInfo, "01000000000", MSG_RECIPIENTS_TYPE_TO); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_forward_message_001() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_mms_forward_message(msgHandle, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_forward_message_002() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_mms_forward_message(NULL, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_forward_message.h b/TC/msgTC/MapiTransport/utc_msg_mms_forward_message.h new file mode 100755 index 0000000..c76fb42 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_forward_message.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_mms_forward_message_001(void); +static void utc_msg_mms_forward_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_mms_forward_message_001,1}, + { utc_msg_mms_forward_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_reject_message.c b/TC/msgTC/MapiTransport/utc_msg_mms_reject_message.c new file mode 100755 index 0000000..3b3aa33 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_reject_message.c @@ -0,0 +1,138 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_reject_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S* mms_data; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_mms_set_message_body(msgInfo, mms_data); + + msg_mms_destroy_message(mms_data); + + msg_add_address(msgInfo, "01000000000", MSG_RECIPIENTS_TYPE_TO); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_reject_message_001() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + //err = msg_mms_reject_message(msgHandle, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_reject_message_002() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_mms_reject_message(NULL, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_reject_message.h b/TC/msgTC/MapiTransport/utc_msg_mms_reject_message.h new file mode 100755 index 0000000..d96637e --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_reject_message.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_mms_reject_message_001(void); +static void utc_msg_mms_reject_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_mms_reject_message_001,1}, + { utc_msg_mms_reject_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_retrieve_message.c b/TC/msgTC/MapiTransport/utc_msg_mms_retrieve_message.c new file mode 100755 index 0000000..9c8e583 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_retrieve_message.c @@ -0,0 +1,138 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_retrieve_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S* mms_data; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_mms_set_message_body(msgInfo, mms_data); + + msg_mms_destroy_message(mms_data); + + msg_add_address(msgInfo, "01000000000", MSG_RECIPIENTS_TYPE_TO); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_retrieve_message_001() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + //err = msg_mms_retrieve_message(msgHandle, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_retrieve_message_002() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_mms_retrieve_message(NULL, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_retrieve_message.h b/TC/msgTC/MapiTransport/utc_msg_mms_retrieve_message.h new file mode 100755 index 0000000..e762a2f --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_retrieve_message.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_mms_retrieve_message_001(void); +static void utc_msg_mms_retrieve_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_mms_retrieve_message_001,1}, + { utc_msg_mms_retrieve_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_send_message.c b/TC/msgTC/MapiTransport/utc_msg_mms_send_message.c new file mode 100755 index 0000000..8fc22b1 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_send_message.c @@ -0,0 +1,140 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_send_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S* mms_data; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); + + msgInfo = msg_new_message(); + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_set_message_type(msgInfo, MSG_TYPE_MMS); + + msg_mms_set_message_body(msgInfo, mms_data); + + msg_mms_destroy_message(mms_data); + + msg_add_address(msgInfo, "01000000000", MSG_RECIPIENTS_TYPE_TO); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_send_message_001() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_mms_send_message(msgHandle, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_send_message_002() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_mms_send_message(NULL, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_send_message.h b/TC/msgTC/MapiTransport/utc_msg_mms_send_message.h new file mode 100755 index 0000000..8d40289 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_send_message.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_mms_send_message_001(void); +static void utc_msg_mms_send_message_001(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_mms_send_message_001,1}, + { utc_msg_mms_send_message_001,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_send_read_report.c b/TC/msgTC/MapiTransport/utc_msg_mms_send_read_report.c new file mode 100755 index 0000000..21cc335 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_send_read_report.c @@ -0,0 +1,79 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_mms_send_read_report.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_mms_send_read_report_001() +{ + int err = MSG_SUCCESS; + + //err = msg_mms_send_read_report(msgHandle, 0, MSG_READ_REPORT_IS_READ); + if (err != MSG_SUCCESS) + { + tet_printf("err is [%d]", err); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_mms_send_read_report_002() +{ + int err = MSG_SUCCESS; + + err = msg_mms_send_read_report(NULL, 0, MSG_READ_REPORT_IS_READ); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_mms_send_read_report.h b/TC/msgTC/MapiTransport/utc_msg_mms_send_read_report.h new file mode 100755 index 0000000..4ea9451 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_mms_send_read_report.h @@ -0,0 +1,50 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +static void utc_msg_mms_send_read_report_001(void); +static void utc_msg_mms_send_read_report_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_mms_send_read_report_001,1}, + { utc_msg_mms_send_read_report_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_lbs_message_callback.c b/TC/msgTC/MapiTransport/utc_msg_reg_lbs_message_callback.c new file mode 100755 index 0000000..13ea5e9 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_lbs_message_callback.c @@ -0,0 +1,83 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_reg_lbs_message_callback.h" + +static MSG_HANDLE_T msgHandle = NULL; + +void lbsCB(MSG_HANDLE_T hMsgHandle, const char* pPushHeader, const char* pPushBody, int pushBodyLen, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_reg_lbs_message_callback_001() +{ + int err = MSG_SUCCESS; + + err = msg_reg_lbs_message_callback(msgHandle, &lbsCB, NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_reg_lbs_message_callback_002() +{ + int err = MSG_SUCCESS; + + err = msg_reg_lbs_message_callback(NULL, &lbsCB, NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_lbs_message_callback.h b/TC/msgTC/MapiTransport/utc_msg_reg_lbs_message_callback.h new file mode 100755 index 0000000..ff492e9 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_lbs_message_callback.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void lbsCB(MSG_HANDLE_T hMsgHandle, const char* pPushHeader, const char* pPushBody, int pushBodyLen, void *pUserParam); +static void utc_msg_reg_lbs_message_callback_001(void); +static void utc_msg_reg_lbs_message_callback_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_reg_lbs_message_callback_001,1}, + { utc_msg_reg_lbs_message_callback_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback.c b/TC/msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback.c new file mode 100755 index 0000000..a265db1 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback.c @@ -0,0 +1,83 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_reg_mms_conf_message_callback.h" + +static MSG_HANDLE_T msgHandle = NULL; + +void incomingMmsConfCB(MSG_HANDLE_T Handle, msg_message_t msg, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_reg_mms_conf_message_callback_001() +{ + int err = MSG_SUCCESS; + + err = msg_reg_mms_conf_message_callback(msgHandle, &incomingMmsConfCB, NULL, NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_reg_mms_conf_message_callback_002() +{ + int err = MSG_SUCCESS; + + err = msg_reg_mms_conf_message_callback(NULL, &incomingMmsConfCB, NULL, NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback.h b/TC/msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback.h new file mode 100755 index 0000000..f5a2ba0 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void incomingMmsConfCB(MSG_HANDLE_T Handle, msg_message_t msg, void *pUserParam); +static void utc_msg_reg_mms_conf_message_callback_001(void); +static void utc_msg_reg_mms_conf_message_callback_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_reg_mms_conf_message_callback_001,1}, + { utc_msg_reg_mms_conf_message_callback_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_sent_status_callback.c b/TC/msgTC/MapiTransport/utc_msg_reg_sent_status_callback.c new file mode 100755 index 0000000..41c9837 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_sent_status_callback.c @@ -0,0 +1,83 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_reg_sent_status_callback.h" + +static MSG_HANDLE_T msgHandle = NULL; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_reg_sent_status_callback_001() +{ + int err = MSG_SUCCESS; + + err = msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_reg_sent_status_callback_002() +{ + int err = MSG_SUCCESS; + + err = msg_reg_sent_status_callback(NULL, &sentStatusCB, (void*)"sent status callback"); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_sent_status_callback.h b/TC/msgTC/MapiTransport/utc_msg_reg_sent_status_callback.h new file mode 100755 index 0000000..c364286 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_sent_status_callback.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_reg_sent_status_callback_001(void); +static void utc_msg_reg_sent_status_callback_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_reg_sent_status_callback_001,1}, + { utc_msg_reg_sent_status_callback_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_sms_message_callback.c b/TC/msgTC/MapiTransport/utc_msg_reg_sms_message_callback.c new file mode 100755 index 0000000..cef3cdf --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_sms_message_callback.c @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_reg_sms_message_callback.h" + +static MSG_HANDLE_T msgHandle = NULL; + +void incomingSmsCB(MSG_HANDLE_T Handle, msg_message_t msg, void *pUserParam) +{ + return; +} + + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_reg_sms_message_callback_001() +{ + int err = MSG_SUCCESS; + + err = msg_reg_sms_message_callback(msgHandle, &incomingSmsCB, 0, (void*)"sms message callback"); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_reg_sms_message_callback_002() +{ + int err = MSG_SUCCESS; + + err = msg_reg_sms_message_callback(NULL, &incomingSmsCB, 0, (void*)"sms message callback"); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_sms_message_callback.h b/TC/msgTC/MapiTransport/utc_msg_reg_sms_message_callback.h new file mode 100755 index 0000000..4cae476 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_sms_message_callback.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void incomingSmsCB(MSG_HANDLE_T Handle, msg_message_t msg, void *pUserParam); +static void utc_msg_reg_sms_message_callback_001(void); +static void utc_msg_reg_sms_message_callback_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_reg_sms_message_callback_001,1}, + { utc_msg_reg_sms_message_callback_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_syncml_message_callback.c b/TC/msgTC/MapiTransport/utc_msg_reg_syncml_message_callback.c new file mode 100755 index 0000000..1bd26ef --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_syncml_message_callback.c @@ -0,0 +1,83 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_reg_syncml_message_callback.h" + +static MSG_HANDLE_T msgHandle = NULL; + +void syncMLCB(MSG_HANDLE_T hMsgHandle, MSG_SYNCML_MESSAGE_TYPE_T msgType, const char* pPushHeader, int PushHeaderLen, const char* pPushBody, int PushBodyLen, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_reg_syncml_message_callback_001() +{ + int err = MSG_SUCCESS; + + err = msg_reg_syncml_message_callback(msgHandle, &syncMLCB, NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_reg_syncml_message_callback_002() +{ + int err = MSG_SUCCESS; + + err = msg_reg_syncml_message_callback(NULL, &syncMLCB, NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_reg_syncml_message_callback.h b/TC/msgTC/MapiTransport/utc_msg_reg_syncml_message_callback.h new file mode 100755 index 0000000..7c266e9 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_reg_syncml_message_callback.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_reg_syncml_message_callback_001(void); +static void utc_msg_reg_syncml_message_callback_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_reg_syncml_message_callback_001,1}, + { utc_msg_reg_syncml_message_callback_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_sms_send.c b/TC/msgTC/MapiTransport/utc_msg_sms_send.c new file mode 100755 index 0000000..70a4fce --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_sms_send.c @@ -0,0 +1,75 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_sms_send.h" + +static MSG_HANDLE_T msgHandle = NULL; + +void sentStatusCB(MSG_SENT_STATUS_S *pStatus, void *pUserParam) +{ + return; +} + +void startup(void) +{ + +} +void cleanup(void) +{ + +} + +void utc_msg_sms_send_001() +{ + int err = MSG_SUCCESS; + + err = msg_sms_send("01000000000,01000000000", "1234567890", sentStatusCB, NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_sms_send_002() +{ + int err = MSG_SUCCESS; + + err = msg_sms_send(NULL, "1234567890", sentStatusCB, NULL); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_sms_send.h b/TC/msgTC/MapiTransport/utc_msg_sms_send.h new file mode 100755 index 0000000..817a39e --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_sms_send.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_sms_send_001(void); +static void utc_msg_sms_send_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_sms_send_001,1}, + { utc_msg_sms_send_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_sms_send_message.c b/TC/msgTC/MapiTransport/utc_msg_sms_send_message.c new file mode 100755 index 0000000..0818214 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_sms_send_message.c @@ -0,0 +1,111 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_sms_send_message.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); + + msgInfo = msg_new_message(); + + msg_set_message_type(msgInfo, MSG_TYPE_SMS); + + msg_sms_set_message_body(msgInfo, "1234567890", 10); + + msg_add_address(msgInfo, "01000000000", MSG_RECIPIENTS_TYPE_TO); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_sms_send_message_001() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_sms_send_message(msgHandle, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_sms_send_message_002() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_sms_send_message(NULL, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_sms_send_message.h b/TC/msgTC/MapiTransport/utc_msg_sms_send_message.h new file mode 100755 index 0000000..12abbad --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_sms_send_message.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_sms_send_message_001(void); +static void utc_msg_sms_send_message_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_sms_send_message_001,1}, + { utc_msg_sms_send_message_002,2}, + {NULL,0} +}; diff --git a/TC/msgTC/MapiTransport/utc_msg_submit_req.c b/TC/msgTC/MapiTransport/utc_msg_submit_req.c new file mode 100755 index 0000000..badd0bd --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_submit_req.c @@ -0,0 +1,112 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "utc_msg_submit_req.h" + +static MSG_HANDLE_T msgHandle = NULL; +msg_message_t msgInfo; +MSG_SENDINGOPT_S sendOpt; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) +{ + return; +} + +void startup(void) +{ + MSG_ERROR_T err = MSG_SUCCESS; + MSG_SORT_RULE_S sort_rule; + + err = msg_open_msg_handle(&msgHandle); + if (err != MSG_SUCCESS) + { + tet_result(TET_FAIL); + return; + } + + msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); + + msgInfo = msg_new_message(); + + msg_set_message_type(msgInfo, MSG_TYPE_SMS); + + msg_sms_set_message_body(msgInfo, "1234567890", 10); + + msg_add_address(msgInfo, "01000000000", MSG_RECIPIENTS_TYPE_TO); + + memset(&sendOpt, 0x00, sizeof(sendOpt)); + + sendOpt.bSetting = false; +} +void cleanup(void) +{ + msg_close_msg_handle(&msgHandle); +} + +void utc_msg_submit_req_001() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_submit_req(msgHandle, &req); + if (err != MSG_SUCCESS) + { + tet_printf("err is [%d]", err); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +void utc_msg_submit_req_002() +{ + int err = MSG_SUCCESS; + MSG_REQUEST_S req; + + memset(&req, 0x00, sizeof(req)); + + req.msg = msgInfo; + req.sendOpt = sendOpt; + + err = msg_submit_req(NULL, &req); + if (err != MSG_SUCCESS) + { + tet_result(TET_PASS); + return; + } + + tet_result(TET_FAIL); +} diff --git a/TC/msgTC/MapiTransport/utc_msg_submit_req.h b/TC/msgTC/MapiTransport/utc_msg_submit_req.h new file mode 100755 index 0000000..ed126b8 --- /dev/null +++ b/TC/msgTC/MapiTransport/utc_msg_submit_req.h @@ -0,0 +1,51 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MapiMessage.h" +#include "MapiTransport.h" + +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; + +void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam); +static void utc_msg_submit_req_001(void); +static void utc_msg_submit_req_002(void); + + + +struct tet_testlist tet_testlist[] = +{ + { utc_msg_submit_req_001,1}, + { utc_msg_submit_req_002,2}, + {NULL,0} +}; diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100755 index 0000000..29ef78e --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,126 @@ +# auto generated tet_scen +all + "Starting Full Test Suite" + /msgTC/MapiSetting/utc_msg_get_config + /msgTC/MapiSetting/utc_msg_set_config + /msgTC/MapiFilter/utc_msg_add_filter + /msgTC/MapiFilter/utc_msg_delete_filter + /msgTC/MapiFilter/utc_msg_get_filter_list + /msgTC/MapiFilter/utc_msg_update_filter + /msgTC/MapiStorage/utc_msg_add_folder + /msgTC/MapiStorage/utc_msg_add_message + /msgTC/MapiStorage/utc_msg_get_conversation_view_list + /msgTC/MapiStorage/utc_msg_add_syncml_message + /msgTC/MapiStorage/utc_msg_get_folder_list + /msgTC/MapiStorage/utc_msg_get_folder_view_list + /msgTC/MapiStorage/utc_msg_get_mem_size + /msgTC/MapiStorage/utc_msg_get_message + /msgTC/MapiStorage/utc_msg_get_quick_panel_data + /msgTC/MapiStorage/utc_msg_get_thread_view_list + /msgTC/MapiStorage/utc_msg_move_msg_to_folder + /msgTC/MapiStorage/utc_msg_move_msg_to_storage + /msgTC/MapiStorage/utc_msg_release_folder_list + /msgTC/MapiStorage/utc_msg_release_thread_view_list + /msgTC/MapiStorage/utc_msg_reset_database + /msgTC/MapiStorage/utc_msg_generate_message + /msgTC/MapiStorage/utc_msg_count_message + /msgTC/MapiStorage/utc_msg_count_msg_by_contact + /msgTC/MapiStorage/utc_msg_thread_view_get_address + /msgTC/MapiStorage/utc_msg_count_msg_by_type + /msgTC/MapiStorage/utc_msg_thread_view_get_contact_id + /msgTC/MapiStorage/utc_msg_delete_all_msgs_in_folder + /msgTC/MapiStorage/utc_msg_thread_view_get_data + /msgTC/MapiStorage/utc_msg_delete_folder + /msgTC/MapiStorage/utc_msg_thread_view_get_direction + /msgTC/MapiStorage/utc_msg_delete_message + /msgTC/MapiStorage/utc_msg_thread_view_get_image_path + /msgTC/MapiStorage/utc_msg_delete_thread_message_list + /msgTC/MapiStorage/utc_msg_thread_view_get_mms_cnt + /msgTC/MapiStorage/utc_msg_thread_view_get_name + /msgTC/MapiStorage/utc_msg_thread_view_get_sms_cnt + /msgTC/MapiStorage/utc_msg_thread_view_get_thread_id + /msgTC/MapiStorage/utc_msg_thread_view_get_time + /msgTC/MapiStorage/utc_msg_thread_view_get_unread_cnt + /msgTC/MapiStorage/utc_msg_update_folder + /msgTC/MapiStorage/utc_msg_update_message + /msgTC/MapiStorage/utc_msg_update_protected_status + /msgTC/MapiStorage/utc_msg_update_read_status + /msgTC/MapiControl/utc_msg_open_msg_handle + /msgTC/MapiControl/utc_msg_close_msg_handle + /msgTC/MapiTransport/utc_msg_mms_forward_message + /msgTC/MapiTransport/utc_msg_reg_lbs_message_callback + /msgTC/MapiTransport/utc_msg_sms_send + /msgTC/MapiTransport/utc_msg_mms_reject_message + /msgTC/MapiTransport/utc_msg_reg_mms_conf_message_callback + /msgTC/MapiTransport/utc_msg_sms_send_message + /msgTC/MapiTransport/utc_msg_mms_retrieve_message + /msgTC/MapiTransport/utc_msg_reg_sent_status_callback + /msgTC/MapiTransport/utc_msg_submit_req + /msgTC/MapiTransport/utc_msg_mms_send_message + /msgTC/MapiTransport/utc_msg_reg_sms_message_callback + /msgTC/MapiTransport/utc_msg_mms_send_read_report + /msgTC/MapiTransport/utc_msg_reg_syncml_message_callback + /msgTC/MapiMessage/utc_msg_add_address + /msgTC/MapiMessage/utc_msg_get_time + /msgTC/MapiMessage/utc_msg_new_message + /msgTC/MapiMessage/utc_msg_mms_create_message + /msgTC/MapiMessage/utc_msg_is_in_sim + /msgTC/MapiMessage/utc_msg_release_message + /msgTC/MapiMessage/utc_msg_get_address_count + /msgTC/MapiMessage/utc_msg_is_mms + /msgTC/MapiMessage/utc_msg_reset_address + /msgTC/MapiMessage/utc_msg_get_dest_port + /msgTC/MapiMessage/utc_msg_is_protected + /msgTC/MapiMessage/utc_msg_set_direction_info + /msgTC/MapiMessage/utc_msg_get_direction_info + /msgTC/MapiMessage/utc_msg_is_read + /msgTC/MapiMessage/utc_msg_set_encode_type + /msgTC/MapiMessage/utc_msg_get_encode_type + /msgTC/MapiMessage/utc_msg_is_sms + /msgTC/MapiMessage/utc_msg_set_folder_id + /msgTC/MapiMessage/utc_msg_get_folder_id + /msgTC/MapiMessage/utc_msg_mms_add_attachment + /msgTC/MapiMessage/utc_msg_set_message_id + /msgTC/MapiMessage/utc_msg_get_ith_address + /msgTC/MapiMessage/utc_msg_mms_add_media + /msgTC/MapiMessage/utc_msg_set_message_type + /msgTC/MapiMessage/utc_msg_get_ith_contact_id + /msgTC/MapiMessage/utc_msg_mms_add_page + /msgTC/MapiMessage/utc_msg_set_network_status + /msgTC/MapiMessage/utc_msg_get_ith_name + /msgTC/MapiMessage/utc_msg_mms_add_region + /msgTC/MapiMessage/utc_msg_set_port + /msgTC/MapiMessage/utc_msg_get_ith_recipient_type + /msgTC/MapiMessage/utc_msg_mms_add_transition + /msgTC/MapiMessage/utc_msg_mms_add_meta + /msgTC/MapiMessage/utc_msg_set_priority_info + /msgTC/MapiMessage/utc_msg_get_ith_thread_id + /msgTC/MapiMessage/utc_msg_mms_destroy_message + /msgTC/MapiMessage/utc_msg_set_protect_status + /msgTC/MapiMessage/utc_msg_get_message_body_size + /msgTC/MapiMessage/utc_msg_mms_get_attachment + /msgTC/MapiMessage/utc_msg_set_read_status + /msgTC/MapiMessage/utc_msg_get_message_id + /msgTC/MapiMessage/utc_msg_mms_get_media + /msgTC/MapiMessage/utc_msg_set_scheduled_time + /msgTC/MapiMessage/utc_msg_get_message_type + /msgTC/MapiMessage/utc_msg_mms_get_message_body + /msgTC/MapiMessage/utc_msg_set_storage_id + /msgTC/MapiMessage/utc_msg_get_network_status + /msgTC/MapiMessage/utc_msg_mms_get_meta + /msgTC/MapiMessage/utc_msg_set_subject + /msgTC/MapiMessage/utc_msg_get_priority_info + /msgTC/MapiMessage/utc_msg_mms_get_page + /msgTC/MapiMessage/utc_msg_set_time + /msgTC/MapiMessage/utc_msg_get_scheduled_time + /msgTC/MapiMessage/utc_msg_mms_get_smil_region + /msgTC/MapiMessage/utc_msg_sms_get_message_body + /msgTC/MapiMessage/utc_msg_get_src_port + /msgTC/MapiMessage/utc_msg_mms_get_transition + /msgTC/MapiMessage/utc_msg_sms_set_message_body + /msgTC/MapiMessage/utc_msg_get_storage_id + /msgTC/MapiMessage/utc_msg_mms_set_message_body + /msgTC/MapiMessage/utc_msg_get_subject + /msgTC/MapiMessage/utc_msg_mms_set_rootlayout + "Completed Full Test Suite" +# EOF diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..f7eda55 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option for build operation checking +TET_BUILD_TOOL=make # build with using make command +TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build +TET_API_COMPLIANT=True # use TET API in Test Case ? +TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..7b613aa --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option +TET_CLEAN_TOOL=make clean # clean tool +TET_CLEAN_FILE=Makefile # file for clean +TET_API_COMPLIANT=True # TET API useage +TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..ef3e452 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capturing execution or not +TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional +TET_EXEC_FILE= # ex) exectool : execution file/ Optional +TET_API_COMPLIANT=True # Test case or Tool usesTET API? +TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/TC/tslist.txt b/TC/tslist.txt new file mode 100755 index 0000000..e592151 --- /dev/null +++ b/TC/tslist.txt @@ -0,0 +1,5 @@ +msgTC/MapiSetting/tslist +msgTC/MapiStorage/tslist +msgTC/MapiControl/tslist +msgTC/MapiTransport/tslist +msgTC/MapiMessage/tslist diff --git a/config/.msg_service.db b/config/.msg_service.db new file mode 100755 index 0000000000000000000000000000000000000000..1eeb23458ea328657f15a585363d61ecefc37049 GIT binary patch literal 21504 zcmeHPUyK_^8K2qNvoCjN-26cfR7fjDC}*{&*twpPv=rF$j_)?NUc0;NB!&m8(5n=Y z5-AE4i5GHl+7nO-iA0SmK%x)OM-Y_?FCZk;r}CJGz7naG$nk(c^nr))&Dc9L>s|Yd z#f8?Ib~tR*w9I2|i8!P5wpxPWH%${fxBs|2xOL;TZYS$_n0j=KAwryRzK~H@fwv z=g^=V+3Ox1PLoENf7R>sYQI(G40{t-x*ALC4ynohOIYe7ixd z3wBW3w1ef-m9phGBg=1lUP?3Sw5TZ3p>@0MMOLNUJAw11Q>XB&-x6-vjuX%@lzt>K zjFck@vEoUbzn?3yp4vj${D9WnmP`Gpn=Oy6FW8<0V(qE2ETPu)BfA!LWjmzIal@8p zce)82tLN4fa{zyXc3XC|Dax-_POBA!9lzF%TsRXBoMQGvR?zn0ygS{RAEm*UT45vH zPo*(|3S5JZ3xGv#(-+mHuLySa4K>$-{&aK+z78+KS78CZ=JW8CBk(n66vz*eL9QWk zjr<9I>O&)-5jao;j-w*P*a9vTFh5vW6~|eOPs9>)1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)~&O#)|i(K6C`-b4JW9y1Aw!^J15Zx{`r2|xVs~L=Yi%egkYkOYv;@Ax|d@oK?JGogXyCt!i zC+YOGB2yaUQCtRi!e<2rJBJR%)O&V;1K*j&H~=Qt7nGh67_Je{JR343c0Q#h1eiw6 zvqQ1gI_uQ)<=CCfeML}7tqq&K8uIk=ZCImW5SKyrb}ioI>`hq8#W;QZCm+E3f8Iyr zAMo~%_u%sfa+iI^bX+ac2xtTj9)XkWT>$eB(L+|%XIUaYNbolY<0;mv`AcJ04)TGbv=;MDQ|KUau5^#A|> literal 0 HcmV?d00001 diff --git a/config/.msg_service.db-journal b/config/.msg_service.db-journal new file mode 100755 index 0000000000000000000000000000000000000000..dd46069af0548578ed97261d93bc29bdef4b69e6 GIT binary patch literal 4640 zcmeHJy>HV{5cl&-8@?>45Gq?w>e5I=byETjEIjPj)L=Wtekt-~6&fU@RFR?}W*`zB z7+?h!Hg-Dj2kbN6wk|95g(TCiM7#78iaF&7d7E9gQbV(xzaHF&oB{oUKa>pd9sKYshrzed80NnDi>jH{?&-0D?~ zlcTuzcU$fIot+l+I^dZOJnnSc+lPCAcz4W)y%s#^ba%FTu!?^T2$608VDv5gq$wZeEd7rT+RfC$Oz+BSb~!g0URbVbTDke>)Zv$H7w@(aGU#=#@%dYaoA+8w!z$` zidq7@A;4~$X2w(a4j-n}`8sQw0@PA}krd~bm&x--!#0?%yWI1VK1LLBrjZeIs*_lM zR4cJxy27Mev3m@pdl z@VM-Y2w&e=xq$O@{tU9Y)5w%l$W9cI%~E7D^1}YBD=7SJ57g0~rhE_NdmvnC0P%z- Z^EY{=#eS3LJl_KcXddexP-=VU{s11ekH`Q3 literal 0 HcmV?d00001 diff --git a/config/alert_on_call.mp3 b/config/alert_on_call.mp3 new file mode 100755 index 0000000000000000000000000000000000000000..c7c77d13d4f04eb74c29d46be28d817c974d1e62 GIT binary patch literal 50369 zcmXV%1yCH%)36UXG(d0;4eoNdyB_ZD?(P=cA$V{-+}#Q85;Qo$g9i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1bd?)`QLb&Zr-0aW`(XK2^W9giQ8S9eFvMYC)jl_zT zl@wa(II#Pn#EoNeg}c4Po0|=kKVlh-{G%-lQ8^DDZ0|$|oTultsGh2|Pb-lB`RrbW z@3P(JRha&gyPoZidQ7~M#wPW5qtMG|Qyh=0Zr0xC7IQRW%c5$?=z==BkMF$o{r~%2 zqgT5^6Viiz+2{>_qi0-=twq1meIp-i%#M4qM#=ChNiC{A{mj@|5hot1MIBjUHJ{ob z6row!ps}V`D`aGnhd<*@y!~Lm6K$H^W{aLQa?lr7Q@KSE%B~=p@fv?(QO)kG7@b+} z&MS}xegQeOzP1cbt=zh4ylJF4UYt+TP9<~Xk2c&b)7Gf2(=6+Fqfw(%tg8Lj_q;!6 zub$3Yw5Q|M_Nl4aWY1%(z1q+E{%tXL4;g`Ls-CfU8l zkd+vQ8G?^J?olYoQfYd=;&o!mX9*VF2Kl28KA zeYf{}-e>O9x6V9c?~oFITYC1h`F+xi=|_Fx)oS4WB(6U`{^OuV>|_0y^L}=&=QFOK zp4O|0(`WT_ALkWM{p1_`KKs&4jdyA7p66cYyZi)uJ3akuK9lS|?{!vubf4$(it|k~ zPcwIWR5Q to support chmod related defines. + * Fix DRM content issue(unregistered mo content) + * Git : public/pkgs/m/msg-service + * Tag : msg-service_0.8.7-5 + + -- Jaeyun Jeong Fri, 16 Mar 2012 17:54:21 +0900 + +msg-service (0.8.7-4) unstable; urgency=low + + * Modify plugin configuration file location for FOTA. + * Remove the db query which create sample data from msg-service.spec. + * Git : public/pkgs/m/msg-service + * Tag : msg-service_0.8.7-4 + + -- Jaeyun Jeong Wed, 14 Mar 2012 20:11:41 +0900 + +msg-service (0.8.7-3) unstable; urgency=low + + * Fix TC execute failure. + * Fix S1-1419(Removed mms raw file issue after rebooting) + * Git : public/pkgs/m/msg-service + * Tag : msg-service_0.8.7-3 + + -- Jaeyun Jeong Mon, 27 Feb 2012 21:19:29 +0900 + +msg-service (0.8.7-2) unstable; urgency=low + + * Remove white spaces. + * Global lists for mms are removed + * Changed MsgFW's interface are applied for TC + * Git : public/pkgs/m/msg-service + * Tag : msg-service_0.8.7-2 + + -- Soonmin Jung Tue, 21 Feb 2012 15:30:26 +0900 + +msg-service (0.8.7-1) unstable; urgency=low + + * Code for removing MMS temp folder applied. + * Bug fix request from java mms. + * Fix bug related with Nabi S1-1253. + * Git : public/pkgs/m/msg-service + * Tag : msg-service_0.8.7-1 + + -- KeeBum Kim Fri, 17 Feb 2012 16:11:38 +0900 + +msg-service (0.8.7-0) unstable; urgency=low + + * apply file wrapper + * Change search API to support Bada API set. + * Apply keep copy option to SMS. + * Git : public/pkgs/m/msg-service + * Tag : msg-service_0.8.7-0 + + -- KeeBum Kim Thu, 09 Feb 2012 18:04:24 +0900 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100755 index 0000000..e48cda2 --- /dev/null +++ b/debian/control @@ -0,0 +1,44 @@ +Source: msg-service +Section: libs +Priority: extra +Maintainer: Jaeyun Jeong , Sangkoo Kim , Seunghwan Lee , SoonMin Jung , Jae-Young Lee , KeeBum Kim +Build-Depends: debhelper (>= 5), libnetwork-dev, libslp-setting-dev, libglib2.0-dev, libslp-tapi-dev, libslp-db-util-dev, libwbxml2-dev, libxml2-dev, libmm-player-dev, dlog-dev, libcontacts-service-dev, drm-service-dev, libslp-pm-dev, libmm-fileinfo-dev, libdevman-haptic-dev, libalarm-dev, capi-appfw-application-dev, libmm-session-sdk-dev, libmm-session-dev, libcurl-dev, libnotification-dev, libsecurity-server-client-dev, libmm-utility-dev, libsvi-dev, libmedia-thumbnail-dev +Standards-Version: 0.1.0 +Homepage: N/A + +Package: libslp-msg-service-dev +XB-Generate-Docs: yes +Section: libdevel +Architecture: any +Depends: libslp-msg-service-0 (= ${Source-Version}), libglib2.0-dev +Description: Messaging Framework Library (development) + +Package: libslp-msg-service-0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Messaging Framework Library (Library) + +Package: msg-service-tools +Section: utils +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-msg-service-0 (= ${Source-Version}) +Description: messaging server application + +Package: libslp-sms-plugin +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-msg-service-0 (= ${Source-Version}) +Description: SMS Plugin Library + +Package: libslp-mms-plugin +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-msg-service-0 (= ${Source-Version}) +Description: MMS Plugin Library + +Package: libslp-msg-service-0-dbg +Section: debug +Architecture: any +Depends: libslp-msg-service-0 (= ${Source-Version}), msg-service-tools (= ${Source-Version}), ${shlibs:Depends} +Description: Messaging Framework Library (unstripped) diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..ca882bb --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e69de29 diff --git a/debian/libslp-mms-plugin.install.in b/debian/libslp-mms-plugin.install.in new file mode 100755 index 0000000..059a1a3 --- /dev/null +++ b/debian/libslp-mms-plugin.install.in @@ -0,0 +1,2 @@ +@PREFIX@/lib/libmsg_mms_language_pack.so +@PREFIX@/lib/libmsg_mms_plugin.so diff --git a/debian/libslp-msg-service-0.install.in b/debian/libslp-msg-service-0.install.in new file mode 100755 index 0000000..fa9615e --- /dev/null +++ b/debian/libslp-msg-service-0.install.in @@ -0,0 +1,9 @@ +@PREFIX@/lib/libmsg_utils.so +@PREFIX@/lib/libmsg_plugin_manager.so +@PREFIX@/lib/libmsg_framework_handler.so +@PREFIX@/lib/libmsg_transaction_manager.so +@PREFIX@/lib/libmsg_transaction_proxy.so +@PREFIX@/lib/libmsg_mapi.so +@PREFIX@/lib/libmsg_mapi.so.* +@PREFIX@/share/msg-service/plugin.cfg +etc/* diff --git a/debian/libslp-msg-service-dev.install.in b/debian/libslp-msg-service-dev.install.in new file mode 100755 index 0000000..3683e76 --- /dev/null +++ b/debian/libslp-msg-service-dev.install.in @@ -0,0 +1,2 @@ +@PREFIX@/include/msg-service/*.h +@PREFIX@/lib/pkgconfig/*.pc diff --git a/debian/libslp-sms-plugin.install.in b/debian/libslp-sms-plugin.install.in new file mode 100755 index 0000000..b2d564e --- /dev/null +++ b/debian/libslp-sms-plugin.install.in @@ -0,0 +1 @@ +@PREFIX@/lib/libmsg_sms_plugin.so diff --git a/debian/msg-service-tools.install.in b/debian/msg-service-tools.install.in new file mode 100755 index 0000000..5962ca9 --- /dev/null +++ b/debian/msg-service-tools.install.in @@ -0,0 +1,5 @@ +@PREFIX@/bin/* +@PREFIX@/share/media/* +@DATADIR@/etc/msg-service/* +#@DATADIR@/dbspace/.msg_service.db +#@DATADIR@/dbspace/.msg_service.db-journal diff --git a/debian/msg-service-tools.postinst b/debian/msg-service-tools.postinst new file mode 100755 index 0000000..894e954 --- /dev/null +++ b/debian/msg-service-tools.postinst @@ -0,0 +1,208 @@ +#!/bin/sh +set -e +# Automatically added by dh_makeshlibs +if [ "$1" = "configure" ]; then + ldconfig +fi +# End automatically added section + +#. /etc/ipkg/functions + +#PATH=$PATH:/usr/bin +#CURRENT_PATH=$PWD + +#cd /usr/bin + +#initDB +#rm /opt/dbspace/.msg_service.db* + +if [ ! -f /opt/dbspace/.msg_service.db ] +then + sqlite3 /opt/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST; + + CREATE TABLE MSG_ADDRESS_TABLE(ADDRESS_ID INTEGER PRIMARY KEY, ADDRESS_TYPE INTEGER, RECIPIENT_TYPE INTEGER, ADDRESS_VAL TEXT, CONTACT_ID INTEGER, DISPLAY_NAME TEXT, FIRST_NAME TEXT, LAST_NAME TEXT, IMAGE_PATH TEXT, SYNC_TIME DATETIME, UNREAD_CNT INTEGER DEFAULT 0, SMS_CNT INTEGER DEFAULT 0, MMS_CNT INTEGER DEFAULT 0, MAIN_TYPE INTEGER NOT NULL, SUB_TYPE INTEGER NOT NULL, MSG_DIRECTION INTEGER NOT NULL, MSG_TIME DATETIME, MSG_TEXT TEXT); + CREATE TABLE MSG_FOLDER_TABLE(FOLDER_ID INTEGER PRIMARY KEY, FOLDER_NAME TEXT NOT NULL, FOLDER_TYPE INTEGER DEFAULT 0); + CREATE TABLE MSG_MESSAGE_TABLE(MSG_ID INTEGER PRIMARY KEY, ADDRESS_ID INTEGER, FOLDER_ID INTEGER, REFERENCE_ID INTEGER, STORAGE_ID INTEGER NOT NULL, MAIN_TYPE INTEGER NOT NULL, SUB_TYPE INTEGER NOT NULL, DISPLAY_TIME DATETIME, DATA_SIZE INTEGER DEFAULT 0, NETWORK_STATUS INTEGER DEFAULT 0, READ_STATUS INTEGER DEFAULT 0, PROTECTED INTEGER DEFAULT 0, PRIORITY INTEGER DEFAULT 0, MSG_DIRECTION INTEGER NOT NULL, SCHEDULED_TIME DATETIME, BACKUP INTEGER DEFAULT 0, SUBJECT TEXT, MSG_DATA TEXT, THUMB_PATH TEXT, MSG_TEXT TEXT, DELIVERY_REPORT_STATUS INTEGER DEFAULT 0, DELIVERY_REPORT_TIME DATETIME, READ_REPORT_STATUS INTEGER DEFAULT 0, READ_REPORT_TIME DATETIME, ATTACHMENT_COUNT INTEGER DEFAULT 0, FOREIGN KEY(ADDRESS_ID) REFERENCES MSG_ADDRESS_TABLE(ADDRESS_ID), FOREIGN KEY(FOLDER_ID) REFERENCES MSG_FOLDER_TABLE(FOLDER_ID)); + CREATE TABLE MSG_SIM_TABLE(MSG_ID INTEGER, SIM_ID INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_PUSH_TABLE(MSG_ID INTEGER, ACTION INTEGER, CREATED INTEGER, EXPIRES INTEGER, ID TEXT, HREF TEXT, CONTENT TEXT, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_CBMSG_TABLE(MSG_ID INTEGER, CB_MSG_ID INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_SYNCML_TABLE(MSG_ID INTEGER, EXT_ID INTEGER NOT NULL, PINCODE INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_SCHEDULED_TABLE(MSG_ID INTEGER, ALARM_ID INTEGER NOT NULL, LISTENER_FD INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_SMS_SENDOPT_TABLE(MSG_ID INTEGER, DELREP_REQ INTEGER NOT NULL, KEEP_COPY INTEGER NOT NULL, REPLY_PATH INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_FILTER_TABLE(FILTER_ID INTEGER PRIMARY KEY, FILTER_TYPE INTEGER NOT NULL, FILTER_VALUE TEXT NOT NULL); + CREATE TABLE MSG_MMS_MESSAGE_TABLE(REFERENCE_ID INTEGER, TRANSACTION_ID TEXT, MESSAGE_ID TEXT, FWD_MESSAGE_ID TEXT, CONTENTS_LOCATION TEXT, FILE_PATH TEXT, FOREIGN KEY(REFERENCE_ID) REFERENCES MSG_MESSAGE_TABLE(REFERENCE_ID)); + CREATE TABLE MSG_MMS_ATTR_TABLE(REFERENCE_ID INTEGER, VERSION INTEGER NOT NULL, DATA_TYPE INTEGER DEFAULT -1, DATE DATETIME, HIDE_ADDRESS INTEGER DEFAULT 0, ASK_DELIVERY_REPORT INTEGER DEFAULT 0, REPORT_ALLOWED INTEGER DEFAULT 0, READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0, ASK_READ_REPLY INTEGER DEFAULT 0, READ INTEGER DEFAULT 0, READ_REPORT_SEND_STATUS INTEGER DEFAULT 0, READ_REPORT_SENT INTEGER DEFAULT 0, PRIORITY INTEGER DEFAULT 0, KEEP_COPY INTEGER DEFAULT 0, MSG_SIZE INTEGER NOT NULL, MSG_CLASS INTEGER DEFAULT -1, EXPIRY_TIME DATETIME, CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0, DELIVERY_TIME DATETIME, MSG_STATUS INTEGER DEFAULT -1, FOREIGN KEY(REFERENCE_ID) REFERENCES MSG_MESSAGE_TABLE(REFERENCE_ID)); + + CREATE INDEX MSG_ADDRESS_INDEX ON MSG_ADDRESS_TABLE(ADDRESS_ID); + CREATE INDEX MSG_FOLDER_INDEX ON MSG_FOLDER_TABLE(FOLDER_ID); + CREATE INDEX MSG_MESSAGE_INDEX ON MSG_MESSAGE_TABLE(MSG_ID, ADDRESS_ID, FOLDER_ID); + + INSERT INTO MSG_FOLDER_TABLE VALUES (1, 'INBOX', 1); + INSERT INTO MSG_FOLDER_TABLE VALUES (2, 'OUTBOX', 2); + INSERT INTO MSG_FOLDER_TABLE VALUES (3, 'SENTBOX', 2); + INSERT INTO MSG_FOLDER_TABLE VALUES (4, 'DRAFT', 3); + INSERT INTO MSG_FOLDER_TABLE VALUES (5, 'CBMSGBOX', 1); + + INSERT INTO MSG_ADDRESS_TABLE VALUES (0, 0, 0, '', 0, '', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '');" +# INSERT INTO MSG_ADDRESS_TABLE VALUES (1, 1, 1, '01030016057', 0, '', '', '', '', 0, 0, 2, 0, 1, 0, 1, 1284036008, 'Welcome to SLP world'); + +# INSERT INTO MSG_MESSAGE_TABLE VALUES (1, 1, 3, 1, 1, 1, 0, 1284035928, 6, 2, 1, 0, 1, 0, 0, 0, '', '', '', 'Hello.', -1, 0, -1, 0, 0); +# INSERT INTO MSG_MESSAGE_TABLE VALUES (2, 1, 1, 2, 1, 1, 0, 1284036008, 20, 6, 1, 0, 1, 1, 0, 0, '', '', '', 'Welcome to SLP world', -1, 0, -1, 0, 0);" +fi + +########## Setting Permission and Owner ########### + +if [ ${USER} == "root" ] +then + # 1. executable + #chown root:root /usr/bin/msg-server + #chown root:root /usr/bin/msg-test-app + + # 2. configuration + chown root:root /usr/share/msg-service/plugin.cfg +# chown root:root /opt/etc/msg-service/mms_plugin.cfg +# chown root:root /opt/etc/msg-service/kdb-setting.sh + + # 3. database + chown :6011 /opt/dbspace/.msg_service.db + chown :6011 /opt/dbspace/.msg_service.db-journal + + # 4. other files + chown root:root /opt/etc/msg-service/A.smi + chown root:root /opt/etc/msg-service/P091120_104633.jpg + chown root:root /opt/etc/msg-service/Temp0_2.txt + chown root:root /opt/etc/msg-service/Temp1_0.txt + chown root:root /opt/etc/msg-service/V091120_104905.3gp + chown root:root /opt/etc/msg-service/alert_on_call.mp3 + chown root:root /opt/etc/msg-service/audio.amr + chown root:root /usr/share/media/Sherbet.wav +fi + +# Change File Permission +# 1. executable +#chmod 700 /usr/bin/msg-server +#chmod 700 /usr/bin/msg-test-app + +# 2. configuration +chmod 644 /usr/share/msg-service/plugin.cfg +#chmod 644 /opt/etc/msg-service/mms_plugin.cfg +#chmod 644 /opt/etc/msg-service/kdb-setting.sh + +# 3. database +chmod 660 /opt/dbspace/.msg_service.db +chmod 660 /opt/dbspace/.msg_service.db-journal + +# 4. other files +chmod 644 /opt/etc/msg-service/A.smi +chmod 644 /opt/etc/msg-service/P091120_104633.jpg +chmod 644 /opt/etc/msg-service/Temp0_2.txt +chmod 644 /opt/etc/msg-service/Temp1_0.txt +chmod 644 /opt/etc/msg-service/V091120_104905.3gp +chmod 644 /opt/etc/msg-service/alert_on_call.mp3 +chmod 644 /opt/etc/msg-service/audio.amr +chmod 644 /usr/share/media/Sherbet.wav + + +########## Setting Config Value ########## + +# General Options +vconftool set -t bool db/msg/general/keep_copy 1 +vconftool set -t int db/msg/general/alert_tone 0 +vconftool set -t bool db/msg/general/auto_erase 0 +vconftool set -t bool db/msg/general/block_msg 0 +vconftool set -t int db/msg/general/contact_sync_time 0 + +# SMS Send Options +vconftool set -t int db/msg/sms_send/dcs 3 +vconftool set -t int db/msg/network_mode 2 +vconftool set -t bool db/msg/sms_send/reply_path 0 +vconftool set -t bool db/msg/sms_send/delivery_report 0 +vconftool set -t int db/msg/sms_send/save_storage 1 + +# MMS Send Options +vconftool set -t int db/msg/mms_send/msg_class 0 +vconftool set -t int db/msg/mms_send/priority 1 +vconftool set -t int db/msg/mms_send/expiry_time 0 +vconftool set -t int db/msg/mms_send/custom_delivery 0 +vconftool set -t bool db/msg/mms_send/sender_visibility 0 +vconftool set -t bool db/msg/mms_send/delivery_report 1 +vconftool set -t bool db/msg/mms_send/read_reply 1 +vconftool set -t bool db/msg/mms_send/keep_copy 0 +vconftool set -t bool db/msg/mms_send/body_replying 0 +vconftool set -t bool db/msg/mms_send/hide_recipients 0 +vconftool set -t bool db/msg/mms_send/report_allowed 1 +vconftool set -t int db/msg/mms_send/reply_charging 0 +vconftool set -t int db/msg/mms_send/reply_charging_deadline 0 +vconftool set -t int db/msg/mms_send/reply_charging_size 0 +vconftool set -t int db/msg/mms_send/delivery_time 0 +vconftool set -t int db/msg/mms_send/creation_mode 2 + +# MMS Receive Options +vconftool set -t int db/msg/mms_recv/home_network 0 +vconftool set -t int db/msg/mms_recv/abroad_network 0 +vconftool set -t bool db/msg/mms_recv/read_receipt 1 +vconftool set -t bool db/msg/mms_recv/delivery_receipt 1 +vconftool set -t bool db/msg/mms_recv/reject_unknown 0 +vconftool set -t bool db/msg/mms_recv/reject_advertisement 0 + +# MMS Receive Options +vconftool set -t int db/msg/mms_style/font_size 30 +vconftool set -t bool db/msg/mms_style/font_style/bold 0 +vconftool set -t bool db/msg/mms_style/font_style/italic 0 +vconftool set -t bool db/msg/mms_style/font_style/underline 0 +vconftool set -t int db/msg/mms_style/font_color/red 0 +vconftool set -t int db/msg/mms_style/font_color/green 0 +vconftool set -t int db/msg/mms_style/font_color/blue 0 +vconftool set -t int db/msg/mms_style/font_color/hue 255 +vconftool set -t int db/msg/mms_style/bg_color/red 255 +vconftool set -t int db/msg/mms_style/bg_color/green 255 +vconftool set -t int db/msg/mms_style/bg_color/blue 255 +vconftool set -t int db/msg/mms_style/bg_color/hue 255 +vconftool set -t int db/msg/mms_style/page_dur 2 +vconftool set -t int db/msg/mms_style/page_custom_dur 0 +vconftool set -t int db/msg/mms_style/page_dur_manual 0 + +# Push Msg Options +vconftool set -t bool db/msg/push_msg/recv_option 1 +vconftool set -t int db/msg/push_msg/service_load 1 + +# CB Msg Options +vconftool set -t bool db/msg/cb_msg/receive 0 +vconftool set -t bool db/msg/cb_msg/all_channel 0 +vconftool set -t int db/msg/cb_msg/max_sim_count 0 +vconftool set -t int db/msg/cb_msg/channel_count 0 +vconftool set -t bool db/msg/cb_msg/language/0 0 +vconftool set -t bool db/msg/cb_msg/language/1 0 +vconftool set -t bool db/msg/cb_msg/language/2 0 +vconftool set -t bool db/msg/cb_msg/language/3 0 +vconftool set -t bool db/msg/cb_msg/language/4 0 +vconftool set -t bool db/msg/cb_msg/language/5 0 +vconftool set -t bool db/msg/cb_msg/language/6 0 +vconftool set -t bool db/msg/cb_msg/language/7 0 +vconftool set -t bool db/msg/cb_msg/language/8 0 +vconftool set -t bool db/msg/cb_msg/language/9 0 + +# Voice Mail Options +vconftool set -t string db/msg/voice_mail/voice_mail_number "12345678" + +# MMS Size Options +vconftool set -t int db/msg/size_opt/msg_size 300 + +vconftool set -t int db/badge/org.tizen.message 0 + +if [ ${USER} == "root" ] +then + + # Msg Count + vconftool set -t int db/msg/recv_sms 0 -u 0 + vconftool set -t int db/msg/recv_mms 0 -u 0 +fi + + +#cd $CURRENT_PATH + + +#mkdir /opt/system/msg-service + +#config "msg-service-@MACHINE@" + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..9f1794c --- /dev/null +++ b/debian/rules @@ -0,0 +1,132 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CFLAGS = -Wall -g +CXXFLAGS ?= -Wall -g +LDFLAGS ?= +PREFIX ?= /usr +DATADIR ?= /opt + +MACHINE=aquila + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CXXFLAGS += -O0 +else + CFLAGS += -O2 + CXXFLAGS += -O2 +endif + +LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed + +CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + mkdir -p $(CMAKE_TMP_DIR); + cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX) + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + cd $(CMAKE_TMP_DIR) && $(MAKE) + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ + done + + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + rm -rf CMakeCache.txt + rm -rf CMakeFiles + rm -rf cmake_install.cmake + rm -rf Makefile + rm -rf install_manifest.txt + rm -rf *.so + rm -rf $(CMAKE_TMP_DIR) + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/msg-service. + cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/ + ln -s ../init.d/msg-server $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S70msg-server + mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/ + ln -s ../init.d/msg-server $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S70msg-server + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir debian/tmp +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip --dbg-package=libslp-msg-service-0-dbg + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt new file mode 100755 index 0000000..3abb9e5 --- /dev/null +++ b/framework/CMakeLists.txt @@ -0,0 +1,152 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(msg-server CXX) + +SET(CMAKE_SKIP_BUILD_RPATH TRUE) + +IF("${CMAKE_BUILD_TYPE}" STREQUAL "") + SET(CMAKE_BUILD_TYPE "Debug") +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") + +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall") + +######################################################### +# Define Plugin Manager +########################################################## + +SET(PLUGIN-MANAGER-SRCS + ${CMAKE_SOURCE_DIR}/framework/plugin-manager/MsgPluginManager.cpp + ${CMAKE_SOURCE_DIR}/framework/plugin-manager/MsgPluginConfig.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/utils +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(plugin_manager_pkgs REQUIRED glib-2.0 dlog vconf) + +FOREACH(flag ${plugin_manager_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_LIBRARY(${PLUGIN-MANAGER-LIB} SHARED ${PLUGIN-MANAGER-SRCS}) +TARGET_LINK_LIBRARIES(${PLUGIN-MANAGER-LIB} ${plugin_manager_pkgs_LDFLAGS} ${UTILS-LIB} dl) + +INSTALL(TARGETS ${PLUGIN-MANAGER-LIB} LIBRARY DESTINATION lib) + +########################################################## +# Define Messaging Framework Handler +########################################################## + +SET(FW-HANDLER-SRCS + ${CMAKE_SOURCE_DIR}/framework/setting-handler/MsgSettingHandler.cpp + ${CMAKE_SOURCE_DIR}/framework/storage-handler/MsgStorageManager.cpp + ${CMAKE_SOURCE_DIR}/framework/storage-handler/MsgStorageMessage.cpp + ${CMAKE_SOURCE_DIR}/framework/storage-handler/MsgStorageMms.cpp + ${CMAKE_SOURCE_DIR}/framework/storage-handler/MsgStorageFolder.cpp + ${CMAKE_SOURCE_DIR}/framework/storage-handler/MsgStorageSim.cpp + ${CMAKE_SOURCE_DIR}/framework/storage-handler/MsgStorageUtil.cpp + ${CMAKE_SOURCE_DIR}/framework/submit-handler/MsgSubmitHandler.cpp + ${CMAKE_SOURCE_DIR}/framework/deliver-handler/MsgDeliverHandler.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/utils +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(fw_handler_pkgs REQUIRED glib-2.0 dlog vconf capi-appfw-application) + +FOREACH(flag ${fw_handler_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -std=c++0x") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_LIBRARY(${FW-HANDLER-LIB} SHARED ${FW-HANDLER-SRCS}) +TARGET_LINK_LIBRARIES(${FW-HANDLER-LIB} ${fw_handler_pkgs_LDFLAGS} ${UTILS-LIB} ${PLUGIN-MANAGER-LIB}) + +INSTALL(TARGETS ${FW-HANDLER-LIB} DESTINATION lib COMPONENT RuntimeLibraries) + +########################################################## +# Define Transaction Manager +########################################################## + +SET(TRANS-MANAGER-SRCS + ${CMAKE_SOURCE_DIR}/framework/transaction-manager/MsgCmdHandlerSetting.cpp + ${CMAKE_SOURCE_DIR}/framework/transaction-manager/MsgCmdHandlerStorage.cpp + ${CMAKE_SOURCE_DIR}/framework/transaction-manager/MsgCmdHandlerTransport.cpp + ${CMAKE_SOURCE_DIR}/framework/transaction-manager/MsgTransManager.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/utils +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(trans_manager_pkgs REQUIRED glib-2.0 security-server dlog vconf) + +FOREACH(flag ${trans_manager_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_LIBRARY(${TRANS-MANAGER-LIB} SHARED ${TRANS-MANAGER-SRCS}) +TARGET_LINK_LIBRARIES(${TRANS-MANAGER-LIB} ${trans_manager_pkgs_LDFLAGS} ${UTILS-LIB} ${FW-HANDLER-LIB}) + +INSTALL(TARGETS ${TRANS-MANAGER-LIB} DESTINATION lib COMPONENT RuntimeLibraries) + +########################################################## +# Define Execute File +########################################################## + +SET(MAIN-SRCS + ${CMAKE_SOURCE_DIR}/framework/main.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/utils +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(main_pkgs REQUIRED glib-2.0 dbus-glib-1 dlog vconf) + +FOREACH(flag ${main_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_EXECUTABLE(${PROJECT_NAME} ${MAIN-SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${main_pkgs_LDFLAGS} ${UTILS-LIB} ${PLUGIN-MANAGER-LIB} ${TRANS-MANAGER-LIB} ${FW-HANDLER-LIB}) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) + diff --git a/framework/deliver-handler/MsgDeliverHandler.cpp b/framework/deliver-handler/MsgDeliverHandler.cpp new file mode 100755 index 0000000..908b076 --- /dev/null +++ b/framework/deliver-handler/MsgDeliverHandler.cpp @@ -0,0 +1,353 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +// for sl message browser launch +#include + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgContact.h" +#include "MsgUtilStorage.h" +#include "MsgGconfWrapper.h" +#include "MsgSoundPlayer.h" +#include "MsgPluginManager.h" +#include "MsgStorageHandler.h" +#include "MsgDeliverHandler.h" +#include "MsgNotificationWrapper.h" + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +extern MsgDbHandler dbHandle; + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_ID_T reqID) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_DEBUG(" msgtype subtype is [%d]", pMsgInfo->msgType.subType); + + if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { + // keep origianl subType + MSG_SUB_TYPE_T subType = pMsgInfo->msgType.subType; + + /* If Retrieve Failed, Msg SubType is remained as Notification Ind */ + if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_FAIL) + pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; + + err = MsgStoUpdateMMSMessage(pMsgInfo); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Command Handle Success : MsgStoUpdateMessage()"); + + if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { + MSG_DEBUG("### MSG_NETWORK_RETRIEVE_SUCCESS ###"); + //Update Mms Message to MMS Plugin DB + + // MMS Received Ind Process Func + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(pMsgInfo->msgType.mainType); + + //Contents of msg Data was removed and replaced to retrievedFilePath + // NOTICE:: now it was moved to handleEvent in MsgListnerThread + err = plg->updateMessage(pMsgInfo, NULL, NULL); + if (err != MSG_SUCCESS) + return MSG_ERR_STORAGE_ERROR; + } + + MSG_DEBUG(" ######################### MESSAGE UPDATE COMPLETED!!! ######################"); + + bool readStatus = false; + + MsgStoGetReadStatus(pMsgInfo->msgId, &readStatus); + MSG_DEBUG("### readStatus = %d ###", readStatus); + + //Update Read Status to Unread beacaus Noti is Read + if (subType == MSG_RETRIEVE_MANUALCONF_MMS && pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { + MSG_DEBUG("###2. subType = %d ###", pMsgInfo->msgType.subType); + + if (readStatus == true) + MsgStoSetReadStatus(&dbHandle, pMsgInfo->msgId, false); + } + + // update badge + if (subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { + int smsCnt = 0; + int mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + MsgSettingHandleNewMsg(smsCnt, mmsCnt); + } + + if (subType == MSG_RETRIEVE_AUTOCONF_MMS) { + // play message-tone when MMS retrieved + MsgSoundPlayStart(); + MsgInsertNoti(&dbHandle, pMsgInfo); + } else if (subType == MSG_RETRIEVE_MANUALCONF_MMS) { + if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { + MSG_DEBUG("Manual success"); + MsgInsertTicker("Message Retrieved", MESSAGE_RETRIEVED); + } else if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_FAIL) { + MSG_DEBUG("Manual failed"); + MsgInsertTicker("Retrieving message failed", RETRIEVING_MESSAGE_FAILED); + } + } + } + else if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS || pMsgInfo->msgType.subType == MSG_SENDCONF_MMS) + { + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(pMsgInfo->msgType.mainType); + // change subType for storage update + pMsgInfo->msgType.subType = MSG_SENDCONF_MMS; + + err = MsgStoUpdateMMSMessage(pMsgInfo); + if (err == MSG_SUCCESS) + MSG_DEBUG("Command Handle Success : MsgStoUpdateMMSMessage()"); + + err = plg->updateMessage(pMsgInfo, NULL, NULL); + if (err != MSG_SUCCESS) + return MSG_ERR_STORAGE_ERROR; + + MSG_DEBUG("pMsg->networkStatus : %d", pMsgInfo->networkStatus); + err = MsgStoUpdateNetworkStatus(pMsgInfo, pMsgInfo->networkStatus); + if (err != MSG_SUCCESS) + return MSG_ERR_STORAGE_ERROR; + + if (pMsgInfo->networkStatus == MSG_NETWORK_SEND_SUCCESS) + { + err = MsgStoMoveMessageToFolder(pMsgInfo->msgId, MSG_SENTBOX_ID); + if (err != MSG_SUCCESS) + return MSG_ERR_STORAGE_ERROR; + } + + // Get subject and text + MsgStoGetText(pMsgInfo->msgId, pMsgInfo->subject, pMsgInfo->msgText); + + MSG_DEBUG(" ######################### MESSAGE UPDATE COMPLETED!!! ######################"); + } + return err; +} + +MSG_ERROR_T MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE) + { + if (pMsgInfo->msgPort.valid == true) + return MSG_SUCCESS; + + err = MsgHandleSMS(pMsgInfo, pSendNoti); + + if (err == MSG_SUCCESS && *pSendNoti == true) + { + MsgSoundPlayStart(); + +// if (pMsgInfo->msgType.subType != MSG_STATUS_REPORT_SMS) + { + int smsCnt = 0, mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + MsgSettingHandleNewMsg(smsCnt, mmsCnt); + MsgInsertNoti(&dbHandle, pMsgInfo); + } + } + } + else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE) + { + err = MsgHandleMMS(pMsgInfo, pSendNoti); + } + + MSG_END(); + + return err; +} + + +MSG_ERROR_T MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if ((pMsgInfo->msgType.subType >= MSG_WAP_SI_SMS) && (pMsgInfo->msgType.subType <= MSG_WAP_CO_SMS)) + { + MSG_DEBUG("Starting WAP Message Incoming."); + + MSG_PUSH_SERVICE_TYPE_T serviceType = (MSG_PUSH_SERVICE_TYPE_T)MsgSettingGetInt(PUSH_SERVICE_TYPE); + service_h svc_handle = NULL; + + switch (pMsgInfo->msgType.subType) + { + case MSG_WAP_SL_SMS: + { + *pSendNoti = false; + + if (serviceType == MSG_PUSH_SERVICE_ALWAYS) { + if (service_create(&svc_handle) < 0) { + MSG_DEBUG("Fail to create service handle"); + break; + } + if (!svc_handle) { + MSG_DEBUG("Service handle is NULL"); + break; + } + if (service_set_operation(svc_handle, SERVICE_OPERATION_VIEW) < 0) { + MSG_DEBUG("Fail to create service handle"); + service_destroy(svc_handle); + break; + } + if (service_set_uri(svc_handle, pMsgInfo->msgText) < 0) { + MSG_DEBUG("Fail to set uri"); + service_destroy(svc_handle); + break; + } + if (service_set_package(svc_handle, MSG_SVC_PKG_NAME_BROWSER) < 0) { + MSG_DEBUG("Fail to set package"); + service_destroy(svc_handle); + break; + } + if (service_send_launch_request(svc_handle, NULL, NULL) < 0) { + MSG_DEBUG("Fail to launch browser"); + service_destroy(svc_handle); + break; + } + + service_destroy(svc_handle); + + } else if (serviceType == MSG_PUSH_SERVICE_PROMPT) { + char urlString[MAX_COMMAND_LEN+1]; + memset(urlString, 0x00, sizeof(urlString)); + + snprintf(urlString, MAX_COMMAND_LEN, "message-dialog -m PUSH_MSG_ALWAYS_ASK -u %s &", pMsgInfo->msgText); + + system(urlString); + } + + } + break; + + case MSG_WAP_SI_SMS: + case MSG_WAP_CO_SMS: + { + *pSendNoti = false; + } + break; + } + } + else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) + { + unsigned int addrId = 0; + + // Get Address ID + MsgExistAddress(&dbHandle, pMsgInfo->addressList[0].addressVal, &addrId); + + MSG_DEBUG("address ID : [%d], Value : [%s]", addrId, pMsgInfo->addressList[0].addressVal); + + pMsgInfo->addressList[0].threadId = (MSG_THREAD_ID_T)addrId; + } + + return err; +} + + +MSG_ERROR_T MsgHandleMMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_REQUEST_INFO_S request = {0}; + bool bReject = false; + + // MMS Received Ind Process Func + MSG_MAIN_TYPE_T msgMainType = pMsgInfo->msgType.mainType; + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(msgMainType); + + // Need to process m-delivery-ind, m-notification-ind, m-read-orig-ind + err = plg->processReceivedInd(pMsgInfo, &request, &bReject); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Process Message Success : processReceivedInd(), btextsms %d", pMsgInfo->bTextSms); + } else { + MSG_DEBUG("Process Message Fail : processReceivedInd()"); + return err; + } + + // Add into DB + if ((pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) && bReject == false) { + + err = MsgStoAddMessage(pMsgInfo, NULL); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgStoAddMessage() Error: [%d]", err); + return err; + } + } else if (pMsgInfo->msgType.subType == MSG_READORGIND_MMS || pMsgInfo->msgType.subType == MSG_DELIVERYIND_MMS) { + MsgSoundPlayStart(); + *pSendNoti = false; + } + + //In the case of m-notification-ind, we should decide whether to send m-notify-response-ind or http 'Get' + //submit request + if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) { + if (request.msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS && bReject == false) { + MsgSoundPlayStart(); + + int smsCnt = 0; + int mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + MsgSettingHandleNewMsg(smsCnt, mmsCnt); + MsgInsertNoti(&dbHandle, pMsgInfo); + } + + request.msgInfo.msgId = pMsgInfo->msgId; + + MSG_DEBUG("-=====================[[[ %s ]]]] =========================", pMsgInfo->msgData); + err = plg->submitReq(&request, false); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Process Message Success : processReceivedInd()"); + } else { + MSG_DEBUG("Process Message Fail : processReceivedInd()"); + } + } + + return err; +} + diff --git a/framework/main.cpp b/framework/main.cpp new file mode 100755 index 0000000..15d8467 --- /dev/null +++ b/framework/main.cpp @@ -0,0 +1,338 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgDebug.h" +#include "MsgException.h" +#include "MsgContact.h" +#include "MsgMemory.h" +#include "MsgGconfWrapper.h" +#include "MsgPluginManager.h" +#include "MsgSettingHandler.h" +#include "MsgStorageHandler.h" +#include "MsgSubmitHandler.h" +#include "MsgDeliverHandler.h" +#include "MsgTransManager.h" +#include "MsgStorageTypes.h" + +#include +#include +#include +#include +#include + +static GMainLoop* mainloop = NULL; + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSG_MOBILE_TRACKER_MSG "Mobile Tracker Alert" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T InitMmsDir() +{ + if (mkdir(MSG_DATA_ROOT_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) + { + if (errno == EEXIST) + { + MSG_DEBUG("The %s already exists", MSG_DATA_ROOT_PATH); + } + else + { + MSG_DEBUG("Error while mkdir %s", MSG_DATA_ROOT_PATH); + return MSG_ERR_DB_MAKE_DIR; + } + } + + if (mkdir(MSG_SMIL_FILE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) + { + if (errno == EEXIST) + { + MSG_DEBUG("The %s already exists", MSG_SMIL_FILE_PATH); + } + else + { + MSG_DEBUG("Error while mkdir %s", MSG_SMIL_FILE_PATH); + return MSG_ERR_DB_MAKE_DIR; + } + } + + if (mkdir(MSG_DATA_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) + { + if (errno == EEXIST) + { + MSG_DEBUG("The %s already exists", MSG_DATA_PATH); + } + else + { + MSG_DEBUG("Error while mkdir %s", MSG_DATA_PATH); + return MSG_ERR_DB_MAKE_DIR; + } + } + + if (mkdir(MSG_THUMBNAIL_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { + if (errno == EEXIST) { + MSG_DEBUG("The %s already exists.", MSG_THUMBNAIL_PATH); + } else { + MSG_DEBUG(" Error while mkdir %s", MSG_THUMBNAIL_PATH); + return MSG_ERR_DB_MAKE_DIR; + } + } + + if (mkdir(MSG_IPC_DATA_PATH, S_IRWXU ) < 0) + { + if (errno == EEXIST) + { + MSG_DEBUG("The %s already exists", MSG_IPC_DATA_PATH); + + // if IPC data path is already exist, clear all files in folder. + char exeStr[1024]; + snprintf(exeStr, 1024, "rm %s*.DATA", MSG_IPC_DATA_PATH); + system(exeStr); + } + else + { + MSG_DEBUG("Error while mkdir %s", MSG_IPC_DATA_PATH); + return MSG_ERR_DB_MAKE_DIR; + } + } + + chmod( MSG_IPC_DATA_PATH, S_IRWXU | S_IRWXG ); //public shared file: pass data by file + chown( MSG_IPC_DATA_PATH, 0, 6502 ); + + return MSG_SUCCESS; +} + + +void* StartMsgServer(void*) +{ + try + { + MsgTransactionManager::instance()->run(); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + } + catch (exception& e) + { + MSG_FATAL("%s", e.what()); + } + + if (g_main_loop_is_running(mainloop)) + g_main_loop_quit(mainloop); + + return (void*)0; +} + + +void* InitMsgServer(void*) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE; + MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); + + // storage handler initialize + err = MsgStoInitDB(false); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("FAIL TO INITIALIZE STORAGE HANDLER [%d]", err); + } + + if (plg == NULL) { + MSG_DEBUG("No plugin for %d type", mainType); + + MsgReleaseMemory(); + + // Set Msg FW Ready Flag + MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, true); + + return (void*)0; + } + + MSG_SIM_STATUS_T simStatus = MSG_SIM_STATUS_NORMAL; + + // Check Sim Status + if (plg->checkSimStatus(&simStatus) == MSG_SUCCESS) { + + // Add the change of SIM to vconf + if (MsgSettingSetInt(MSG_SIM_CHANGED, (int)simStatus) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_SIM_CHANGED); + } + + if (simStatus != MSG_SIM_STATUS_NOT_FOUND) { + // Check Device Status + if (plg->checkDeviceStatus() != MSG_SUCCESS) { + MSG_DEBUG("checkDeviceStatus() error"); + + MsgReleaseMemory(); + + // Set Msg FW Ready Flag + MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, true); + + return (void*)0; + } + } + + // Init SIM Message + if (MsgInitSimMessage(simStatus) != MSG_SUCCESS) { + MSG_DEBUG("Fail to Initialize SIM Message"); + } + + // Init SIM Configuration + if (MsgInitSimConfig(simStatus) != MSG_SUCCESS) { + MSG_DEBUG("Fail to Initialize SIM Configuration"); + } + } else { + MSG_DEBUG("checkSimStatus() error"); + } + + MsgReleaseMemory(); + + // Try to connect contact server if it is not opened. + MsgOpenContactSvc(); + + // Register Callback to get the change of contact + MsgInitContactSvc(&MsgContactChangedCallback); + + // Set Msg FW Ready Flag + MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, true); + + return (void*)0; +} + + +static gboolean InitThreadFunc(void* pData) +{ + MSG_BEGIN(); + + pthread_t initThreadId; + + // initialize msg fw + if (pthread_create(&initThreadId, NULL, InitMsgServer, NULL) != 0) + { + MSG_DEBUG("InitMsgFw not invoked: %s", strerror(errno)); + return -1; + } + + pthread_detach(initThreadId); + + MSG_END(); + + return FALSE; +} + + +int main(void) +{ + g_thread_init(NULL); + dbus_g_thread_init(); + +//////////////////////////////////// + +/// set to ignore child process terminated signal. +signal( SIGCHLD, SIG_IGN ); + +//////////////////////////////////// + + + MSG_DEBUG("===========START MESSAGING FRAMEWORK=========="); + + // Reset message server ready flag + MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, false); + + // Connect to DB + // MsgStoConnectDB(); + + // Open Contact Service + MsgOpenContactSvc(); + + // Clean up mms dir + InitMmsDir(); + + try + { + // plugin manager initialize + MsgPluginManager::instance()->initialize(); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + } + catch (exception& e) + { + MSG_FATAL("%s", e.what()); + } + + pthread_t startThreadId; + + // start transaction manager + if (pthread_create(&startThreadId, NULL, StartMsgServer, NULL) != 0) + { + MSG_DEBUG("StartMsgServer not invoked: %s", strerror(errno)); + return -1; + } + + MsgTransactionManager::instance()->getTMStatus(); + + mainloop = g_main_loop_new(NULL, FALSE); + + g_type_init(); + + g_idle_add(InitThreadFunc, NULL); + + if (mainloop != NULL) + { + MSG_DEBUG("Start Messaging Framework!!!"); + + // Run GMainLoop + g_main_loop_run(mainloop); + } + else + { + MSG_DEBUG("Fail to start Messaging Framework!!!"); + } + + // Close Contact Sevice + MsgCloseContactSvc(); + + // Disconnect to DB + MsgStoDisconnectDB(); + + return 0; +} + diff --git a/framework/plugin-manager/MsgPluginConfig.cpp b/framework/plugin-manager/MsgPluginConfig.cpp new file mode 100755 index 0000000..d27e387 --- /dev/null +++ b/framework/plugin-manager/MsgPluginConfig.cpp @@ -0,0 +1,251 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgPluginConfig.h" +#include "MsgException.h" + + +/*================================================================================================== + IMPLEMENTATION OF MsgPlgToken - Member Functions +==================================================================================================*/ +int MsgPlgToken::tokenize(char *pStr) +{ + MSG_BEGIN(); + + if (pStr == NULL) + THROW(MsgException::INVALID_PARAM, "pstr is NULL"); + + char *pFirst = index(pStr, '['); + + if (pFirst) // title is enclosed by [ ] + { + pFirst++; // excluding '[' + + char *pEnd = index(pStr, ']'); + + if (pEnd) + { + pEnd--; + + tokenType = TOK_PLG_TITLE; + int len = pEnd-pFirst+1; + + memcpy(tokenVal, pFirst, len); + tokenVal[len] = '\0'; + + MSG_DEBUG("%s", tokenVal); + } + else + THROW(MsgException::INVALID_RESULT, "']' not found"); + } + else // (attribute, value) pair + { + char tokStr[strlen(pStr)+1]; + strncpy(tokStr, pStr, strlen(pStr)); + + char *attr = strtok(tokStr, "="); + char *val = strtok(NULL, "="); + + if (!attr || !val) + { + tokenType = TOK_UNDEFINED; + } + else + { + // trimming enter key + char *tmp = index(val,'\n'); + + if (tmp) + *tmp = '\0'; + + MSG_DEBUG("attr \"%s\", val \"%s\" ", attr, val); + + // classifying the attribute + if (strcmp(attr, "type") == 0) + { + tokenType = TOK_PLG_TYPE; + strncpy(tokenVal, val, 255); + } + else if (strcmp(attr, "path") == 0) + { + tokenType = TOK_PLG_PATH; + strncpy(tokenVal, val, 255); + } + else + { + tokenType = TOK_UNDEFINED; + } + } + } + + MSG_END(); + + return tokenType; +} + + +/*================================================================================================== + IMPLEMENTATION OF MsgPlgConfig - Member Functions +==================================================================================================*/ +MsgPlgConfig::MsgPlgConfig(FILE* fp) +{ + MSG_BEGIN(); + + if (fp == NULL) + THROW(MsgException::INVALID_PARAM, "fp is NULL"); + + MsgPlgToken tokTitle, tokMsgType, tokLibPath; + + char str[256]; + memset(str, 0x00, sizeof(str)); + + MsgPlgToken tok = MsgPlgToken(); + + while (fgets(str, 255, fp)) + { + tok.tokenize(str); // parsing the line into tokens + + switch ( tok.getType() ) + { + case MsgPlgToken::TOK_PLG_TITLE: + // processing previous items + if( tokTitle && tokMsgType && tokLibPath ) + { + insert(tokTitle, tokMsgType, tokLibPath); + } + + tokTitle = tok; + tokMsgType.reset(); + tokLibPath.reset(); + + break; + + case MsgPlgToken::TOK_PLG_TYPE: + tokMsgType = tok; + break; + + case MsgPlgToken::TOK_PLG_PATH: + tokLibPath = tok; + break; + + default: + MSG_DEBUG("the line \"%s\" is not accecpted", str); + break; + } + } + + if (tokTitle && tokMsgType && tokLibPath) + { + insert(tokTitle, tokMsgType, tokLibPath); + } + + MSG_END(); +} + + +void MsgPlgConfig::insert(const MsgPlgToken& tokTitle, const MsgPlgToken& tokMsgType, const MsgPlgToken& tokLibPath) +{ + MSG_BEGIN(); + + MsgPlgTokenVec item2add; + item2add.push_back(tokMsgType); + item2add.push_back(tokLibPath); + + CharVector titleVec; + tokTitle.getVal(titleVec); + MsgConfigMap::iterator it=configMap.find(titleVec); + + if (it == configMap.end()) + configMap.insert(std::make_pair(titleVec, item2add)); + else + THROW(MsgException::PLUGIN_ERROR, "duplicated plugin title"); + + MSG_DEBUG("item inserted"); + MSG_DEBUG("token:%d,value:%s", tokTitle.getType(), tokTitle.getVal()); + MSG_DEBUG("token:%d,value:%s", tokMsgType.getType(), tokMsgType.getVal()); + MSG_DEBUG("token:%d,value:%s", tokLibPath.getType(), tokLibPath.getVal()); + + MSG_END(); +} + + +const CharVector& MsgPlgConfig::title(unsigned int pos) +{ + if (pos >= configMap.size() || pos < 0) + THROW(MsgException::OUT_OF_RANGE, "Input Parameter is not valid [%d]", pos); + + MsgConfigMap::iterator it = configMap.begin(); + + unsigned int i=0; + + while (it != configMap.end()) + { + if (i++ == pos) break; + it++; + } + + if (it == configMap.end()) + THROW(MsgException::INVALID_RESULT, "no title"); + + MSG_DEBUG("searched title:%s", &(it->first)[0]); + + return it->first; +} + + +void MsgPlgConfig::token(const CharVector& key, unsigned int pos, MsgPlgToken& retTok) +{ + MsgConfigMap::iterator it = configMap.find(key); + + if (it != configMap.end()) //found + { + MSG_DEBUG("searched title:%s", &(it->first)[0]); + + MsgPlgTokenVec tokVec = it->second; + retTok = tokVec[pos]; + + MSG_DEBUG("searched token:%d,value:%s", retTok.getType(), retTok.getVal()); + } + else + { + THROW(MsgException::INVALID_RESULT, "no title"); + } +} + + +void MsgPlgConfig::token(int i, unsigned int pos, MsgPlgToken& retTok) +{ + const CharVector& key = title(i); + + token(key, pos, retTok); + + MSG_DEBUG("returned token:%d,value:%s", retTok.getType(), retTok.getVal()); +} + diff --git a/framework/plugin-manager/MsgPluginManager.cpp b/framework/plugin-manager/MsgPluginManager.cpp new file mode 100755 index 0000000..4332799 --- /dev/null +++ b/framework/plugin-manager/MsgPluginManager.cpp @@ -0,0 +1,727 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgException.h" +#include "MsgIpcSocket.h" +#include "MsgCmdTypes.h" +#include "MsgGconfWrapper.h" +#include "MsgPluginManager.h" +#include "MsgMmsTypes.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +void MsgSentStatusListener(MSG_SENT_STATUS_S *pSentStatus) +{ + MSG_BEGIN(); + + MSG_DEBUG("SENT STATUS %d, %d", pSentStatus->reqId, pSentStatus->status); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + client.connect(MSG_SOCKET_PATH); + + // composing command + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SENT_STATUS_S); // cmd type, MSG_SENT_STATUS + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + + MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_PLG_SENT_STATUS_CNF; + + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); + + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pSentStatus, sizeof(MSG_SENT_STATUS_S)); + + // Send Command to Transaction Manager + client.write(cmdBuf, cmdSize); + + // Receive result from Transaction Manager + MSG_DEBUG("Waiting result for SENT STATUS"); + + char *temp = NULL; + AutoPtr wrap(&temp); + int len; + client.read(&temp, &len); + + // close connection to msgfw daemon + client.close(); + + MSG_END(); +} + + +void MsgStorageChangeListener(MSG_STORAGE_CHANGE_TYPE_T storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo) +{ + MSG_BEGIN(); + + MSG_DEBUG("StorageChangeType : [%d], msg ID : [%d]", storageChangeType, pMsgInfo->msgId); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + client.connect(MSG_SOCKET_PATH); + + // composing command + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_INFO_S) + sizeof(MSG_STORAGE_CHANGE_TYPE_T); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + + MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_PLG_STORAGE_CHANGE_IND; + + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); + + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_INFO_S)), &storageChangeType, sizeof(MSG_STORAGE_CHANGE_TYPE_T)); + + // Send Command to Transaction Manager + client.write(cmdBuf, cmdSize); + + // Receive result from Transaction Manager + MSG_DEBUG("Waiting result for STORAGE CHANGE"); + + char *temp = NULL; + AutoPtr wrap(&temp); + int len; + client.read(&temp, &len); + + // close connection to msgfw daemon + client.close(); + + MSG_END(); +} + + +MSG_ERROR_T MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg) +{ + MSG_BEGIN(); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + client.connect(MSG_SOCKET_PATH); + + // Check Invalid Message Structure + if (pMsg == NULL) + { + MSG_DEBUG("pMsg is NULL !!"); + + return MSG_ERR_NULL_MESSAGE; + } + + // composing command + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_INFO_S); // cmd type, MSG_MESSAGE_INFO_S + + MSG_DEBUG("cmdSize: %d", cmdSize); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + + MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_PLG_INCOMING_MSG_IND; + + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); + + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pMsg, sizeof(MSG_MESSAGE_INFO_S)); + + // Send Command to Messaging FW + client.write(cmdBuf, cmdSize); + + char* retBuf = NULL; + AutoPtr wrap(&retBuf); + int retSize; + + client.read(&retBuf, &retSize); + + // close connection to msgfw daemon + client.close(); + + // Decoding the result from FW and Returning it to plugin + // the result is used for making delivery report + MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; + + if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_MSG_IND) + THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + + MSG_END(); + + return (pEvent->result); +} + + +MSG_ERROR_T MsgIncomingSyncMLMessageListener(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLData) +{ + MSG_BEGIN(); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + client.connect(MSG_SOCKET_PATH); + + // composing command + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SYNCML_MESSAGE_DATA_S); // cmd type, MSG_SYNCML_MESSAGE_DATA_S + + MSG_DEBUG("cmdSize: %d", cmdSize); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_PLG_INCOMING_SYNCML_IND; + + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); + + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pSyncMLData, sizeof(MSG_SYNCML_MESSAGE_DATA_S)); + + // Send Command to Messaging FW + client.write(cmdBuf, cmdSize); + + // Receive result from Transaction Manager + char* retBuf = NULL; + AutoPtr wrap(&retBuf); + int retSize; + client.read(&retBuf, &retSize); + + // close connection to msgfw daemon + client.close(); + + // Decoding the result from FW and Returning it to plugin + // the result is used for making delivery report + MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; + + if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND) + THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + + MSG_END(); + + return (pEvent->result); +} + + +MSG_ERROR_T MsgIncomingLBSMessageListener(MSG_LBS_MESSAGE_DATA_S *pLBSData) +{ + MSG_BEGIN(); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + client.connect(MSG_SOCKET_PATH); + + // composing command + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_LBS_MESSAGE_DATA_S); // cmd type, MSG_LBS_MESSAGE_DATA_S + + MSG_DEBUG("cmdSize: %d", cmdSize); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_PLG_INCOMING_LBS_IND; + + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); + + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pLBSData, sizeof(MSG_LBS_MESSAGE_DATA_S)); + + // Send Command to Messaging FW + client.write(cmdBuf, cmdSize); + + // Receive result from Transaction Manager + char* retBuf = NULL; + AutoPtr wrap(&retBuf); + int retSize; + client.read(&retBuf, &retSize); + + // close connection to msgfw daemon + client.close(); + + // Decoding the result from FW and Returning it to plugin + // the result is used for making delivery report + MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; + + if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_LBS_MSG_IND) + THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + + MSG_END(); + + return (pEvent->result); +} + + +MSG_ERROR_T MsgInitSimBySatListener() +{ + MSG_BEGIN(); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + client.connect(MSG_SOCKET_PATH); + + // composing command + int cmdSize = sizeof(MSG_CMD_S); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + + MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_PLG_INIT_SIM_BY_SAT; + + // Send Command to Transaction Manager + client.write(cmdBuf, cmdSize); + + // Receive result from Transaction Manager + char* retBuf = NULL; + AutoPtr wrap(&retBuf); + int retSize; + client.read(&retBuf, &retSize); + + // close connection to msgfw daemon + client.close(); + + // Decoding the result from FW and Returning it to plugin + MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; + + if (pEvent->eventType != MSG_EVENT_PLG_INIT_SIM_BY_SAT) + THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + + MSG_END(); + + return (pEvent->result); +} + +/* MMS_Incoming_listener */ +MSG_ERROR_T MsgMmsConfIncomingListener(MSG_MESSAGE_INFO_S *pMsg, MSG_REQUEST_ID_T *pReqId) +{ + MSG_BEGIN(); + MSG_DEBUG("pMsg = %s, pReqId = %d ", pMsg->msgData, *pReqId); + + // establish connection to msgfw daemon + MsgIpcClientSocket client; + client.connect(MSG_SOCKET_PATH); + + // composing command + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_INFO_S) + sizeof(MSG_REQUEST_ID_T); // cmd type, MSG_MESSAGE_INFO_S, MSG_REQUEST_ID_T + MSG_DEBUG("cmdSize : %d", cmdSize); + + char cmdBuf[cmdSize]; + bzero(cmdBuf, cmdSize); + + MSG_CMD_S *pCmd = (MSG_CMD_S *)cmdBuf; + + // Set Command Parameters + pCmd->cmdType = MSG_CMD_PLG_INCOMING_MMS_CONF; // cmd type + + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); // cmd cookie + + // cmd data + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pMsg, sizeof(MSG_MESSAGE_INFO_S)); + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_INFO_S)), pReqId, sizeof(MSG_REQUEST_ID_T)); + + // Send Command to Messaging FW + client.write(cmdBuf, cmdSize); + + // Receive result from Transaction Manager + char *retBuf = NULL; + AutoPtr wrap(&retBuf); + int retSize = 0; + client.read(&retBuf, &retSize); + + // close connection to msgfw daemon + client.close(); + + //Decoding the result from FW and Returning it to plugin + // the result is used for making delivery report + MSG_EVENT_S *pEvent = (MSG_EVENT_S *)retBuf; + + if(pEvent->eventType != MSG_EVENT_PLG_INCOMING_MMS_CONF && pEvent->eventType != MSG_EVENT_PLG_SENT_STATUS_CNF) + THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + + MSG_END(); + + return (pEvent->result); +} + +/*================================================================================================== + IMPLEMENTATION OF MsgPlugin - Member Functions +==================================================================================================*/ +MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedMsg(mainType) +{ + MSG_DEBUG("msg type : [%d] library path : [%s]", mainType, libPath); + + bzero(&mPlgHandler, sizeof(mPlgHandler)); + + if (libPath == NULL) + THROW(MsgException::INVALID_PARAM, "libPath NULL"); + + void* libHandle = NULL; + + libHandle = dlopen(libPath, RTLD_NOW); + + if (!libHandle) + THROW(MsgException::PLUGIN_ERROR, "ERROR dlopen library : [%s] [%s]", libPath, dlerror()); + + // Clear Error + dlerror(); + + // assign the c function pointers + MSG_ERROR_T(*pFunc)(MSG_PLUGIN_HANDLER_S*) = NULL; + + pFunc = (MSG_ERROR_T(*)(MSG_PLUGIN_HANDLER_S*))dlsym(libHandle, "MsgPlgCreateHandle"); + + char *error = dlerror(); + + if (error != NULL) + THROW(MsgException::PLUGIN_ERROR, "ERROR dlsym library : [%s]", dlerror()); + + if ((*pFunc)(&mPlgHandler) != MSG_SUCCESS) + THROW(MsgException::PLUGIN_ERROR, "ERROR to create plugin handle"); + + // Initialize Plug-in + if (initialize() != MSG_SUCCESS) + THROW(MsgException::PLUGIN_ERROR, "ERROR to initialize plugin"); + + MSG_PLUGIN_LISTENER_S fwListener = {0}; + fwListener.pfSentStatusCb = &MsgSentStatusListener; + fwListener.pfStorageChangeCb = &MsgStorageChangeListener; + fwListener.pfMsgIncomingCb = &MsgIncomingMessageListener; + fwListener.pfInitSimBySatCb = &MsgInitSimBySatListener; + fwListener.pfSyncMLMsgIncomingCb = &MsgIncomingSyncMLMessageListener; + fwListener.pfLBSMsgIncomingCb = &MsgIncomingLBSMessageListener; + fwListener.pfMmsConfIncomingCb = &MsgMmsConfIncomingListener; + + if (registerListener(&fwListener) != MSG_SUCCESS) + THROW(MsgException::PLUGIN_ERROR, "ERROR to register listener"); + +// dlclose(libHandle); +} + + +MsgPlugin::~MsgPlugin() +{ + + +} + + +MSG_ERROR_T MsgPlugin::initialize() +{ + if ( mPlgHandler.pfInitialize != NULL) + return mPlgHandler.pfInitialize(); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +void MsgPlugin::finalize() +{ + if (mPlgHandler.pfFinalize != NULL) + mPlgHandler.pfFinalize(); +} + + +MSG_ERROR_T MsgPlugin::submitReq(MSG_REQUEST_INFO_S *pReqInfo, bool bReqCb) +{ + if (mPlgHandler.pfSubmitRequest != NULL) + return mPlgHandler.pfSubmitRequest(pReqInfo, bReqCb); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::registerListener(MSG_PLUGIN_LISTENER_S *pListener) +{ + if (mPlgHandler.pfRegisterListener != NULL) + return mPlgHandler.pfRegisterListener(pListener); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::checkSimStatus(MSG_SIM_STATUS_T *pStatus) +{ + if (mPlgHandler.pfRegisterListener != NULL) + return mPlgHandler.pfCheckSimStatus(pStatus); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::checkDeviceStatus() +{ + if (mPlgHandler.pfRegisterListener != NULL) + return mPlgHandler.pfCheckDeviceStatus(); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::initSimMessage() +{ + if (mPlgHandler.pfInitSimMessage != NULL) + return mPlgHandler.pfInitSimMessage(); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::saveSimMessage(MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList) +{ + if (mPlgHandler.pfSaveSimMessage != NULL) + return mPlgHandler.pfSaveSimMessage(pMsgInfo, pSimIdList); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::deleteSimMessage(MSG_SIM_ID_T SimMsgId) +{ + if (mPlgHandler.pfDeleteSimMessage != NULL) + return mPlgHandler.pfDeleteSimMessage(SimMsgId); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::setReadStatus(MSG_SIM_ID_T SimMsgId) +{ + if (mPlgHandler.pfSetReadStatus != NULL) + return mPlgHandler.pfSetReadStatus(SimMsgId); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::setMemoryStatus(MSG_ERROR_T Error) +{ + if (mPlgHandler.pfSetMemoryStatus != NULL) + return mPlgHandler.pfSetMemoryStatus(Error); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::initConfigData(MSG_SIM_STATUS_T SimStatus) +{ + if (mPlgHandler.pfInitConfigData != NULL) + return mPlgHandler.pfInitConfigData(SimStatus); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::setConfigData(const MSG_SETTING_S *pSetting) +{ + if (mPlgHandler.pfSetConfigData != NULL) + return mPlgHandler.pfSetConfigData(pSetting); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +MSG_ERROR_T MsgPlugin::getConfigData(MSG_SETTING_S *pSetting) +{ + if (mPlgHandler.pfGetConfigData != NULL) + return mPlgHandler.pfGetConfigData(pSetting); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + +MSG_ERROR_T MsgPlugin::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData) +{ + if (mPlgHandler.pfAddMessage != NULL) { + return mPlgHandler.pfAddMessage(pMsgInfo, pSendOptInfo, pFileData); + } else { + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } +} + +MSG_ERROR_T MsgPlugin::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData) +{ + if (mPlgHandler.pfUpdateMessage != NULL) { + return mPlgHandler.pfUpdateMessage(pMsgInfo, pSendOptInfo, pFileData); + } else { + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } +} + + +MSG_ERROR_T MsgPlugin::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject) +{ + if (mPlgHandler.pfProcessReceivedInd != NULL) { + return mPlgHandler.pfProcessReceivedInd(pMsgInfo, pRequest, bReject); + } else { + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } +} + + +MSG_ERROR_T MsgPlugin::getMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg) +{ + if (mPlgHandler.pfGetMmsMessage != NULL) { + return mPlgHandler.pfGetMmsMessage(pMsg, pSendOptInfo, pMmsMsg, pDestMsg); + } else { + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } +} + + +MSG_ERROR_T MsgPlugin::updateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + if (mPlgHandler.pfUpdateRejectStatus != NULL) { + return mPlgHandler.pfUpdateRejectStatus(pMsgInfo); + } else { + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } +} + + +MSG_ERROR_T MsgPlugin::composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + if (mPlgHandler.pfComposeReadReport != NULL) { + return mPlgHandler.pfComposeReadReport(pMsgInfo); + } else { + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } +} + + +MSG_ERROR_T MsgPlugin::restoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char* pRecvBody, int rcvdBodyLen, char* filePath) +{ + if (mPlgHandler.pfRestoreMsg != NULL) + return mPlgHandler.pfRestoreMsg(pMsgInfo,pRecvBody, rcvdBodyLen, filePath); + else + return MSG_ERR_INVALID_PLUGIN_HANDLE; +} + + +/*================================================================================================== + IMPLEMENTATION OF MsgPluginManager - Member Functions +==================================================================================================*/ +MsgPluginManager* MsgPluginManager::pInstance = NULL; + + +MsgPluginManager* MsgPluginManager::instance() +{ + if (pInstance == NULL) + pInstance = new MsgPluginManager(); + + return pInstance; +} + + +MsgPluginManager::MsgPluginManager() +{ + +} + + +void MsgPluginManager::initialize() +{ + char path[64]; + + memset(path, 0x00, sizeof(path)); + snprintf(path, sizeof(path), "%s%s", MSG_PLUGIN_CFG_PATH, MSG_PLUGIN_CFG_NAME); + + loadPlugins(path); +} + + +void MsgPluginManager::finalize() +{ + MsgPluginMap::iterator it; + + for (it = plgMap.begin(); it != plgMap.end(); it++) + { + MsgPlugin temp = it->second; + temp.finalize(); + } + + plgMap.clear(); +} + + +void MsgPluginManager::loadPlugins(const char* path) +{ + /* read plugins from configuration file */ + FILE* fp = MsgOpenFile(path, "rt"); + + MsgPlgConfig plgConf = MsgPlgConfig(fp); + + for (int i=0; i < plgConf.titleCount(); i++) + { + MsgPlgToken tok; + + plgConf.token(i, 0, tok); + const char* content = tok.getVal(); + + MSG_MAIN_TYPE_T mainType = strstr(content,"sms")? MSG_SMS_TYPE: + (strstr(content,"mms")? MSG_MMS_TYPE: MSG_UNKNOWN_TYPE); + + plgConf.token(i, 1, tok); + const char* libPath = tok.getVal(); + + MsgPlugin* pDupPlgCheck = getPlugin(mainType); + + if (pDupPlgCheck) + THROW(MsgException::PLUGIN_ERROR, "Plugin for type %d is duplicated", mainType); + + MsgPlugin newPlg(mainType, libPath); + + plgMap.insert(make_pair(mainType, newPlg)); + } + + MsgCloseFile(fp); +} + + +MsgPlugin* MsgPluginManager::getPlugin(MSG_MAIN_TYPE_T mainType) +{ + /* Implementing the content */ + MsgPluginMap::iterator it = plgMap.find(mainType); + + if (it == plgMap.end()) + return NULL; + + return &(it->second); +} + diff --git a/framework/setting-handler/MsgSettingHandler.cpp b/framework/setting-handler/MsgSettingHandler.cpp new file mode 100755 index 0000000..dcaebb3 --- /dev/null +++ b/framework/setting-handler/MsgSettingHandler.cpp @@ -0,0 +1,1104 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MsgPluginManager.h" +#include "MsgSettingHandler.h" +#include "MsgGconfWrapper.h" + + +#define DEF_BUF_LEN 128 + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgInitSimConfig(MSG_SIM_STATUS_T SimStatus) +{ + MSG_DEBUG("Start to initialize SIM Configuration"); + + MSG_ERROR_T err = MSG_SUCCESS; + + if (SimStatus != MSG_SIM_STATUS_NOT_FOUND) + { + MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE; + MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); + + if (plg == NULL) + { + MSG_DEBUG("No plugin for %d type", mainType); + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } + + // Check SIM Status + MSG_DEBUG(" ** SIM is available - status : [%d] ** ", SimStatus); + + err = plg->initConfigData(SimStatus); + } + + return err; +} + + +MSG_ERROR_T MsgSetConfigData(const MSG_SETTING_S *pSetting) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_DEBUG("Setting Type : %d", pSetting->type); + + switch (pSetting->type) + { + case MSG_GENERAL_OPT : + err = MsgSetGeneralOpt(pSetting); + break; + case MSG_SMS_SENDOPT : + err = MsgSetSMSSendOpt(pSetting); + break; + case MSG_SMSC_LIST : + err = MsgSetSMSCList(pSetting, true); + break; + case MSG_MMS_SENDOPT : + err = MsgSetMMSSendOpt(pSetting); + break; + case MSG_MMS_RECVOPT : + err = MsgSetMMSRecvOpt(pSetting); + break; + case MSG_MMS_STYLEOPT : + err = MsgSetMMSStyleOpt(pSetting); + break; + case MSG_PUSHMSG_OPT : + err = MsgSetPushMsgOpt(pSetting); + break; + case MSG_CBMSG_OPT : + err = MsgSetCBMsgOpt(pSetting, true); + break; + case MSG_VOICEMAIL_OPT : + err = MsgSetVoiceMailOpt(pSetting); + break; + case MSG_MSGSIZE_OPT: + err = MsgSetMsgSizeOpt(pSetting); + default : + break; + } + + return err; +} + + +MSG_ERROR_T MsgGetConfigData(MSG_SETTING_S *pSetting) +{ + switch (pSetting->type) + { + case MSG_GENERAL_OPT : + MsgGetGeneralOpt(pSetting); + break; + case MSG_SMS_SENDOPT : + MsgGetSMSSendOpt(pSetting); + break; + case MSG_SMSC_LIST : + MsgGetSMSCList(pSetting); + break; + case MSG_MMS_SENDOPT : + MsgGetMMSSendOpt(pSetting); + break; + case MSG_MMS_RECVOPT : + MsgGetMMSRecvOpt(pSetting); + break; + case MSG_MMS_STYLEOPT : + MsgGetMMSStyleOpt(pSetting); + break; + case MSG_PUSHMSG_OPT : + MsgGetPushMsgOpt(pSetting); + break; + case MSG_CBMSG_OPT : + MsgGetCBMsgOpt(pSetting); + break; + case MSG_VOICEMAIL_OPT : + MsgGetVoiceMailOpt(pSetting); + break; + case MSG_MSGSIZE_OPT : + MsgGetMsgSizeOpt(pSetting); + break; + + default : + break; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSetGeneralOpt(const MSG_SETTING_S *pSetting) +{ + MSG_GENERAL_OPT_S generalOpt; + bool bValue = false; + + memcpy(&generalOpt, &(pSetting->option.generalOpt), sizeof(MSG_GENERAL_OPT_S)); + + MsgSettingGetBool(MSG_KEEP_COPY, &bValue); + if (bValue != generalOpt.bKeepCopy) { + if (MsgSettingSetBool(MSG_KEEP_COPY, generalOpt.bKeepCopy) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_KEEP_COPY); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MSG_AUTO_ERASE, &bValue); + if (bValue != generalOpt.bAutoErase) { + if (MsgSettingSetBool(MSG_AUTO_ERASE, generalOpt.bAutoErase) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSG_AUTO_ERASE); + return MSG_ERR_SET_SETTING; + } + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSetSMSSendOpt(const MSG_SETTING_S *pSetting) +{ + MSG_SMS_SENDOPT_S sendOpt; + int iValue = 0; + bool bValue = false; + + memcpy(&sendOpt, &(pSetting->option.smsSendOpt), sizeof(MSG_SMS_SENDOPT_S)); + + iValue = MsgSettingGetInt(SMS_SEND_DCS); + if (iValue != (int)sendOpt.dcs) { + if (MsgSettingSetInt(SMS_SEND_DCS, (int)sendOpt.dcs) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", SMS_SEND_DCS); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(SMS_SEND_NETWORK_MODE); + if (iValue != (int)sendOpt.netMode) { + if (MsgSettingSetInt(SMS_SEND_NETWORK_MODE, (int)sendOpt.netMode) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", SMS_SEND_NETWORK_MODE); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(SMS_SEND_REPLY_PATH, &bValue); + if (bValue != sendOpt.bReplyPath) { + if (MsgSettingSetBool(SMS_SEND_REPLY_PATH, sendOpt.bReplyPath) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", SMS_SEND_REPLY_PATH); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &bValue); + if (bValue != sendOpt.bDeliveryReport) { + if (MsgSettingSetBool(SMS_SEND_DELIVERY_REPORT, sendOpt.bDeliveryReport) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", SMS_SEND_DELIVERY_REPORT); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(SMS_SEND_SAVE_STORAGE); + if (iValue != (int)sendOpt.saveStorage) { + if (MsgSettingSetInt(SMS_SEND_SAVE_STORAGE, (int)sendOpt.saveStorage) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", SMS_SEND_SAVE_STORAGE); + return MSG_ERR_SET_SETTING; + } + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSetSMSCList(const MSG_SETTING_S *pSetting, bool bSetSim) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + for (int index = 0; index < pSetting->option.smscList.totalCnt; index++) + { + if(strlen(pSetting->option.smscList.smscData[index].smscAddr.address) > SMSC_ADDR_MAX) + { + MSG_DEBUG("SMSC address is too long [%d]", strlen(pSetting->option.smscList.smscData[index].smscAddr.address)); + return MSG_ERR_SET_SIM_SET; + } + } + + if (bSetSim == true) + { + err = MsgSetConfigInSim(pSetting); + + if (err != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data in sim [%d]", err); + return MSG_ERR_SET_SIM_SET; + } + } + + MSG_SMSC_LIST_S smscList; + + memcpy(&smscList, &(pSetting->option.smscList), sizeof(MSG_SMSC_LIST_S)); + + char keyName[DEF_BUF_LEN] = {0, }; + + // No selected SMSC Info. in SIM. + if (bSetSim == true) + { + if (MsgSettingSetInt(SMSC_SELECTED, smscList.selected) != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data [%s]", SMSC_SELECTED); + return MSG_ERR_SET_SETTING; + } + } + + if (MsgSettingSetInt(SMSC_TOTAL_COUNT, smscList.totalCnt) != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data [%s]", SMSC_TOTAL_COUNT); + return MSG_ERR_SET_SETTING; + } + + for (int i = 0; i < smscList.totalCnt; i++) + { + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_PID, i); + + if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].pid)) != MSG_SUCCESS) + break; + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_VAL_PERIOD, i); + + if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].valPeriod)) != MSG_SUCCESS) + break; + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NAME, i); + + if ((err = MsgSettingSetString(keyName, smscList.smscData[i].name)) != MSG_SUCCESS) + break; + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_TON, i); + + if (smscList.smscData[i].smscAddr.address[0] == '+') + smscList.smscData[i].smscAddr.ton = MSG_TON_INTERNATIONAL; + else + smscList.smscData[i].smscAddr.ton = MSG_TON_NATIONAL; + + if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].smscAddr.ton)) != MSG_SUCCESS) + break; + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NPI, i); + + smscList.smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value + + if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].smscAddr.npi)) != MSG_SUCCESS) + break; + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_ADDRESS, i); + + if ((err = MsgSettingSetString(keyName, smscList.smscData[i].smscAddr.address)) != MSG_SUCCESS) + break; + } + + if (err != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data [%s]", keyName); + } + + return err; +} + + +MSG_ERROR_T MsgSetMMSSendOpt(const MSG_SETTING_S *pSetting) +{ + MSG_MMS_SENDOPT_S sendOpt; + int iValue = 0; + bool bValue = false; + + memcpy(&sendOpt, &(pSetting->option.mmsSendOpt), sizeof(MSG_MMS_SENDOPT_S)); + + iValue = MsgSettingGetInt(MMS_SEND_MSG_CLASS); + if (iValue != (int)sendOpt.msgClass) { + if (MsgSettingSetInt(MMS_SEND_MSG_CLASS, (int)sendOpt.msgClass) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_MSG_CLASS); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_SEND_PRIORITY); + if (iValue != (int)sendOpt.priority) { + if (MsgSettingSetInt(MMS_SEND_PRIORITY, (int)sendOpt.priority) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_PRIORITY); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_SEND_EXPIRY_TIME); + if (iValue != (int)sendOpt.expiryTime) { + if (MsgSettingSetInt(MMS_SEND_EXPIRY_TIME, (int)sendOpt.expiryTime) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_EXPIRY_TIME); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); + if (iValue != (int)sendOpt.deliveryTime) { + if (MsgSettingSetInt(MMS_SEND_DELIVERY_TIME, (int)sendOpt.deliveryTime) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_DELIVERY_TIME); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY); + if (iValue != (int)sendOpt.customDeliveryTime) { + if (MsgSettingSetInt(MMS_SEND_CUSTOM_DELIVERY, sendOpt.customDeliveryTime) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_CUSTOM_DELIVERY); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &bValue); + if (bValue != sendOpt.bSenderVisibility) { + if (MsgSettingSetBool(MMS_SEND_SENDER_VISIBILITY, sendOpt.bSenderVisibility) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_SENDER_VISIBILITY); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &bValue); + if (bValue != sendOpt.bDeliveryReport) { + if (MsgSettingSetBool(MMS_SEND_DELIVERY_REPORT, sendOpt.bDeliveryReport) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_DELIVERY_REPORT); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_SEND_READ_REPLY, &bValue); + if (bValue != sendOpt.bReadReply) { + if (MsgSettingSetBool(MMS_SEND_READ_REPLY, sendOpt.bReadReply) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_READ_REPLY); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &bValue); + if (bValue != sendOpt.bBodyReplying) { + if (MsgSettingSetBool(MMS_SEND_BODY_REPLYING, sendOpt.bBodyReplying) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_BODY_REPLYING); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &bValue); + if (bValue != sendOpt.bHideRecipients) { + if (MsgSettingSetBool(MMS_SEND_HIDE_RECIPIENTS, sendOpt.bHideRecipients) != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_HIDE_RECIPIENTS); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING); + if (iValue != sendOpt.replyCharging) { + if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING, sendOpt.replyCharging) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE); + if (iValue != (int)sendOpt.replyChargingDeadline) { + if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_DEADLINE, sendOpt.replyChargingDeadline) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING_DEADLINE); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE); + if (iValue != (int)sendOpt.replyChargingSize) { + if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_SIZE, sendOpt.replyChargingSize) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING_SIZE); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_SEND_CREATION_MODE); + if (iValue != sendOpt.creationMode) { + if (MsgSettingSetInt(MMS_SEND_CREATION_MODE, sendOpt.creationMode) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_SEND_CREATION_MODE); + return MSG_ERR_SET_SETTING; + } + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSetMMSRecvOpt(const MSG_SETTING_S *pSetting) +{ + MSG_MMS_RECVOPT_S recvOpt; + int iValue = 0; + bool bValue = false; + + memcpy(&recvOpt, &(pSetting->option.mmsRecvOpt), sizeof(MSG_MMS_RECVOPT_S)); + + iValue = MsgSettingGetInt(MMS_RECV_HOME_NETWORK); + if (iValue != (int)recvOpt.homeNetwork) { + if (MsgSettingSetInt(MMS_RECV_HOME_NETWORK, (int)recvOpt.homeNetwork) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_RECV_HOME_NETWORK); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK); + if (iValue != (int)recvOpt.abroadNetwok) { + if (MsgSettingSetInt(MMS_RECV_ABROAD_NETWORK, (int)recvOpt.abroadNetwok) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_RECV_ABROAD_NETWORK); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_RECV_READ_RECEIPT, &bValue); + if (bValue != recvOpt.readReceipt) { + if (MsgSettingSetBool(MMS_RECV_READ_RECEIPT, recvOpt.readReceipt) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_RECV_READ_RECEIPT); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &bValue); + if (bValue != recvOpt.bDeliveryReceipt) { + if (MsgSettingSetBool(MMS_RECV_DELIVERY_RECEIPT, recvOpt.bDeliveryReceipt) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_RECV_DELIVERY_RECEIPT); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bValue); + if (bValue != recvOpt.bRejectUnknown) { + if (MsgSettingSetBool(MMS_RECV_REJECT_UNKNOWN, recvOpt.bRejectUnknown) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_RECV_REJECT_UNKNOWN); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bValue); + if (bValue != recvOpt.bRejectAdvertisement) { + if (MsgSettingSetBool(MMS_RECV_REJECT_ADVERTISE, recvOpt.bRejectAdvertisement) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_RECV_REJECT_ADVERTISE); + return MSG_ERR_SET_SETTING; + } + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSetMMSStyleOpt(const MSG_SETTING_S *pSetting) +{ + MSG_MMS_STYLEOPT_S styleOpt; + int iValue = 0; + bool bValue = false; + + memcpy(&styleOpt, &(pSetting->option.mmsStyleOpt), sizeof(MSG_MMS_STYLEOPT_S)); + + iValue = MsgSettingGetInt(MMS_STYLE_FONT_SIZE); + if (iValue != (int)styleOpt.fontSize) { + if (MsgSettingSetInt(MMS_STYLE_FONT_SIZE, styleOpt.fontSize) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_SIZE); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_STYLE_FONT_STYLE_BOLD, &bValue); + if (bValue != styleOpt.bFontStyleBold) { + if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_BOLD, styleOpt.bFontStyleBold) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_BOLD); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_STYLE_FONT_STYLE_ITALIC, &bValue); + if (bValue != styleOpt.bFontStyleItalic) { + if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_ITALIC, styleOpt.bFontStyleItalic) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_ITALIC); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, &bValue); + if (bValue != styleOpt.bFontStyleUnderline) { + if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, styleOpt.bFontStyleUnderline) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_UNDERLINE); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED); + if (iValue != (int)styleOpt.fontColorRed) { + if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_RED, styleOpt.fontColorRed) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_RED); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN); + if (iValue != (int)styleOpt.fontColorGreen) { + if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_GREEN, styleOpt.fontColorGreen) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_GREEN); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE); + if (iValue != (int)styleOpt.fontColorBlue) { + if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_BLUE, styleOpt.fontColorBlue) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_BLUE); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE); + if (iValue != (int)styleOpt.fontColorHue) { + if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, styleOpt.fontColorHue) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_HUE); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED); + if (iValue != (int)styleOpt.bgColorRed) { + if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_RED, styleOpt.bgColorRed) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_RED); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN); + if (iValue != (int)styleOpt.bgColorGreen) { + if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_GREEN, styleOpt.bgColorGreen) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_GREEN); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE); + if (iValue != (int)styleOpt.bgColorBlue) { + if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_BLUE, styleOpt.bgColorBlue) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_BLUE); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE); + if (iValue != (int)styleOpt.bgColorHue) { + if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_HUE, styleOpt.bgColorHue) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_HUE); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_PAGE_DUR); + if (iValue != (int)styleOpt.pageDur) { + if (MsgSettingSetInt(MMS_STYLE_PAGE_DUR, styleOpt.pageDur) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_DUR); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR); + if (iValue != (int)styleOpt.pageCustomDur) { + if (MsgSettingSetInt(MMS_STYLE_PAGE_CUSTOM_DUR, styleOpt.pageCustomDur) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_CUSTOM_DUR); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL); + if (iValue != (int)styleOpt.pageDurManual) { + if (MsgSettingSetInt(MMS_STYLE_PAGE_DUR_MANUAL, styleOpt.pageDurManual) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_DUR_MANUAL); + return MSG_ERR_SET_SETTING; + } + } + + return MSG_SUCCESS; +} + +MSG_ERROR_T MsgSetPushMsgOpt(const MSG_SETTING_S *pSetting) +{ + MSG_PUSHMSG_OPT_S pushOpt; + int iValue = 0; + bool bValue = false; + + memcpy(&pushOpt, &(pSetting->option.pushMsgOpt), sizeof(MSG_PUSHMSG_OPT_S)); + + MsgSettingGetBool(PUSH_RECV_OPTION, &bValue); + if (bValue != pushOpt.bReceive) { + if (MsgSettingSetBool(PUSH_RECV_OPTION, pushOpt.bReceive) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", PUSH_RECV_OPTION); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(PUSH_SERVICE_TYPE); + if (iValue != (int)pushOpt.serviceType) { + if (MsgSettingSetInt(PUSH_SERVICE_TYPE, (int)pushOpt.serviceType) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", PUSH_SERVICE_TYPE); + return MSG_ERR_SET_SETTING; + } + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_CBMSG_OPT_S cbOpt; + int iValue = 0; + bool bValue = false; + + memcpy(&cbOpt, &(pSetting->option.cbMsgOpt), sizeof(MSG_CBMSG_OPT_S)); + + if (bSetSim == true) + { + cbOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT); + + if (cbOpt.channelData.channelCnt > cbOpt.maxSimCnt) + { + MSG_DEBUG("Channel Count is over Max SIM Count [%d]", cbOpt.channelData.channelCnt); + return MSG_ERR_SET_SIM_SET; + } + + if (MsgSetConfigInSim(pSetting) != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data in sim [%d]", err); + return MSG_ERR_SET_SIM_SET; + } + } + + MsgSettingGetBool(CB_RECEIVE, &bValue); + if (bValue != cbOpt.bReceive) { + if (MsgSettingSetBool(CB_RECEIVE, cbOpt.bReceive) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", CB_RECEIVE); + return MSG_ERR_SET_SETTING; + } + } + + MsgSettingGetBool(CB_ALL_CHANNEL, &bValue); + if (bValue != cbOpt.bAllChannel) { + if (MsgSettingSetBool(CB_ALL_CHANNEL, cbOpt.bAllChannel) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", CB_ALL_CHANNEL); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(CB_MAX_SIM_COUNT); + if (iValue != cbOpt.maxSimCnt) { + if (MsgSettingSetInt(CB_MAX_SIM_COUNT, cbOpt.maxSimCnt) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", CB_MAX_SIM_COUNT); + return MSG_ERR_SET_SETTING; + } + } + + iValue = MsgSettingGetInt(CB_CHANNEL_COUNT); + if (iValue != cbOpt.channelData.channelCnt) { + if (MsgSettingSetInt(CB_CHANNEL_COUNT, cbOpt.channelData.channelCnt) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", CB_CHANNEL_COUNT); + return MSG_ERR_SET_SETTING; + } + } + + char keyName[DEF_BUF_LEN] = {0, }; + + for (int i = 0; i < cbOpt.channelData.channelCnt; i++) + { + snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ACTIVATE, i); + + if ((err = MsgSettingSetBool(keyName, cbOpt.channelData.channelInfo[i].bActivate)) != MSG_SUCCESS) + break; + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID, i); + + if ((err = MsgSettingSetInt(keyName, cbOpt.channelData.channelInfo[i].id)) != MSG_SUCCESS) + break; + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_NAME, i); + + if ((err = MsgSettingSetString(keyName, cbOpt.channelData.channelInfo[i].name)) != MSG_SUCCESS) + break; + } + + if (bSetSim == true) + { + for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) + { + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_LANGUAGE, i); + + if (MsgSettingSetBool(keyName, cbOpt.bLanguage[i]) != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data [%s]", keyName); + return MSG_ERR_SET_SETTING; + } + } + } + + return err; +} + + +MSG_ERROR_T MsgSetVoiceMailOpt(const MSG_SETTING_S *pSetting) +{ + MSG_VOICEMAIL_OPT_S voiceMailOpt; + char *pValue = NULL; + + memcpy(&voiceMailOpt, &(pSetting->option.voiceMailOpt), sizeof(MSG_VOICEMAIL_OPT_S)); + + pValue = MsgSettingGetString(VOICEMAIL_NUMBER); + if (pValue != NULL && strcmp(pValue, voiceMailOpt.mailNumber) == 0) { + /* Value is same with previous one. Therefore, we don't need to save it. */ + } else { + if (MsgSettingSetString(VOICEMAIL_NUMBER, voiceMailOpt.mailNumber) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_NUMBER); + + if (pValue != NULL) { + free(pValue); + pValue = NULL; + } + + return MSG_ERR_SET_SETTING; + } + } + + if (pValue != NULL) { + free(pValue); + pValue = NULL; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSetMsgSizeOpt(const MSG_SETTING_S *pSetting) +{ + MSG_MSGSIZE_OPT_S msgSizeOpt; + int iValue = 0; + + memcpy(&msgSizeOpt, &(pSetting->option.msgSizeOpt), sizeof(MSG_MSGSIZE_OPT_S)); + + iValue = MsgSettingGetInt(MSGSIZE_OPTION); + if (iValue != msgSizeOpt.nMsgSize) { + if (MsgSettingSetInt(MSGSIZE_OPTION, msgSizeOpt.nMsgSize) != MSG_SUCCESS) { + MSG_DEBUG("Error to set config data [%s]", MSGSIZE_OPTION); + return MSG_ERR_SET_SETTING; + } + } + + return MSG_SUCCESS; +} + + +void MsgGetGeneralOpt(MSG_SETTING_S *pSetting) +{ + memset(&(pSetting->option.generalOpt), 0x00, sizeof(MSG_GENERAL_OPT_S)); + + MsgSettingGetBool(MSG_KEEP_COPY, &pSetting->option.generalOpt.bKeepCopy); +} + + +void MsgGetSMSSendOpt(MSG_SETTING_S *pSetting) +{ + memset(&(pSetting->option.smsSendOpt), 0x00, sizeof(MSG_SMS_SENDOPT_S)); + + pSetting->option.smsSendOpt.dcs = (MSG_ENCODE_TYPE_T)MsgSettingGetInt(SMS_SEND_DCS); + + pSetting->option.smsSendOpt.netMode = (MSG_SMS_NETWORK_MODE_T)MsgSettingGetInt(SMS_SEND_NETWORK_MODE); + + MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSetting->option.smsSendOpt.bReplyPath); + + MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSetting->option.smsSendOpt.bDeliveryReport); + + pSetting->option.smsSendOpt.saveStorage = (MSG_SMS_SAVE_STORAGE_T)MsgSettingGetInt(SMS_SEND_SAVE_STORAGE); +} + + +void MsgGetSMSCList(MSG_SETTING_S *pSetting) +{ + char keyName[DEF_BUF_LEN] = {0, }; + char *tmpValue = NULL; + + memset(&(pSetting->option.smscList), 0x00, sizeof(MSG_SMSC_LIST_S)); + + pSetting->option.smscList.selected = MsgSettingGetInt(SMSC_SELECTED); + + pSetting->option.smscList.totalCnt = MsgSettingGetInt(SMSC_TOTAL_COUNT); + + for (int i = 0; i < pSetting->option.smscList.totalCnt; i++) + { + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_PID, i); + + pSetting->option.smscList.smscData[i].pid = (MSG_SMS_PID_T)MsgSettingGetInt(keyName); + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_VAL_PERIOD, i); + + pSetting->option.smscList.smscData[i].valPeriod = (MSG_VAL_PERIOD_T)MsgSettingGetInt(keyName); + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NAME, i); + + memset(pSetting->option.smscList.smscData[i].name, 0x00, SMSC_NAME_MAX+1); + + tmpValue = MsgSettingGetString(keyName); + if (tmpValue != NULL) { + strncpy(pSetting->option.smscList.smscData[i].name, tmpValue, SMSC_NAME_MAX); + free(tmpValue); + tmpValue = NULL; + } + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_TON, i); + + pSetting->option.smscList.smscData[i].smscAddr.ton = (MSG_SMS_TON_T)MsgSettingGetInt(keyName); + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NPI, i); + + pSetting->option.smscList.smscData[i].smscAddr.npi = (MSG_SMS_NPI_T)MsgSettingGetInt(keyName); + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_ADDRESS, i); + + memset(pSetting->option.smscList.smscData[i].smscAddr.address, 0x00, sizeof(pSetting->option.smscList.smscData[i].smscAddr.address)); + + tmpValue = MsgSettingGetString(keyName); + if (tmpValue != NULL) { + strncpy(pSetting->option.smscList.smscData[i].smscAddr.address, tmpValue, SMSC_ADDR_MAX); + free(tmpValue); + tmpValue = NULL; + } + } +} + + +void MsgGetMMSSendOpt(MSG_SETTING_S *pSetting) +{ + memset(&(pSetting->option.mmsSendOpt), 0x00, sizeof(MSG_MMS_SENDOPT_S)); + + pSetting->option.mmsSendOpt.msgClass = (MSG_MMS_MSG_CLASS_TYPE_T)MsgSettingGetInt(MMS_SEND_MSG_CLASS); + + pSetting->option.mmsSendOpt.priority = (MSG_PRIORITY_TYPE_T)MsgSettingGetInt(MMS_SEND_PRIORITY); + + pSetting->option.mmsSendOpt.expiryTime = (MSG_MMS_EXPIRY_TIME_T)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME); + + pSetting->option.mmsSendOpt.deliveryTime = (MSG_MMS_DELIVERY_TIME_T)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); + + pSetting->option.mmsSendOpt.customDeliveryTime = MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY); + + MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &pSetting->option.mmsSendOpt.bSenderVisibility); + + MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &pSetting->option.mmsSendOpt.bDeliveryReport); + + MsgSettingGetBool(MMS_SEND_READ_REPLY, &pSetting->option.mmsSendOpt.bReadReply); + + MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &pSetting->option.mmsSendOpt.bBodyReplying); + + MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &pSetting->option.mmsSendOpt.bHideRecipients); + + pSetting->option.mmsSendOpt.replyCharging = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING); + + pSetting->option.mmsSendOpt.replyChargingDeadline = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE); + + pSetting->option.mmsSendOpt.replyChargingSize = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE); + + pSetting->option.mmsSendOpt.creationMode = MsgSettingGetInt(MMS_SEND_CREATION_MODE); +} + + +void MsgGetMMSRecvOpt(MSG_SETTING_S *pSetting) +{ + memset(&(pSetting->option.mmsRecvOpt), 0x00, sizeof(MSG_MMS_RECVOPT_S)); + + pSetting->option.mmsRecvOpt.homeNetwork = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_HOME_NETWORK); + + pSetting->option.mmsRecvOpt.abroadNetwok = (MSG_MMS_ABROAD_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK); + + MsgSettingGetBool(MMS_RECV_READ_RECEIPT, &pSetting->option.mmsRecvOpt.readReceipt); + + MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &pSetting->option.mmsRecvOpt.bDeliveryReceipt); + + MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &pSetting->option.mmsRecvOpt.bRejectUnknown); + + MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &pSetting->option.mmsRecvOpt.bRejectAdvertisement); +} + + +void MsgGetMMSStyleOpt(MSG_SETTING_S *pSetting) +{ + memset(&(pSetting->option.mmsStyleOpt), 0x00, sizeof(MSG_MMS_STYLEOPT_S)); + + pSetting->option.mmsStyleOpt.fontSize = MsgSettingGetInt(MMS_STYLE_FONT_SIZE); + + MsgSettingGetBool(MMS_STYLE_FONT_STYLE_BOLD, &pSetting->option.mmsStyleOpt.bFontStyleBold); + + MsgSettingGetBool(MMS_STYLE_FONT_STYLE_ITALIC, &pSetting->option.mmsStyleOpt.bFontStyleItalic); + + MsgSettingGetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, &pSetting->option.mmsStyleOpt.bFontStyleUnderline); + + pSetting->option.mmsStyleOpt.fontColorRed = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED); + + pSetting->option.mmsStyleOpt.fontColorGreen = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN); + + pSetting->option.mmsStyleOpt.fontColorBlue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE); + + pSetting->option.mmsStyleOpt.fontColorHue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE); + + pSetting->option.mmsStyleOpt.bgColorRed = MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED); + + pSetting->option.mmsStyleOpt.bgColorGreen = MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN); + + pSetting->option.mmsStyleOpt.bgColorBlue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE); + + pSetting->option.mmsStyleOpt.bgColorHue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE); + + pSetting->option.mmsStyleOpt.pageDur = MsgSettingGetInt(MMS_STYLE_PAGE_DUR); + + pSetting->option.mmsStyleOpt.pageCustomDur = MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR); + + pSetting->option.mmsStyleOpt.pageDurManual = MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL); +} + + +void MsgGetPushMsgOpt(MSG_SETTING_S *pSetting) +{ + memset(&(pSetting->option.pushMsgOpt), 0x00, sizeof(MSG_PUSHMSG_OPT_S)); + + MsgSettingGetBool(PUSH_RECV_OPTION, &pSetting->option.pushMsgOpt.bReceive); + + pSetting->option.pushMsgOpt.serviceType = (MSG_PUSH_SERVICE_TYPE_T)MsgSettingGetInt(PUSH_SERVICE_TYPE); +} + + +void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting) +{ + char keyName[DEF_BUF_LEN] = {0, }; + char *tmpValue = NULL; + + memset(&(pSetting->option.cbMsgOpt), 0x00, sizeof(MSG_CBMSG_OPT_S)); + + MsgSettingGetBool(CB_RECEIVE, &pSetting->option.cbMsgOpt.bReceive); + + MsgSettingGetBool(CB_ALL_CHANNEL, &pSetting->option.cbMsgOpt.bAllChannel); + + pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT); + + pSetting->option.cbMsgOpt.channelData.channelCnt = MsgSettingGetInt(CB_CHANNEL_COUNT); + + for (int i = 0; i < pSetting->option.cbMsgOpt.channelData.channelCnt; i++) + { + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ACTIVATE, i); + + MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.channelData.channelInfo[i].bActivate); + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID, i); + + pSetting->option.cbMsgOpt.channelData.channelInfo[i].id = MsgSettingGetInt(keyName); + + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_NAME, i); + + tmpValue = MsgSettingGetString(keyName); + if (tmpValue != NULL) { + strncpy(pSetting->option.cbMsgOpt.channelData.channelInfo[i].name, tmpValue, CB_CHANNEL_NAME_MAX); + free(tmpValue); + tmpValue = NULL; + } + } + + for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) + { + memset(keyName, 0x00, sizeof(keyName)); + snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_LANGUAGE, i); + + MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.bLanguage[i]); + } +} + + +void MsgGetVoiceMailOpt(MSG_SETTING_S *pSetting) +{ + char *tmpValue = NULL; + + memset(&(pSetting->option.voiceMailOpt), 0x00, sizeof(MSG_VOICEMAIL_OPT_S)); + + tmpValue = MsgSettingGetString(VOICEMAIL_NUMBER); + if (tmpValue != NULL) { + strncpy(pSetting->option.voiceMailOpt.mailNumber, tmpValue, MAX_PHONE_NUMBER_LEN); + free(tmpValue); + tmpValue = NULL; + } +} + + +void MsgGetMsgSizeOpt(MSG_SETTING_S *pSetting) +{ + memset(&(pSetting->option.msgSizeOpt), 0x00, sizeof(MSG_MSGSIZE_OPT_S)); + + pSetting->option.msgSizeOpt.nMsgSize = MsgSettingGetInt(MSGSIZE_OPTION); +} + + +MSG_ERROR_T MsgSetConfigInSim(const MSG_SETTING_S *pSetting) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + + // Get Setting Data from SIM + if (plg != NULL) + err = plg->setConfigData(pSetting); + else + err = MSG_ERR_NULL_POINTER; + + if (err != MSG_SUCCESS) + { + MSG_DEBUG("Error. Error code is %d.", err); + return err; + } + + return err; +} diff --git a/framework/storage-handler/MsgStorageFolder.cpp b/framework/storage-handler/MsgStorageFolder.cpp new file mode 100755 index 0000000..9eb8a93 --- /dev/null +++ b/framework/storage-handler/MsgStorageFolder.cpp @@ -0,0 +1,175 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MsgUtilStorage.h" +#include "MsgSqliteWrapper.h" +#include "MsgStorageHandler.h" + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +extern MsgDbHandler dbHandle; + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + unsigned int rowId = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + err = dbHandle.getRowId(MSGFW_FOLDER_TABLE_NAME, &rowId); + + if (err != MSG_SUCCESS) + return err; + + // Add Folder + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, '%s', %d);", + MSGFW_FOLDER_TABLE_NAME, rowId, pFolderInfo->folderName, pFolderInfo->folderType); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoUpdateFolder(const MSG_FOLDER_INFO_S *pFolderInfo) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + // Update Folder + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET FOLDER_NAME = '%s', FOLDER_TYPE = %d WHERE FOLDER_ID = %d;", + MSGFW_FOLDER_TABLE_NAME, pFolderInfo->folderName, pFolderInfo->folderType, pFolderInfo->folderId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoDeleteFolder(const MSG_FOLDER_ID_T FolderId) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + dbHandle.beginTrans(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE FOLDER_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, FolderId); + + // Delete Message in the folder from msg table + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE FOLDER_ID = %d;", + MSGFW_FOLDER_TABLE_NAME, FolderId); + + // Delete Message in the folder from msg table + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + // Clear Address table + if (MsgStoClearAddressTable(&dbHandle) != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + dbHandle.endTrans(true); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetFolderList(MSG_FOLDER_LIST_S *pFolderList) +{ + if (pFolderList == NULL) + { + MSG_DEBUG("pFolderList is NULL"); + return MSG_ERR_NULL_POINTER; + } + + int rowCnt = 0; + int index = 3; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FOLDER_ID, FOLDER_TYPE, FOLDER_NAME FROM %s;", + MSGFW_FOLDER_TABLE_NAME); + + if (dbHandle.getTable(sqlQuery, &rowCnt) != MSG_SUCCESS) + { + dbHandle.freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + pFolderList->nCount = rowCnt; + + MSG_DEBUG("pFolderList->nCount [%d]", pFolderList->nCount); + + pFolderList->folderInfo = (MSG_FOLDER_INFO_S*)new char[sizeof(MSG_FOLDER_INFO_S)*rowCnt]; + + MSG_FOLDER_INFO_S* pTmp = pFolderList->folderInfo; + + for (int i = 0; i < rowCnt; i++) + { + pTmp->folderId = dbHandle.getColumnToInt(index++); + + pTmp->folderType = dbHandle.getColumnToInt(index++); + + memset(pTmp->folderName, 0x00, sizeof(pTmp->folderName)); + dbHandle.getColumnToString(index++, MAX_FOLDER_NAME_SIZE, pTmp->folderName); + + pTmp++; + } + + dbHandle.freeTable(); + + return MSG_SUCCESS; +} + diff --git a/framework/storage-handler/MsgStorageManager.cpp b/framework/storage-handler/MsgStorageManager.cpp new file mode 100755 index 0000000..91a3fe7 --- /dev/null +++ b/framework/storage-handler/MsgStorageManager.cpp @@ -0,0 +1,828 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgUtilStorage.h" +#include "MsgGconfWrapper.h" +#include "MsgSqliteWrapper.h" +#include "MsgPluginManager.h" +#include "MsgStorageHandler.h" + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +MsgDbHandler dbHandle; + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgStoConnectDB() +{ + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoDisconnectDB() +{ + if (dbHandle.disconnect() != MSG_SUCCESS) + { + MSG_DEBUG("DB Disconnect Fail"); + return MSG_ERR_DB_DISCONNECT; + } + + MSG_DEBUG("DB Disconnect Success"); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoInitDB(bool bSimChanged) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + +#ifdef MSG_DB_CREATE + if (MsgCreateAddressTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateFolderTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateMsgTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateSimMessageTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateWAPMessageTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateCBMessageTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateSyncMLMessageTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateScheduledMessageTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateSmsSendOptTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateFilterTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateMmsMsgTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + if (MsgCreateMmsAttributeTable() != MSG_SUCCESS) + return MSG_ERR_DB_STORAGE_INIT; + + // Add Default Folders + if (MsgAddDefaultFolders() != MSG_SUCCESS) + { + MSG_DEBUG("Add Default Folders Fail"); + return MSG_ERR_DB_STORAGE_INIT; + } + + // Add Default Address + if (MsgAddDefaultAddress() != MSG_SUCCESS) + { + MSG_DEBUG("Add Default Address Fail"); + return MSG_ERR_DB_STORAGE_INIT; + } +#endif + + // Delete Msgs in Hidden Folder + MsgStoDeleteAllMessageInFolder(0, true, NULL); + + // Reset network status + MsgStoResetNetworkStatus(); + + //clear abnormal mms message + MsgStoCleanAbnormalMmsData(); + + // Clear all old Sim data + MsgStoClearSimMessageInDB(); + + int smsCnt = 0, mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + // Set Indicator + MsgSettingSetIndicator(smsCnt, mmsCnt); + + MSG_END(); + + return err; +} + + +MSG_ERROR_T MsgCreateAddressTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_ADDRESS_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + ADDRESS_ID INTEGER PRIMARY KEY, \ + ADDRESS_TYPE INTEGER, \ + RECIPIENT_TYPE INTEGER, \ + ADDRESS_VAL TEXT, \ + CONTACT_ID INTEGER, \ + DISPLAY_NAME TEXT, \ + FIRST_NAME TEXT, \ + LAST_NAME TEXT, \ + IMAGE_PATH TEXT, \ + SYNC_TIME DATETIME, \ + UNREAD_CNT INTEGER DEFAULT 0, \ + SMS_CNT INTEGER DEFAULT 0, \ + MMS_CNT INTEGER DEFAULT 0, \ + MAIN_TYPE INTEGER NOT NULL, \ + SUB_TYPE INTEGER NOT NULL, \ + MSG_DIRECTION INTEGER NOT NULL, \ + MSG_TIME DATETIME, \ + MSG_TEXT TEXT);", + MSGFW_ADDRESS_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_ADDRESS_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_ADDRESS_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateFolderTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_FOLDER_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + FOLDER_ID INTEGER PRIMARY KEY, \ + FOLDER_NAME TEXT NOT NULL, \ + FOLDER_TYPE INTEGER DEFAULT 0);", + MSGFW_FOLDER_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_FOLDER_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_FOLDER_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateMsgTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_MESSAGE_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER PRIMARY KEY, \ + ADDRESS_ID INTEGER, \ + FOLDER_ID INTEGER, \ + REFERENCE_ID INTEGER, \ + STORAGE_ID INTEGER NOT NULL, \ + MAIN_TYPE INTEGER NOT NULL, \ + SUB_TYPE INTEGER NOT NULL, \ + DISPLAY_TIME DATETIME, \ + DATA_SIZE INTEGER DEFAULT 0, \ + NETWORK_STATUS INTEGER DEFAULT 0, \ + READ_STATUS INTEGER DEFAULT 0, \ + PROTECTED INTEGER DEFAULT 0, \ + PRIORITY INTEGER DEFAULT 0, \ + MSG_DIRECTION INTEGER NOT NULL, \ + SCHEDULED_TIME DATETIME, \ + BACKUP INTEGER DEFAULT 0, \ + SUBJECT TEXT, \ + MSG_DATA TEXT, \ + THUMB_PATH TEXT, \ + MSG_TEXT TEXT, \ + DELIVERY_REPORT_STATUS INTEGER DEFAULT 0, \ + DELIVERY_REPORT_TIME DATETIME, \ + READ_REPORT_STATUS INTEGER DEFAULT 0, \ + READ_REPORT_TIME DATETIME, \ + ATTACHMENT_COUNT INTEGER DEFAULT 0, \ + FOREIGN KEY(ADDRESS_ID) REFERENCES %s(ADDRESS_ID), \ + FOREIGN KEY(FOLDER_ID) REFERENCES %s(FOLDER_ID) \ + );", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MSGFW_FOLDER_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_MESSAGE_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_MESSAGE_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateSimMessageTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_SIM_MSG_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER, \ + SIM_ID INTEGER NOT NULL, \ + FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID));", + MSGFW_SIM_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_SIM_MSG_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_SIM_MSG_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateWAPMessageTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_PUSH_MSG_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER, \ + ACTION INTEGER, \ + CREATED INTEGER, \ + EXPIRES INTEGER, \ + ID TEXT, \ + HREF TEXT, \ + CONTENT TEXT, \ + FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID));", + MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_PUSH_MSG_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_PUSH_MSG_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateCBMessageTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_CB_MSG_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER, \ + CB_MSG_ID INTEGER NOT NULL, \ + FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID));", + MSGFW_CB_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_CB_MSG_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_CB_MSG_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateSyncMLMessageTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_SYNCML_MSG_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER, \ + EXT_ID INTEGER NOT NULL, \ + PINCODE INTEGER NOT NULL, \ + FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID));", + MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_SYNCML_MSG_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_SYNCML_MSG_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateScheduledMessageTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_SCHEDULED_MSG_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER, \ + ALARM_ID INTEGER NOT NULL, \ + LISTENER_FD INTEGER NOT NULL, \ + FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID));", + MSGFW_SCHEDULED_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_SCHEDULED_MSG_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_SCHEDULED_MSG_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateSmsSendOptTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_SMS_SENDOPT_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER, \ + DELREP_REQ INTEGER NOT NULL, \ + KEEP_COPY INTEGER NOT NULL, \ + REPLY_PATH INTEGER NOT NULL, \ + FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID));", + MSGFW_SMS_SENDOPT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_SMS_SENDOPT_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_SMS_SENDOPT_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateFilterTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MSGFW_FILTER_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + FILTER_ID INTEGER PRIMARY KEY, \ + FILTER_TYPE INTEGER NOT NULL, \ + FILTER_VALUE TEXT NOT NULL);", + MSGFW_FILTER_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MSGFW_FILTER_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MSGFW_FILTER_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateMmsMsgTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MMS_PLUGIN_MESSAGE_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER, \ + TRANSACTION_ID TEXT, \ + MESSAGE_ID TEXT, \ + FWD_MESSAGE_ID TEXT, \ + CONTENTS_LOCATION TEXT, \ + FILE_PATH TEXT, \ + FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID));", + MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MMS_PLUGIN_MESSAGE_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MMS_PLUGIN_MESSAGE_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgCreateMmsAttributeTable() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + if (!dbHandle.checkTableExist(MMS_PLUGIN_ATTRIBUTE_TABLE_NAME)) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "CREATE TABLE %s ( \ + MSG_ID INTEGER, \ + VERSION INTEGER NOT NULL, \ + DATA_TYPE INTEGER DEFAULT -1, \ + DATE DATETIME, \ + HIDE_ADDRESS INTEGER DEFAULT 0, \ + ASK_DELIVERY_REPORT INTEGER DEFAULT 0, \ + REPORT_ALLOWED INTEGER DEFAULT 0, \ + READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0, \ + ASK_READ_REPLY INTEGER DEFAULT 0, \ + READ INTEGER DEFAULT 0, \ + READ_REPORT_SEND_STATUS INTEGER DEFAULT 0, \ + READ_REPORT_SENT INTEGER DEFAULT 0, \ + PRIORITY INTEGER DEFAULT 0, \ + KEEP_COPY INTEGER DEFAULT 0, \ + MSG_SIZE INTEGER NOT NULL, \ + MSG_CLASS INTEGER DEFAULT -1, \ + EXPIRY_TIME DATETIME, \ + CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0, \ + DELIVERY_TIME DATETIME, \ + MSG_STATUS INTEGER DEFAULT -1, \ + FOREIGN KEY(MSG_ID) REFERENCES %s(MSG_ID));", + MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = dbHandle.execQuery(sqlQuery); + + if (err == MSG_SUCCESS) + MSG_DEBUG("SUCCESS : create %s.", MMS_PLUGIN_ATTRIBUTE_TABLE_NAME); + else + MSG_DEBUG("FAIL : create %s [%d].", MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, err); + } + + return err; +} + + +MSG_ERROR_T MsgAddDefaultFolders() +{ + int nRowCnt = 0; + int nResult = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + // INBOX + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", + MSGFW_FOLDER_TABLE_NAME, MSG_INBOX_ID); + + if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) + { + dbHandle.freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + nResult = dbHandle.getColumnToInt(1); + + dbHandle.freeTable(); + + if (nResult == 0) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'INBOX', %d);", + MSGFW_FOLDER_TABLE_NAME, MSG_INBOX_ID, MSG_FOLDER_TYPE_INBOX); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + } + + // OUTBOX + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", + MSGFW_FOLDER_TABLE_NAME, MSG_OUTBOX_ID); + + if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) + { + dbHandle.freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + nResult = dbHandle.getColumnToInt(1); + + dbHandle.freeTable(); + + if (nResult == 0) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'OUTBOX', %d);", + MSGFW_FOLDER_TABLE_NAME, MSG_OUTBOX_ID, MSG_FOLDER_TYPE_OUTBOX); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + } + + // SENTBOX + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", + MSGFW_FOLDER_TABLE_NAME, MSG_SENTBOX_ID); + + if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) + { + dbHandle.freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + nResult = dbHandle.getColumnToInt(1); + + dbHandle.freeTable(); + + if (nResult == 0) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'SENTBOX', %d);", + MSGFW_FOLDER_TABLE_NAME, MSG_SENTBOX_ID, MSG_FOLDER_TYPE_OUTBOX); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + } + + // DRAFT + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", + MSGFW_FOLDER_TABLE_NAME, MSG_DRAFT_ID); + + if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) + { + dbHandle.freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + nResult = dbHandle.getColumnToInt(1); + + dbHandle.freeTable(); + + if (nResult == 0) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'DRAFT', %d);", + MSGFW_FOLDER_TABLE_NAME, MSG_DRAFT_ID, MSG_FOLDER_TYPE_DRAFT); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + } + + // CBMSGBOX + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", + MSGFW_FOLDER_TABLE_NAME, MSG_CBMSGBOX_ID); + + if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) + { + dbHandle.freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + nResult = dbHandle.getColumnToInt(1); + + dbHandle.freeTable(); + + if (nResult == 0) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 'CBMSGBOX', %d);", + MSGFW_FOLDER_TABLE_NAME, MSG_CBMSGBOX_ID, MSG_FOLDER_TYPE_INBOX); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgAddDefaultAddress() +{ + MSG_BEGIN(); + + int nRowCnt = 0, nResult = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE ADDRESS_ID = 0;", + MSGFW_ADDRESS_TABLE_NAME); + + if (dbHandle.getTable(sqlQuery, &nRowCnt) != MSG_SUCCESS) + { + dbHandle.freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + nResult = dbHandle.getColumnToInt(1); + + dbHandle.freeTable(); + + if (nResult == 0) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (0, 0, 0, '', 0, '', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '');", + MSGFW_ADDRESS_TABLE_NAME); + + MSG_DEBUG("%s", sqlQuery); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoResetDatabase() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + const char* tableList[] = {MSGFW_FOLDER_TABLE_NAME, MSGFW_FILTER_TABLE_NAME, + MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME, + MMS_PLUGIN_MESSAGE_TABLE_NAME, MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, + MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SCHEDULED_MSG_TABLE_NAME, MSGFW_SMS_SENDOPT_TABLE_NAME}; + + int listCnt = sizeof(tableList)/sizeof(char*); + + dbHandle.beginTrans(); + + // Delete Database + for (int i = 0; i < listCnt; i++) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", tableList[i]); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } + + // Delete Message Table + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE STORAGE_ID <> %d;", + MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + // Delete Address Table + err = MsgStoClearAddressTable(&dbHandle); + + if (err != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return err; + } + + // Add Default Folders + if (MsgAddDefaultFolders() != MSG_SUCCESS) + { + MSG_DEBUG("Add Default Folders Fail"); + dbHandle.endTrans(false); + return MSG_ERR_DB_STORAGE_INIT; + } + + // Add Default Address + if (MsgAddDefaultAddress() != MSG_SUCCESS) + { + MSG_DEBUG("Add Default Address Fail"); + dbHandle.endTrans(false); + return MSG_ERR_DB_STORAGE_INIT; + } + + dbHandle.endTrans(true); + + // Delete MMS Files + MsgRmRf((char*)MSG_DATA_PATH); + MsgRmRf((char*)MSG_SMIL_FILE_PATH); + + // Reset SMS Count + if (MsgSettingSetIndicator(0, 0) != MSG_SUCCESS) + { + MSG_DEBUG("MsgSettingSetIndicator() FAILED"); + return MSG_ERR_SET_SETTING; + } + + // Reset MMS Count + if (MsgSettingSetIndicator(0, 0) != MSG_SUCCESS) + { + MSG_DEBUG("MsgSettingSetIndicator() FAILED"); + return MSG_ERR_SET_SETTING; + } + + return MSG_SUCCESS; +} diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp new file mode 100755 index 0000000..6a95817 --- /dev/null +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -0,0 +1,3327 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "MsgDebug.h" +#include "MsgCppTypes.h" +#include "MsgContact.h" +#include "MsgUtilFile.h" +#include "MsgMutex.h" +#include "MsgUtilStorage.h" +#include "MsgSoundPlayer.h" +#include "MsgGconfWrapper.h" +#include "MsgSqliteWrapper.h" +#include "MsgPluginManager.h" +#include "MsgStorageHandler.h" +#include "MsgNotificationWrapper.h" +#include "MsgMmsMessage.h" + +using namespace std; + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +extern MsgDbHandler dbHandle; + +static unsigned int refId = 0; + +Mutex delNotiMx; +CndVar delNoticv; +bool delNotiRunning = false; + +Mutex delLogMx; +CndVar delLogcv; +bool delLogRunning = false; + + +/*================================================================================================== + FUNCTION FOR THREAD +==================================================================================================*/ +static gboolean startToDeleteNoti(void *pVoid) +{ + MSG_BEGIN(); + + MSG_MSGID_LIST_S *pMsgIdList = (MSG_MSGID_LIST_S *)pVoid; + + MSG_DEBUG("pMsgIdList->nCount [%d]", pMsgIdList->nCount); + + delNotiMx.lock(); + + while (delNotiRunning) { + delNoticv.wait(delNotiMx.pMutex()); + } + + delNotiRunning = true; + + for (int i = 0; i < pMsgIdList->nCount; i++) { + MsgDeleteNotiByMsgId(pMsgIdList->msgIdList[i]); + + /** sleep for moment */ + if ((i%100 == 0) && (i != 0)) + usleep(70000); + } + + delNotiRunning = false; + + delNoticv.signal(); + delNotiMx.unlock(); + + // memory free + if (pMsgIdList != NULL) { + //free peer info list + if (pMsgIdList->msgIdList != NULL) + delete [] pMsgIdList->msgIdList; + + delete [] pMsgIdList; + } + + MSG_END(); + + return FALSE; +} + + +static gboolean updateUnreadMsgCount(void *pVoid) +{ + MSG_BEGIN(); + + int smsCnt = 0; + int mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + MsgSettingSetIndicator(smsCnt, mmsCnt); + + MSG_END(); + + return FALSE; +} + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, int addrIdx) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + unsigned int rowId = 0; + unsigned int addrId = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + dbHandle.beginTrans(); + + if (pMsg->nAddressCnt > 0) { + err = MsgStoAddAddress(&dbHandle, &(pMsg->addressList[addrIdx]), &addrId); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + return err; + } + + pMsg->addressList[addrIdx].threadId = (MSG_THREAD_ID_T)addrId; + } + + err = dbHandle.getRowId(MSGFW_MESSAGE_TABLE_NAME, &rowId); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + return err; + } + + pMsg->msgId = (MSG_MESSAGE_ID_T)rowId; + + if (addrIdx == 0) + refId = pMsg->msgId; + + pMsg->referenceId = refId; + + int fileSize = 0; + + char *pFileData = NULL; + AutoPtr buf(&pFileData); + + // Get File Data + if (pMsg->bTextSms == false) { + if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { + dbHandle.endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + MSG_DEBUG("file size [%d]", fileSize); + } + + // Add Message + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, %d, 0, %d, 0, 0);", + MSGFW_MESSAGE_TABLE_NAME, rowId, addrId, pMsg->folderId, pMsg->referenceId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, + pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, + pMsg->scheduledTime, pMsg->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE); + + MSG_DEBUG("QUERY : %s", sqlQuery); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + dbHandle.bindText(pMsg->subject, 1); + + dbHandle.bindText(pMsg->msgData, 2); + + dbHandle.bindText(pMsg->thumbPath, 3); + + if (pMsg->bTextSms == false) + dbHandle.bindText(pFileData, 4); + else + dbHandle.bindText(pMsg->msgText, 4); + + if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { + dbHandle.finalizeQuery(); + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + dbHandle.finalizeQuery(); + + if (pMsg->msgType.subType != MSG_SENDREQ_MMS) { + err = MsgStoUpdateAddress(&dbHandle, addrId); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + return err; + } + } + + dbHandle.endTrans(true); + + /* In the case of MMS Message, load the MMS plugin to save MMS PDU */ + if (pMsg->msgType.mainType == MSG_MMS_TYPE) { + MMS_MESSAGE_DATA_S mmsMsg; + memset(&mmsMsg, 0x00, sizeof(MMS_MESSAGE_DATA_S)); + + if (pMsg->dataSize == 0) { + MSG_DEBUG("pMsg->dataSize == 0, So Making emtpy MMS body."); + char * tempMmsBody = _MsgMmsSerializeMessageData(&mmsMsg, &(pMsg->dataSize)); + memcpy(&pMsg->msgText, tempMmsBody, pMsg->dataSize); + free(tempMmsBody); + } + + if (pMsg->msgType.subType != MSG_DELIVERYIND_MMS && pMsg->msgType.subType != MSG_READORGIND_MMS) { + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE); + + //pMsg->msgId = pMsg->refernceId; + + err = plg->addMessage(pMsg, pSendOptInfo, pFileData); + + if (err != MSG_SUCCESS) + return MSG_ERR_STORAGE_ERROR; + + if (pMsg->msgType.subType == MSG_SENDREQ_MMS) { + MSG_DEBUG("pMsg->msgText: %s, pMsg->thumbPath: %s ", pMsg->msgText, pMsg->thumbPath); + + err = MsgStoUpdateMMSMessage(pMsg); + + if (err != MSG_SUCCESS) + return MSG_ERR_STORAGE_ERROR; + + } + } + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, int addrIdx) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + unsigned int addrId = 0; + + dbHandle.beginTrans(); + + if (pMsg->nAddressCnt > 0) { + err = MsgStoAddAddress(&dbHandle, &(pMsg->addressList[addrIdx]), &addrId); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + return err; + } + } + + int fileSize = 0; + + char *pFileData = NULL; + AutoPtr buf(&pFileData); + + // Get File Data + if (pMsg->bTextSms == false) { + if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { + dbHandle.endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + } + + if (pSendOptInfo != NULL) { + // Get Global setting value if bSetting == false + if (pSendOptInfo->bSetting == false) { + MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy); + + if (pMsg->msgType.mainType == MSG_SMS_TYPE) { + MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq); + MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath); + } else if (pMsg->msgType.mainType == MSG_MMS_TYPE) { + MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq); + MsgSettingGetBool(MMS_SEND_READ_REPLY, &pSendOptInfo->option.mmsSendOptInfo.bReadReq); + pSendOptInfo->option.mmsSendOptInfo.expiryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME); + + MSG_MMS_DELIVERY_TIME_T deliveryTime = (MSG_MMS_DELIVERY_TIME_T)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); + + if (deliveryTime == MSG_DELIVERY_TIME_CUSTOM) { + pSendOptInfo->option.mmsSendOptInfo.bUseDeliveryCustomTime = true; + pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY); + } else { + pSendOptInfo->option.mmsSendOptInfo.bUseDeliveryCustomTime = false; + pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time = (unsigned int)deliveryTime; + } + + pSendOptInfo->option.mmsSendOptInfo.priority = (MSG_PRIORITY_TYPE_T)MsgSettingGetInt(MMS_SEND_PRIORITY); + } + } + } + + // Update Message + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ADDRESS_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, SCHEDULED_TIME = %lu, BACKUP = %d, SUBJECT = ?, MSG_DATA = ?, THUMB_PATH = ?, MSG_TEXT = ? \ + WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, addrId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->dataSize, + pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, pMsg->scheduledTime, pMsg->bBackup, pMsg->msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + dbHandle.bindText(pMsg->subject, 1); + + dbHandle.bindText(pMsg->msgData, 2); + + dbHandle.bindText(pMsg->thumbPath, 3); + + if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->bTextSms == false) + dbHandle.bindText(pFileData, 4); + else + dbHandle.bindText(pMsg->msgText, 4); + + MSG_DEBUG("%s", sqlQuery); + + if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { + dbHandle.finalizeQuery(); + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + dbHandle.finalizeQuery(); + + if (pMsg->msgType.mainType == MSG_SMS_TYPE && pSendOptInfo != NULL) { + if (pSendOptInfo->bSetting == true) { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET DELREP_REQ = %d, KEEP_COPY = %d, REPLY_PATH = %d \ + WHERE MSG_ID = %d;", + MSGFW_SMS_SENDOPT_TABLE_NAME, pSendOptInfo->bDeliverReq, pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath, pMsg->msgId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } + } else if (pMsg->msgType.mainType == MSG_MMS_TYPE) { + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE); + + err = plg->updateMessage(pMsg, pSendOptInfo, pFileData); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + } + + err = MsgStoUpdateAddress(&dbHandle, addrId); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + + err = MsgStoClearAddressTable(&dbHandle); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + + dbHandle.endTrans(true); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoUpdateReadStatus(MSG_MESSAGE_ID_T MsgId, bool bRead) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + MSG_STORAGE_ID_T storageId; + + if (MsgStoSetReadStatus(&dbHandle, MsgId, bRead) != MSG_SUCCESS) { + MSG_DEBUG("MsgStoUpdateAddress() Error"); + return MSG_ERR_STORAGE_ERROR; + } + + // Get STORAGE_ID + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT STORAGE_ID \ + FROM %s \ + WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + storageId = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + MSG_DEBUG("StorageId:[%d]", storageId); + + // Update Read Status for SIM Msg + if (storageId == MSG_STORAGE_SIM) { + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + + if (plg == NULL) { + MSG_DEBUG("SMS Plug-in is NULL"); + return MSG_ERR_NULL_POINTER; + } + + // Get SIM Msg ID + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_ID FROM %s WHERE MSG_ID = %d;", + MSGFW_SIM_MSG_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + MSG_SIM_ID_T simId; + + while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + simId = dbHandle.columnInt(0); + + if (plg->setReadStatus(simId) != MSG_SUCCESS) { + MSG_DEBUG("Fail to Set Read Status for SIM SMS"); + continue; + } + } + + dbHandle.finalizeQuery(); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoUpdateThreadReadStatus(MSG_THREAD_ID_T ThreadId) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + int rowCnt = 0; + int index = 1; + MSG_MSGID_LIST_S *pUnreadMsgIdList = NULL; + + pUnreadMsgIdList = (MSG_MSGID_LIST_S *)new char[sizeof(MSG_MSGID_LIST_S)]; + memset(pUnreadMsgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + char sqlQuery[MAX_QUERY_LEN+1]; + + // Get MSG_ID List + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID \ + FROM %s A \ + WHERE ADDRESS_ID = %d AND READ_STATUS = 0;", + MSGFW_MESSAGE_TABLE_NAME, ThreadId); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + dbHandle.freeTable(); + return err; + } + + pUnreadMsgIdList->nCount = rowCnt; + + MSG_DEBUG("unreadMsgIdList.nCount [%d]", pUnreadMsgIdList->nCount); + + pUnreadMsgIdList->msgIdList = (MSG_MESSAGE_ID_T *)new char[sizeof(MSG_MESSAGE_ID_T) * rowCnt]; + + for (int i = 0; i < rowCnt; i++) + pUnreadMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++); + + dbHandle.freeTable(); + + + // Get sim MSG_ID + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID \ + FROM %s A \ + WHERE ADDRESS_ID = %d AND READ_STATUS = 0 AND STORAGE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, ThreadId, MSG_STORAGE_SIM); + + rowCnt = 0; + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + dbHandle.freeTable(); + return err; + } + + for (int i = 1; i <= rowCnt; i++) { + MsgStoUpdateReadStatus(dbHandle.getColumnToInt(i), true); + } + + dbHandle.freeTable(); + + // set read status + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_STATUS = %d \ + WHERE ADDRESS_ID = %d AND READ_STATUS = 0;", + MSGFW_MESSAGE_TABLE_NAME, 1, ThreadId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + + if (MsgStoUpdateAddress(&dbHandle, ThreadId) != MSG_SUCCESS) { + MSG_DEBUG("MsgStoUpdateAddress() Error"); + return MSG_ERR_STORAGE_ERROR; + } + + if (g_idle_add(updateUnreadMsgCount, NULL) == 0) { + MSG_DEBUG("updateUnreadMsgCount() Error"); + } + + if (pUnreadMsgIdList->nCount > 0) { + if (g_idle_add(startToDeleteNoti, (void *)pUnreadMsgIdList) == 0) { + MSG_DEBUG("startToDeleteNoti not invoked: %s", strerror(errno)); + // memory free + if (pUnreadMsgIdList != NULL) { + //free peer info list + if (pUnreadMsgIdList->msgIdList != NULL) + delete [] pUnreadMsgIdList->msgIdList; + + delete [] pUnreadMsgIdList; + } + err = MSG_ERR_UNKNOWN; + } + } + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoUpdateProtectedStatus(MSG_MESSAGE_ID_T MsgId, bool bProtected) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET PROTECTED = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, (int)bProtected, MsgId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoDeleteMessage(MSG_MESSAGE_ID_T MsgId, bool bCheckIndication) +{ + MSG_BEGIN(); + + MSG_DEBUG("Msg Id : %d", MsgId); + + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + // Get SUB_TYPE, STORAGE_ID + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MAIN_TYPE, A.SUB_TYPE, A.FOLDER_ID, A.STORAGE_ID, A.READ_STATUS, B.CONTACT_ID, B.ADDRESS_ID \ + FROM %s A, %s B \ + WHERE A.MSG_ID = %d AND A.ADDRESS_ID = B.ADDRESS_ID;", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + MSG_MESSAGE_TYPE_S msgType; + MSG_FOLDER_ID_T folderId; + MSG_STORAGE_ID_T storageId; + MSG_CONTACT_ID_T contactId; + + bool bRead; + unsigned int addrId; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + msgType.mainType = dbHandle.columnInt(0); + msgType.subType = dbHandle.columnInt(1); + folderId = dbHandle.columnInt(2); + storageId = dbHandle.columnInt(3); + bRead = dbHandle.columnInt(4); + contactId = dbHandle.columnInt(5); + addrId = dbHandle.columnInt(6); + + MSG_DEBUG("Main Type:[%d] SubType:[%d] FolderId:[%d] StorageId:[%d] ContactId:[%d] AddressId:[%d]", msgType.mainType, msgType.subType, folderId, storageId, contactId, addrId); + } else { + MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery); + + dbHandle.finalizeQuery(); + + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + + if (plg == NULL) { + MSG_DEBUG("SMS Plug-in is NULL"); + + return MSG_ERR_NULL_POINTER; + } + + dbHandle.beginTrans(); + + // Check sim message + if (storageId == MSG_STORAGE_SIM) { + // get sim message id + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_ID FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, MsgId); + + MSG_DEBUG("sqlQuery is [%s]", sqlQuery); + + MSG_SIM_ID_T simMsgId; + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_PREPARE; + } + + while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + simMsgId = dbHandle.columnInt(0); + + MSG_DEBUG("SIM Msg Id : [%d]", simMsgId); + + err = plg->deleteSimMessage(simMsgId); + + if (err != MSG_SUCCESS) { + dbHandle.finalizeQuery(); + dbHandle.endTrans(false); + return err; + } + + //Sim message delete in db table + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE SIM_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, simMsgId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.finalizeQuery(); + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } + + dbHandle.finalizeQuery(); + } + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SCHEDULED_MSG_TABLE_NAME, MsgId); + + // Delete Message from scheduled msg table + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + if (msgType.mainType == MSG_SMS_TYPE) { + 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 + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + if (msgType.subType == MSG_CB_SMS || msgType.subType == MSG_JAVACB_SMS) { + 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 + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } else if (msgType.subType >= MSG_WAP_SI_SMS && msgType.subType <= MSG_WAP_CO_SMS) { + 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 + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } else if (msgType.subType == MSG_SYNCML_CP) { + 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 + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } + } else if (msgType.mainType == MSG_MMS_TYPE) { + //get multiple recipient message count + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MsgId); + + int rowCnt = 0; + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS) { + dbHandle.freeTable(); + return err; + } + + dbHandle.freeTable(); + MSG_DEBUG("rowCnt = %d", rowCnt); + + if (rowCnt == 1) { + char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + char thumbnailpath[MSG_FILEPATH_LEN_MAX] = {0,}; + char dirPath[MSG_FILEPATH_LEN_MAX]= {0,}; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_PREPARE; + } + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX); + + snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath); + + if (remove(filePath) == -1) + MSG_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_DEBUG("Success to delete file [%s]", filePath); + + MsgRmRf(dirPath); + rmdir(dirPath); + + // remove thumbnail file + char *fileName = NULL; + fileName = strrchr(filePath, '/'); + + snprintf(thumbnailpath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", fileName+1); + if(remove(thumbnailpath) == -1) + MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailpath); + else + MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailpath); + } else { + MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery); + dbHandle.finalizeQuery(); + dbHandle.endTrans(false); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + const char *tableList[] = {MMS_PLUGIN_MESSAGE_TABLE_NAME, MMS_PLUGIN_ATTRIBUTE_TABLE_NAME}; + + int listCnt = sizeof(tableList)/sizeof(char *); + + for (int i = 0; i < listCnt; i++) { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + tableList[i], MSGFW_MESSAGE_TABLE_NAME, MsgId); + + // Delete Data from MMS table + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } + } else { + MSG_DEBUG("There is more multi-recipient mms. MMS DB table is not destroyed"); + } + } + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, MsgId); + + // Delete Message from msg table + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + // Clear Address table + if (MsgStoClearAddressTable(&dbHandle) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + // Update Address Info. + if (MsgStoUpdateAddress(&dbHandle, addrId) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + + dbHandle.endTrans(true); + + if (msgType.mainType == MSG_SMS_TYPE && folderId == MSG_INBOX_ID) { + msgType.classType = MSG_CLASS_NONE; + + // Set memory status in SIM + if (MsgStoCheckMsgCntFull(&dbHandle, &msgType, folderId) == MSG_SUCCESS) { + MSG_DEBUG("Set Memory Status"); + + plg->setMemoryStatus(MSG_SUCCESS); + } + } + + if (bCheckIndication == true) { + MSG_DEBUG("bCheckIndication is true."); + + int smsCnt = 0; + int mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + MsgSettingSetIndicator(smsCnt, mmsCnt); + + MsgDeleteNotiByMsgId(MsgId); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoDeleteAllMessageInFolder(MSG_FOLDER_ID_T FolderId, bool bOnlyDB, MSG_MSGID_LIST_S *pMsgIdList) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + queue threadList; + + const char *tableList[] = {MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME, + MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SCHEDULED_MSG_TABLE_NAME, + MSGFW_SMS_SENDOPT_TABLE_NAME, MMS_PLUGIN_MESSAGE_TABLE_NAME, + MSGFW_MESSAGE_TABLE_NAME}; + + int listCnt = sizeof(tableList)/sizeof(char *); + int rowCnt = 0; + + // Get Address ID in Folder + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(B.ADDRESS_ID) \ + FROM %s A, %s B \ + WHERE A.ADDRESS_ID = B.ADDRESS_ID \ + AND A.FOLDER_ID = %d", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, FolderId); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("sql query is %s.", sqlQuery); + + dbHandle.freeTable(); + return err; + } + + if (rowCnt <= 0) { + dbHandle.freeTable(); + + return MSG_SUCCESS; + } + + for (int i = 1; i <= rowCnt; i++) { + MSG_DEBUG("thread ID : %d", dbHandle.getColumnToInt(i)); + threadList.push((MSG_THREAD_ID_T)dbHandle.getColumnToInt(i)); + } + + dbHandle.freeTable(); + + /*** Get msg id list **/ + MSG_MSGID_LIST_S *pToDeleteMsgIdList = NULL; + pToDeleteMsgIdList = (MSG_MSGID_LIST_S *)new char[sizeof(MSG_MSGID_LIST_S)]; + memset(pToDeleteMsgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d", + MSGFW_MESSAGE_TABLE_NAME, FolderId); + + rowCnt = 0; + int index = 1; + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + dbHandle.freeTable(); + + goto FREE_MEMORY; + } + + if (rowCnt <= 0) { + dbHandle.freeTable(); + err = MSG_SUCCESS; + + goto FREE_MEMORY; + } + + pToDeleteMsgIdList->nCount = rowCnt; + + MSG_DEBUG("pToDeleteMsgIdList->nCount [%d]", pToDeleteMsgIdList->nCount); + + pToDeleteMsgIdList->msgIdList = (MSG_MESSAGE_ID_T *)new char[sizeof(MSG_MESSAGE_ID_T) * rowCnt]; + + for (int i = 0; i < rowCnt; i++) + pToDeleteMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++); + + dbHandle.freeTable(); + /*** **/ + + /*** Delete Sim Message In Folder **/ + if (FolderId >= MSG_INBOX_ID) { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s \ + WHERE FOLDER_ID = %d AND STORAGE_ID = %d", + MSGFW_MESSAGE_TABLE_NAME, FolderId, MSG_STORAGE_SIM); + + MSG_DEBUG("sql query is %s.", sqlQuery); + + rowCnt = 0; + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + dbHandle.freeTable(); + + goto FREE_MEMORY; + } + + for (int i = 1; i <= rowCnt; i++) { + err = MsgStoDeleteMessage(dbHandle.getColumnToInt(i), false); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgStoDeleteMessage() Error!!!"); + + dbHandle.freeTable(); + + goto FREE_MEMORY; + } + } + + dbHandle.freeTable(); + } + + dbHandle.beginTrans(); + + for (int i = 0; i < listCnt; i++) { + if (!strcmp(tableList[i], MMS_PLUGIN_MESSAGE_TABLE_NAME)) { + //MMS_PLUGIN_MESSAGE_TABLE and MMS_PLUGIN_ATTRIBUTE_TABLE will be updated together + int rowCnt = 0; + int msgCnt = 0; + int index = 2; + + //get mms msg id list + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, REFERENCE_ID FROM %s \ + WHERE FOLDER_ID = %d AND MAIN_TYPE = %d", + MSGFW_MESSAGE_TABLE_NAME, FolderId, MSG_MMS_TYPE); + + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + MSG_DEBUG("rowCnt %d", rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + dbHandle.freeTable(); + dbHandle.endTrans(false); + + goto FREE_MEMORY; + } + + for (int i = 1; i <= rowCnt; i++) { + int msgId = 0; + int refId = 0; + + msgId = dbHandle.getColumnToInt(index++); + refId = dbHandle.getColumnToInt(index++); + + //get multiple recipient message count + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE REFERENCE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, refId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_PREPARE; + + goto FREE_MEMORY; + } + + msgCnt = 0; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + msgCnt = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_STEP; + + goto FREE_MEMORY; + } + + dbHandle.finalizeQuery(); + + //delete mms raw file and db(mms_table and mms_attr_table) data + if (msgCnt == 1) { + char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + char dirPath[MSG_FILEPATH_LEN_MAX] = {0,}; + char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,}; + + //get raw file_path + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE REFERENCE_ID = %d;", + MMS_PLUGIN_MESSAGE_TABLE_NAME, refId); + + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_PREPARE; + + goto FREE_MEMORY; + } + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX); + } else { + dbHandle.finalizeQuery(); + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_STEP; + + goto FREE_MEMORY; + } + + dbHandle.finalizeQuery(); + + MSG_DEBUG("filePath [%s]", filePath); + + //delete raw file + snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); + + if (remove(filePath) == -1) + MSG_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_DEBUG("Success to delete file [%s]", filePath); + + MsgRmRf(dirPath); + rmdir(dirPath); + // delete thumbanil + + char *fileName = NULL; + fileName = strrchr(filePath, '/'); + + snprintf(thumbnailPath, sizeof(thumbnailPath), MSG_THUMBNAIL_PATH"%s.jpg", fileName+1); + + if (remove(thumbnailPath) == -1) + MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailPath); + else + MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailPath); + + //delete MMS_PLUGIN_MESSAGE_TABLE_NAME table data + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE REFERENCE_ID = %d;", + MMS_PLUGIN_MESSAGE_TABLE_NAME, refId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_EXEC; + + goto FREE_MEMORY; + } + + //delete MMS_PLUGIN_ATTRIBUTE_TABLE_NAME table data + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE REFERENCE_ID = %d;", + MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, refId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_EXEC; + + goto FREE_MEMORY; + } + } else { + MSG_DEBUG("There is remained multi-recipient mms for this msg = %d", msgId); + } + } + + dbHandle.freeTable(); + } else { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN \ + (SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d);", + tableList[i], MSGFW_MESSAGE_TABLE_NAME, FolderId); + + // Delete Message in specific folder from table + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbHandle.endTrans(false); + err = MSG_ERR_DB_EXEC; + + goto FREE_MEMORY; + } + } + } + + // Clear Address table + if (MsgStoClearAddressTable(&dbHandle) != MSG_SUCCESS) { + dbHandle.endTrans(false); + err = MSG_ERR_DB_EXEC; + + goto FREE_MEMORY; + } + + // Update Address + while (!threadList.empty()) { + err = MsgStoUpdateAddress(&dbHandle, threadList.front()); + + threadList.pop(); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + + goto FREE_MEMORY; + } + } + + dbHandle.endTrans(true); + + if (FolderId == MSG_INBOX_ID) { + int smsCnt = 0; + int mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + MsgSettingSetIndicator(smsCnt, mmsCnt); + } + +/*** Set pMsgIdList **/ + if (pMsgIdList != NULL && pToDeleteMsgIdList->nCount > 0) { + pMsgIdList->nCount = pToDeleteMsgIdList->nCount; + + pMsgIdList->msgIdList = (MSG_MESSAGE_ID_T *)new char[sizeof(MSG_MESSAGE_ID_T)*pToDeleteMsgIdList->nCount]; + memcpy(pMsgIdList->msgIdList, pToDeleteMsgIdList->msgIdList, sizeof(MSG_MESSAGE_ID_T)*pToDeleteMsgIdList->nCount); + } +/*** **/ + +/*** Create thread for noti delete. **/ + if (!bOnlyDB) { + if (pToDeleteMsgIdList->nCount > 0) { + + if (g_idle_add(startToDeleteNoti, (void *)pToDeleteMsgIdList) == 0) { + MSG_DEBUG("startToDeleteNoti not invoked: %s", strerror(errno)); + // memory free + if (pToDeleteMsgIdList != NULL) { + //free peer info list + if (pToDeleteMsgIdList->msgIdList != NULL) + delete [] pToDeleteMsgIdList->msgIdList; + + delete [] pToDeleteMsgIdList; + } + err = MSG_ERR_UNKNOWN; + } + } + } +/*** **/ + + return MSG_SUCCESS; + +FREE_MEMORY: + MSG_DEBUG("Error case Free Memory"); + + while (!threadList.empty()) { + threadList.front(); + threadList.pop(); + } + + // memory free + if (pToDeleteMsgIdList != NULL) { + //free peer info list + if (pToDeleteMsgIdList->msgIdList != NULL) + delete [] pToDeleteMsgIdList->msgIdList; + + delete [] pToDeleteMsgIdList; + } + + return err; + +} + + +MSG_ERROR_T MsgStoMoveMessageToFolder(MSG_MESSAGE_ID_T MsgId, MSG_FOLDER_ID_T DestFolderId) +{ + MSG_MESSAGE_TYPE_S msgType; + + MsgStoGetMsgType(MsgId, &msgType); + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if (msgType.mainType == MSG_SMS_TYPE) { + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET FOLDER_ID = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, DestFolderId, MsgId); + } else { + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET FOLDER_ID = %d WHERE REFERENCE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, DestFolderId, MsgId); + } + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + unsigned int addrId = 0; + /* get address id */ + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_ID FROM %s WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + addrId = dbHandle.columnInt(0); + } + MSG_DEBUG("addrId : %d", addrId); + + dbHandle.finalizeQuery(); + + /* update address table */ + MsgStoUpdateAddress(&dbHandle, addrId); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoMoveMessageToStorage(MSG_MESSAGE_ID_T MsgId, MSG_STORAGE_ID_T DestStorageId) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + MSG_DEBUG("MsgId : %d, DestStorageId : %d", MsgId, DestStorageId); + + switch (DestStorageId) { + case MSG_STORAGE_SIM : // Move message to sim card + { + MSG_MESSAGE_INFO_S msgInfo; + SMS_SIM_ID_LIST_S simIdList; + + memset(&simIdList, 0x00, sizeof(SMS_SIM_ID_LIST_S)); + + if ((err = MsgStoGetMessage(MsgId, &msgInfo, NULL)) != MSG_SUCCESS) + return err; + + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + + if ((err = plg->saveSimMessage(&msgInfo, &simIdList)) != MSG_SUCCESS) + return err; + + dbHandle.beginTrans(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET STORAGE_ID = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, DestStorageId, MsgId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + for (unsigned int i = 0; i < simIdList.count; i++) { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);", + MSGFW_SIM_MSG_TABLE_NAME, MsgId, simIdList.simId[i]); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } + + dbHandle.endTrans(true); + } + break; + + default: //Moving message to memory (when destination storage id is MSG_STORAGE_PHONE) + { + bool bSimMsg = false; + int rowCnt = 0; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT STORAGE_ID FROM %s WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MsgId); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS) { + dbHandle.freeTable(); + return err; + } + + if (dbHandle.getColumnToInt(1) == MSG_STORAGE_SIM) { + MSG_DEBUG("It is SIM Message"); + bSimMsg = true; + } + + dbHandle.freeTable(); + + if (bSimMsg == true) { + MSG_SIM_ID_T simMsgId; + + // get sim message id + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_ID FROM %s WHERE MSG_ID = %d;", + MSGFW_SIM_MSG_TABLE_NAME, MsgId); + + MSG_DEBUG("sqlQuery is %s.", sqlQuery); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS) { + dbHandle.freeTable(); + return err; + } + + //Delete messages in sim card + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + + for (int i = 0; i < rowCnt; i++) { + simMsgId = dbHandle.getColumnToInt(i+1); + + MSG_DEBUG("simMsgId is %d.", simMsgId); + + if ((err = plg->deleteSimMessage(simMsgId)) != MSG_SUCCESS) { + dbHandle.freeTable(); + return err; + } + } + + dbHandle.freeTable(); + + dbHandle.beginTrans(); + + //Delete Messages in SIM Msg table + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", + MSGFW_SIM_MSG_TABLE_NAME, MsgId); + MSG_DEBUG("sqlQuery is %s.", sqlQuery); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + //Move storage id + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET STORAGE_ID = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, DestStorageId, MsgId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + dbHandle.endTrans(true); + } + } + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoCountMessage(MSG_FOLDER_ID_T FolderId, MSG_COUNT_INFO_S *pCountInfo) +{ + if (pCountInfo == NULL) { + MSG_DEBUG("pCountInfo is NULL"); + return MSG_ERR_NULL_POINTER; + } + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND READ_STATUS = 1 \ + UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND READ_STATUS = 0 \ + UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d \ + UNION ALL SELECT COUNT(MSG_ID) FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d ;", + MSGFW_MESSAGE_TABLE_NAME, FolderId, + MSGFW_MESSAGE_TABLE_NAME, FolderId, + MSGFW_MESSAGE_TABLE_NAME, FolderId, MSG_SMS_TYPE, + MSGFW_MESSAGE_TABLE_NAME, FolderId, MSG_MMS_TYPE); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pCountInfo->nReadCnt = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pCountInfo->nUnreadCnt = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pCountInfo->nSms = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pCountInfo->nMms = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount) +{ + if (pMsgType == NULL) { + MSG_DEBUG("pMsgType is NULL"); + return MSG_ERR_NULL_POINTER; + } + + *pMsgCount = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + // SMS + if ((pMsgType->mainType == MSG_SMS_TYPE) && + (pMsgType->subType == MSG_NORMAL_SMS || pMsgType->subType == MSG_STATUS_REPORT_SMS || pMsgType->subType == MSG_CONCAT_SIM_SMS)) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d, %d);", + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_NORMAL_SMS, MSG_STATUS_REPORT_SMS, MSG_CONCAT_SIM_SMS); + } else if ((pMsgType->mainType == MSG_SMS_TYPE) && + (pMsgType->subType == MSG_WAP_SI_SMS || pMsgType->subType == MSG_WAP_SL_SMS)) { + // PUSH + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d);", + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_WAP_SI_SMS, MSG_WAP_SL_SMS); + } else if ((pMsgType->mainType == MSG_MMS_TYPE) && + (pMsgType->subType == MSG_SENDREQ_MMS || pMsgType->subType == MSG_SENDCONF_MMS || pMsgType->subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgType->subType == MSG_RETRIEVE_MANUALCONF_MMS)) { + // MMS + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d, %d, %d);", + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_SENDREQ_MMS, MSG_SENDCONF_MMS, MSG_RETRIEVE_AUTOCONF_MMS, MSG_RETRIEVE_MANUALCONF_MMS); + } else { + return MSG_ERR_INVALID_PARAMETER; + } + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + *pMsgCount = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetMessage(MSG_MESSAGE_ID_T MsgId, MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + unsigned int addrId = 0; + + char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1]; + + memset(firstName, 0x00, sizeof(firstName)); + memset(lastName, 0x00, sizeof(lastName)); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MSG_ID, A.ADDRESS_ID, A.FOLDER_ID, A.REFERENCE_ID, A.STORAGE_ID, A.MAIN_TYPE, A.SUB_TYPE, A.DISPLAY_TIME, A.DATA_SIZE, \ + A.NETWORK_STATUS, A.READ_STATUS, A.PROTECTED, A.BACKUP, A.PRIORITY, A.MSG_DIRECTION, A.SCHEDULED_TIME, A.SUBJECT, A.MSG_TEXT, \ + B.ADDRESS_TYPE, B.RECIPIENT_TYPE, B.CONTACT_ID, B.ADDRESS_VAL, B.DISPLAY_NAME, B.FIRST_NAME, B.LAST_NAME, A.THUMB_PATH \ + FROM %s A, %s B WHERE A.MSG_ID = %d AND A.ADDRESS_ID = B.ADDRESS_ID;", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pMsg->msgId = dbHandle.columnInt(0); + addrId = dbHandle.columnInt(1); + pMsg->folderId = dbHandle.columnInt(2); + pMsg->referenceId = dbHandle.columnInt(3); + pMsg->storageId = dbHandle.columnInt(4); + pMsg->msgType.mainType = dbHandle.columnInt(5); + pMsg->msgType.subType = dbHandle.columnInt(6); + pMsg->displayTime = (time_t)dbHandle.columnInt(7); + pMsg->dataSize = dbHandle.columnInt(8); + pMsg->networkStatus = dbHandle.columnInt(9); + pMsg->bRead = dbHandle.columnInt(10); + pMsg->bProtected = dbHandle.columnInt(11); + pMsg->bBackup = dbHandle.columnInt(12); + pMsg->priority = dbHandle.columnInt(13); + pMsg->direction= dbHandle.columnInt(14); + pMsg->scheduledTime = (time_t)dbHandle.columnInt(15); + + strncpy(pMsg->subject, (char *)dbHandle.columnText(16), MAX_SUBJECT_LEN); + + /* Temp_File_Handling */ + if (pMsg->msgType.mainType == MSG_SMS_TYPE || pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) { + if (pMsg->dataSize > MAX_MSG_TEXT_LEN) { + char msgData[pMsg->dataSize+1]; + memset(msgData, 0x00, sizeof(msgData)); + + strncpy(msgData, (char *)dbHandle.columnText(17), pMsg->dataSize); + + // Save Message Data into File + char fileName[MAX_COMMON_INFO_SIZE+1]; + memset(fileName, 0x00, sizeof(fileName)); + + if (MsgCreateFileName(fileName) == false) { + dbHandle.finalizeQuery(); + return MSG_ERR_STORAGE_ERROR; + } + + MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsg->dataSize, fileName); + + if (MsgWriteIpcFile(fileName, msgData, pMsg->dataSize) == false) { + dbHandle.finalizeQuery(); + return MSG_ERR_STORAGE_ERROR; + } + + strncpy(pMsg->msgData, fileName, MAX_MSG_DATA_LEN); + + pMsg->bTextSms = false; + } else { + memset(pMsg->msgText, 0x00, sizeof(pMsg->msgText)); + strncpy(pMsg->msgText, (char *)dbHandle.columnText(17), pMsg->dataSize); + + // For WAP PUSH SI Message + if (pMsg->msgType.subType == MSG_WAP_SI_SMS) { + strncat(pMsg->msgText, "\n", MAX_MSG_TEXT_LEN-strlen(pMsg->msgText)); + strncat(pMsg->msgText, pMsg->subject, MAX_MSG_TEXT_LEN-strlen(pMsg->msgText)); + MSG_DEBUG("pMsg->msgText : [%s]", pMsg->msgText); + pMsg->dataSize = sizeof(pMsg->msgText); + } + + pMsg->bTextSms = true; + } + } else { + if (dbHandle.columnText(17) != NULL) + strncpy(pMsg->msgText, (char *)dbHandle.columnText(17), MAX_MSG_TEXT_LEN); + } + + if (addrId > 0) + pMsg->nAddressCnt = 1; + else + pMsg->nAddressCnt = 0; + + pMsg->addressList[0].threadId = addrId; + pMsg->addressList[0].addressType = dbHandle.columnInt(18); + pMsg->addressList[0].recipientType = dbHandle.columnInt(19); + pMsg->addressList[0].contactId = dbHandle.columnInt(20); + + if (dbHandle.columnText(21) != NULL) + strncpy(pMsg->addressList[0].addressVal, (char *)dbHandle.columnText(21), MAX_ADDRESS_VAL_LEN); + + if (dbHandle.columnText(22) != NULL && ((char *)dbHandle.columnText(22))[0]!='\0') { + MSG_DEBUG("displayName : [%s]", dbHandle.columnText(22)); + strncpy(pMsg->addressList[0].displayName, (char *)dbHandle.columnText(22), MAX_DISPLAY_NAME_LEN); + } else { + if (dbHandle.columnText(23) != NULL) + strncpy(firstName, (char *)dbHandle.columnText(23), MAX_DISPLAY_NAME_LEN); + + if (dbHandle.columnText(24) != NULL) + strncpy(lastName, (char *)dbHandle.columnText(24), MAX_DISPLAY_NAME_LEN); + + int order = MsgGetContactNameOrder(); + + if (order == 0) { + if (strlen(firstName) > 0) { + strncpy(pMsg->addressList[0].displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (strlen(lastName) > 0) { + strncat(pMsg->addressList[0].displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(pMsg->addressList[0].displayName)); + strncat(pMsg->addressList[0].displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(pMsg->addressList[0].displayName)); + } + } else if (order == 1) { + if (strlen(lastName) > 0) { + strncpy(pMsg->addressList[0].displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(pMsg->addressList[0].displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(pMsg->addressList[0].displayName)); + } + + if (strlen(firstName) > 0) { + strncat(pMsg->addressList[0].displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(pMsg->addressList[0].displayName)); + } + } + } + + // thumbnail path + if (dbHandle.columnText(25)!=NULL && ((char *)dbHandle.columnText(25))[0] != '\0') { + strncpy(pMsg->thumbPath, (char *)dbHandle.columnText(25), MSG_FILEPATH_LEN_MAX); + MSG_DEBUG("pMsg->thumbPath : [%s]", pMsg->thumbPath); + } + } else { + dbHandle.finalizeQuery(); + MSG_DEBUG("%s", sqlQuery); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + // Get MMS body if it is MMS. + if ((pMsg->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS && (pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS)) || + pMsg->msgType.subType == MSG_SENDREQ_MMS || + pMsg->msgType.subType == MSG_SENDCONF_MMS) { + MSG_ERROR_T err = MSG_SUCCESS; + MMS_MESSAGE_DATA_S mmsMsg; + char *pDestMsg = NULL; + + // call mms plugin to get mms specific message data + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(pMsg->msgType.mainType); + memset(&mmsMsg, 0, sizeof(MMS_MESSAGE_DATA_S)); + err = plg->getMmsMessage(pMsg, pSendOptInfo, &mmsMsg, &pDestMsg); + + if (err != MSG_SUCCESS) { + if (pDestMsg) { + free(pDestMsg); + pDestMsg = NULL; + } + return MSG_ERR_STORAGE_ERROR; + } + + memset(pMsg->msgData, 0, MAX_MSG_DATA_LEN+1); + + // Encode MMS specific data to MMS_MESSAGE_DATA_S + if (pMsg->dataSize > MAX_MSG_DATA_LEN) { + // Save Message Data into File + char tempFileName[MAX_COMMON_INFO_SIZE+1]; + memset(tempFileName, 0x00, sizeof(tempFileName)); + + if (MsgCreateFileName(tempFileName) == false) { + if(pDestMsg) { + free (pDestMsg); + pDestMsg = NULL; + } + return MSG_ERR_STORAGE_ERROR; + } + MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsg->dataSize, tempFileName); + + if (MsgWriteIpcFile(tempFileName, pDestMsg, pMsg->dataSize) == false) { + if(pDestMsg) { + free (pDestMsg); + pDestMsg = NULL; + } + return MSG_ERR_STORAGE_ERROR; + } + strncpy(pMsg->msgData, tempFileName, MAX_MSG_DATA_LEN); + //pMsg->dataSize = strlen(fileName); + pMsg->bTextSms = false; + } else { + strncpy(pMsg->msgData, pDestMsg, pMsg->dataSize); + pMsg->bTextSms = true; + } + + if (pDestMsg) { + free(pDestMsg); + pDestMsg = NULL; + } + } + + // Get SMS Sending Options + if (pMsg->msgType.mainType == MSG_SMS_TYPE && pSendOptInfo != NULL) { + MsgStoGetSmsSendOpt(pMsg->msgId, pSendOptInfo); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetFolderViewList(MSG_FOLDER_ID_T FolderId, const MSG_SORT_RULE_S *pSortRule, MSG_LIST_S *pMsgFolderViewList) +{ + if (pMsgFolderViewList == NULL) { + MSG_DEBUG("pMsgFolderViewList is NULL"); + return MSG_ERR_NULL_POINTER; + } + + int rowCnt = 0; + int index = 27; // numbers of index + + unsigned int addrId = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + char sqlSort[64]; + char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1]; + char displayName[MAX_DISPLAY_NAME_LEN+1]; + // Get Name Order + int order = MsgGetContactNameOrder(); + + // Get Message In Folder + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if (FolderId == MSG_ALLBOX_ID) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MSG_ID, A.ADDRESS_ID, A.FOLDER_ID, A.REFERENCE_ID, A.STORAGE_ID, A.MAIN_TYPE, A.SUB_TYPE, \ + A.DISPLAY_TIME, A.DATA_SIZE, A.NETWORK_STATUS, A.READ_STATUS, A.PROTECTED, A.BACKUP, A.PRIORITY, \ + A.MSG_DIRECTION, A.SCHEDULED_TIME, A.SUBJECT, A.MSG_TEXT, B.ADDRESS_TYPE, B.RECIPIENT_TYPE, \ + B.CONTACT_ID, B.ADDRESS_VAL, B.DISPLAY_NAME, B.FIRST_NAME, B.LAST_NAME, A.ATTACHMENT_COUNT, A.THUMB_PATH \ + FROM %s A, %s B \ + WHERE A.ADDRESS_ID = B.ADDRESS_ID \ + AND A.FOLDER_ID < %d ", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MSG_CBMSGBOX_ID); + } else { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MSG_ID, A.ADDRESS_ID, A.FOLDER_ID, A.REFERENCE_ID, A.STORAGE_ID, A.MAIN_TYPE, A.SUB_TYPE, \ + A.DISPLAY_TIME, A.DATA_SIZE, A.NETWORK_STATUS, A.READ_STATUS, A.PROTECTED, A.BACKUP, A.PRIORITY, \ + A.MSG_DIRECTION, A.SCHEDULED_TIME, A.SUBJECT, A.MSG_TEXT, B.ADDRESS_TYPE, B.RECIPIENT_TYPE, \ + B.CONTACT_ID, B.ADDRESS_VAL, B.DISPLAY_NAME, B.FIRST_NAME, B.LAST_NAME, A.ATTACHMENT_COUNT, A.THUMB_PATH \ + FROM %s A, %s B \ + WHERE A.ADDRESS_ID = B.ADDRESS_ID \ + AND A.FOLDER_ID = %d ", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, FolderId); + } + + memset(sqlSort, 0x00, sizeof(sqlSort)); + MsgMakeSortRule(pSortRule, sqlSort); + strncat(sqlQuery, sqlSort, strlen(sqlSort)); + + MSG_ERROR_T err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err == MSG_ERR_DB_NORECORD) { + pMsgFolderViewList->nCount = 0; + pMsgFolderViewList->msgInfo = NULL; + + dbHandle.freeTable(); + + return MSG_SUCCESS; + } else if (err != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery is - %s", sqlQuery); + dbHandle.freeTable(); + return err; + } + + pMsgFolderViewList->nCount = rowCnt; + + MSG_DEBUG("pMsgCommInfoList->nCount [%d]", pMsgFolderViewList->nCount); + + pMsgFolderViewList->msgInfo = (msg_message_t *)new char[sizeof(MSG_MESSAGE_S *) * rowCnt]; + + MSG_MESSAGE_S *pTmp = NULL; + + for (int i = 0; i < rowCnt; i++) { + pMsgFolderViewList->msgInfo[i] = (msg_message_t)new char[sizeof(MSG_MESSAGE_S)]; + + pTmp = (MSG_MESSAGE_S *)pMsgFolderViewList->msgInfo[i]; + + memset(pTmp, 0x00, sizeof(pTmp)); + + pTmp->pData = NULL; + pTmp->pMmsData = NULL; + + pTmp->msgId = dbHandle.getColumnToInt(index++); + addrId = dbHandle.getColumnToInt(index++); + pTmp->folderId = dbHandle.getColumnToInt(index++); + pTmp->referenceId = dbHandle.getColumnToInt(index++); + pTmp->storageId = dbHandle.getColumnToInt(index++); + pTmp->msgType.mainType = dbHandle.getColumnToInt(index++); + pTmp->msgType.subType = dbHandle.getColumnToInt(index++); + pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++); + pTmp->dataSize = dbHandle.getColumnToInt(index++); + pTmp->networkStatus = dbHandle.getColumnToInt(index++); + pTmp->bRead = dbHandle.getColumnToInt(index++); + pTmp->bProtected = dbHandle.getColumnToInt(index++); + pTmp->bBackup = dbHandle.getColumnToInt(index++); + pTmp->priority = dbHandle.getColumnToInt(index++); + pTmp->direction= dbHandle.getColumnToInt(index++); + pTmp->scheduledTime = (time_t)dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); + + if (pTmp->msgType.mainType == MSG_MMS_TYPE && + (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->msgType.subType == MSG_NOTIFICATIONIND_MMS)) { + pTmp->pData = NULL; + index++; + } else { + pTmp->pData = (void *)new char[pTmp->dataSize + 2]; + memset(pTmp->pData, 0x00, sizeof(pTmp->pData)); + + dbHandle.getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData); + } + + if (addrId > 0) + pTmp->nAddressCnt = 1; + else + pTmp->nAddressCnt = 0; + + pTmp->addressList[0].threadId = addrId; + pTmp->addressList[0].addressType = dbHandle.getColumnToInt(index++); + pTmp->addressList[0].recipientType = dbHandle.getColumnToInt(index++); + pTmp->addressList[0].contactId = dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pTmp->addressList[0].addressVal); + + memset(displayName, 0x00, sizeof(displayName)); + dbHandle.getColumnToString(index++, MAX_DISPLAY_NAME_LEN, displayName); + + memset(firstName, 0x00, sizeof(firstName)); + dbHandle.getColumnToString(index++, MAX_DISPLAY_NAME_LEN, firstName); + + memset(lastName, 0x00, sizeof(lastName)); + dbHandle.getColumnToString(index++, MAX_DISPLAY_NAME_LEN, lastName); + + + if (strlen(displayName) <= 0) { + if (order == 0) { + if (firstName[0] != '\0') { + strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (lastName[0] != '\0') { + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } else if (order == 1) { + if (lastName[0] != '\0') { + strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + + if (firstName[0] != '\0') { + strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + } + + strncpy(pTmp->addressList[0].displayName, displayName, MAX_DISPLAY_NAME_LEN); + + pTmp->attachCount = dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath); + } + + dbHandle.freeTable(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int ExtId, int PinCode) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + unsigned int rowId = 0; + unsigned int addrId = 0; + + dbHandle.beginTrans(); + + if (pMsgInfo->nAddressCnt > 0) { + err = MsgStoAddAddress(&dbHandle, &(pMsgInfo->addressList[0]), &addrId); + + if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); + return err; + } + } + + // Add Message Table + rowId = MsgStoAddMessageTable(&dbHandle, pMsgInfo, addrId); + + if (rowId <= 0) { + dbHandle.endTrans(false); + return MSG_ERR_DB_ROW; + } + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d);", + MSGFW_SYNCML_MSG_TABLE_NAME, rowId, ExtId, PinCode); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + if (MsgStoUpdateAddress(&dbHandle, addrId) != MSG_SUCCESS) { + dbHandle.endTrans(false); + return MSG_ERR_STORAGE_ERROR; + } + + dbHandle.endTrans(true); + + pMsgInfo->msgId = (MSG_MESSAGE_ID_T)rowId; + pMsgInfo->referenceId = (MSG_REFERENCE_ID_T)rowId; + + MsgSoundPlayStart(); + + int smsCnt = 0; + int mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + MsgSettingHandleNewMsg(smsCnt, mmsCnt); + + MsgInsertNoti(&dbHandle, pMsgInfo); + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetMsgType(MSG_MESSAGE_ID_T msgId, MSG_MESSAGE_TYPE_S *pMsgType) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE FROM %s WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pMsgType->mainType = dbHandle.columnInt(0); + pMsgType->subType = dbHandle.columnInt(1); + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetQuickPanelData(MSG_QUICKPANEL_TYPE_T Type, MSG_MESSAGE_INFO_S *pMsg) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if (Type == MSG_QUICKPANEL_SMS) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE = %d AND READ_STATUS = 0 ORDER BY DISPLAY_TIME DESC;", + MSGFW_MESSAGE_TABLE_NAME, MSG_INBOX_ID, MSG_SMS_TYPE, MSG_NORMAL_SMS); + } else if (Type == MSG_QUICKPANEL_MMS) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d) AND READ_STATUS = 0 ORDER BY DISPLAY_TIME DESC;", + MSGFW_MESSAGE_TABLE_NAME, MSG_INBOX_ID, MSG_MMS_TYPE, MSG_RETRIEVE_AUTOCONF_MMS, MSG_RETRIEVE_MANUALCONF_MMS); + } else if (Type == MSG_QUICKPANEL_DELIVER_REP) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE SUB_TYPE IN (%d, %d) AND READ_STATUS = 0 ORDER BY DISPLAY_TIME DESC;", + MSGFW_MESSAGE_TABLE_NAME, MSG_STATUS_REPORT_SMS, MSG_DELIVERYIND_MMS); + } else if (Type == MSG_QUICKPANEL_READ_REP) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE = %d AND READ_STATUS = 0 ORDER BY DISPLAY_TIME DESC;", + MSGFW_MESSAGE_TABLE_NAME, MSG_MMS_TYPE, MSG_READORGIND_MMS); + } else if (Type == MSG_QUICKPANEL_VOICEMAIL) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE = %d AND READ_STATUS = 0 ORDER BY DISPLAY_TIME DESC;", + MSGFW_MESSAGE_TABLE_NAME, MSG_INBOX_ID, MSG_SMS_TYPE, MSG_MWI_VOICE_SMS); + } else if (Type == MSG_QUICKPANEL_MMS_NOTI) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE = %d AND READ_STATUS = 0 ORDER BY DISPLAY_TIME DESC;", + MSGFW_MESSAGE_TABLE_NAME, MSG_INBOX_ID, MSG_MMS_TYPE, MSG_NOTIFICATIONIND_MMS); + } + + // Get Message ID + MSG_MESSAGE_ID_T msgId; + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + msgId = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + // Get Message Info + err = MsgStoGetMessage(msgId, pMsg, NULL); + + return err; +} + + +MSG_ERROR_T MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, MSG_THREAD_VIEW_LIST_S *pThreadViewList) +{ + pThreadViewList->nCount = 0; + pThreadViewList->msgThreadInfo = NULL; + + int rowCnt = 0; + int index = 15; // numbers of index + + char sqlQuery[MAX_QUERY_LEN+1]; + char sqlSort[64]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_ID, CONTACT_ID, ADDRESS_VAL, \ + DISPLAY_NAME, FIRST_NAME, LAST_NAME, IMAGE_PATH, \ + UNREAD_CNT, SMS_CNT, MMS_CNT, MAIN_TYPE, SUB_TYPE, \ + MSG_DIRECTION, MSG_TIME, MSG_TEXT \ + FROM %s \ + WHERE ADDRESS_ID <> 0 AND (SMS_CNT > 0 OR MMS_CNT > 0) ", + MSGFW_ADDRESS_TABLE_NAME); + + memset(sqlSort, 0x00, sizeof(sqlSort)); + MsgMakeSortRule(pSortRule, sqlSort); + strncat(sqlQuery, sqlSort, sizeof(sqlQuery) - strlen(sqlQuery) - 1); + + MSG_ERROR_T err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err == MSG_ERR_DB_NORECORD) { + dbHandle.freeTable(); + + return MSG_SUCCESS; + } else if (err != MSG_SUCCESS) { + MSG_DEBUG("%s", sqlQuery); + + dbHandle.freeTable(); + + return err; + } + + char firstName[MAX_THREAD_NAME_LEN+1]; + char lastName[MAX_THREAD_NAME_LEN+1]; + char displayName[MAX_DISPLAY_NAME_LEN+1]; + + int order = MsgGetContactNameOrder(); + + pThreadViewList->nCount = rowCnt; + + MSG_DEBUG("pThreadViewList->nCount [%d]", pThreadViewList->nCount); + + pThreadViewList->msgThreadInfo = (msg_thread_view_t *)new char[sizeof(MSG_THREAD_VIEW_S *)*rowCnt]; + + MSG_THREAD_VIEW_S *pTmp = NULL; + + for (int i = 0; i < rowCnt; i++) { + pThreadViewList->msgThreadInfo[i] = (msg_thread_view_t)new char[sizeof(MSG_THREAD_VIEW_S)]; + + pTmp = (MSG_THREAD_VIEW_S *)pThreadViewList->msgThreadInfo[i]; + + pTmp->threadId = dbHandle.getColumnToInt(index++); + pTmp->contactId = dbHandle.getColumnToInt(index++); + + memset(pTmp->threadAddr, 0x00, sizeof(pTmp->threadAddr)); + dbHandle.getColumnToString(index++, MAX_THREAD_ADDR_LEN, pTmp->threadAddr); + + memset(displayName, 0x00, sizeof(displayName)); + dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, displayName); + + memset(firstName, 0x00, sizeof(firstName)); + dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, firstName); + + memset(lastName, 0x00, sizeof(lastName)); + dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, lastName); + + if (strlen(displayName) <= 0) { + if (order == 0) { + if (firstName[0] != '\0') { + strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (lastName[0] != '\0') { + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } else if (order == 1) { + if (lastName[0] != '\0') { + strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + + if (firstName[0] != '\0') { + strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + } + + memset(pTmp->threadName, 0x00, sizeof(pTmp->threadName)); + strncpy(pTmp->threadName, displayName, MAX_THREAD_NAME_LEN); + + memset(pTmp->threadImagePath, 0x00, sizeof(pTmp->threadImagePath)); + dbHandle.getColumnToString(index++, MAX_IMAGE_PATH_LEN, pTmp->threadImagePath); + + pTmp->unreadCnt = dbHandle.getColumnToInt(index++); + pTmp->smsCnt = dbHandle.getColumnToInt(index++); + pTmp->mmsCnt = dbHandle.getColumnToInt(index++); + + pTmp->threadType.mainType = dbHandle.getColumnToInt(index++); + pTmp->threadType.subType = dbHandle.getColumnToInt(index++); + + pTmp->direction = dbHandle.getColumnToInt(index++); + pTmp->threadTime = (time_t)dbHandle.getColumnToInt(index++); + + memset(pTmp->threadData, 0x00, sizeof(pTmp->threadData)); + dbHandle.getColumnToString(index++, MAX_THREAD_DATA_LEN, pTmp->threadData); + } + + dbHandle.freeTable(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetConversationViewList(MSG_THREAD_ID_T ThreadId, MSG_LIST_S *pConvViewList) +{ + MSG_BEGIN(); + + pConvViewList->nCount = 0; + pConvViewList->msgInfo = NULL; + + int rowCnt = 0; + int index = 20; /** numbers of index */ + + unsigned int addrId = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, ADDRESS_ID, FOLDER_ID, REFERENCE_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \ + DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, BACKUP, PRIORITY, \ + MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, THUMB_PATH \ + FROM %s \ + WHERE ADDRESS_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d \ + ORDER BY DISPLAY_TIME, MSG_ID ASC;", + MSGFW_MESSAGE_TABLE_NAME, ThreadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID); + + MSG_ERROR_T err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err == MSG_ERR_DB_NORECORD) { + dbHandle.freeTable(); + return MSG_SUCCESS; + } else if (err != MSG_SUCCESS) { + MSG_DEBUG("%s", sqlQuery); + dbHandle.freeTable(); + return err; + } + + pConvViewList->nCount = rowCnt; + + MSG_DEBUG("pConvViewList->nCount [%d]", pConvViewList->nCount); + + pConvViewList->msgInfo = (msg_message_t *)new char[sizeof(MSG_MESSAGE_S *) * rowCnt]; + + MSG_MESSAGE_S *pTmp = NULL; + + for (int i = 0; i < rowCnt; i++) { + pConvViewList->msgInfo[i] = (msg_message_t)new char[sizeof(MSG_MESSAGE_S)]; + + pTmp = (MSG_MESSAGE_S *)pConvViewList->msgInfo[i]; + + memset(pTmp, 0x00, sizeof(pTmp)); + + pTmp->pData = NULL; + pTmp->pMmsData = NULL; + + pTmp->msgId = dbHandle.getColumnToInt(index++); + addrId = dbHandle.getColumnToInt(index++); + pTmp->folderId = dbHandle.getColumnToInt(index++); + pTmp->referenceId = dbHandle.getColumnToInt(index++); + pTmp->storageId = dbHandle.getColumnToInt(index++); + pTmp->msgType.mainType = dbHandle.getColumnToInt(index++); + pTmp->msgType.subType = dbHandle.getColumnToInt(index++); + pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++); + pTmp->dataSize = dbHandle.getColumnToInt(index++); + pTmp->networkStatus = dbHandle.getColumnToInt(index++); + pTmp->bRead = dbHandle.getColumnToInt(index++); + pTmp->bProtected = dbHandle.getColumnToInt(index++); + pTmp->bBackup = dbHandle.getColumnToInt(index++); + pTmp->priority = dbHandle.getColumnToInt(index++); + pTmp->direction = dbHandle.getColumnToInt(index++); + pTmp->scheduledTime = (time_t)dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); + + if (pTmp->msgType.mainType == MSG_MMS_TYPE && + (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->msgType.subType == MSG_NOTIFICATIONIND_MMS)) { + pTmp->pData = NULL; + index++; + } else { + pTmp->pData = (void *)new char[pTmp->dataSize+2]; + memset(pTmp->pData, 0x00, pTmp->dataSize+2); + + dbHandle.getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData); + } + + pTmp->attachCount = dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath); + + } + + dbHandle.freeTable(); + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoDeleteThreadMessageList(MSG_THREAD_ID_T ThreadId, MSG_MSGID_LIST_S *pMsgIdList) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + /*** Get msg id list **/ + MSG_MSGID_LIST_S *pToDeleteMsgIdList = NULL; + + int rowCnt = 0; + int index = 1; + // Set Indicator + int smsCnt = 0; + int mmsCnt = 0; + + const char *tableList[] = {MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME, + MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SCHEDULED_MSG_TABLE_NAME, + MSGFW_SMS_SENDOPT_TABLE_NAME, MMS_PLUGIN_MESSAGE_TABLE_NAME, + MSGFW_MESSAGE_TABLE_NAME}; + + int listCnt = sizeof(tableList)/sizeof(char *); + + pToDeleteMsgIdList = (MSG_MSGID_LIST_S *)new char[sizeof(MSG_MSGID_LIST_S)]; + memset(pToDeleteMsgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE ADDRESS_ID = %d", + MSGFW_MESSAGE_TABLE_NAME, ThreadId); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + dbHandle.freeTable(); + + goto FREE_MEMORY; + } + + if (rowCnt <= 0) { + dbHandle.freeTable(); + err = MSG_SUCCESS; + + goto FREE_MEMORY; + } + + pToDeleteMsgIdList->nCount = rowCnt; + + MSG_DEBUG("pToDeleteMsgIdList->nCount [%d]", pToDeleteMsgIdList->nCount); + + pToDeleteMsgIdList->msgIdList = (MSG_MESSAGE_ID_T *)new char[sizeof(MSG_MESSAGE_ID_T) * rowCnt]; + + for (int i = 0; i < rowCnt; i++) + pToDeleteMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++); + + dbHandle.freeTable(); + /*** **/ + + /*** Delete Sim Message **/ + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID \ + FROM %s \ + WHERE ADDRESS_ID = %d \ + AND STORAGE_ID = %d", + MSGFW_MESSAGE_TABLE_NAME, ThreadId, MSG_STORAGE_SIM); + + rowCnt = 0; + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + dbHandle.freeTable(); + + goto FREE_MEMORY; + } + + for (int i = 1; i <= rowCnt; i++) { + err = MsgStoDeleteMessage(dbHandle.getColumnToInt(i), false); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("MsgStoDeleteMessage() Error!!!"); + + dbHandle.freeTable(); + + goto FREE_MEMORY; + } + } + + dbHandle.freeTable(); + /*** **/ + + dbHandle.beginTrans(); + + for (int i = 0; i < listCnt; i++) { + if (!strcmp(tableList[i], MMS_PLUGIN_MESSAGE_TABLE_NAME)) { + //MMS_PLUGIN_MESSAGE_TABLE_NAME and MMS_PLUGIN_ATTRIBUTE_TABLE_NAME will be updated together + int rowCnt = 0; + int msgCnt = 0; + int index = 2; + + //get mms msg id list + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, REFERENCE_ID FROM %s \ + WHERE ADDRESS_ID = %d AND MAIN_TYPE = %d", + MSGFW_MESSAGE_TABLE_NAME, ThreadId, MSG_MMS_TYPE); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + MSG_DEBUG("rowCnt %d", rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + dbHandle.freeTable(); + dbHandle.endTrans(false); + + goto FREE_MEMORY; + } + + for (int i = 1; i <= rowCnt; i++) { + int msgId = 0; + int refId = 0; + + msgId = dbHandle.getColumnToInt(index++); + refId = dbHandle.getColumnToInt(index++); + + //get multiple recipient message count + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE REFERENCE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, refId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_PREPARE; + + goto FREE_MEMORY; + } + + msgCnt = 0; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + msgCnt = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_STEP; + + goto FREE_MEMORY; + } + + dbHandle.finalizeQuery(); + + //delete mms raw file and db(mms_table and mms_attr_table) data + if (msgCnt == 1) { + char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + char dirPath[MSG_FILEPATH_LEN_MAX] = {0,}; + char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,}; + + //get raw file_path + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE REFERENCE_ID = %d;", + MMS_PLUGIN_MESSAGE_TABLE_NAME, refId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_PREPARE; + + goto FREE_MEMORY; + } + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX); + } else { + dbHandle.finalizeQuery(); + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_STEP; + + goto FREE_MEMORY; + } + + dbHandle.finalizeQuery(); + + MSG_DEBUG("filePath [%s]", filePath); + + //delete raw file + snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); + + if (remove(filePath) == -1) + MSG_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_DEBUG("Success to delete file [%s]", filePath); + + MsgRmRf(dirPath); + // remove directory also + rmdir(dirPath); + + // delete thumbnail + char *fileName = NULL; + fileName = strrchr(filePath, '/'); + + snprintf(thumbnailPath, sizeof(thumbnailPath), MSG_THUMBNAIL_PATH"%s.jpg", fileName+1); + + if (remove(thumbnailPath) == -1) + MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailPath); + else + MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailPath); + + //delete MMS_PLUGIN_MESSAGE_TABLE_NAME table data + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE REFERENCE_ID = %d;", + MMS_PLUGIN_MESSAGE_TABLE_NAME, refId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_EXEC; + + goto FREE_MEMORY; + } + + //delete MMS_PLUGIN_ATTRIBUTE_TABLE_NAME table data + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE REFERENCE_ID = %d;", + MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, refId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbHandle.freeTable(); + dbHandle.endTrans(false); + err = MSG_ERR_DB_EXEC; + + goto FREE_MEMORY; + } + } else { + MSG_DEBUG("There is remained multi-recipient mms for this msg = %d", msgId); + } + } + + dbHandle.freeTable(); + } else { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN \ + (SELECT MSG_ID FROM %s WHERE ADDRESS_ID = %d);", + tableList[i], MSGFW_MESSAGE_TABLE_NAME, ThreadId); + + // Delete Message in specific folder from table + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbHandle.endTrans(false); + err = MSG_ERR_DB_EXEC; + + goto FREE_MEMORY; + } + } + } + + // Delete Address table + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if (ThreadId > 0) { + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s \ + WHERE ADDRESS_ID = %d;", + MSGFW_ADDRESS_TABLE_NAME, ThreadId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) { + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + dbHandle.endTrans(false); + err = MSG_ERR_DB_EXEC; + + goto FREE_MEMORY; + } + } + + dbHandle.endTrans(true); + + MSG_MESSAGE_TYPE_S msgType; + + msgType.mainType = MSG_SMS_TYPE; + msgType.subType = MSG_NORMAL_SMS; + msgType.classType = MSG_CLASS_NONE; + + // Set memory status in SIM + if (MsgStoCheckMsgCntFull(&dbHandle, &msgType, MSG_INBOX_ID) == MSG_SUCCESS) { + MSG_DEBUG("Set Memory Status"); + + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); + + if (plg == NULL) { + MSG_DEBUG("SMS Plug-in is NULL"); + err = MSG_ERR_NULL_POINTER; + + goto FREE_MEMORY; + } + + plg->setMemoryStatus(MSG_SUCCESS); + } + + // Set Indicator + smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE); + + MsgSettingSetIndicator(smsCnt, mmsCnt); + +/*** Set pMsgIdList **/ + if (pMsgIdList != NULL && pToDeleteMsgIdList->nCount > 0) { + pMsgIdList->nCount = pToDeleteMsgIdList->nCount; + + pMsgIdList->msgIdList = (MSG_MESSAGE_ID_T *)new char[sizeof(MSG_MESSAGE_ID_T)*pToDeleteMsgIdList->nCount]; + memcpy(pMsgIdList->msgIdList, pToDeleteMsgIdList->msgIdList, sizeof(MSG_MESSAGE_ID_T)*pToDeleteMsgIdList->nCount); + } +/*** **/ + + /*** Create thread for noti delete. **/ + if (pToDeleteMsgIdList->nCount > 0) { + if (g_idle_add(startToDeleteNoti, (void *)pToDeleteMsgIdList) == 0) { + MSG_DEBUG("startToDeleteNoti not invoked: %s", strerror(errno)); + // memory free + if (pToDeleteMsgIdList != NULL) { + //free peer info list + if (pToDeleteMsgIdList->msgIdList != NULL) + delete [] pToDeleteMsgIdList->msgIdList; + + delete [] pToDeleteMsgIdList; + } + err = MSG_ERR_UNKNOWN; + } + } + /*** **/ + + return MSG_SUCCESS; + +FREE_MEMORY: + MSG_DEBUG("Error case Free Memory"); + // memory free + if (pToDeleteMsgIdList != NULL) { + //free peer info list + if (pToDeleteMsgIdList->msgIdList != NULL) { + delete [] pToDeleteMsgIdList->msgIdList; + pToDeleteMsgIdList->msgIdList = NULL; + } + + delete [] pToDeleteMsgIdList; + pToDeleteMsgIdList = NULL; + } + + return err; + +} + + +MSG_ERROR_T MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if (pAddrInfo->contactId > 0) { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) AS TOTAL, \ + SUM(CASE WHEN READ_STATUS=0 AND FOLDER_ID=%d THEN 1 ELSE 0 END), \ + SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END), \ + SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END) \ + FROM (SELECT * FROM %s A JOIN %s B ON A.ADDRESS_ID = B.ADDRESS_ID WHERE B.CONTACT_ID = %d)", + MSG_INBOX_ID, MSG_SMS_TYPE, MSG_MMS_TYPE, + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, pAddrInfo->contactId); + } else { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) AS TOTAL, \ + SUM(CASE WHEN READ_STATUS=0 AND FOLDER_ID=%d THEN 1 ELSE 0 END), \ + SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END), \ + SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END) \ + FROM (SELECT * FROM %s A JOIN %s B ON A.ADDRESS_ID = B.ADDRESS_ID WHERE B.ADDRESS_VAL = '%s')", + MSG_INBOX_ID, MSG_SMS_TYPE, MSG_MMS_TYPE, + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, pAddrInfo->msgAddrInfo.addressVal); + } + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pThreadCountInfo->totalCount = dbHandle.columnInt(0); + pThreadCountInfo->unReadCount = dbHandle.columnInt(1); + pThreadCountInfo->smsMsgCount = dbHandle.columnInt(2); + pThreadCountInfo->mmsMsgCount = dbHandle.columnInt(3); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoSearchMessage(const char *pSearchString, MSG_THREAD_VIEW_LIST_S *pThreadViewList) +{ + if (!pSearchString) + return MSG_ERR_NULL_POINTER; + + // Clear Out Parameter + pThreadViewList->nCount = 0; + pThreadViewList->msgThreadInfo = NULL; + + tr1::unordered_set IdList; + queue searchList; + + MSG_THREAD_VIEW_S threadView; + + char sqlQuery[MAX_QUERY_LEN+1]; + + char firstName[MAX_DISPLAY_NAME_LEN+1]; + char lastName[MAX_DISPLAY_NAME_LEN+1]; + char displayName[MAX_DISPLAY_NAME_LEN+1]; + + // Get Name Order + int order = MsgGetContactNameOrder(); + + // Replace string for '%' and '_' character + char *ext1_str = NULL; + char *ext2_str = NULL; + + ext1_str = MsgStoReplaceString(pSearchString, "_", "\\_"); + ext2_str = MsgStoReplaceString(ext1_str, "%", "\\%"); + + // Search - Address, Name + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_ID, A.CONTACT_ID, A.ADDRESS_VAL, \ + A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, A.IMAGE_PATH, \ + A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, \ + A.MSG_DIRECTION, B.DISPLAY_TIME, B.MSG_TEXT \ + FROM %s A, %s B \ + WHERE A.ADDRESS_ID = B.ADDRESS_ID AND A.ADDRESS_ID <> 0 \ + AND B.FOLDER_ID > 0 AND B.FOLDER_ID < %d \ + AND ( B.MSG_TEXT LIKE '%%%s%%' ESCAPE '\\' \ + OR B.SUBJECT LIKE '%%%s%%' ESCAPE '\\' \ + OR A.ADDRESS_VAL LIKE '%%%s%%' ESCAPE '\\' \ + OR A.DISPLAY_NAME LIKE '%%%s%%' ESCAPE '\\' \ + OR A.FIRST_NAME LIKE '%%%s%%' ESCAPE '\\' \ + OR A.LAST_NAME LIKE '%%%s%%' ESCAPE '\\') \ + ORDER BY B.DISPLAY_TIME DESC;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MSG_CBMSGBOX_ID, + ext2_str, ext2_str, ext2_str, ext2_str, ext2_str, ext2_str); + + + if (ext1_str) { + free(ext1_str); + ext1_str = NULL; + } + + if (ext2_str) { + free(ext2_str); + ext2_str = NULL; + } + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + memset(&threadView, 0x00, sizeof(threadView)); + + threadView.threadId = dbHandle.columnInt(0); + threadView.contactId = dbHandle.columnInt(1); + + memset(threadView.threadAddr, 0x00, sizeof(threadView.threadAddr)); + strncpy(threadView.threadAddr, (char *)dbHandle.columnText(2), MAX_THREAD_ADDR_LEN); + + memset(displayName, 0x00, sizeof(displayName)); + strncpy(displayName, (char *)dbHandle.columnText(3), MAX_DISPLAY_NAME_LEN); + + memset(firstName, 0x00, sizeof(firstName)); + strncpy(firstName, (char *)dbHandle.columnText(4), MAX_DISPLAY_NAME_LEN); + + memset(lastName, 0x00, sizeof(lastName)); + strncpy(lastName, (char *)dbHandle.columnText(5), MAX_DISPLAY_NAME_LEN); + + if (strlen(displayName) <= 0) { + if (order == 0) { + if (firstName[0] != '\0') { + strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (lastName[0] != '\0') { + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } else if (order == 1) { + if (lastName[0] != '\0') { + strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + + if (firstName[0] != '\0') { + strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + } + + strncpy(threadView.threadName, displayName, MAX_THREAD_NAME_LEN); + + strncpy(threadView.threadImagePath, (char *)dbHandle.columnText(6), MAX_IMAGE_PATH_LEN); + + threadView.unreadCnt = dbHandle.columnInt(7); + threadView.smsCnt = dbHandle.columnInt(8); + threadView.mmsCnt = dbHandle.columnInt(9); + + threadView.direction = dbHandle.columnInt(10); + threadView.threadTime = (time_t)dbHandle.columnInt(11); + + strncpy(threadView.threadData, (char *)dbHandle.columnText(12), MAX_THREAD_DATA_LEN); + + tr1::unordered_set::iterator it; + + it = IdList.find(threadView.threadId); + + if (it == IdList.end()) { + IdList.insert(threadView.threadId); + searchList.push(threadView); + } + + } + + dbHandle.finalizeQuery(); + + // Add data to Out Parameter + pThreadViewList->nCount = searchList.size(); + pThreadViewList->msgThreadInfo = (msg_thread_view_t *)new char[sizeof(MSG_THREAD_VIEW_S *) * searchList.size()]; + + MSG_THREAD_VIEW_S *pTmp = NULL; + + int index = 0; + + while (!searchList.empty()) { + pThreadViewList->msgThreadInfo[index] = (msg_thread_view_t)new char[sizeof(MSG_THREAD_VIEW_S)]; + + pTmp = (MSG_THREAD_VIEW_S *)pThreadViewList->msgThreadInfo[index]; + + memcpy(pTmp, &(searchList.front()), sizeof(MSG_THREAD_VIEW_S)); + + searchList.pop(); + + index++; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, MSG_LIST_S *pMsgList) +{ + // Clear Out Parameter + pMsgList->nCount = 0; + pMsgList->msgInfo = NULL; + + int rowCnt = 0; + int index = 27; // numbers of index + + unsigned int addrId = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + char sqlQuerySubset[(MAX_QUERY_LEN/5)+1]; + + char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1]; + char displayName[MAX_DISPLAY_NAME_LEN+1]; + + char *ext1_str = NULL; + char *ext2_str = NULL; + + // Get Name Order + int order = MsgGetContactNameOrder(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MSG_ID, A.ADDRESS_ID, A.FOLDER_ID, A.REFERENCE_ID, A.STORAGE_ID, A.MAIN_TYPE, A.SUB_TYPE, \ + A.DISPLAY_TIME, A.DATA_SIZE, A.NETWORK_STATUS, A.READ_STATUS, A.PROTECTED, A.BACKUP, A.PRIORITY, \ + A.MSG_DIRECTION, A.SCHEDULED_TIME, A.SUBJECT, A.MSG_TEXT, B.ADDRESS_TYPE, B.RECIPIENT_TYPE, \ + B.CONTACT_ID, B.ADDRESS_VAL, B.DISPLAY_NAME, B.FIRST_NAME, B.LAST_NAME, A.ATTACHMENT_COUNT, A.THUMB_PATH \ + FROM %s A, %s B \ + WHERE A.ADDRESS_ID = B.ADDRESS_ID AND B.ADDRESS_ID <> 0 ", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME); + + //// folder + memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); + + if (pSearchCon->folderId == MSG_ALLBOX_ID) + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.FOLDER_ID > 0 AND A.FOLDER_ID < %d ", MSG_CBMSGBOX_ID); + else if (pSearchCon->folderId == MSG_IOSBOX_ID) + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.FOLDER_ID > 0 AND A.FOLDER_ID < %d ", MSG_DRAFT_ID); + else + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.FOLDER_ID = %d ", pSearchCon->folderId); + + strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); + + + //// msg type + memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); + + switch (pSearchCon->msgType) { + case MSG_TYPE_SMS: + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.MAIN_TYPE = %d AND A.SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_NORMAL_SMS); + break; + + case MSG_TYPE_MMS: + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.MAIN_TYPE = %d ", MSG_MMS_TYPE); + break; + + case MSG_TYPE_MMS_JAVA: + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.MAIN_TYPE = %d AND A.SUB_TYPE = %d ", MSG_MMS_TYPE, MSG_SENDREQ_JAVA_MMS); + break; + + case MSG_TYPE_SMS_SYNCML: + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.MAIN_TYPE = %d AND A.SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_SYNCML_CP); + break; + + case MSG_TYPE_SMS_REJECT: + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.MAIN_TYPE = %d AND A.SUB_TYPE = %d ", MSG_SMS_TYPE, MSG_REJECT_SMS); + break; + + default: + MSG_DEBUG("msg type is not set."); + } + + strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); + + /// string + if (pSearchCon->pSearchVal != NULL) { + + // Replace string for '%' and '_' character + ext1_str = MsgStoReplaceString(pSearchCon->pSearchVal, "_", "\\_"); + ext2_str = MsgStoReplaceString(ext1_str, "%", "\\%"); + + memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND ( A.MSG_TEXT LIKE '%%%s%%' ESCAPE '\\' \ + OR A.SUBJECT LIKE '%%%s%%' ESCAPE '\\' \ + OR B.ADDRESS_VAL LIKE '%%%s%%' ESCAPE '\\' \ + OR B.DISPLAY_NAME LIKE '%%%s%%' ESCAPE '\\' \ + OR B.FIRST_NAME LIKE '%%%s%%' ESCAPE '\\' \ + OR B.LAST_NAME LIKE '%%%s%%' ESCAPE '\\') ", + ext2_str, ext2_str, ext2_str, ext2_str, ext2_str, ext2_str); + strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); + + if (ext1_str) { + free(ext1_str); + ext1_str = NULL; + } + + if (ext2_str) { + free(ext2_str); + ext2_str = NULL; + } + } + + /// address + if (pSearchCon->pAddressVal != NULL) { + + // Replace string for '%' and '_' character + ext1_str = MsgStoReplaceString(pSearchCon->pAddressVal, "_", "\\_"); + ext2_str = MsgStoReplaceString(ext1_str, "%", "\\%"); + + memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND B.ADDRESS_VAL LIKE '%%%s%%' ESCAPE '\\'", ext2_str); + strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); + + if (ext1_str) { + free(ext1_str); + ext1_str = NULL; + } + + if (ext2_str) { + free(ext2_str); + ext2_str = NULL; + } + } + + /// limit, offset + memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); + + if (offset >= 0 && limit > 0) + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "ORDER BY A.DISPLAY_TIME DESC LIMIT %d OFFSET %d;", limit, offset); + else + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "ORDER BY A.DISPLAY_TIME DESC;"); + + strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); + + MSG_ERROR_T err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err == MSG_ERR_DB_NORECORD) { + dbHandle.freeTable(); + + return MSG_SUCCESS; + } else if (err != MSG_SUCCESS) { + MSG_DEBUG("%s", sqlQuery); + + dbHandle.freeTable(); + + return err; + } + + pMsgList->nCount = rowCnt; + + MSG_DEBUG("pMsgList->nCount [%d]", pMsgList->nCount); + + pMsgList->msgInfo = (msg_message_t *)new char[sizeof(MSG_MESSAGE_S *) * rowCnt]; + + MSG_MESSAGE_S *pTmp = NULL; + + for (int i = 0; i < rowCnt; i++) { + pMsgList->msgInfo[i] = (msg_message_t)new char[sizeof(MSG_MESSAGE_S)]; + + pTmp = (MSG_MESSAGE_S *)pMsgList->msgInfo[i]; + + memset(pTmp, 0x00, sizeof(pTmp)); + + pTmp->pData = NULL; + pTmp->pMmsData = NULL; + + pTmp->msgId = dbHandle.getColumnToInt(index++); + addrId = dbHandle.getColumnToInt(index++); + pTmp->folderId = dbHandle.getColumnToInt(index++); + pTmp->referenceId = dbHandle.getColumnToInt(index++); + pTmp->storageId = dbHandle.getColumnToInt(index++); + pTmp->msgType.mainType = dbHandle.getColumnToInt(index++); + pTmp->msgType.subType = dbHandle.getColumnToInt(index++); + pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++); + pTmp->dataSize = dbHandle.getColumnToInt(index++); + pTmp->networkStatus = dbHandle.getColumnToInt(index++); + pTmp->bRead = dbHandle.getColumnToInt(index++); + pTmp->bProtected = dbHandle.getColumnToInt(index++); + pTmp->bBackup = dbHandle.getColumnToInt(index++); + pTmp->priority = dbHandle.getColumnToInt(index++); + pTmp->direction= dbHandle.getColumnToInt(index++); + pTmp->scheduledTime = (time_t)dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); + + if (pTmp->msgType.mainType == MSG_MMS_TYPE && + (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->msgType.subType == MSG_NOTIFICATIONIND_MMS)) { + pTmp->pData = NULL; + index++; + } else { + MSG_DEBUG("pTmp->dataSize [%d]", pTmp->dataSize); + pTmp->pData = (void *)new char[pTmp->dataSize + 2]; + memset(pTmp->pData, 0x00, sizeof(pTmp->pData)); + + dbHandle.getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData); + } + + if (addrId > 0) + pTmp->nAddressCnt = 1; + else + pTmp->nAddressCnt = 0; + + pTmp->addressList[0].threadId = addrId; + pTmp->addressList[0].addressType = dbHandle.getColumnToInt(index++); + pTmp->addressList[0].recipientType = dbHandle.getColumnToInt(index++); + pTmp->addressList[0].contactId = dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pTmp->addressList[0].addressVal); + + memset(displayName, 0x00, sizeof(displayName)); + dbHandle.getColumnToString(index++, MAX_DISPLAY_NAME_LEN, displayName); + + memset(firstName, 0x00, sizeof(firstName)); + dbHandle.getColumnToString(index++, MAX_DISPLAY_NAME_LEN, firstName); + + memset(lastName, 0x00, sizeof(lastName)); + dbHandle.getColumnToString(index++, MAX_DISPLAY_NAME_LEN, lastName); + + if (strlen(displayName) <= 0) { + if (order == 0) { + if (firstName[0] != '\0') { + strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (lastName[0] != '\0') { + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } else if (order == 1) { + if (lastName[0] != '\0') { + strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + + if (firstName[0] != '\0') { + strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + } + + strncpy(pTmp->addressList[0].displayName, displayName, MAX_DISPLAY_NAME_LEN); + + pTmp->attachCount = dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath); + + } + dbHandle.freeTable(); + + return MSG_SUCCESS; +} + + + +MSG_ERROR_T MsgStoGetMsgIdList(MSG_REFERENCE_ID_T RefId, MSG_MSGID_LIST_S *pMsgIdList) +{ + // Clear Out Parameter + pMsgIdList->nCount = 0; + pMsgIdList->msgIdList = NULL; + + int rowCnt = 0; + int index = 1; // numbers of index + + char sqlQuery[MAX_QUERY_LEN+1]; + + // Search - Address, Name + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT MSG_ID \ + FROM %s \ + WHERE REFERENCE_ID = %d \ + ORDER BY MSG_ID ASC;", + MSGFW_MESSAGE_TABLE_NAME, RefId); + + MSG_ERROR_T err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("%s", sqlQuery); + + dbHandle.freeTable(); + + return err; + } + + pMsgIdList->nCount = rowCnt; + + MSG_DEBUG("pMsgIdList->nCount [%d]", pMsgIdList->nCount); + + pMsgIdList->msgIdList = (MSG_MESSAGE_ID_T *)new char[sizeof(MSG_MESSAGE_ID_T *) * rowCnt]; + + for (int i = 0; i < rowCnt; i++) { + pMsgIdList->msgIdList[i] = (MSG_MESSAGE_ID_T)new char[sizeof(MSG_MESSAGE_ID_T)]; + + pMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++); + } + + dbHandle.freeTable(); + + return MSG_SUCCESS; +} + + +void MsgConvertNumber(const char *pSrcNum, char *pDestNum) +{ + int overLen = 0; + int i = 0; + + overLen = strlen(pSrcNum) - MAX_PRECONFIG_NUM; + + for (i = 0; i < MAX_PRECONFIG_NUM; i++) + pDestNum[i] = pSrcNum[i+overLen]; + + pDestNum[i] = '\0'; +} + + +MSG_ERROR_T MsgStoGetRejectMsgList(const char *pNumber, MSG_REJECT_MSG_LIST_S *pRejectMsgList) +{ + // Clear Out Parameter + pRejectMsgList->nCount = 0; + pRejectMsgList->rejectMsgInfo = NULL; + + int rowCnt = 0; + int index = 3; // numbers of index + + char sqlQuery[MAX_QUERY_LEN+1]; + + // Search Reject Msg + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if (pNumber != NULL) { + char phoneNumber[MAX_PRECONFIG_NUM+1]; + memset(phoneNumber, 0x00, sizeof(phoneNumber)); + + if (strlen(pNumber) > MAX_PRECONFIG_NUM) { + MsgConvertNumber(pNumber, phoneNumber); + } else { + strncpy(phoneNumber, pNumber, MAX_PRECONFIG_NUM); + } + + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT B.MSG_ID, B.MSG_TEXT, B.DISPLAY_TIME \ + FROM %s A, %s B \ + WHERE A.ADDRESS_ID = B.ADDRESS_ID \ + AND B.MAIN_TYPE = %d \ + AND B.SUB_TYPE = %d \ + AND A.ADDRESS_VAL LIKE '%%%s' \ + ORDER BY B.DISPLAY_TIME DESC;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_SMS_TYPE, MSG_REJECT_SMS, phoneNumber); + } else { + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT B.MSG_ID, B.MSG_TEXT, B.DISPLAY_TIME \ + FROM %s A, %s B \ + WHERE A.ADDRESS_ID = B.ADDRESS_ID \ + AND B.MAIN_TYPE = %d \ + AND B.SUB_TYPE = %d \ + ORDER BY B.DISPLAY_TIME DESC;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, + MSG_SMS_TYPE, MSG_REJECT_SMS); + } + + MSG_ERROR_T err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS) { + MSG_DEBUG("%s", sqlQuery); + + dbHandle.freeTable(); + + return err; + } + + pRejectMsgList->nCount = rowCnt; + + MSG_DEBUG("pRejectMsgList->nCount [%d]", pRejectMsgList->nCount); + + pRejectMsgList->rejectMsgInfo = (MSG_REJECT_MSG_INFO_S *)new char[sizeof(MSG_REJECT_MSG_INFO_S)*rowCnt]; + + MSG_REJECT_MSG_INFO_S *pTmp = pRejectMsgList->rejectMsgInfo; + + for (int i = 0; i < rowCnt; i++) { + pTmp->msgId = dbHandle.getColumnToInt(index++); + + memset(pTmp->msgText, 0x00, sizeof(pTmp->msgText)); + dbHandle.getColumnToString(index++, MAX_MSG_TEXT_LEN, pTmp->msgText); + + pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++); + + pTmp++; + } + + dbHandle.freeTable(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetSyncMLExtId(MSG_MESSAGE_ID_T msgId, int *extId) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT EXT_ID FROM %s WHERE MSG_ID = %d;", + MSGFW_SYNCML_MSG_TABLE_NAME, msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + *extId = dbHandle.columnInt(0); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetReportStatus(MSG_MESSAGE_ID_T msgId, MSG_REPORT_STATUS_INFO_S *pReportStatus) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DELIVERY_REPORT_STATUS, DELIVERY_REPORT_TIME, READ_REPORT_STATUS, READ_REPORT_TIME \ + FROM %s WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pReportStatus->deliveryStatus = (MSG_DELIVERY_REPORT_STATUS_T)dbHandle.columnInt(0); + pReportStatus->deliveryStatusTime = (time_t)dbHandle.columnInt(1); + pReportStatus->readStatus = (MSG_READ_REPORT_STATUS_T)dbHandle.columnInt(2); + pReportStatus->readStatusTime = (time_t)dbHandle.columnInt(3); + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetThreadUnreadCnt(MSG_THREAD_ID_T ThreadId, int *cnt) +{ + MSG_BEGIN(); + + int msgCnt = 0; + *cnt = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + // Get MSG_ID + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s A \ + WHERE ADDRESS_ID = %d AND READ_STATUS = 0;", + MSGFW_MESSAGE_TABLE_NAME, ThreadId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + msgCnt = dbHandle.columnInt(0); + } + + dbHandle.finalizeQuery(); + + *cnt = msgCnt; + + MSG_END(); + + return MSG_SUCCESS; +} + diff --git a/framework/storage-handler/MsgStorageMms.cpp b/framework/storage-handler/MsgStorageMms.cpp new file mode 100755 index 0000000..2290ce1 --- /dev/null +++ b/framework/storage-handler/MsgStorageMms.cpp @@ -0,0 +1,553 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MsgCppTypes.h" +#include "MsgUtilFile.h" +#include "MsgUtilStorage.h" +#include "MsgSqliteWrapper.h" +#include "MsgStorageHandler.h" +#include "MsgContact.h" + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +extern MsgDbHandler dbHandle; + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgStoGetText(MSG_MESSAGE_ID_T MsgId, char *pSubject, char *pMsgText) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SUBJECT, MSG_TEXT FROM %s WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MsgId); + + if(dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if(dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + + char *subject = (char*)dbHandle.columnText(0); + char *text = (char*)dbHandle.columnText(1); + + if(subject) + strncpy(pSubject, subject, MAX_SUBJECT_LEN); + if(text) + strncpy(pMsgText, text, MAX_MSG_TEXT_LEN); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; + +} + + + +MSG_ERROR_T MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + int rowCnt = 0; + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + dbHandle.beginTrans(); + + if(pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) + { + if( pMsg->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS ) + { + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, DISPLAY_TIME = %lu, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE REFERENCE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->networkStatus, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + dbHandle.bindText(pMsg->subject, 1); + dbHandle.bindText(pMsg->msgText, 2); + } + else if( pMsg->networkStatus == MSG_NETWORK_RETRIEVE_FAIL) + { + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s' WHERE REFERENCE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->networkStatus, pMsg->thumbPath, pMsg->msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + dbHandle.bindText(pMsg->subject, 1); + dbHandle.bindText(pMsg->msgText, 2); + } + } + else if (pMsg->msgType.subType == MSG_SENDREQ_MMS) + { + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET MSG_DATA = '%s', MSG_TEXT = ?, THUMB_PATH = '%s' WHERE REFERENCE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgData, pMsg->thumbPath, pMsg->referenceId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + dbHandle.bindText(pMsg->msgText, 1); + } + else + { + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, NETWORK_STATUS = %d WHERE REFERENCE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->folderId, pMsg->networkStatus, pMsg->msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + } + + if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) + { + dbHandle.finalizeQuery(); + dbHandle.endTrans(false); + MSG_DEBUG("Update MMS Message. Fail [%s]", sqlQuery); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + unsigned int addrId = 0; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + // Get SUB_TYPE, STORAGE_ID + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT ADDRESS_ID \ + FROM %s \ + WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return MSG_ERR_DB_PREPARE; + } + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) + { + addrId = dbHandle.columnInt(0); + + MSG_DEBUG("AddressId:[%d]", addrId); + } + else + { + MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery); + dbHandle.finalizeQuery(); + dbHandle.endTrans(false); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT ADDRESS_ID \ + FROM %s \ + WHERE REFERENCE_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) + { + MSG_DEBUG("Failed to Get Table"); + + dbHandle.freeTable(); + dbHandle.endTrans(false); + + return MSG_ERR_STORAGE_ERROR; + } + + for (int i = 1; i <= rowCnt; i++) + { + addrId = dbHandle.getColumnToInt(i); + + if (MsgStoUpdateAddress(&dbHandle, addrId) != MSG_SUCCESS) + { + MSG_DEBUG("MsgStoUpdateAddress() Error"); + dbHandle.freeTable(); + dbHandle.endTrans(false); + + return MSG_ERR_STORAGE_ERROR; + } + } + + dbHandle.freeTable(); + + dbHandle.endTrans(true); + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONTENTS_LOCATION FROM %s WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsgInfo->msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) + { + if (dbHandle.columnText(0) != NULL) + { + strncpy(pMsgInfo->msgData, (char*)dbHandle.columnText(0), MAX_MSG_DATA_LEN); + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + } + else + { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_NORECORD; + } + } + else + { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoSetReadReportSendStatus(MSG_MESSAGE_ID_T msgId, int readReportSendStatus) +{ + bool bReadReportSent = false; + + if((MmsRecvReadReportSendStatus)readReportSendStatus == MMS_RECEIVE_READ_REPORT_SENT) + bReadReportSent = true; + else + bReadReportSent = false; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_REPORT_SEND_STATUS = %d, READ_REPORT_SENT = %d WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, (MmsRecvReadReportSendStatus)readReportSendStatus, (int)bReadReportSent, + MSGFW_MESSAGE_TABLE_NAME, msgId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg) +{ + MSG_ERROR_T err = MSG_SUCCESS; + char sqlQuery[MAX_QUERY_LEN+1]; + int referenceId = 0; + int rowCnt = 0; + int index = 3; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) + referenceId = dbHandle.columnInt(0); + + dbHandle.finalizeQuery(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_TYPE, RECIPIENT_TYPE, ADDRESS_VAL FROM %s WHERE ADDRESS_ID IN \ + (SELECT ADDRESS_ID FROM %s WHERE REFERENCE_ID = %d);", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, referenceId); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) + { + dbHandle.freeTable(); + return err; + } + + for(int i = 0; i < rowCnt; i++) + { + pMsg->addressList[i].addressType = dbHandle.getColumnToInt(index++); + pMsg->addressList[i].recipientType = dbHandle.getColumnToInt(index++); + dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pMsg->addressList[i].addressVal); + } + + pMsg->nAddressCnt = rowCnt; + + dbHandle.freeTable(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetSubject(MSG_MESSAGE_ID_T MsgId, char *pSubject) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SUBJECT FROM %s WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) + { + strncpy(pSubject, (char*)dbHandle.columnText(0), MAX_SUBJECT_LEN); + } + else + { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoUpdateNetworkStatus(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_NETWORK_STATUS_T Status) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + MSGFW_MESSAGE_TABLE_NAME, Status, + MSGFW_MESSAGE_TABLE_NAME, pMsgInfo->msgId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + MSG_END(); + + return err; +} + + +MSG_ERROR_T MsgStoGetRecipientList(MSG_MESSAGE_ID_T msgId, MSG_RECIPIENTS_LIST_S *pRecipientList) +{ + if (pRecipientList == NULL) + { + MSG_DEBUG("pRecipientList is NULL"); + return MSG_ERR_NULL_POINTER; + } + + int rowCnt = 0, index = 7; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.ADDRESS_TYPE, B.RECIPIENT_TYPE, B.ADDRESS_VAL, B.CONTACT_ID, \ + B.DISPLAY_NAME, B.FIRST_NAME, B.LAST_NAME \ + FROM %s A, %s B \ + WHERE A.MSG_ID = %d \ + AND A.ADDRESS_ID = B.ADDRESS_ID;", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, msgId); + + if (dbHandle.getTable(sqlQuery, &rowCnt) != MSG_SUCCESS) + { + dbHandle.freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + pRecipientList->recipientCnt= rowCnt; + + MSG_DEBUG("pRecipientList->recipientCnt [%d]", pRecipientList->recipientCnt); + + pRecipientList->recipientAddr= (MSG_ADDRESS_INFO_S*)new char[sizeof(MSG_ADDRESS_INFO_S)*rowCnt]; + + MSG_ADDRESS_INFO_S* pTmp = pRecipientList->recipientAddr; + + char firstName[MAX_THREAD_NAME_LEN+1], lastName[MAX_THREAD_NAME_LEN+1]; + char displayName[MAX_DISPLAY_NAME_LEN+1]; + + int order = MsgGetContactNameOrder(); + + for (int i = 0; i < rowCnt; i++) + { + pTmp->threadId = 0; + + pTmp->addressType = dbHandle.getColumnToInt(index++); + pTmp->recipientType= dbHandle.getColumnToInt(index++); + + memset(pTmp->addressVal, 0x00, sizeof(pTmp->addressVal)); + dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pTmp->addressVal); + + pTmp->contactId= dbHandle.getColumnToInt(index++); + + memset(displayName, 0x00, sizeof(displayName)); + dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, displayName); + + memset(firstName, 0x00, sizeof(firstName)); + dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, firstName); + + memset(lastName, 0x00, sizeof(lastName)); + dbHandle.getColumnToString(index++, MAX_THREAD_NAME_LEN, lastName); + + if (strlen(displayName) <= 0) + { + if (order == 0) + { + if (firstName[0] != '\0') + { + strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (lastName[0] != '\0') + { + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + else if (order == 1) + { + if (lastName[0] != '\0') + { + strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + + if (firstName[0] != '\0') + { + strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + } + + memset(pTmp->displayName, 0x00, sizeof(pTmp->displayName)); + strncpy(pTmp->displayName, displayName, MAX_DISPLAY_NAME_LEN); + + pTmp++; + } + + dbHandle.freeTable(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetReadStatus(MSG_MESSAGE_ID_T MsgId, bool *pReadStatus) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT READ_STATUS FROM %s WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) + { + *pReadStatus = (bool)dbHandle.columnInt(0); + } + else + { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetAddrInfo(MSG_MESSAGE_ID_T MsgId, MSG_ADDRESS_INFO_S *pAddrInfo) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + // Add Address + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_ID, A.ADDRESS_TYPE, A.RECIPIENT_TYPE, A.CONTACT_ID, A.ADDRESS_VAL \ + FROM %s A, %s B WHERE A.ADDRESS_ID = B.ADDRESS_ID AND B.MSG_ID = %d;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + pAddrInfo->threadId = dbHandle.columnInt(0); + pAddrInfo->addressType = dbHandle.columnInt(1); + pAddrInfo->recipientType = dbHandle.columnInt(2); + pAddrInfo->contactId = dbHandle.columnInt(3); + + strncpy(pAddrInfo->addressVal, (char*)dbHandle.columnText(4), MAX_ADDRESS_VAL_LEN); + } else { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + diff --git a/framework/storage-handler/MsgStorageSim.cpp b/framework/storage-handler/MsgStorageSim.cpp new file mode 100755 index 0000000..ccbcb4e --- /dev/null +++ b/framework/storage-handler/MsgStorageSim.cpp @@ -0,0 +1,182 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgContact.h" +#include "MsgUtilStorage.h" +#include "MsgGconfWrapper.h" +#include "MsgSqliteWrapper.h" +#include "MsgPluginManager.h" +#include "MsgStorageHandler.h" + +using namespace std; + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +extern MsgDbHandler dbHandle; + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgInitSimMessage(MSG_SIM_STATUS_T SimStatus) +{ + MSG_DEBUG("Start SIM Message Initialization"); + + MSG_ERROR_T err = MSG_SUCCESS; + + // Set SIM count of vconf to 0 + if (MsgSettingSetInt(SIM_USED_COUNT, 0) != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT); + } + + if (MsgSettingSetInt(SIM_TOTAL_COUNT, 0) != MSG_SUCCESS) + { + MSG_DEBUG("Error to set config data [%s]", SIM_TOTAL_COUNT); + } + + if (SimStatus != MSG_SIM_STATUS_NOT_FOUND) + { + MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE; + MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); + + if (plg == NULL) + { + MSG_DEBUG("No plugin for %d type", mainType); + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } + + // Check SIM Status + MSG_DEBUG(" ** SIM is available - status : [%d] ** ", SimStatus); + + err = plg->initSimMessage(); + } + + return err; +} + + +MSG_ERROR_T MsgStoClearSimMessageInDB() +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + queue threadList; + + // Get Address ID of SIM Message + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(B.ADDRESS_ID) \ + FROM %s A, %s B \ + WHERE A.ADDRESS_ID = B.ADDRESS_ID \ + AND A.STORAGE_ID = %d", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MSG_STORAGE_SIM); + + int rowCnt = 0; + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) + { + MSG_DEBUG("sql query is %s.", sqlQuery); + + dbHandle.freeTable(); + return err; + } + + if (rowCnt <= 0) + { + dbHandle.freeTable(); + return MSG_SUCCESS; + } + + for (int i = 1; i <= rowCnt; i++) + { + MSG_DEBUG("thread ID : %d", dbHandle.getColumnToInt(i)); + threadList.push((MSG_THREAD_ID_T)dbHandle.getColumnToInt(i)); + } + + dbHandle.freeTable(); + + const char* tableList[] = {MSGFW_SMS_SENDOPT_TABLE_NAME, MSGFW_SIM_MSG_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME}; + + int listCnt = sizeof(tableList)/sizeof(char*); + + dbHandle.beginTrans(); + + for (int i = 0; i < listCnt; i++) + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN \ + (SELECT MSG_ID FROM %s WHERE STORAGE_ID = %d);", + tableList[i], MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM); + + // Delete SIM Message in tables + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + } + + // Clear Address table + if (MsgStoClearAddressTable(&dbHandle) != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return MSG_ERR_DB_EXEC; + } + + // Update Address + while (!threadList.empty()) + { + err = MsgStoUpdateAddress(&dbHandle, threadList.front()); + + threadList.pop(); + + if (err != MSG_SUCCESS) + { + dbHandle.endTrans(false); + return err; + } + } + + dbHandle.endTrans(true); + + return MSG_SUCCESS; +} + diff --git a/framework/storage-handler/MsgStorageUtil.cpp b/framework/storage-handler/MsgStorageUtil.cpp new file mode 100755 index 0000000..372b622 --- /dev/null +++ b/framework/storage-handler/MsgStorageUtil.cpp @@ -0,0 +1,398 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include + +#include "MsgDebug.h" +#include "MsgCppTypes.h" +#include "MsgUtilFile.h" +#include "MsgContact.h" +#include "MsgSoundPlayer.h" +#include "MsgGconfWrapper.h" +#include "MsgSqliteWrapper.h" +#include "MsgPluginManager.h" +#include "MsgUtilStorage.h" +#include "MsgStorageHandler.h" + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +extern MsgDbHandler dbHandle; + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort) +{ + char sql[128]; + char order[6]; + + memset(sql, 0x00, sizeof(sql)); + memset(order, 0x00, sizeof(order)); + + if (pSortRule->bAscending == true) + strncpy(order, "ASC", 5); + else + strncpy(order, "DESC", 5); + + int nameOrder = MsgGetContactNameOrder(); + + switch (pSortRule->sortType) + { + case MSG_SORT_BY_DISPLAY_FROM : + if (nameOrder == 0) + snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); + else + snprintf(sql, sizeof(sql), "ORDER BY B.LAST_NAME %s, B.FIRST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); + break; + case MSG_SORT_BY_DISPLAY_TO : + if (nameOrder == 0) + snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); + else + snprintf(sql, sizeof(sql), "ORDER BY B.LAST_NAME %s, B.FIRST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); + break; + case MSG_SORT_BY_DISPLAY_TIME : + snprintf(sql, sizeof(sql), "ORDER BY A.DISPLAY_TIME %s;", order); + break; + case MSG_SORT_BY_MSG_TYPE : + snprintf(sql, sizeof(sql), "ORDER BY A.MAIN_TYPE %s, A.DISPLAY_TIME DESC;", order); + break; + case MSG_SORT_BY_READ_STATUS : + snprintf(sql, sizeof(sql), "ORDER BY A.READ_STATUS %s, A.DISPLAY_TIME DESC;", order); + break; + case MSG_SORT_BY_STORAGE_TYPE : + snprintf(sql, sizeof(sql), "ORDER BY A.STORAGE_ID %s, A.DISPLAY_TIME DESC;", order); + break; + case MSG_SORT_BY_THREAD_NAME : + if (nameOrder == 0) + snprintf(sql, sizeof(sql), "ORDER BY FIRST_NAME %s, LAST_NAME %s;", order, order); + else + snprintf(sql, sizeof(sql), "ORDER BY LAST_NAME %s, FIRST_NAME %s;", order, order); + break; + case MSG_SORT_BY_THREAD_DATE : + snprintf(sql, sizeof(sql), "ORDER BY MSG_TIME %s;", order); + break; + case MSG_SORT_BY_THREAD_COUNT : + snprintf(sql, sizeof(sql), "ORDER BY UNREAD_CNT %s;", order); + break; + default : + snprintf(sql, sizeof(sql), "ORDER BY A.DISPLAY_TIME %s;", order); + break; + } + + memcpy(pSqlSort, sql, strlen(sql)); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetSmsSendOpt(MSG_MESSAGE_ID_T MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DELREP_REQ, KEEP_COPY, REPLY_PATH FROM %s WHERE MSG_ID = %d;", + MSGFW_SMS_SENDOPT_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) + { + pSendOpt->bSetting = true; + pSendOpt->bDeliverReq = (bool)dbHandle.columnInt(0); + pSendOpt->bKeepCopy = (bool)dbHandle.columnInt(1); + pSendOpt->option.smsSendOptInfo.bReplyPath = (bool)dbHandle.columnInt(2); + } + else + { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetMmsSendOpt(MSG_MESSAGE_ID_T MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ASK_DELIVERY_REPORT, KEEP_COPY, ASK_READ_REPLY, EXPIRY_TIME, PRIORITY FROM %s WHERE MSG_ID = %d;", + MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, MsgId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) + { + pSendOpt->bSetting = true; + pSendOpt->bDeliverReq = (bool)dbHandle.columnInt(0); + pSendOpt->bKeepCopy = (bool)dbHandle.columnInt(1); + pSendOpt->option.mmsSendOptInfo.bReadReq = (bool)dbHandle.columnInt(2); + pSendOpt->option.mmsSendOptInfo.expiryTime.time = (unsigned int)dbHandle.columnInt(3); + pSendOpt->option.mmsSendOptInfo.priority = (MSG_PRIORITY_TYPE_T)dbHandle.columnInt(4); + } + else + { + dbHandle.finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoAddScheduledMessage(MSG_MESSAGE_ID_T MsgID, int AlarmId, int ListenerFd) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d);", + MSGFW_SCHEDULED_MSG_TABLE_NAME, MsgID, AlarmId, ListenerFd); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + { + return MSG_ERR_DB_EXEC; + } + + if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) + { + return MSG_ERR_DB_EXEC; + } + + dbHandle.finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoDeleteScheduledMessage(MSG_MESSAGE_ID_T MsgId) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", + MSGFW_SCHEDULED_MSG_TABLE_NAME, MsgId); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + { + MSG_DEBUG("Delete Scheduled Msg Fail!!"); + return MSG_ERR_DB_EXEC; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetScheduledMessage(int AlarmId, MSG_REQUEST_INFO_S *pReqInfo, int *pListenerFd) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, LISTENER_FD FROM %s WHERE ALARM_ID = %d;", + MSGFW_SCHEDULED_MSG_TABLE_NAME, AlarmId); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) + { + pReqInfo->msgInfo.msgId = dbHandle.columnInt(0); + *pListenerFd = dbHandle.columnInt(1); + } + + dbHandle.finalizeQuery(); + + err = MsgStoGetMessage(pReqInfo->msgInfo.msgId, &(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo)); + + if (err != MSG_SUCCESS) + { + MSG_DEBUG("MsgStoGetMessage() Error!! [%d]", err); + return err; + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +bool MsgStoCheckSyncMLMsgInThread(MSG_THREAD_ID_T threadId) +{ + MSG_ERROR_T err = MSG_SUCCESS; + int rowCnt = 0; + bool isSyncMLMsg = false; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE SUB_TYPE = %d AND ADDRESS_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, MSG_SYNCML_CP, threadId); + + MSG_DEBUG("sqlQuery [%s]", sqlQuery); + + err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (rowCnt > 0) isSyncMLMsg = true; + + MSG_DEBUG("rowCnt [%d]", rowCnt); + + dbHandle.freeTable(); + + return isSyncMLMsg; +} + + +MSG_ERROR_T MsgStoResetNetworkStatus() +{ + MSG_BEGIN(); + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), + "UPDATE %s SET NETWORK_STATUS = %d WHERE NETWORK_STATUS = %d; UPDATE %s SET NETWORK_STATUS = %d WHERE NETWORK_STATUS = %d;" + , MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SEND_FAIL, MSG_NETWORK_SENDING + , MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_RETRIEVE_FAIL, MSG_NETWORK_RETRIEVING); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoCleanAbnormalMmsData() +{ + MSG_BEGIN(); + + int rowCnt = 0, index = 2; // numbers of index + + MSG_MESSAGE_ID_T msgId; + + char sqlQuery[MAX_QUERY_LEN+1]; + char filePath[MSG_FILEPATH_LEN_MAX]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MSG_ID, A.FILE_PATH FROM %s A, %s B WHERE A.MSG_ID = B.MSG_ID AND (B.SUB_TYPE = %d OR B.SUB_TYPE = %d OR B.SUB_TYPE = %d);", + MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MSG_SENDCONF_MMS, MSG_RETRIEVE_AUTOCONF_MMS, MSG_RETRIEVE_MANUALCONF_MMS); + + MSG_ERROR_T err = dbHandle.getTable(sqlQuery, &rowCnt); + + if (err == MSG_ERR_DB_NORECORD) + { + dbHandle.freeTable(); + + return MSG_SUCCESS; + } + else if (err != MSG_SUCCESS) + { + MSG_DEBUG("%s", sqlQuery); + + dbHandle.freeTable(); + + return err; + } + + + for (int i = 0; i < rowCnt; i++) + { + memset(filePath, 0x00, sizeof(filePath)); + + msgId = dbHandle.getColumnToInt(index++); + + dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, filePath); + + if(strlen(filePath) > 1) + { + MSG_DEBUG("strlen(filePath) [%d]", strlen(filePath)); + MSG_DEBUG("filePath [%s]", filePath); + if(MsgGetFileSize(filePath) < 0) + { + // abnormal mms message + MSG_DEBUG("abnormal mms message [%d]", msgId); + + // delete mms message + MsgStoDeleteMessage(msgId, false); + } + } + + } + dbHandle.freeTable(); + + MSG_END(); + + return MSG_SUCCESS; +} + +MSG_ERROR_T MsgStoCheckReadReportStatus(MSG_MESSAGE_ID_T msgId) +{ + MSG_BEGIN(); + + bool bReadReportRequested; + bool bReadReportIsSent; + + bReadReportRequested = MsgStoCheckReadReportRequested(&dbHandle, msgId); + if(bReadReportRequested == false) + return MSG_ERR_READREPORT_NOT_REQUESTED; + + bReadReportIsSent = MsgStoCheckReadReportIsSent(&dbHandle, msgId); + if(bReadReportIsSent == true) + return MSG_ERR_READREPORT_ALEADY_SENT; + + MSG_END(); + + return MSG_SUCCESS; +} + diff --git a/framework/submit-handler/MsgSubmitHandler.cpp b/framework/submit-handler/MsgSubmitHandler.cpp new file mode 100755 index 0000000..ee27fc4 --- /dev/null +++ b/framework/submit-handler/MsgSubmitHandler.cpp @@ -0,0 +1,463 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgException.h" +#include "MsgGconfWrapper.h" +#include "MsgPluginManager.h" +#include "MsgStorageHandler.h" +#include "MsgSubmitHandler.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgSubmitReq(MSG_REQUEST_INFO_S *pReqInfo, bool bScheduled) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + static int reqId = 1; + + pReqInfo->reqId = reqId; + reqId++; + + MSG_DEBUG("==== Msg ID = [%d] ====", pReqInfo->msgInfo.msgId); + MSG_DEBUG("==== Folder ID = [%d] ====", pReqInfo->msgInfo.folderId); + MSG_DEBUG("==== Main Type = [%d] ====", pReqInfo->msgInfo.msgType.mainType); + MSG_DEBUG("==== Sub Type = [%d] ====", pReqInfo->msgInfo.msgType.subType); + MSG_DEBUG("==== Class Type = [%d] ====", pReqInfo->msgInfo.msgType.classType); + MSG_DEBUG("==== Message Data = [%s] ====", pReqInfo->msgInfo.msgData); + MSG_DEBUG("==== Message Text = [%s] ====", pReqInfo->msgInfo.msgText); + + MSG_DEBUG("==== bSetting = [%d] ====", pReqInfo->sendOptInfo.bSetting); + + if (pReqInfo->msgInfo.msgType.mainType == MSG_SMS_TYPE) + { + MSG_DEBUG("==== deliver = [%d] ====", pReqInfo->sendOptInfo.bDeliverReq); + MSG_DEBUG("==== keepcopy = [%d] ====", pReqInfo->sendOptInfo.bKeepCopy); + MSG_DEBUG("==== bReplyPath = [%d] ====", pReqInfo->sendOptInfo.option.smsSendOptInfo.bReplyPath); + + err = MsgSubmitReqSMS(pReqInfo); + } + else if (pReqInfo->msgInfo.msgType.mainType == MSG_MMS_TYPE) + { + MSG_DEBUG("==== deliver = [%d] ====", pReqInfo->sendOptInfo.bDeliverReq); + MSG_DEBUG("==== keepcopy = [%d] ====", pReqInfo->sendOptInfo.bKeepCopy); + MSG_DEBUG("==== bReadReq = [%d] ====", pReqInfo->sendOptInfo.option.mmsSendOptInfo.bReadReq); + MSG_DEBUG("==== priority = [%d] ====", pReqInfo->sendOptInfo.option.mmsSendOptInfo.priority); + MSG_DEBUG("==== expiryTime = [%d] ====", pReqInfo->sendOptInfo.option.mmsSendOptInfo.expiryTime.time); + + err = MsgSubmitReqMMS(pReqInfo, bScheduled); + } + + return err; +} + + +MSG_ERROR_T MsgSubmitReqSMS(MSG_REQUEST_INFO_S *pReqInfo) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + // submit request based on msgType; + MSG_MAIN_TYPE_T mainType = pReqInfo->msgInfo.msgType.mainType; + MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); + + if (plg == NULL) + { + THROW(MsgException::PLUGIN_ERROR, "No plugin for %d type", mainType); + } + + MSG_REQUEST_INFO_S tmpInfo = {}; + + bool bReqSentStatus = false; + + for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++) + { + MsgCopyReqInfo(pReqInfo, i, &tmpInfo); + + // If MSG ID > 0 -> MSG in DRAFT + // Move Folder to OUTBOX + if (pReqInfo->msgInfo.msgPort.valid == false) + { + pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID; + + if (pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID)) + { + err = MsgStoUpdateMessage(&(tmpInfo.msgInfo), &(tmpInfo.sendOptInfo)); + } + + if (err != MSG_SUCCESS) + { + MSG_DEBUG("MsgStoUpdateMessage() Fail"); + continue; + } + } + + if (i == (pReqInfo->msgInfo.nAddressCnt -1)) + { + // Request Sent Status Callback + bReqSentStatus = true; + } + + err = plg->submitReq(&tmpInfo, bReqSentStatus); + + if (err != MSG_SUCCESS) + { + break; + } + + if (i == (pReqInfo->msgInfo.nAddressCnt -1)) + { + // Copy MSG ID + pReqInfo->msgInfo.msgId = tmpInfo.msgInfo.msgId; + } + } + + return err; +} + + +MSG_ERROR_T MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo, bool bScheduled) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_RECIPIENTS_LIST_S pRecipientList; + + MSG_MAIN_TYPE_T msgMainType = pReqInfo->msgInfo.msgType.mainType; + MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(msgMainType); + + if(!plg) + { + MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); + MSG_DEBUG("No Plugin for %d type", msgMainType); + + return MSG_ERR_INVALID_PLUGIN_HANDLE; + } + + // If MSG ID > 0 -> MSG in DRAFT + // Move Folder to OUTBOX + /* reject_msg_support */ + if(!bScheduled) + { + if(pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS) + { + char fileName[MAX_COMMON_INFO_SIZE+1] = {0}; + + // copy whole of MMS PDU filepath to msgData + strncpy(fileName, pReqInfo->msgInfo.msgData, MAX_COMMON_INFO_SIZE); + memset(pReqInfo->msgInfo.msgData, 0x00, MAX_MSG_DATA_LEN+1); + snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, MSG_IPC_DATA_PATH"%s", fileName); + + MSG_DEBUG("JAVA MMS PDU filepath:%s", pReqInfo->msgInfo.msgData); + + // submit request + plg->submitReq(pReqInfo, false); + + if(err != MSG_SUCCESS) + { + MSG_DEBUG("Update Network Status : [%d]", err); + MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo),MSG_NETWORK_SEND_FAIL); + } + + return err; + } + else if((pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_MMS) || (pReqInfo->msgInfo.msgType.subType == MSG_FORWARD_MMS)) + { + // update address list in the ase of existing message + if(pReqInfo->msgInfo.msgId > 0) + { + err = MsgStoGetOrgAddressList(&(pReqInfo->msgInfo)); + + if(err != MSG_SUCCESS) + MSG_DEBUG("[WARNING]MsgStoGetOrgAddressList returned not a MSG_SUCCESS"); + } + + if(pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID)) { + MSG_ADDRESS_INFO_S addrInfo = {0,}; + int addrIdx = 0; + + err = MsgStoGetAddrInfo(pReqInfo->msgInfo.msgId, &addrInfo); + + if (err == MSG_SUCCESS) { + for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++) { + //if (pReqInfo->msgInfo.addressList[i].threadId == addrInfo.threadId) { + if (!strcmp(pReqInfo->msgInfo.addressList[i].addressVal, addrInfo.addressVal)) { + addrIdx = i; + MSG_DEBUG("addrIdx = %d, address = [%s]", addrIdx, pReqInfo->msgInfo.addressList[i].addressVal); + break; + } + } + } else { + MSG_DEBUG("[Error]MsgStoGetAddrInfo is failed"); + } + + pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID; + err = MsgStoUpdateMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo), addrIdx); + + MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus); + } else { + //new message case + MSG_DEBUG("New Message"); + for(int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++) { + pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID; + err = MsgStoAddMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo), i); + //pReqInfo->msgInfo.msgId = 0; + } + + if (pReqInfo->msgInfo.msgId != pReqInfo->msgInfo.referenceId) { + MSG_DEBUG("Add Multi-recipient Message"); + //multi-recipient mms case + pReqInfo->msgInfo.msgId = pReqInfo->msgInfo.referenceId; + } + } + // pReqInfo->msgInfo.msgId = pReqInfo->msgInfo.referenceId; + } + else if(pReqInfo->msgInfo.msgType.subType == MSG_READREPLY_MMS) + { + err = MsgStoCheckReadReportStatus(pReqInfo->msgInfo.msgId); + if(err != MSG_SUCCESS) + return err; + + err = MsgStoGetRecipientList(pReqInfo->msgInfo.msgId, &pRecipientList); + if(err != MSG_SUCCESS) + return MSG_ERR_PLUGIN_STORAGE; + + pReqInfo->msgInfo.nAddressCnt = pRecipientList.recipientCnt; + + for(int i = 0; i < pRecipientList.recipientCnt; i++) + { + pReqInfo->msgInfo.addressList[i].addressType = pRecipientList.recipientAddr[i].addressType; + pReqInfo->msgInfo.addressList[i].recipientType = MSG_RECIPIENTS_TYPE_TO; + pReqInfo->msgInfo.addressList[i].contactId = pRecipientList.recipientAddr[i].contactId; + strncpy(pReqInfo->msgInfo.addressList[i].addressVal, pRecipientList.recipientAddr[i].addressVal, MAX_ADDRESS_VAL_LEN); + } + + char subject[MAX_SUBJECT_LEN+1]; + + err = MsgStoGetSubject(pReqInfo->msgInfo.msgId, subject); + if(err != MSG_SUCCESS) + MSG_DEBUG("Getting subject returned not a MSG_SUCCESS"); + + strncpy(pReqInfo->msgInfo.subject, subject, MAX_SUBJECT_LEN); + + err = plg->composeReadReport(&(pReqInfo->msgInfo)); + } + else if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS) + { + MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus); + } + } + + /* reject_msg_support */ + + if(err != MSG_SUCCESS) + { + MSG_DEBUG("Fail to Add/Update Message : MsgStoMoveMessageToFolder()/MsgStoAddMessage()"); + return err; + } + + switch(pReqInfo->msgInfo.msgType.subType) + { + case MSG_SENDREQ_MMS: + case MSG_FORWARD_MMS: + MsgDeleteFile(pReqInfo->msgInfo.msgData); + memset(pReqInfo->msgInfo.msgData, 0x00, MAX_MSG_DATA_LEN+1); + snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, MSG_DATA_PATH"%d.mms", pReqInfo->msgInfo.referenceId); + break; + + case MSG_READREPLY_MMS: + case MSG_READRECIND_MMS: + memset(pReqInfo->msgInfo.msgData, 0x00, MAX_MSG_DATA_LEN+1); + snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, MSG_DATA_PATH"%d.mms", pReqInfo->msgInfo.msgId); + break; + default: + break; + } + + // update content location from db + if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS) + err = MsgStoGetContentLocation(&(pReqInfo->msgInfo)); + /* reject_msg_support */ + else if(pReqInfo->msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS) + err = plg->updateRejectStatus(&(pReqInfo->msgInfo)); + /* reject_msg_support */ + + // 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..."); + MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); + + return MSG_ERR_NO_SIM; + } + + if(err == MSG_SUCCESS) + err = plg->submitReq(pReqInfo, false); + + if(err == MSG_SUCCESS && ( pReqInfo->msgInfo.msgType.subType == MSG_READREPLY_MMS || pReqInfo->msgInfo.msgType.subType == MSG_READRECIND_MMS )) + MsgStoSetReadReportSendStatus(pReqInfo->msgInfo.msgId, MMS_RECEIVE_READ_REPORT_SENT); + + if (err != MSG_SUCCESS) + { + if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS ) + MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_RETRIEVE_FAIL); + else + MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); + } + + + return err; +} + + +MSG_ERROR_T MsgCancelReq(MSG_REQUEST_ID_T reqId) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + return err; +} + + +MSG_ERROR_T MsgUpdateSentMsg(MSG_MESSAGE_ID_T MsgId, MSG_NETWORK_STATUS_T Status) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + bool bKeepCopy = true; + + // Move Msg to SENTBOX + if (Status == MSG_NETWORK_SEND_SUCCESS) + { + MSG_DEBUG(" In Status == MSG_NETWORK_SEND_SUCCESS and bKeepCopy is [%d]", bKeepCopy); + if (bKeepCopy == true) + err = MsgStoMoveMessageToFolder(MsgId, MSG_SENTBOX_ID); + else + err = MsgStoDeleteMessage(MsgId, false); + } + + return err; +} + + +void MsgCopyReqInfo(MSG_REQUEST_INFO_S *pSrc, int addrIdx, MSG_REQUEST_INFO_S *pDest) +{ + MSG_BEGIN(); + + memset(pDest, 0x00, sizeof(pDest)); + + // Copy Request ID + pDest->reqId = pSrc->reqId; + + // Copy Msg Info + pDest->msgInfo.msgId = pSrc->msgInfo.msgId; + pDest->msgInfo.folderId = pSrc->msgInfo.folderId; + + pDest->msgInfo.referenceId = pSrc->msgInfo.referenceId; + + pDest->msgInfo.msgType.mainType = pSrc->msgInfo.msgType.mainType; + pDest->msgInfo.msgType.subType = pSrc->msgInfo.msgType.subType; + pDest->msgInfo.msgType.classType = pSrc->msgInfo.msgType.classType; + + pDest->msgInfo.storageId = pSrc->msgInfo.storageId; + + pDest->msgInfo.nAddressCnt = 1; + + pDest->msgInfo.addressList[0].threadId = pSrc->msgInfo.addressList[addrIdx].threadId; + pDest->msgInfo.addressList[0].addressType = pSrc->msgInfo.addressList[addrIdx].addressType; + pDest->msgInfo.addressList[0].recipientType = pSrc->msgInfo.addressList[addrIdx].recipientType; + pDest->msgInfo.addressList[0].contactId = pSrc->msgInfo.addressList[addrIdx].contactId; + strncpy(pDest->msgInfo.addressList[0].addressVal, pSrc->msgInfo.addressList[addrIdx].addressVal, MAX_ADDRESS_VAL_LEN); + strncpy(pDest->msgInfo.addressList[0].displayName, pSrc->msgInfo.addressList[addrIdx].displayName, MAX_DISPLAY_NAME_LEN); + + strncpy(pDest->msgInfo.replyAddress, pSrc->msgInfo.replyAddress, MAX_PHONE_NUMBER_LEN); + strncpy(pDest->msgInfo.subject, pSrc->msgInfo.subject, MAX_SUBJECT_LEN); + + pDest->msgInfo.scheduledTime = pSrc->msgInfo.scheduledTime; + pDest->msgInfo.displayTime = pSrc->msgInfo.displayTime; + pDest->msgInfo.networkStatus = pSrc->msgInfo.networkStatus; + pDest->msgInfo.encodeType = pSrc->msgInfo.encodeType; + pDest->msgInfo.bRead = pSrc->msgInfo.bRead; + pDest->msgInfo.bProtected = pSrc->msgInfo.bProtected; + pDest->msgInfo.priority = pSrc->msgInfo.priority; + pDest->msgInfo.direction = pSrc->msgInfo.direction; + + pDest->msgInfo.msgPort.valid = pSrc->msgInfo.msgPort.valid; + + if (pDest->msgInfo.msgPort.valid == true) + { + pDest->msgInfo.msgPort.dstPort = pSrc->msgInfo.msgPort.dstPort; + pDest->msgInfo.msgPort.srcPort = pSrc->msgInfo.msgPort.srcPort; + } + + pDest->msgInfo.bTextSms = pSrc->msgInfo.bTextSms; + pDest->msgInfo.dataSize = pSrc->msgInfo.dataSize; + + strncpy(pDest->msgInfo.msgData, pSrc->msgInfo.msgData, MAX_MSG_DATA_LEN); + + if (pDest->msgInfo.bTextSms == true) + { + memcpy(pDest->msgInfo.msgText, pSrc->msgInfo.msgText, pDest->msgInfo.dataSize); + pDest->msgInfo.msgText[pDest->msgInfo.dataSize] = '\0'; + } + + // Set Sending Info + pDest->sendOptInfo.bSetting = pSrc->sendOptInfo.bSetting; + + if (pDest->sendOptInfo.bSetting == true) + { + pDest->sendOptInfo.bDeliverReq = pSrc->sendOptInfo.bDeliverReq; + pDest->sendOptInfo.bKeepCopy = pSrc->sendOptInfo.bKeepCopy; + + if (pDest->msgInfo.msgType.mainType == MSG_SMS_TYPE) + { + pDest->sendOptInfo.option.smsSendOptInfo.bReplyPath = pSrc->sendOptInfo.option.smsSendOptInfo.bReplyPath; + } + else if (pDest->msgInfo.msgType.mainType == MSG_MMS_TYPE) + { + pDest->sendOptInfo.option.mmsSendOptInfo.priority = pSrc->sendOptInfo.option.mmsSendOptInfo.priority; + pDest->sendOptInfo.option.mmsSendOptInfo.bReadReq = pSrc->sendOptInfo.option.mmsSendOptInfo.bReadReq; + + pDest->sendOptInfo.option.mmsSendOptInfo.expiryTime.type = pSrc->sendOptInfo.option.mmsSendOptInfo.expiryTime.type; + pDest->sendOptInfo.option.mmsSendOptInfo.expiryTime.time = pSrc->sendOptInfo.option.mmsSendOptInfo.expiryTime.time; + + pDest->sendOptInfo.option.mmsSendOptInfo.bUseDeliveryCustomTime = pSrc->sendOptInfo.option.mmsSendOptInfo.bUseDeliveryCustomTime; + pDest->sendOptInfo.option.mmsSendOptInfo.deliveryTime.type = pSrc->sendOptInfo.option.mmsSendOptInfo.deliveryTime.type; + pDest->sendOptInfo.option.mmsSendOptInfo.deliveryTime.time = pSrc->sendOptInfo.option.mmsSendOptInfo.deliveryTime.time; + } + } + + MSG_END(); +} + diff --git a/framework/transaction-manager/MsgCmdHandlerSetting.cpp b/framework/transaction-manager/MsgCmdHandlerSetting.cpp new file mode 100755 index 0000000..926c551 --- /dev/null +++ b/framework/transaction-manager/MsgCmdHandlerSetting.cpp @@ -0,0 +1,105 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MsgCmdHandler.h" +#include "MsgSettingHandler.h" +#include "MsgUtilFunction.h" +#include "MsgCppTypes.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +int MsgSetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + // Get Setting Structure + MSG_SETTING_S* pSetting = (MSG_SETTING_S*)pCmd->cmdData; + + // Set Config Data + err = MsgSetConfigData(pSetting); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgSetConfigData()"); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgSetConfigData()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SET_CONFIG, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Option Type + MSG_OPTION_TYPE_T* type = (MSG_OPTION_TYPE_T*)pCmd->cmdData; + + // Get Config Data + MSG_SETTING_S setting; + setting.type = *type; + + err = MsgGetConfigData(&setting); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgGetConfigData()"); + + // Encoding Config Data + dataSize = MsgEncodeSetting(&setting, &encodedData); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgGetConfigData()"); + } + + MSG_DEBUG("dataSize [%d]", dataSize); + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_CONFIG, err, (void**)ppEvent); + + return eventSize; +} diff --git a/framework/transaction-manager/MsgCmdHandlerStorage.cpp b/framework/transaction-manager/MsgCmdHandlerStorage.cpp new file mode 100755 index 0000000..54144ee --- /dev/null +++ b/framework/transaction-manager/MsgCmdHandlerStorage.cpp @@ -0,0 +1,1080 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgException.h" +#include "MsgCppTypes.h" +#include "MsgUtilFunction.h" +#include "MsgStorageHandler.h" +#include "MsgPluginManager.h" +#include "MsgTransManager.h" +#include "MsgCmdHandler.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Message Info + MSG_MESSAGE_INFO_S* pMsgInfo = (MSG_MESSAGE_INFO_S*)pCmd->cmdData; + + // Get Sending Option + MSG_SENDINGOPT_INFO_S* pSendOptInfo = (MSG_SENDINGOPT_INFO_S*)(pCmd->cmdData + sizeof(MSG_MESSAGE_INFO_S)); + + // Add Message with address + for (int i = 0; i < pMsgInfo->nAddressCnt; i++) + { + err = MsgStoAddMessage(pMsgInfo, pSendOptInfo, i); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoAddMessage()"); + + // Get First Msg Id + if (i == 0) + { + // Encoding Message ID + dataSize = MsgEncodeMsgId(&(pMsgInfo->msgId), &encodedData); + } + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoAddMessage()"); + } + } + + // Add Message without address + if (pMsgInfo->nAddressCnt == 0) + { + err = MsgStoAddMessage(pMsgInfo, pSendOptInfo); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoAddMessage()"); + + // Encoding Message ID + dataSize = MsgEncodeMsgId(&(pMsgInfo->msgId), &encodedData); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoAddMessage()"); + } + } + + // Delete Temp File for Message Data + if (pMsgInfo->bTextSms == false) + MsgDeleteFile(pMsgInfo->msgData); //ipc + + //storage change CB + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = pMsgInfo->msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList); + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_ADD_MSG, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgAddSyncMLMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + int extId = 0, pinCode = 0; + + MSG_MESSAGE_INFO_S msgInfo = {}; + + memcpy(&extId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int)); + memcpy(&pinCode, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)), sizeof(int)); + memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+sizeof(int)), sizeof(MSG_MESSAGE_INFO_S)); + + // Add Message + err = MsgStoAddSyncMLMessage(&msgInfo, extId, pinCode); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoAddSyncMLMessage()"); + + // broadcast to listener threads, here + MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo); + //storage change CB + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = msgInfo.msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoAddSyncMLMessage()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ADD_SYNCML_MSG, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgUpdateMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + // Get Message Info + MSG_MESSAGE_INFO_S* pMsgInfo = (MSG_MESSAGE_INFO_S*)pCmd->cmdData; + + // Get Sending Option + MSG_SENDINGOPT_INFO_S* pSendOptInfo = (MSG_SENDINGOPT_INFO_S*)(pCmd->cmdData + sizeof(MSG_MESSAGE_INFO_S)); + + // Update Message + err = MsgStoUpdateMessage(pMsgInfo, pSendOptInfo); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Command Handle Success : MsgStoUpdateMessage()"); + else + MSG_DEBUG("Command Handle Fail : MsgStoUpdateMessage()"); + + // Delete Temp File for Message Data + if (pMsgInfo->bTextSms == false) + MsgDeleteFile(pMsgInfo->msgData); //ipc + + //storage change CB + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = pMsgInfo->msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_MSG, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgUpdateReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + MSG_MESSAGE_ID_T msgId; + bool readStatus; + + memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_ID_T)); + memcpy(&readStatus, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), sizeof(bool)); + + // Update Read Status + err = MsgStoUpdateReadStatus(msgId, readStatus); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoUpdateReadStatus()"); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoUpdateReadStatus()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_READ, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgUpdateThreadReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + MSG_THREAD_ID_T threadId; + int unReadCnt = 0; + + memcpy(&threadId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_THREAD_ID_T)); + + MsgStoGetThreadUnreadCnt(threadId, &unReadCnt); + + MSG_DEBUG("unReadCnt [%d]", unReadCnt); + + if (unReadCnt > 0) { + + err = MsgStoUpdateThreadReadStatus(threadId); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Command Handle Success : MsgStoUpdateThreadReadStatus()"); + else + MSG_DEBUG("Command Handle Fail : MsgStoUpdateThreadReadStatus()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_THREAD_READ, err, (void**)ppEvent); + + return eventSize; + +} + + +int MsgUpdateProtectedStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + MSG_MESSAGE_ID_T msgId; + bool protectedStatus; + + memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_ID_T)); + memcpy(&protectedStatus, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), sizeof(bool)); + + // Update Protected Status + err = MsgStoUpdateProtectedStatus(msgId, protectedStatus); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoUpdateProtectedStatus()"); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoUpdateProtectedStatus()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_PROTECTED, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgDeleteMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + int extId = 0; + + MSG_MESSAGE_ID_T* msgId = (MSG_MESSAGE_ID_T*)pCmd->cmdData; + + MsgStoGetSyncMLExtId(*msgId, &extId); + + // Delete Message + err = MsgStoDeleteMessage(*msgId, true); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Command Handle Success : MsgStoDeleteMessage()"); + + if(extId > 0) { + // broadcast to listener threads, here + MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, -1, extId); + } + + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = *msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, &msgIdList); + } else { + MSG_DEBUG("Command Handle Fail : MsgStoDeleteMessage()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_MSG, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgDeleteAllMessageInFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + MSG_FOLDER_ID_T* folderId = (MSG_FOLDER_ID_T*)pCmd->cmdData; + + bool bOnlyDB; + memcpy(&bOnlyDB, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_FOLDER_ID_T)), sizeof(bool)); + + + MSG_MSGID_LIST_S msgIdList; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + // Delete Message + err = MsgStoDeleteAllMessageInFolder(*folderId, bOnlyDB, &msgIdList); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Command Handle Success : MsgStoDeleteAllMessageInFolder()"); + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, &msgIdList); + if(msgIdList.msgIdList != NULL) + delete [] (char*)msgIdList.msgIdList; + } else { + MSG_DEBUG("Command Handle Fail : MsgStoDeleteAllMessageInFolder()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELALL_MSGINFOLDER, err, (void**)ppEvent); + + return eventSize; + +} + + +int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + MSG_MESSAGE_ID_T msgId; + MSG_FOLDER_ID_T folderId; + + memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_ID_T)); + memcpy(&folderId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), sizeof(MSG_FOLDER_ID_T)); + + // Move Message + err = MsgStoMoveMessageToFolder(msgId, folderId); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Command Handle Success : MsgStoMoveMessageToFolder()"); + + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + } else { + MSG_DEBUG("Command Handle Fail : MsgStoMoveMessageToFolder()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_MOVE_MSGTOFOLDER, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgMoveMessageToStorageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + MSG_MESSAGE_ID_T msgId; + MSG_STORAGE_ID_T storageId; + + memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_ID_T)); + memcpy(&storageId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), sizeof(MSG_STORAGE_ID_T)); + + // Move Message + err = MsgStoMoveMessageToStorage(msgId, storageId); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoMoveMessageToStorage()"); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoMoveMessageToStorage()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_MOVE_MSGTOSTORAGE, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgCountMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Folder ID + MSG_FOLDER_ID_T* folderId = (MSG_FOLDER_ID_T*)pCmd->cmdData; + + // Get Message Count + MSG_COUNT_INFO_S countInfo; + + err = MsgStoCountMessage(*folderId, &countInfo); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoCountMessage()"); + + // Encoding Messaging Count Data + dataSize = MsgEncodeCountInfo(&countInfo, &encodedData); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoCountMessage()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_COUNT_MSG, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgCountMsgByTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Folder ID + MSG_MESSAGE_TYPE_S* pMsgType = (MSG_MESSAGE_TYPE_S*)pCmd->cmdData; + + int nMsgCnt = 0; + + // Get Message Count + err = MsgStoCountMsgByType(pMsgType, &nMsgCnt); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoCountMsgByType()"); + + // Encoding Messaging Count Data + dataSize = MsgEncodeCountByMsgType(nMsgCnt, &encodedData); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoCountMsgByType()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_COUNT_BY_MSGTYPE, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + // Get Message ID + MSG_MESSAGE_ID_T* msgId = (MSG_MESSAGE_ID_T*)pCmd->cmdData; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Message + MSG_MESSAGE_INFO_S msgInfo; + MSG_SENDINGOPT_INFO_S sendOptInfo; + + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + memset(&sendOptInfo, 0x00, sizeof(MSG_SENDINGOPT_INFO_S)); + + err = MsgStoGetMessage(*msgId, &msgInfo, &sendOptInfo); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoGetMessage()"); + + // Encoding Message Info Data + dataSize = MsgEncodeMsgInfo(&msgInfo, &sendOptInfo, &encodedData); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoGetMessage()"); + } + +// MsgSoundPlayStop(); + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_MSG, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetFolderViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + // Get Folder ID + MSG_FOLDER_ID_T folderId; + MSG_SORT_RULE_S sortRule; + + memcpy(&folderId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_FOLDER_ID_T)); + memcpy(&sortRule, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_FOLDER_ID_T)), sizeof(MSG_SORT_RULE_S)); + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Message Common Info + MSG_LIST_S folderViewList; + + err = MsgStoGetFolderViewList(folderId, &sortRule, &folderViewList); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoGetFolderViewList()"); + + // Encoding Folder View List Data + dataSize = MsgEncodeFolderViewList(&folderViewList, &encodedData); + + MSG_DEBUG("dataSize [%d]", dataSize); + + if (folderViewList.msgInfo != NULL) + { + delete [] folderViewList.msgInfo; + folderViewList.msgInfo = NULL; + } + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoGetFolderViewList()"); + return err; + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_FOLDERVIEWLIST, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgAddFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + // Get Folder Info + MSG_FOLDER_INFO_S* pFolderInfo = (MSG_FOLDER_INFO_S*)pCmd->cmdData; + + // Add Folder + err = MsgStoAddFolder(pFolderInfo); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoAddFolder()"); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoAddFolder()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ADD_FOLDER, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgUpdateFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + // Get Folder Info + MSG_FOLDER_INFO_S* pFolderInfo = (MSG_FOLDER_INFO_S*)pCmd->cmdData; + + // Update Folder + err = MsgStoUpdateFolder(pFolderInfo); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoUpdateFolder()"); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoUpdateFolder()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_FOLDER, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgDeleteFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + // Get Folder Info + MSG_FOLDER_ID_T* pFolderInfo = (MSG_FOLDER_ID_T*)pCmd->cmdData; + + // Delete Folder + err = MsgStoDeleteFolder(*pFolderInfo); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoDeleteFolder()"); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoDeleteFolder()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_FOLDER, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetFolderListHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Storage List + MSG_FOLDER_LIST_S folderList; + + err = MsgStoGetFolderList(&folderList); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoGetFolderList()"); + + // Encoding Folder List Data + dataSize = MsgEncodeFolderList(&folderList, &encodedData); + + delete [] folderList.folderInfo; + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoGetFolderList()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_FOLDERLIST, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgInitSimBySatHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + // Sim Init - Later + //Run msg-init-app + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INIT_SIM_BY_SAT, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetMsgTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + + int dataSize = 0, eventSize = 0; + + // Get Message ID + MSG_MESSAGE_ID_T msgId; + + memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_ID_T)); + + // Get Msg Type + MSG_MESSAGE_TYPE_S msgType; + + err = MsgStoGetMsgType(msgId, &msgType); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoGetMsgType()"); + + // Encoding Storage List Data + dataSize = MsgEncodeMsgType(&msgType, &encodedData); + + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoGetMsgType()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_MSG_TYPE, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_SORT_RULE_S sortRule = {0}; + + memcpy(&sortRule, pCmd->cmdData, sizeof(MSG_SORT_RULE_S)); + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Thread View List + MSG_THREAD_VIEW_LIST_S msgThreadViewList; + + err = MsgStoGetThreadViewList(&sortRule, &msgThreadViewList); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoGetThreadViewList()"); + + // Encoding Folder View List Data + dataSize = MsgEncodeThreadViewList(&msgThreadViewList, &encodedData); + + MSG_DEBUG("dataSize [%d]", dataSize); + + if (msgThreadViewList.msgThreadInfo != NULL) + { + delete [] msgThreadViewList.msgThreadInfo; + msgThreadViewList.msgThreadInfo = NULL; + } + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoGetThreadViewList()"); + return err; + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_THREADVIEWLIST, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetConversationViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_THREAD_ID_T threadId; + + memcpy(&threadId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_THREAD_ID_T)); + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + MSG_LIST_S convViewList; + + err = MsgStoGetConversationViewList(threadId, &convViewList); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoGetConversationViewList()"); + + // Encoding Folder View List Data + dataSize = MsgEncodeConversationViewList(&convViewList, &encodedData); + + MSG_DEBUG("dataSize [%d]", dataSize); + + if (convViewList.msgInfo != NULL) + { + delete [] convViewList.msgInfo; + convViewList.msgInfo = NULL; + } + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoGetConversationViewList()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_CONVERSATIONVIEWLIST, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_THREAD_ID_T threadId; + bool isSyncMLMsg = false; + + memcpy(&threadId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_THREAD_ID_T)); + + int eventSize = 0; + + isSyncMLMsg = MsgStoCheckSyncMLMsgInThread(threadId); + + MSG_MSGID_LIST_S msgIdList; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + err = MsgStoDeleteThreadMessageList(threadId, &msgIdList); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("Command Handle Success : MsgStoDeleteThreadMessageList()"); + + if(isSyncMLMsg == true) { + // broadcast to listener threads, here + MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, -1, -1); + } + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, &msgIdList); + if(msgIdList.msgIdList != NULL) + delete [] (char*)msgIdList.msgIdList; + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoDeleteThreadMessageList()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_THREADMESSAGELIST, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgCountMsgByContactHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + // Get From address + MSG_THREAD_LIST_INDEX_S addrInfo; + + memcpy(&addrInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_THREAD_LIST_INDEX_S)); + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Message Common Info + MSG_THREAD_COUNT_INFO_S threadCountInfo = {0}; + + err = MsgStoCountMsgByContact(&addrInfo, &threadCountInfo); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoCountMsgByContact()"); + + // Encoding Folder View List Data + dataSize = MsgEncodeMsgGetContactCount(&threadCountInfo, &encodedData); + + MSG_DEBUG("dataSize [%d]", dataSize); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoCountMsgByContact()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_CONTACT_COUNT, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetQuickPanelDataHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + // Get Message ID + MSG_QUICKPANEL_TYPE_T* type = (MSG_QUICKPANEL_TYPE_T*)pCmd->cmdData; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Message + MSG_MESSAGE_INFO_S msgInfo; + + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + + err = MsgStoGetQuickPanelData(*type, &msgInfo); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoGetQuickPanelData()"); + + // Encoding Message Info Data + dataSize = MsgEncodeMsgInfo(&msgInfo, &encodedData); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoGetQuickPanelData()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_QUICKPANEL_DATA, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgResetDatabaseHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + // Reset DB + err = MsgStoResetDatabase(); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Command Handle Success : MsgStoResetDatabase()"); + else + MSG_DEBUG("Command Handle Fail : MsgStoResetDatabase()"); + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_RESET_DB, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetMemSizeHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + // Get Memory size + unsigned int memsize = 0; + + memsize = MsgDu(MSG_DATA_ROOT_PATH); + + dataSize = MsgEncodeMemSize(&memsize, &encodedData); + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_MEMSIZE, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgGetReportStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + // Get Message ID + MSG_MESSAGE_ID_T* msgId = (MSG_MESSAGE_ID_T*)pCmd->cmdData; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int dataSize = 0, eventSize = 0; + + MSG_REPORT_STATUS_INFO_S reportStatus; + + memset(&reportStatus, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S)); + + err = MsgStoGetReportStatus(*msgId, &reportStatus); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgGetReportStatusHandler()"); + + // Encoding Report Status Data + dataSize = MsgEncodeReportStatus(&reportStatus, &encodedData); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgGetReportStatusHandler()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_REPORT_STATUS, err, (void**)ppEvent); + + return eventSize; +} diff --git a/framework/transaction-manager/MsgCmdHandlerTransport.cpp b/framework/transaction-manager/MsgCmdHandlerTransport.cpp new file mode 100755 index 0000000..b66cbc5 --- /dev/null +++ b/framework/transaction-manager/MsgCmdHandlerTransport.cpp @@ -0,0 +1,662 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgDebug.h" +#include "MsgException.h" +#include "MsgUtilFile.h" +#include "MsgContact.h" +#include "MsgSoundPlayer.h" +#include "MsgGconfWrapper.h" +#include "MsgNotificationWrapper.h" +#include "MsgUtilFunction.h" +#include "MsgSubmitHandler.h" +#include "MsgDeliverHandler.h" +#include "MsgStorageHandler.h" +#include "MsgTransManager.h" +#include "MsgPluginManager.h" +#include "MsgCmdHandler.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + bool bNewMsg = true; + + int eventSize = 0; + + MSG_REQUEST_INFO_S reqInfo = {0,}; + MSG_PROXY_INFO_S proxyInfo = {0,}; + + // Get Message Request + memcpy(&reqInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_REQUEST_INFO_S)); + + // Storing Request ID, Proxy Info for Sent Status CNF + memcpy(&proxyInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_REQUEST_INFO_S)), sizeof(MSG_PROXY_INFO_S)); + + if (reqInfo.msgInfo.msgId > 0) + bNewMsg = false; + + // Submit Request + err = MsgSubmitReq(&reqInfo, false); + + if (err == MSG_SUCCESS){ + MSG_DEBUG("Command Handle Success : MsgSubmitReq()"); + } else { + MSG_DEBUG("Command Handle Fail : MsgSubmitReq()"); + } + + int reqId = reqInfo.reqId; + proxyInfo.sentMsgId = reqInfo.msgInfo.msgId; + + MSG_DEBUG("REQID: %d, MSGID: %d", reqId, proxyInfo.sentMsgId); + + if (reqInfo.msgInfo.msgType.mainType == MSG_SMS_TYPE) { + MsgTransactionManager::instance()->insertSentMsg(reqId, &proxyInfo); + } else if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE) { + // Retrieve MMS shall not be kept in sentMsg + if ((reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_MMS) || + (reqInfo.msgInfo.msgType.subType == MSG_FORWARD_MMS) || + (reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS)) + MsgTransactionManager::instance()->insertSentMsg(reqId, &proxyInfo); + } + + // keep transaction Id list for distinguish java MMS sent msg when sendconf received + if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE && + reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS) { + MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S trId={0}; + memcpy(&trId.id, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_REQUEST_INFO_S)+sizeof(MSG_PROXY_INFO_S)), MMS_TR_ID_LEN); + + char* pFileName; + pFileName = strstr(reqInfo.msgInfo.msgData, "MSG_"); + strncpy(trId.pduFileName, pFileName, MAX_COMMON_INFO_SIZE); + + MSG_DEBUG("java MMS msg trId:%s filepath:%s ",trId.id, reqInfo.msgInfo.msgData); + + MsgTransactionManager* tm = MsgTransactionManager::instance(); + tm->setJavaMMSList(&trId); + } + + // Make Event Data + eventSize = MsgMakeEvent(&reqId, sizeof(reqId), MSG_EVENT_SUBMIT_REQ, err, (void**)ppEvent); + + /* reject_msg_support */ + if(((reqInfo.msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS) && + (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE))) + err = MsgStoDeleteMessage(reqInfo.msgInfo.msgId, true); + /* reject_msg_support */ + + /** send storage CB */ + if (err == MSG_SUCCESS && bNewMsg && reqInfo.msgInfo.msgPort.valid == false) { + + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = reqInfo.msgInfo.msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList); + } + return eventSize; +} + + +int MsgCancelReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + int eventSize = 0; + + // Get Request ID + MSG_REQUEST_ID_T* reqId = (MSG_REQUEST_ID_T*)pCmd->cmdData; + + // Cancel Request + err = MsgCancelReq(*reqId); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgSubCancelReq()"); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgSubCancelReq()"); + } + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_CANCEL_REQ, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgRegSentStatusCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if( !pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + int listenerFd = *((int*) pCmd->cmdData); + MSG_DEBUG("Registering sent status CB for %d", listenerFd); + + // storing dst fd in list + MsgTransactionManager::instance()->setSentStatusCB(listenerFd); + + // Make Event Data + int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_SENT_STATUS_CB, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgRegIncomingMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if( !pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + MSG_CMD_REG_INCOMING_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_MSG_CB_S*) pCmd->cmdData; + MSG_DEBUG("Registering incoming SMS CB for fd %d mType %d port %d", pCmdData->listenerFd, pCmdData->msgType, pCmdData->port); + + // storing dst fd in list + MsgTransactionManager::instance()->setIncomingMsgCB(pCmdData); + + // Make Event Data + int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_MSG_CB, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgRegIncomingMMSConfMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if( !pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S*) pCmd->cmdData; + MSG_DEBUG("Registering incoming MMS Conf CB for fd:%d mType:%d appId:%s", pCmdData->listenerFd, pCmdData->msgType, pCmdData->appId); + + // storing dst fd in list + MsgTransactionManager::instance()->setMMSConfMsgCB(pCmdData); + + // Make Event Data + int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if( !pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S*) pCmd->cmdData; + MSG_DEBUG("Registering incoming Sync ML Msg CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType); + + // storing dst fd in list + MsgTransactionManager::instance()->setSyncMLMsgCB(pCmdData); + + // Make Event Data + int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgRegIncomingLBSMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if( !pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_LBS_MSG_CB_S*) pCmd->cmdData; + MSG_DEBUG("Registering incoming LBS Msg CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType); + + // storing dst fd in list + MsgTransactionManager::instance()->setLBSMsgCB(pCmdData); + + // Make Event Data + int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_LBS_MSG_CB, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgRegSyncMLMsgOperationCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if( !pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCmdData = (MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S*) pCmd->cmdData; + MSG_DEBUG("Registering SyncML Msg ooperation CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType); + + // storing dst fd in list + MsgTransactionManager::instance()->setSyncMLMsgOperationCB(pCmdData); + + // Make Event Data + int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if( !pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + int listenerFd = *((int*) pCmd->cmdData); + MSG_DEBUG("Registering storage change CB for %d", listenerFd); + + // storing dst fd in list + MsgTransactionManager::instance()->setStorageChangeCB(listenerFd); + + // Make Event Data + int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_STORAGE_CHANGE_CB, MsgException::SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if (!pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Message Request + MSG_SENT_STATUS_S* pStatus = (MSG_SENT_STATUS_S*) pCmd->cmdData; + + MSG_DEBUG("REQID %d, STATUS %d", pStatus->reqId, pStatus->status); + + // storing dst fd in list + MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(pStatus->reqId); + + // when no sent status cb is found (in case of mobile tracker) + if (!prxInfo) + { + return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); + } + + MSG_DEBUG("REQID %d, listenerFD %d, handleAddr %x, msgId %d", pStatus->reqId, prxInfo->listenerFd, prxInfo->handleAddr, prxInfo->sentMsgId); + + // if APP send and quit(not exist at this time), don't send the data up. + if (prxInfo->handleAddr == 0) + { + // just making data which will be passed to plugin. it indicates "handling evt success" + MsgTransactionManager::instance()->delProxyInfo(pStatus->reqId); + + //in case of scheduled message sending, scheduled msg table should be updated. + MsgStoDeleteScheduledMessage(prxInfo->sentMsgId); + + return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); + } + + unsigned int ret[3] = {0}; //3// reqid, status, object + + ret[0] = pStatus->reqId; + ret[1] = pStatus->status; + ret[2] = prxInfo->handleAddr; + + // Make Event Data for APP + int eventSize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); + + // Send to listener thread, here + MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventSize); + + MsgTransactionManager::instance()->delProxyInfo(pStatus->reqId); + + return eventSize; +} + + +int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + int eventSize = 0; + bool sendNoti = true; + + // input check + if (!pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Incoming Message + MSG_MESSAGE_INFO_S msgInfo; + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + + memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_INFO_S)); + + // normal process + err = MsgHandleIncomingMsg(&msgInfo, &sendNoti); + + // broadcast to listener threads, here + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = msgInfo.msgId; + msgIdList.msgIdList = msgIds; + + if (sendNoti == true) { + MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo); + MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); + } + + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MSG_IND, err, (void**)ppEvent); + + MSG_END(); + + return eventSize; +} + +int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_BEGIN(); + MSG_ERROR_T err = MSG_SUCCESS; + int eventsize = 0; + + MSG_MESSAGE_INFO_S msgInfo = {0}; + MSG_REQUEST_ID_T reqID; + + memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_INFO_S)); + memcpy(&reqID, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_INFO_S)), sizeof(MSG_REQUEST_ID_T)); + + MSG_DEBUG(" pMsg = %s, pReqId = %d ", msgInfo.msgData, reqID); + MSG_DEBUG(" msgtype subtype is [%d]", msgInfo.msgType.subType); + + // For Storage change callback + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = msgInfo.msgId; + msgIdList.msgIdList = msgIds; + + err = MsgStoGetAddrInfo(msgInfo.msgId, &(msgInfo.addressList[0])); + + if (err == MSG_SUCCESS) { + MSG_DEBUG("MmsStoGetAddrInfo() success."); + msgInfo.nAddressCnt = 1; + } else { + MSG_DEBUG("MmsStoGetAddrInfo() fail."); + } + + if(msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || msgInfo.msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { + + err = MsgHandleMmsConfIncomingMsg(&msgInfo, reqID); + + if(err != MSG_SUCCESS) + return err; + + MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData; + + if (pMmsRecvData->msgAppId.valid == true) { + MSG_DEBUG("valid : %d, appId : %s", pMmsRecvData->msgAppId.valid, pMmsRecvData->msgAppId.appId); + } else { + msgInfo.bTextSms = true; + msgInfo.dataSize = 0 ; + memset(msgInfo.msgData, 0x00, sizeof(MMS_RECV_DATA_S)); + } + + eventsize = MsgMakeEvent(&msgInfo, sizeof(MSG_MESSAGE_INFO_S), MSG_EVENT_PLG_INCOMING_MMS_CONF, msgInfo.networkStatus, (void**)ppEvent); + + // broadcast to listener threads, here + MsgTransactionManager::instance()->broadcastMMSConfCB(msgInfo.networkStatus, &msgInfo, pMmsRecvData); + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + } else if (msgInfo.msgType.subType == MSG_SENDREQ_MMS || msgInfo.msgType.subType == MSG_SENDCONF_MMS) { + MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(reqID); + + // when no sent status cb is found (in case of mobile tracker) + if (!prxInfo) + return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); + + // No need to update javaMMS sent messages + javamms_list& listenerList = MsgTransactionManager::instance()->getJavaMMSList(); + javamms_list::iterator it = listenerList.begin(); + + MSG_DEBUG("listenerList size:%d ",listenerList.size()); + + if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL && msgInfo.msgType.subType == MSG_SENDREQ_MMS) { + for ( ; it != listenerList.end() ; it++) { + if (strstr(it->pduFileName,"JAVA")) { + MSG_DEBUG("JAVA MMS fileName:%s", it->pduFileName); + MsgDeleteFile(it->pduFileName); // ipc + listenerList.erase(it); + goto __BYPASS_UPDATE; + } + } + } else { + //msgData has MMS_RECV_DATA_S + MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData; + + for ( ; it != listenerList.end() ; it++) { + if(!strcmp(it->id, pMmsRecvData->szTrID)) { + MSG_DEBUG("find sent JAVA MMS message trId:%s from listener list trId:%s",pMmsRecvData->szTrID, it->id); + MsgDeleteFile(it->pduFileName); // ipc + listenerList.erase(it); + goto __BYPASS_UPDATE; + } + } + } + + err = MsgHandleMmsConfIncomingMsg(&msgInfo, reqID); + + if(err != MSG_SUCCESS) + return err; + +__BYPASS_UPDATE: + if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL) { + MSG_DEBUG("message-dialog: send fail"); + MsgInsertTicker("Sending multimedia message failed.", SENDING_MULTIMEDIA_MESSAGE_FAILED); + } else { + MSG_DEBUG("message-dialog: send success"); + MsgInsertTicker("Multimedia message sent.", MULTIMEDIA_MESSAGE_SENT); + } + + if (prxInfo->handleAddr == 0) { + // just making data which will be passed to plugin. it indicates "handling evt success" + MsgTransactionManager::instance()->delProxyInfo(reqID); + + //in case of scheduled message sending, scheduled msg table should be updated. + MsgStoDeleteScheduledMessage(prxInfo->sentMsgId); + + return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); + } + + unsigned int ret[3] = {0}; //3// reqid, status, object + + ret[0] = reqID; + ret[1] = msgInfo.networkStatus; + ret[2] = prxInfo->handleAddr; + + // Make Event Data for APP + eventsize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); + + // Send to listener thread, here + MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventsize); + + MsgTransactionManager::instance()->delProxyInfo(reqID); + + msgInfo.bTextSms = true; + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); + } + + MSG_END(); + return eventsize; +} + + +int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if (!pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + MSG_SYNCML_MESSAGE_DATA_S syncMLData; + memset(&syncMLData, 0x00, sizeof(MSG_SYNCML_MESSAGE_DATA_S)); + + // Get Incoming Message + memcpy(&syncMLData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_SYNCML_MESSAGE_DATA_S)); + + int eventSize = 0; + + // broadcast to listener threads, here + MsgTransactionManager::instance()->broadcastSyncMLMsgCB(MSG_SUCCESS, &syncMLData); + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgIncomingLBSMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + int eventSize = 0; + + // input check + if (!pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + MSG_LBS_MESSAGE_DATA_S lbsData; + memset(&lbsData, 0x00, sizeof(MSG_LBS_MESSAGE_DATA_S)); + + // Get Incoming Message + memcpy(&lbsData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_LBS_MESSAGE_DATA_S)); + + // broadcast to listener threads, here + MsgTransactionManager::instance()->broadcastLBSMsgCB(MSG_SUCCESS, &lbsData); + + // Make Event Data + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_LBS_MSG_IND, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} + + +int MsgSyncMLMsgOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int eventSize = 0; + + MSG_MESSAGE_ID_T msgId = 0; + int extId = 0; + + // input check + if (!pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + // Get Data + memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_ID_T)); + memcpy(&extId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), sizeof(int)); + + err = MsgStoGetSyncMLExtId(msgId, &extId); + + if (err == MSG_SUCCESS) + { + MSG_DEBUG("Command Handle Success : MsgStoGetSyncMLExtId()"); + + // broadcast to listener threads, here + MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, msgId, extId); + } + else + { + MSG_DEBUG("Command Handle Fail : MsgStoGetSyncMLExtId()"); + } + + // Make Event Data to Client + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SYNCML_OPERATION, err, (void**)ppEvent); + + return eventSize; +} + + +int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent) +{ + // input check + if (!pCmd || !ppEvent) + THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null"); + + MSG_STORAGE_CHANGE_TYPE_T storageChangeType; + + MSG_MESSAGE_INFO_S msgInfo; + memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); + + memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_INFO_S)); + memcpy(&storageChangeType, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_INFO_S)), sizeof(MSG_STORAGE_CHANGE_TYPE_T)); + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + int eventSize = 0; + + MSG_DEBUG("storageChangeType : [%d], msg Id : [%d]", storageChangeType, msgInfo.msgId); + + // broadcast to listener threads, here + MSG_MSGID_LIST_S msgIdList; + MSG_MESSAGE_ID_T msgIds[1]; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + msgIdList.nCount = 1; + msgIds[0] = msgInfo.msgId; + msgIdList.msgIdList = msgIds; + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, storageChangeType, &msgIdList); + + // Make Event Data to Client + eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_STORAGE_CHANGE_IND, MSG_SUCCESS, (void**)ppEvent); + + return eventSize; +} diff --git a/framework/transaction-manager/MsgTransManager.cpp b/framework/transaction-manager/MsgTransManager.cpp new file mode 100755 index 0000000..3862772 --- /dev/null +++ b/framework/transaction-manager/MsgTransManager.cpp @@ -0,0 +1,876 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include + +#include + +#include "MsgDebug.h" +#include "MsgMemory.h" +#include "MsgException.h" +#include "MsgCppTypes.h" +#include "MsgContact.h" +#include "MsgIpcSocket.h" +#include "MsgGconfWrapper.h" +#include "MsgUtilFunction.h" +#include "MsgCmdHandler.h" +#include "MsgSettingHandler.h" +#include "MsgStorageHandler.h" +#include "MsgPluginManager.h" +#include "MsgTransManager.h" + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +void MsgContactChangedCallback() +{ + MSG_MSGID_LIST_S msgIdList; + memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S)); + + MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_CONTACT, &msgIdList); +} + +/*================================================================================================== + IMPLEMENTATION OF MsgTransactionManager - Member Functions +==================================================================================================*/ +MsgTransactionManager* MsgTransactionManager::pInstance = NULL; +MsgIpcServerSocket MsgTransactionManager::servSock; + + +MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv() +{ + sentMsgMap.clear(); + + statusCBFdMap.clear(); + newMsgCBList.clear(); + newMMSConfMsgCBList.clear(); + newSyncMLMsgCBList.clear(); + newLBSMsgCBList.clear(); + javaMMSList.clear(); + operationSyncMLMsgCBList.clear(); + storageChangeFdMap.clear(); + + handlerMap.clear(); + +// Fill in mMsgHandlers, as given in the below. + handlerMap[MSG_CMD_ADD_MSG] = &MsgAddMessageHandler; + handlerMap[MSG_CMD_ADD_SYNCML_MSG] = &MsgAddSyncMLMessageHandler; + handlerMap[MSG_CMD_UPDATE_MSG] = &MsgUpdateMessageHandler; + handlerMap[MSG_CMD_UPDATE_READ] = &MsgUpdateReadStatusHandler; + handlerMap[MSG_CMD_UPDATE_PROTECTED] = &MsgUpdateProtectedStatusHandler; + handlerMap[MSG_CMD_DELETE_MSG] = &MsgDeleteMessageHandler; + handlerMap[MSG_CMD_DELALL_MSGINFOLDER] = &MsgDeleteAllMessageInFolderHandler; + handlerMap[MSG_CMD_MOVE_MSGTOFOLDER] = &MsgMoveMessageToFolderHandler; + handlerMap[MSG_CMD_MOVE_MSGTOSTORAGE] = &MsgMoveMessageToStorageHandler; + handlerMap[MSG_CMD_COUNT_MSG] = &MsgCountMessageHandler; + handlerMap[MSG_CMD_GET_MSG] = &MsgGetMessageHandler; + handlerMap[MSG_CMD_GET_FOLDERVIEWLIST] = &MsgGetFolderViewListHandler; + + handlerMap[MSG_CMD_ADD_FOLDER] = &MsgAddFolderHandler; + handlerMap[MSG_CMD_UPDATE_FOLDER] = &MsgUpdateFolderHandler; + handlerMap[MSG_CMD_DELETE_FOLDER] = &MsgDeleteFolderHandler; + handlerMap[MSG_CMD_GET_FOLDERLIST] = &MsgGetFolderListHandler; + + handlerMap[MSG_CMD_SET_CONFIG] = &MsgSetConfigHandler; + handlerMap[MSG_CMD_GET_CONFIG] = &MsgGetConfigHandler; + handlerMap[MSG_CMD_GET_MSG_TYPE] = &MsgGetMsgTypeHandler; + + handlerMap[MSG_CMD_SUBMIT_REQ] = &MsgSubmitReqHandler; + handlerMap[MSG_CMD_CANCEL_REQ] = &MsgCancelReqHandler; + + handlerMap[MSG_CMD_REG_SENT_STATUS_CB] = &MsgRegSentStatusCallbackHandler; + handlerMap[MSG_CMD_REG_STORAGE_CHANGE_CB] = &MsgRegStorageChangeCallbackHandler; + handlerMap[MSG_CMD_REG_INCOMING_MSG_CB] = &MsgRegIncomingMsgCallbackHandler; + handlerMap[MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB] = &MsgRegIncomingMMSConfMsgCallbackHandler; + handlerMap[MSG_CMD_REG_INCOMING_SYNCML_MSG_CB] = &MsgRegIncomingSyncMLMsgCallbackHandler; + handlerMap[MSG_CMD_REG_INCOMING_LBS_MSG_CB] = &MsgRegIncomingLBSMsgCallbackHandler; + handlerMap[MSG_CMD_REG_SYNCML_MSG_OPERATION_CB] = &MsgRegSyncMLMsgOperationCallbackHandler; + + handlerMap[MSG_CMD_PLG_SENT_STATUS_CNF] = &MsgSentStatusHandler; + handlerMap[MSG_CMD_PLG_STORAGE_CHANGE_IND] = &MsgStorageChangeHandler; + handlerMap[MSG_CMD_PLG_INCOMING_MSG_IND] = &MsgIncomingMsgHandler; + handlerMap[MSG_CMD_PLG_INCOMING_MMS_CONF] = &MsgIncomingMMSConfMsgHandler; + + handlerMap[MSG_CMD_PLG_INCOMING_SYNCML_IND] = &MsgIncomingSyncMLMsgHandler; + handlerMap[MSG_CMD_PLG_INCOMING_LBS_IND] = &MsgIncomingLBSMsgHandler; + handlerMap[MSG_CMD_PLG_INIT_SIM_BY_SAT] = &MsgInitSimBySatHandler; + + handlerMap[MSG_CMD_GET_THREADVIEWLIST] = &MsgGetThreadViewListHandler; + handlerMap[MSG_CMD_GET_CONVERSATIONVIEWLIST] = &MsgGetConversationViewListHandler; + handlerMap[MSG_CMD_DELETE_THREADMESSAGELIST] = &MsgDeleteThreadMessageListHandler; + + handlerMap[MSG_CMD_GET_CONTACT_COUNT] = &MsgCountMsgByContactHandler; + handlerMap[MSG_CMD_GET_QUICKPANEL_DATA] = &MsgGetQuickPanelDataHandler; + handlerMap[MSG_CMD_COUNT_BY_MSGTYPE] = &MsgCountMsgByTypeHandler; + handlerMap[MSG_CMD_RESET_DB] = &MsgResetDatabaseHandler; + handlerMap[MSG_CMD_GET_MEMSIZE] = &MsgGetMemSizeHandler; + + handlerMap[MSG_CMD_UPDATE_THREAD_READ] = &MsgUpdateThreadReadStatusHandler; + + handlerMap[MSG_CMD_SYNCML_OPERATION] = &MsgSyncMLMsgOperationHandler; + handlerMap[MSG_CMD_GET_REPORT_STATUS] = &MsgGetReportStatusHandler; +} + + +MsgTransactionManager::~MsgTransactionManager() +{ + +} + + +MsgTransactionManager* MsgTransactionManager::instance() +{ + if (!pInstance) + pInstance = new MsgTransactionManager(); + + return pInstance; +} + + +void MsgTransactionManager::run() +{ + servSock.open(MSG_SOCKET_PATH); + + fd_set readfds = servSock.fdSet(); + int nfds = 0; + + MSG_DEBUG("Start Transaction Manager"); + + while(1) + { + readfds = servSock.fdSet(); + nfds = servSock.maxFd(); + + MSG_DEBUG("Wait For Select() : nfds %d", nfds); + + // set Status; + setTMStatus(); + + if( select(nfds, &readfds, NULL, NULL, NULL) == -1) + { + THROW(MsgException::SELECT_ERROR, strerror(errno)); + } + + try + { + for (int i=0 ; i < nfds; i++) + { + if (FD_ISSET(i, &readfds)) + { + if (i == servSock.fd()) // if it is socket connection request + servSock.accept(); + else + handleRequest(i); + } + } + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + } + catch (exception& e) + { + MSG_FATAL("%s", e.what()); + } + + // Release Memory + MsgReleaseMemory(); + } +} + + +void MsgTransactionManager::write(int fd, const char* buf, int len) +{ + servSock.write(fd, buf, len); +} + + +void MsgTransactionManager::insertSentMsg(int reqId, MSG_PROXY_INFO_S* pPrxInfo) +{ + if (pPrxInfo == NULL) + THROW(MsgException::SENT_STATUS_ERROR, "Input Parameter is NULL"); + + MSG_DEBUG("msg for submit: reqId %d listenerFd %d handleAddr %x", reqId, pPrxInfo->listenerFd, pPrxInfo->handleAddr); + + fd_map::iterator it = statusCBFdMap.find(pPrxInfo->listenerFd); + + if (it == statusCBFdMap.end()) { // if the status CB is not registered + MSG_DEBUG("No sent_status registered for fd %d", pPrxInfo->listenerFd); + } else { + sentMsgMap.insert(make_pair(reqId, *pPrxInfo)); + } +} + + +MSG_PROXY_INFO_S* MsgTransactionManager::getProxyInfo(int reqId) +{ + sentmsg_map::iterator it = sentMsgMap.find(reqId); + + if (it == sentMsgMap.end()) + { + MSG_DEBUG("No sent status cb found (exception: mobile tracker)"); + return NULL; + } + + return &(it->second); +} + + +void MsgTransactionManager::delProxyInfo(int reqId) +{ + sentmsg_map::iterator it = sentMsgMap.find(reqId); + + if (it == sentMsgMap.end()) + { + THROW(MsgException::SENT_STATUS_ERROR, "channel info does not exist"); + } + + sentMsgMap.erase(it); +} + + +void MsgTransactionManager::handleRequest(int fd) +{ + MSG_BEGIN(); + + MSG_DEBUG("Event from fd %d", fd); + + char* buf = NULL; + AutoPtr wrap(&buf); + int len; + int ret = servSock.read(fd, &buf, &len); + + if( ret == CLOSE_CONNECTION_BY_SIGNAL || ret == CLOSE_CONNECTION_BY_USER || ret < 0) + { + MSG_DEBUG("Read value [%d]", ret); + cleanup(fd); + return; + } + + if (len == 0) + THROW(MsgException::INVALID_RESULT, "read buffer size = 0"); + + char* pEventData = NULL; + AutoPtr eventBuf(&pEventData); + + int eventSize = 0; + + // decoding cmd from APP + MSG_CMD_S* pCmd = (MSG_CMD_S*) buf; + MSG_DEBUG("Command Type [%d : %s]", pCmd->cmdType, MsgDbgCmdStr(pCmd->cmdType)); + + if (pCmd->cmdType > MSG_CMD_NUM) + THROW(MsgException::OUT_OF_RANGE, "request CMD is not defined"); + + if (pCmd->cmdType < MSG_CMD_GET_REPORT_STATUS) + { + // check privilege + if (checkPrivilege(pCmd->cmdType, pCmd->cmdCookie) == false) + { +#ifdef MSG_CHECK_PRIVILEGE + eventSize = sizeof(MSG_EVENT_S); + + pEventData = new char[eventSize]; + + MSG_EVENT_S* pMsgEvent = (MSG_EVENT_S*)pEventData; + + pMsgEvent->eventType = pCmd->cmdType; + pMsgEvent->result = MSG_ERR_SECURITY_ERROR; + + MSG_DEBUG("Replying to fd [%d], size [%d]", fd, eventSize); + servSock.write(fd, pEventData, eventSize); + + return; +#endif + } + } + + // determine the handler based on pCmd->cmdType + int (*pfHandler)(const MSG_CMD_S*, char**) = NULL; + + pfHandler = handlerMap[pCmd->cmdType]; + + if (!pfHandler) + THROW(MsgException::INVALID_PARAM, "No handler for %d", pCmd->cmdType); + + // run handler function + eventSize = pfHandler(pCmd, &pEventData); + + if (eventSize == 0 || pEventData == NULL) + THROW(MsgException::INVALID_RESULT, "event size = 0 or event data = NULL"); + + MSG_DEBUG("Replying to fd [%d], size [%d]", fd, eventSize); + + servSock.write(fd, pEventData, eventSize); + + MSG_END(); +} + + +// terminating the socket connection between ipc server and ipc client +void MsgTransactionManager::cleanup(int fd) +{ + MSG_BEGIN(); + + servSock.close(fd); + + MSG_DEBUG("fd %d disonnected", fd); + + // remove sent msg info for fd + sentmsg_map::iterator sentmsg_it = sentMsgMap.begin(); + + for (; sentmsg_it != sentMsgMap.end(); sentmsg_it++) + { + if (sentmsg_it->second.listenerFd == fd) + { + sentmsg_it->second.listenerFd = 0; + sentmsg_it->second.handleAddr = 0; + } + } + + // remove sent status callback for fd + statusCBFdMap.erase(fd); + + // remove all newMsgCBs for fd + newmsg_list::iterator newmsg_it = newMsgCBList.begin(); + + while (newmsg_it != newMsgCBList.end()) + { + if (newmsg_it->listenerFd == fd) + { + newmsg_it = newMsgCBList.erase(newmsg_it); + } + else + { + ++newmsg_it; + } + } + + // remove all newMMSConfMsgCBs for fd + mmsconf_list::iterator mmsconf_it = newMMSConfMsgCBList.begin(); + + while (mmsconf_it != newMMSConfMsgCBList.end()) + { + if (mmsconf_it->listenerFd == fd) + { + mmsconf_it = newMMSConfMsgCBList.erase(mmsconf_it); + } + else + { + ++mmsconf_it; + } + } + + // remove all newSyncMLMsgCBs for fd + syncmlmsg_list::iterator syncmlmsg_it = newSyncMLMsgCBList.begin(); + + while (syncmlmsg_it != newSyncMLMsgCBList.end()) + { + if (syncmlmsg_it->listenerFd == fd) + { + syncmlmsg_it = newSyncMLMsgCBList.erase(syncmlmsg_it); + } + else + { + ++syncmlmsg_it; + } + } + + // remove all newLBSMsgCBs for fd + lbsmsg_list::iterator lbsmsg_it = newLBSMsgCBList.begin(); + + while (lbsmsg_it != newLBSMsgCBList.end()) + { + if (lbsmsg_it->listenerFd == fd) + { + lbsmsg_it = newLBSMsgCBList.erase(lbsmsg_it); + } + else + { + ++lbsmsg_it; + } + } + + // remove all operationSyncMLMsgCBs for fd + syncmlop_list::iterator syncmlop_it = operationSyncMLMsgCBList.begin(); + + while (syncmlop_it != operationSyncMLMsgCBList.end()) + { + if (syncmlop_it->listenerFd == fd) + { + syncmlop_it = operationSyncMLMsgCBList.erase(syncmlop_it); + } + else + { + ++syncmlop_it; + } + } + + // remove storage change callback for fd + storageChangeFdMap.erase(fd); + + MSG_END(); +} + + +bool MsgTransactionManager::checkPrivilege(MSG_CMD_TYPE_T CmdType, const char *pCookie) +{ + if (CmdType >= MSG_CMD_PLG_SENT_STATUS_CNF && CmdType <= MSG_CMD_PLG_INIT_SIM_BY_SAT) + { + MSG_DEBUG("Request from Plug-in"); + return true; + } + + // Get Cookie from APP + if (pCookie == NULL) + { + MSG_DEBUG("Cookie is NULL"); + return false; + } + + // Check Cookie + size_t cookieSize; + gid_t gid; + + cookieSize = security_server_get_cookie_size(); + + MSG_DEBUG("cookie size : [%d]", cookieSize); + + // Get GID + if (CmdType == MSG_CMD_REG_INCOMING_SYNCML_MSG_CB) + { + MSG_DEBUG("get GID for message_sync"); + gid = security_server_get_gid("message_sync"); + } + else if (CmdType == MSG_CMD_REG_INCOMING_LBS_MSG_CB) + { + MSG_DEBUG("get GID for message_lbs"); + gid = security_server_get_gid("message_lbs"); + } + else + { + MSG_DEBUG("get GID for message"); + gid = security_server_get_gid("message"); + } + + MSG_DEBUG("gid [%d]", gid); + + int retVal = 0; + + retVal = security_server_check_privilege(pCookie, gid); + + if (retVal < 0) + { + if (retVal == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) + { + MSG_DEBUG("access denied !! [%d]", retVal); + } + else + { + MSG_DEBUG("fail to check privilege [%d]", retVal); + } + + return false; + } + + MSG_DEBUG("privilege check success !!"); + + return true; +} + + +void MsgTransactionManager::setSentStatusCB(int listenerFd) +{ + if (listenerFd <= 0) + THROW(MsgException::INVALID_PARAM,"InParam Error: listenerFd %d",listenerFd); + + statusCBFdMap[listenerFd] = true; +} + + +void MsgTransactionManager::setIncomingMsgCB(MSG_CMD_REG_INCOMING_MSG_CB_S *pCbInfo) +{ + if (!pCbInfo) + { + MSG_FATAL("cbinfo NULL"); + return; + } + + newmsg_list::iterator it = newMsgCBList.begin(); + + for (; it != newMsgCBList.end(); it++) + { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && (it->port == pCbInfo->port)) + { + MSG_DEBUG("Duplicated messageCB info fd %d, mType %d, port %d", it->listenerFd, it->msgType, it->port); + return; + } + } + + newMsgCBList.push_back(*pCbInfo); +} + + +void MsgTransactionManager::setMMSConfMsgCB(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S *pCbInfo) +{ + if (!pCbInfo) + { + MSG_FATAL("cbinfo NULL"); + return; + } + + mmsconf_list::iterator it = newMMSConfMsgCBList.begin(); + + for (; it != newMMSConfMsgCBList.end(); it++) + { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && (!strncmp(it->appId, pCbInfo->appId, MAX_MMS_JAVA_APPID_LEN))) + { + MSG_DEBUG("Duplicated MMSConfMessageCB info fd:%d, mType:%d, appId:%s", it->listenerFd, it->msgType, it->appId); + return; + } + } + + newMMSConfMsgCBList.push_back(*pCbInfo); +} + + +void MsgTransactionManager::setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCbInfo) +{ + if (!pCbInfo) + { + MSG_FATAL("cbinfo NULL"); + return; + } + + syncmlmsg_list::iterator it = newSyncMLMsgCBList.begin(); + + for (; it != newSyncMLMsgCBList.end(); it++) + { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) + { + MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); + return; + } + } + + newSyncMLMsgCBList.push_back(*pCbInfo); +} + + +void MsgTransactionManager::setLBSMsgCB(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCbInfo) +{ + if (!pCbInfo) + { + MSG_FATAL("cbinfo NULL"); + return; + } + + lbsmsg_list::iterator it = newLBSMsgCBList.begin(); + + for (; it != newLBSMsgCBList.end(); it++) + { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) + { + MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); + return; + } + } + + newLBSMsgCBList.push_back(*pCbInfo); +} + + +void MsgTransactionManager::setJavaMMSList(MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S *pTrId) +{ + if (!pTrId) + { + MSG_FATAL("trId NULL"); + return; + } + + javamms_list::iterator it; + + for (it = javaMMSList.begin(); it != javaMMSList.end(); it++) + { + if (!strcmp(it->id, pTrId->id)) + { + MSG_DEBUG("Duplicated javaMMS transaction Id:%s", it->id); + return; + } + } + + javaMMSList.push_back(*pTrId); +} + + +void MsgTransactionManager::setSyncMLMsgOperationCB(MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCbInfo) +{ + if (!pCbInfo) + { + MSG_FATAL("cbinfo NULL"); + return; + } + + syncmlop_list::iterator it = operationSyncMLMsgCBList.begin(); + + for (; it != operationSyncMLMsgCBList.end(); it++) + { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) + { + MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); + return; + } + } + + operationSyncMLMsgCBList.push_back(*pCbInfo); +} + + +void MsgTransactionManager::setStorageChangeCB(int listenerFd) +{ + if (listenerFd <= 0) + THROW(MsgException::INVALID_PARAM,"InParam Error: listenerFd %d", listenerFd); + + storageChangeFdMap[listenerFd] = true; +} + + +javamms_list& MsgTransactionManager::getJavaMMSList() +{ + return javaMMSList; +} + + +void MsgTransactionManager::broadcastIncomingMsgCB(const MSG_ERROR_T err, const MSG_MESSAGE_INFO_S *msgInfo) +{ + MSG_BEGIN(); + + char* pEventData = NULL; + AutoPtr eventBuf(&pEventData); + + int eventSize = MsgMakeEvent(msgInfo, sizeof(MSG_MESSAGE_INFO_S), MSG_EVENT_PLG_INCOMING_MSG_IND, err, (void**)(&pEventData)); + + MSG_DEBUG("valid %d dstport %d", msgInfo->msgPort.valid, msgInfo->msgPort.dstPort); + + newmsg_list::iterator it = newMsgCBList.begin(); + + for (; it != newMsgCBList.end(); it++) + { + MSG_DEBUG("fd %d dstport %d",it->listenerFd, it->port); + + if ((msgInfo->msgPort.valid == false) && (it->port == 0)) + { + MSG_DEBUG("Send incoming normal msg to listener %d", it->listenerFd); + write(it->listenerFd, pEventData, eventSize); + } + else if ((msgInfo->msgPort.valid == true) && (it->port == msgInfo->msgPort.dstPort)) + { + MSG_DEBUG("Send incoming port msg to listener %d", it->listenerFd); + write(it->listenerFd, pEventData, eventSize); + } + } + + MSG_END(); +} + + +void MsgTransactionManager::broadcastMMSConfCB(const MSG_ERROR_T err, const MSG_MESSAGE_INFO_S *msgInfo, const MMS_RECV_DATA_S *mmsRecvData) +{ + MSG_BEGIN(); + + char* pEventData = NULL; + AutoPtr eventBuf(&pEventData); + + int eventSize = MsgMakeEvent(msgInfo, sizeof(MSG_MESSAGE_INFO_S), MSG_EVENT_PLG_INCOMING_MMS_CONF, err, (void**)(&pEventData)); + + mmsconf_list::iterator it = newMMSConfMsgCBList.begin(); + + for (; it != newMMSConfMsgCBList.end(); it++) + { + MSG_DEBUG("fd:%d appId:%s",it->listenerFd, it->appId); + + if (mmsRecvData->msgAppId.valid == true) + { + if (!strcmp(it->appId, mmsRecvData->msgAppId.appId)) + { + MSG_DEBUG("Send incoming java msg to listener %d", it->listenerFd); + write(it->listenerFd, pEventData, eventSize); + } + } + else + { + if (strlen(it->appId) <= 0) + { + MSG_DEBUG("Send incoming normal msg to listener %d", it->listenerFd); + write(it->listenerFd, pEventData, eventSize); + } + } + } + + + MSG_END(); +} + + +void MsgTransactionManager::broadcastSyncMLMsgCB(const MSG_ERROR_T err, const MSG_SYNCML_MESSAGE_DATA_S *syncMLData) +{ + MSG_BEGIN(); + + char* pEventData = NULL; + AutoPtr eventBuf(&pEventData); + + int eventSize = MsgMakeEvent(syncMLData, sizeof(MSG_SYNCML_MESSAGE_DATA_S), MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND, err, (void**)(&pEventData)); + + syncmlmsg_list::iterator it = newSyncMLMsgCBList.begin(); + + for (; it != newSyncMLMsgCBList.end(); it++) + { + MSG_DEBUG("Send incoming SyncML information to listener %d", it->listenerFd); + write(it->listenerFd, pEventData, eventSize); + } + + MSG_END(); +} + + +void MsgTransactionManager::broadcastLBSMsgCB(const MSG_ERROR_T err, const MSG_LBS_MESSAGE_DATA_S *lbsData) +{ + MSG_BEGIN(); + + char* pEventData = NULL; + AutoPtr eventBuf(&pEventData); + + int eventSize = MsgMakeEvent(lbsData, sizeof(MSG_LBS_MESSAGE_DATA_S), MSG_EVENT_PLG_INCOMING_LBS_MSG_IND, err, (void**)(&pEventData)); + + lbsmsg_list::iterator it = newLBSMsgCBList.begin(); + + for (; it != newLBSMsgCBList.end(); it++) + { + MSG_DEBUG("Send incoming LBS msg to listener %d", it->listenerFd); + write(it->listenerFd, pEventData, eventSize); + } + + MSG_END(); +} + + +void MsgTransactionManager::broadcastSyncMLMsgOperationCB(const MSG_ERROR_T err, const int msgId, const int extId) +{ + MSG_BEGIN(); + + char* pEventData = NULL; + AutoPtr eventBuf(&pEventData); + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + // Encoding Storage Change Data + int dataSize = MsgEncodeSyncMLOperationData(msgId, extId, &encodedData); + + int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_SYNCML_OPERATION, err, (void**)(&pEventData)); + + syncmlop_list::iterator it = operationSyncMLMsgCBList.begin(); + + for( ; it != operationSyncMLMsgCBList.end() ; it++ ) + { + MSG_DEBUG("Send SyncML operation to listener %d", it->listenerFd); + write(it->listenerFd, pEventData, eventSize); + } + + MSG_END(); +} + + +void MsgTransactionManager::broadcastStorageChangeCB(const MSG_ERROR_T err, const MSG_STORAGE_CHANGE_TYPE_T storageChangeType, const MSG_MSGID_LIST_S *pMsgIdList) +{ + MSG_BEGIN(); + + if(pMsgIdList == NULL) { + MSG_DEBUG("pMsgIdList is NULL."); + return; + } + + MSG_DEBUG("storageChangeType [%d]", storageChangeType); + + int dataSize = 0; + + char* pEventData = NULL; + AutoPtr eventBuf(&pEventData); + + char* encodedData = NULL; + AutoPtr buf(&encodedData); + + // Encoding Storage Change Data + dataSize = MsgEncodeStorageChangeData(storageChangeType, pMsgIdList, &encodedData); + + int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_STORAGE_CHANGE_IND, err, (void**)(&pEventData)); + + fd_map::iterator it = storageChangeFdMap.begin(); + + for (; it != storageChangeFdMap.end(); it++) + { + MSG_DEBUG("Send Storage Change Callback to listener %d", it->first); + write(it->first, pEventData, eventSize); + } + + MSG_END(); +} + + +void MsgTransactionManager::setTMStatus() +{ + MSG_BEGIN(); + mx.lock(); + cv.signal(); + mx.unlock(); + MSG_END(); +} + + +void MsgTransactionManager::getTMStatus() +{ + MSG_BEGIN(); + mx.lock(); + + int ret = 0; + + ret = cv.timedwait(mx.pMutex(), 3); + + mx.unlock(); + + if (ret == ETIMEDOUT) + { + MSG_DEBUG("MsgTransactionManager::getTMStatus TIME-OUT"); + } + MSG_END(); +} diff --git a/image/messaging_image001.png b/image/messaging_image001.png new file mode 100755 index 0000000000000000000000000000000000000000..0c575c4e8c3dacf60dad2043a43c32722a827ab3 GIT binary patch literal 70483 zcmd@5XH*nH_b-f+nGpmA6eQ;$abUf5hTfw;cee@&RUPp|J=3ir~BouZn3AUx@uR|PPO;1;tch*Zr)(Hfrp28Q~RF! zLp(e}6doRd6^I0QW4oXD7Wfa}=b@G=UezemPv8fUlZu`S9$sw<*@Z1J@SDy4-a|b+ zyq7$9cwtd^cxS+?uuVL?7f?LBEgL*MSp*&)-P4?w2l7Ax_~|_}AK*9S??3!6Jcmkn zc-H~i>MD=?t+sQC5lsCv(R6+wA_5gcB5e@YN&k}2y{BOCZ;QpqR6O>kRv&Lazni~* zQ_y96xH`nGd~TdX{T|(ZKK5uV=tzEp{#R95NO^H%L`wixgEM50ub1=BKmRyWj%4Ne_4Eeq!HLBms zk2xF^8}=W!G7V%e;?znG%ZQFHNp5cq?!atYAPu+?=0DRo5tB@P%=|8W6%z_P$F5=?RPP?mG zS92|J8lI3{NT@-po@YZW<|~{gQ^>{l1E!3dB29h<#u;xDPu=-T078ZT&+W`WUw`Vb zdob0O5_+rcMx)MMrrl0=i^lIAl*M0cjMTrS!;98~SZYoB-mg^q<*?b@;$9#mxI=1y4XS2JOq^y(>!|aZwk=E$FccU)RRF~-O!l=#p-sNi>To(QE zqCHBpZ?^<#5+x8|%^WHY)h+9S02lWo{8%$k#C@P$G!?_J5{p!0zo}3vS{EA=)MSVAEXJ5ray`lUC6b^ zDtrU^bp%c)LIeB-88%>6ZP%-~8!7haWl^=0^>p5eciUrj9u*OaJ>+ka3yRSv6#9XK z3x^R@g94O<@(X|Px&OzApZs0Y94fn61iPz~q&X(BzY8R!DIbvH^0hY+sx}pD*N~4< zghwd`j`6ZDadn(eZr_EqbwxcrkGj{lFs#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TIXKgkgm-0qj>E1gZVbAhPi{ zi6Gq4FPsoJAWs-HpY7I*BP}RCzANX(I!spQc{C_r;3)M3C22|B{6u~n4ySk~k0qK8 znG{9i3QS4^1XP0_6w@lH%6Hs}HO_9&3og=6p9D3UdBtihUOvMUk+!!7X(;G4zpN5L= K-OAh0i2nmq1^YAr literal 0 HcmV?d00001 diff --git a/include/common/MsgCmdTypes.h b/include/common/MsgCmdTypes.h new file mode 100755 index 0000000..c86cf98 --- /dev/null +++ b/include/common/MsgCmdTypes.h @@ -0,0 +1,235 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_CMD_TYPES_H +#define MSG_CMD_TYPES_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgTypes.h" + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MAX_COOKIE_LEN 20 + + +/*================================================================================================== + TYPES +==================================================================================================*/ +typedef unsigned int MSG_CMD_TYPE_T; + +typedef unsigned int MSG_EVENT_TYPE_T; + + +/*================================================================================================== + STRUCTURES +==================================================================================================*/ +typedef struct _MSG_CMD_S +{ + MSG_CMD_TYPE_T cmdType; + char cmdCookie[MAX_COOKIE_LEN]; + char cmdData[2]; +} MSG_CMD_S; + + +typedef struct _MSG_EVENT_S +{ + MSG_EVENT_TYPE_T eventType; + MSG_ERROR_T result; + char data[2]; +} MSG_EVENT_S; + + +/*================================================================================================== + ENUMS +==================================================================================================*/ + +enum _MSG_CMD_TYPE_E +{ + MSG_CMD_OPEN_HANDLE = 0, + MSG_CMD_CLOSE_HANDLE, + MSG_CMD_GET_STORAGELIST, + MSG_CMD_ADD_MSG, + MSG_CMD_ADD_SYNCML_MSG, + +// 05 + MSG_CMD_UPDATE_MSG, + MSG_CMD_UPDATE_READ, + MSG_CMD_UPDATE_PROTECTED, + MSG_CMD_DELETE_MSG, + MSG_CMD_DELALL_MSGINFOLDER, + +// 10 + MSG_CMD_MOVE_MSGTOFOLDER, + MSG_CMD_MOVE_MSGTOSTORAGE, + MSG_CMD_COUNT_MSG, + MSG_CMD_GET_MSG, + MSG_CMD_GET_FOLDERVIEWLIST, + +// 15 + MSG_CMD_ADD_FOLDER, + MSG_CMD_UPDATE_FOLDER, + MSG_CMD_DELETE_FOLDER, + MSG_CMD_GET_FOLDERLIST, + MSG_CMD_SET_CONFIG, + +// 20 + MSG_CMD_GET_CONFIG, + MSG_CMD_GET_MSG_TYPE, + MSG_CMD_SUBMIT_REQ, + MSG_CMD_CANCEL_REQ, + MSG_CMD_REG_SENT_STATUS_CB, + +// 25 + MSG_CMD_REG_STORAGE_CHANGE_CB, + MSG_CMD_REG_INCOMING_MSG_CB, + MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB, + MSG_CMD_REG_INCOMING_SYNCML_MSG_CB, + MSG_CMD_REG_INCOMING_LBS_MSG_CB, + +// 30 + MSG_CMD_PLG_SENT_STATUS_CNF, + MSG_CMD_PLG_STORAGE_CHANGE_IND, + MSG_CMD_PLG_INCOMING_MSG_IND, + MSG_CMD_PLG_INCOMING_MMS_CONF, + MSG_CMD_PLG_INCOMING_SYNCML_IND, + +// 35 + MSG_CMD_PLG_INCOMING_LBS_IND, + MSG_CMD_PLG_INIT_SIM_BY_SAT, + MSG_CMD_GET_THREADVIEWLIST, + MSG_CMD_GET_CONVERSATIONVIEWLIST, + MSG_CMD_DELETE_THREADMESSAGELIST, + +// 40 + MSG_CMD_GET_CONTACT_COUNT, + MSG_CMD_GET_QUICKPANEL_DATA, + MSG_CMD_COUNT_BY_MSGTYPE, + MSG_CMD_RESET_DB, + MSG_CMD_GET_MEMSIZE, + +// 45 + MSG_CMD_BACKUP_MESSAGE, + MSG_CMD_RESTORE_MESSAGE, + MSG_CMD_UPDATE_THREAD_READ, + MSG_CMD_REG_SYNCML_MSG_OPERATION_CB, + MSG_CMD_SYNCML_OPERATION, + +// 50 + MSG_CMD_GET_REPORT_STATUS, + +// end of MSG_CMD; new CMD should be defined before MSG_CMD_NUM + MSG_CMD_NUM +}; + + +enum _MSG_EVENT_TYPE_E +{ + MSG_EVENT_OPEN_HANDLE = 0, + MSG_EVENT_CLOSE_HANDLE, + MSG_EVENT_GET_STORAGELIST, + MSG_EVENT_ADD_MSG, + MSG_EVENT_ADD_SYNCML_MSG, + +// 5 + MSG_EVENT_UPDATE_MSG, + MSG_EVENT_UPDATE_READ, + MSG_EVENT_UPDATE_PROTECTED, + MSG_EVENT_DELETE_MSG, + MSG_EVENT_DELALL_MSGINFOLDER, + +// 10 + MSG_EVENT_MOVE_MSGTOFOLDER, + MSG_EVENT_MOVE_MSGTOSTORAGE, + MSG_EVENT_COUNT_MSG, + MSG_EVENT_GET_MSG, + MSG_EVENT_GET_FOLDERVIEWLIST, + +// 15 + MSG_EVENT_ADD_FOLDER, + MSG_EVENT_UPDATE_FOLDER, + MSG_EVENT_DELETE_FOLDER, + MSG_EVENT_GET_FOLDERLIST, + MSG_EVENT_SET_CONFIG, + +// 20 + MSG_EVENT_GET_CONFIG, + MSG_EVENT_GET_MSG_TYPE, + MSG_EVENT_SUBMIT_REQ, + MSG_EVENT_CANCEL_REQ, + MSG_EVENT_REG_SENT_STATUS_CB, + +// 25 + MSG_EVENT_REG_INCOMING_MSG_CB, + MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB, + MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB, + MSG_EVENT_REG_INCOMING_LBS_MSG_CB, + MSG_EVENT_REG_STORAGE_CHANGE_CB, + +// 30 + MSG_EVENT_PLG_SENT_STATUS_CNF, + MSG_EVENT_PLG_STORAGE_CHANGE_IND, + MSG_EVENT_PLG_INCOMING_MSG_IND, + MSG_EVENT_PLG_INCOMING_MMS_CONF, + MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND, + +// 35 + MSG_EVENT_PLG_INCOMING_LBS_MSG_IND, + MSG_EVENT_PLG_INIT_SIM_BY_SAT, + MSG_EVENT_GET_THREADVIEWLIST, + MSG_EVENT_GET_CONVERSATIONVIEWLIST, + MSG_EVENT_DELETE_THREADMESSAGELIST, + +// 40 + MSG_EVENT_GET_CONTACT_COUNT, + MSG_EVENT_GET_QUICKPANEL_DATA, + MSG_EVENT_COUNT_BY_MSGTYPE, + MSG_EVENT_RESET_DB, + MSG_EVENT_GET_MEMSIZE, + +// 45 + MSG_EVENT_BACKUP_MESSAGE, + MSG_EVENT_RESTORE_MESSAGE, + MSG_EVENT_UPDATE_THREAD_READ, + MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB, + MSG_EVENT_SYNCML_OPERATION, + +// 50 + MSG_EVENT_GET_REPORT_STATUS, + +// end of MSG_EVENT; new EVENT should be defined before MSG_EVENT_NUM + MSG_EVENT_NUM +}; + +#endif // MSG_CMD_TYPES_H + diff --git a/include/common/MsgCppTypes.h b/include/common/MsgCppTypes.h new file mode 100755 index 0000000..2002ae6 --- /dev/null +++ b/include/common/MsgCppTypes.h @@ -0,0 +1,65 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __MSG_CPP_TYPES_H__ +#define __MSG_CPP_TYPES_H__ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include + +typedef std::vector CharVector; + +template + +class AutoPtr +{ +private: + T** ptr; // Caution: Memory allocation should be done by "new" not "malloc" + + +public: + AutoPtr():ptr(NULL) {} + + AutoPtr(T** target) { ptr = target; } + + ~AutoPtr() + { + if (ptr) + { + if ( *ptr ) delete[] *ptr; + } + } +}; + +#endif // #ifndef __MSG_CPP_TYPES_H__ + diff --git a/include/common/MsgInternalTypes.h b/include/common/MsgInternalTypes.h new file mode 100755 index 0000000..e1c9bf0 --- /dev/null +++ b/include/common/MsgInternalTypes.h @@ -0,0 +1,526 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_INTERNAL_TYPES_H +#define MSG_INTERNAL_TYPES_H + +/** + * @file MsgInternalTypes.h + * @brief Defines types of messaging framework + * @version 1.0 + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgMmsTypes.h" + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSG_DATA_ROOT_PATH "/opt/data/msg-service/" +#define MSG_DATA_PATH MSG_DATA_ROOT_PATH"msgdata/" +#define MSG_SMIL_FILE_PATH MSG_DATA_ROOT_PATH"smildata/" +#define MSG_IPC_DATA_PATH MSG_DATA_ROOT_PATH"ipcdata/" +#define MSG_THUMBNAIL_PATH MSG_DATA_PATH"thumbnails/" +#define MAX_FULL_PATH_SIZE 320 // max length for internal file path +#define VALID_ADDRESS_LEN 8 +#define MAX_PRECONFIG_NUM 8 +#define MAX_THREAD_ADDR_LEN 40 +#define MAX_THREAD_NAME_LEN 195 +#define MAX_THREAD_DATA_LEN 128 + +#define SMS_MINIMUM_SPACE (3 * 1024) +#define MMS_MINIMUM_SPACE (600 * 1024) + +/*vconf keys*/ +#define MSG_SIM_CHANGED "memory/msg/sim_changed" + +#define DEFAULT_SETTING_PATH "db/msg" + +#define DEFAULT_GENERAL_OPT_PATH DEFAULT_SETTING_PATH"/general" +#define DEFAULT_SMS_SEND_OPT_PATH DEFAULT_SETTING_PATH"/sms_send" +#define DEFAULT_SMSC_INFO_PATH DEFAULT_SETTING_PATH"/smsc" +#define DEFAULT_MMS_SEND_OPT_PATH DEFAULT_SETTING_PATH"/mms_send" +#define DEFAULT_MMS_RECV_OPT_PATH DEFAULT_SETTING_PATH"/mms_recv" +#define DEFAULT_MMS_STYLE_OPT_PATH DEFAULT_SETTING_PATH"/mms_style" +#define DEFAULT_PUSH_MSG_OPT_PATH DEFAULT_SETTING_PATH"/push_msg" +#define DEFAULT_CB_MSG_OPT_PATH DEFAULT_SETTING_PATH"/cb_msg" +#define DEFAULT_VOICE_MAIL_OPT_PATH DEFAULT_SETTING_PATH"/voice_mail" +#define DEFAULT_MSGSIZE_OPT_PATH DEFAULT_SETTING_PATH"/size_opt" +#define DEFAULT_SIM_COUNT_PATH DEFAULT_SETTING_PATH"/sim_count" + +#define MSG_KEEP_COPY DEFAULT_GENERAL_OPT_PATH"/keep_copy" +#define MSG_ALERT_TONE VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT +#define MSG_AUTO_ERASE DEFAULT_GENERAL_OPT_PATH"/auto_erase" +#define MSG_BLOCK_MESSAGE DEFAULT_GENERAL_OPT_PATH"/block_msg" +#define CONTACT_SYNC_TIME DEFAULT_GENERAL_OPT_PATH"/contact_sync_time" + +#define SMS_SEND_DCS DEFAULT_SMS_SEND_OPT_PATH"/dcs" +#define SMS_SEND_NETWORK_MODE VCONFKEY_MESSAGE_NETWORK_MODE +#define SMS_SEND_REPLY_PATH DEFAULT_SMS_SEND_OPT_PATH"/reply_path" +#define SMS_SEND_DELIVERY_REPORT DEFAULT_SMS_SEND_OPT_PATH"/delivery_report" +#define SMS_SEND_SAVE_STORAGE DEFAULT_SMS_SEND_OPT_PATH"/save_storage" + +#define SMSC_TOTAL_COUNT DEFAULT_SMSC_INFO_PATH"/total_count" +#define SMSC_SELECTED DEFAULT_SMSC_INFO_PATH"/selected" +#define SMSC_PID DEFAULT_SMSC_INFO_PATH"/pid" +#define SMSC_VAL_PERIOD DEFAULT_SMSC_INFO_PATH"/val_period" +#define SMSC_NAME DEFAULT_SMSC_INFO_PATH"/name" +#define SMSC_TON DEFAULT_SMSC_INFO_PATH"/ton" +#define SMSC_NPI DEFAULT_SMSC_INFO_PATH"/npi" +#define SMSC_ADDRESS DEFAULT_SMSC_INFO_PATH"/address" + +#define MMS_SEND_MSG_CLASS DEFAULT_MMS_SEND_OPT_PATH"/msg_class" +#define MMS_SEND_PRIORITY DEFAULT_MMS_SEND_OPT_PATH"/priority" +#define MMS_SEND_EXPIRY_TIME DEFAULT_MMS_SEND_OPT_PATH"/expiry_time" +#define MMS_SEND_CUSTOM_DELIVERY DEFAULT_MMS_SEND_OPT_PATH"/custom_delivery" +#define MMS_SEND_DELIVERY_TIME DEFAULT_MMS_SEND_OPT_PATH"/delivery_time" +#define MMS_SEND_SENDER_VISIBILITY DEFAULT_MMS_SEND_OPT_PATH"/sender_visibility" +#define MMS_SEND_DELIVERY_REPORT DEFAULT_MMS_SEND_OPT_PATH"/delivery_report" +#define MMS_SEND_READ_REPLY DEFAULT_MMS_SEND_OPT_PATH"/read_reply" +#define MMS_SEND_KEEP_COPY DEFAULT_MMS_SEND_OPT_PATH"/keep_copy" +#define MMS_SEND_BODY_REPLYING DEFAULT_MMS_SEND_OPT_PATH"/body_replying" +#define MMS_SEND_HIDE_RECIPIENTS DEFAULT_MMS_SEND_OPT_PATH"/hide_recipients" +#define MMS_SEND_REPORT_ALLOWED DEFAULT_MMS_SEND_OPT_PATH"/report_allowed" +#define MMS_SEND_REPLY_CHARGING DEFAULT_MMS_SEND_OPT_PATH"/reply_charging" +#define MMS_SEND_REPLY_CHARGING_DEADLINE DEFAULT_MMS_SEND_OPT_PATH"/reply_charging_deadline" +#define MMS_SEND_REPLY_CHARGING_SIZE DEFAULT_MMS_SEND_OPT_PATH"/reply_charging_size" +#define MMS_SEND_CREATION_MODE DEFAULT_MMS_SEND_OPT_PATH"/creation_mode" + +#define MMS_RECV_HOME_NETWORK DEFAULT_MMS_RECV_OPT_PATH"/home_network" +#define MMS_RECV_ABROAD_NETWORK DEFAULT_MMS_RECV_OPT_PATH"/abroad_network" +#define MMS_RECV_READ_RECEIPT DEFAULT_MMS_RECV_OPT_PATH"/read_receipt" +#define MMS_RECV_DELIVERY_RECEIPT DEFAULT_MMS_RECV_OPT_PATH"/delivery_receipt" +#define MMS_RECV_REJECT_UNKNOWN DEFAULT_MMS_RECV_OPT_PATH"/reject_unknown" +#define MMS_RECV_REJECT_ADVERTISE DEFAULT_MMS_RECV_OPT_PATH"/reject_advertisement" + +#define MMS_STYLE_FONT_SIZE DEFAULT_MMS_STYLE_OPT_PATH"/font_size" +#define MMS_STYLE_FONT_STYLE_BOLD DEFAULT_MMS_STYLE_OPT_PATH"/font_style/bold" +#define MMS_STYLE_FONT_STYLE_ITALIC DEFAULT_MMS_STYLE_OPT_PATH"/font_style/italic" +#define MMS_STYLE_FONT_STYLE_UNDERLINE DEFAULT_MMS_STYLE_OPT_PATH"/font_style/underline" +#define MMS_STYLE_FONT_COLOR_RED DEFAULT_MMS_STYLE_OPT_PATH"/font_color/red" +#define MMS_STYLE_FONT_COLOR_GREEN DEFAULT_MMS_STYLE_OPT_PATH"/font_color/green" +#define MMS_STYLE_FONT_COLOR_BLUE DEFAULT_MMS_STYLE_OPT_PATH"/font_color/blue" +#define MMS_STYLE_FONT_COLOR_HUE DEFAULT_MMS_STYLE_OPT_PATH"/font_color/hue" +#define MMS_STYLE_BG_COLOR_RED DEFAULT_MMS_STYLE_OPT_PATH"/bg_color/red" +#define MMS_STYLE_BG_COLOR_GREEN DEFAULT_MMS_STYLE_OPT_PATH"/bg_color/green" +#define MMS_STYLE_BG_COLOR_BLUE DEFAULT_MMS_STYLE_OPT_PATH"/bg_color/blue" +#define MMS_STYLE_BG_COLOR_HUE DEFAULT_MMS_STYLE_OPT_PATH"/bg_color/hue" +#define MMS_STYLE_PAGE_DUR DEFAULT_MMS_STYLE_OPT_PATH"/page_dur" +#define MMS_STYLE_PAGE_CUSTOM_DUR DEFAULT_MMS_STYLE_OPT_PATH"/page_custom_dur" +#define MMS_STYLE_PAGE_DUR_MANUAL DEFAULT_MMS_STYLE_OPT_PATH"/page_dur_manual" + +#define PUSH_RECV_OPTION DEFAULT_PUSH_MSG_OPT_PATH"/recv_option" +#define PUSH_SERVICE_TYPE DEFAULT_PUSH_MSG_OPT_PATH"/service_load" + +#define CB_RECEIVE DEFAULT_CB_MSG_OPT_PATH"/receive" +#define CB_ALL_CHANNEL DEFAULT_CB_MSG_OPT_PATH"/all_channel" +#define CB_MAX_SIM_COUNT DEFAULT_CB_MSG_OPT_PATH"/max_sim_count" +#define CB_CHANNEL_COUNT DEFAULT_CB_MSG_OPT_PATH"/channel_count" +#define CB_CHANNEL_ACTIVATE DEFAULT_CB_MSG_OPT_PATH"/channel_activate" +#define CB_CHANNEL_ID DEFAULT_CB_MSG_OPT_PATH"/channel_id" +#define CB_CHANNEL_NAME DEFAULT_CB_MSG_OPT_PATH"/channel_name" +#define CB_LANGUAGE DEFAULT_CB_MSG_OPT_PATH"/language" + +#define VOICEMAIL_NUMBER DEFAULT_VOICE_MAIL_OPT_PATH"/voice_mail_number" + +#define MSGSIZE_OPTION DEFAULT_MSGSIZE_OPT_PATH"/msg_size" + +#define SIM_USED_COUNT DEFAULT_SIM_COUNT_PATH"/used_cnt" +#define SIM_TOTAL_COUNT DEFAULT_SIM_COUNT_PATH"/total_cnt" + + +/*================================================================================================== + TYPES +==================================================================================================*/ + +/** + * @brief Represents a message main type. \n + * The values for this type SHOULD be in _MSG_MAIN_TYPE_E. + */ +typedef unsigned char MSG_MAIN_TYPE_T; + + +/** + * @brief Represents a message sub type. \n + * Each main type of a message can be divided into some sub types. \n + * For instance of SMS, the message sub type can be one of the NORMAL, WAPPUSH, CB and so on. \n + * The values for this type SHOULD be in _MSG_SUB_TYPE_E. + */ +typedef unsigned char MSG_SUB_TYPE_T; + + +/** + * @brief Represents a message class. \n + * The values for this type SHOULD be in _MSG_CLASS_TYPE_E. + */ +typedef unsigned char MSG_CLASS_TYPE_T; + + +/** + * @brief Represents a message class. \n + * The values for this type SHOULD be in _MSG_MMS_TRANSACTION_TYPE_E. + */ +typedef unsigned char MSG_MMS_TRANSACTION_TYPE_T; + + +/*================================================================================================== + STRUCTURES +==================================================================================================*/ + +/** + * @brief Represents a message type. + */ +typedef struct +{ + MSG_MAIN_TYPE_T mainType; /**< Message main type. See enum _MSG_MAIN_TYPE_E */ + MSG_SUB_TYPE_T subType; /**< Message sub type. See enum _MSG_SUB_TYPE_E */ + MSG_CLASS_TYPE_T classType; /**< Message class type. See enum _MSG_CLASS_TYPE_E */ +} MSG_MESSAGE_TYPE_S; + + +/** + * @brief Represents a message in the framework. + */ +typedef struct +{ + MSG_MESSAGE_ID_T msgId; /**< Indicates the message ID of this message. */ + MSG_FOLDER_ID_T folderId; /**< Indicates the folder ID. */ + MSG_REFERENCE_ID_T referenceId; /**< Indicates group message of messages that is sent together. */ + MSG_MESSAGE_TYPE_S msgType; /**< Indicates the message type such as SMS and MMS */ + MSG_STORAGE_ID_T storageId; /**< Indicates where the message is saved. */ + int nAddressCnt; /**< Indicates the count of addresses. */ + MSG_ADDRESS_INFO_S addressList[MAX_TO_ADDRESS_CNT]; /**< Indicates the address information list. */ + char replyAddress[MAX_PHONE_NUMBER_LEN+1]; /**< Indicates the reply address. */ + char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */ + time_t displayTime; /**< Indicates the display time related to the specific operation. */ + MSG_NETWORK_STATUS_T networkStatus; /**< Indicates the network status of the message. */ + MSG_ENCODE_TYPE_T encodeType; /**< Indicates the string encoding type. */ + bool bRead; /**< Indicates whether the message is read or not. */ + bool bProtected; /**< Indicates whether the message is protected or not. */ + bool bBackup; /**< Indicates whether the message was restored from PC. */ + MSG_PRIORITY_TYPE_T priority; /**< Indicates the priority of the message. */ + MSG_DIRECTION_TYPE_T direction; /**< Indicates whether the message is MO or MT (affecting address). */ + MSG_PORT_INFO_S msgPort; /**< Indicates the port number information. */ + bool bTextSms; /**< Indicates whether the message is just a text message or not. */ + size_t dataSize; /**< Indicates the data size. The unit is byte. */ + char msgData[MAX_MSG_DATA_LEN+1]; /**< Indicates the message payload information as a body. */ + char msgText[MAX_MSG_TEXT_LEN+1]; + char thumbPath[MSG_FILEPATH_LEN_MAX]; + time_t scheduledTime; /**< Indicates the time to send scheduled message. */ +} MSG_MESSAGE_INFO_S; + + +typedef struct +{ + MSG_MESSAGE_ID_T msgId; /**< Indicates the message ID of this message. */ + MSG_FOLDER_ID_T folderId; /**< Indicates the folder ID. see enum _MSG_FOLDER_TYPE_E */ + MSG_REFERENCE_ID_T referenceId; /**< Indicates group message of messages that is sent together. */ + MSG_MESSAGE_TYPE_S msgType; /**< Indicates the message type either of SMS or MMS */ + MSG_STORAGE_ID_T storageId; /**< Indicates where the message is saved. see enum _MSG_FOLDER_TYPE_E*/ + int nAddressCnt; /**< Indicates the count of addresses. */ + MSG_ADDRESS_INFO_S addressList[MAX_TO_ADDRESS_CNT]; /**< Indicates the address information list. */ + char replyAddress[MAX_PHONE_NUMBER_LEN+1]; /**< Indicates the reply address. */ + char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */ + time_t displayTime; /**< Indicates the display time related to the specific operation. */ + time_t scheduledTime; /**< Indicates the time to send scheduled message. */ + MSG_NETWORK_STATUS_T networkStatus; /**< Indicates the network status of the message. */ + MSG_ENCODE_TYPE_T encodeType; /**< Indicates the string encoding type. */ + bool bRead; /**< Indicates whether the message is read or not. */ + bool bProtected; /**< Indicates whether the message is protected or not. */ + bool bBackup; /**< Indicates whether the message was restored from PC. */ + MSG_PRIORITY_TYPE_T priority; /**< Indicates the priority of the message. */ + MSG_DIRECTION_TYPE_T direction; /**< Indicates whether the message is MO or MT, affecting address. */ + MSG_PORT_INFO_S msgPort; /**< Indicates the port number information. */ + int attachCount; /**< Indicates the count of attached files in mms. */ + char thumbPath[MSG_FILEPATH_LEN_MAX]; + size_t dataSize; /**< Indicates the data size. The unit is byte. */ + void *pData; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ + void *pMmsData; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ +} MSG_MESSAGE_S; + + +/** + * @brief Represents message information for thread view. + */ +typedef struct +{ + MSG_THREAD_ID_T threadId; /**< Indicates the thread ID of this peer. */ + char threadAddr[MAX_THREAD_ADDR_LEN+1]; /**< Indicates the address of this peer. > */ + char threadName[MAX_THREAD_NAME_LEN+1]; /**< Indicates the name of this peer. > */ + char threadImagePath[MAX_IMAGE_PATH_LEN+1]; /**< Indicates the image path of this peer */ + MSG_MESSAGE_TYPE_S threadType; /**< Indicates the latest msg type. */ + char threadData[MAX_THREAD_DATA_LEN+1]; /**< Indicates the latest msg data. */ + time_t threadTime; /**< Indicates the latest msg time. */ + MSG_DIRECTION_TYPE_T direction; /**< Indicates whether the message is MO or MT (affecting address). */ + + MSG_CONTACT_ID_T contactId; /**< Indicates the unique contact ID. */ + + int unreadCnt; /**< Indicates the unread messages from the Peer. */ + int smsCnt; /**< Indicates the SMS messages from the Peer. */ + int mmsCnt; /**< Indicates the MMS messages from the Peer. */ +} MSG_THREAD_VIEW_S; + + +/** + * @brief Represents message information for conversation view. + */ +typedef struct +{ + MSG_MESSAGE_ID_T msgId; /**< Indicates the message ID of this message. */ + MSG_MESSAGE_TYPE_S msgType; /**< Indicates the message type such as SMS, MMS, and Email. */ + MSG_STORAGE_ID_T storageId; /**< Indicates where the message is saved. */ + time_t displayTime; /**< Indicates the display time related to the specific operation. */ //MAX_DISPLAY_TIME_LEN + char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */ + MSG_NETWORK_STATUS_T networkStatus; /**< Indicates the network status of the message. */ + bool bRead; /**< Indicates whether the message is read or not. */ + bool bProtected; /**< Indicates whether the message is protected or not. */ + MSG_DIRECTION_TYPE_T direction; /**< Indicates whether the message is MO or MT, affecting address. */ + char thumbNailPath[MSG_FILEPATH_LEN_MAX]; /**< Indicates the MMS media thumbnail path.*/ + char msgText[MAX_MSG_TEXT_LEN+1]; /**< Indicates the message payload information as a body. */ + MSG_DELIVERY_REPORT_STATUS_T deliveryStatus; /**< Indicates the message ID of this message. */ + time_t deliveryStatusTime; /**< Indicates the display time related to the specific operation. */ //MAX_DISPLAY_TIME_LEN + MSG_READ_REPORT_STATUS_T readStatus; /**< Indicates the message ID of this message. */ + time_t readStatusTime; /**< Indicates the display time related to the specific operation. */ //MAX_DISPLAY_TIME_LEN + int attachCount; /**< Indicates the count of attached files in mms. */ +} MSG_CONV_VIEW_S; + + +/** + * @brief Represents sim message informatioin list. + */ +typedef struct +{ + int nIdxCnt; /**< The count of sim index */ + int nMsgCnt; /**< The count of sim message */ + MSG_MESSAGE_INFO_S *simMsgInfo; /**< The pointer to sim message informatioin */ +} MSG_SIM_MSG_INFO_LIST_S; + + +/** + * @brief Represents a request in the framework. \n + * Applications compose a request and send it to the framework via Message handle. \n + * This request ID is used to manage the request by the framework. + */ +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; +} MSG_REQUEST_INFO_S; + + +/** + * @brief Represents proxy information. \n + * This stucture contains the information about the status cnf of a sent message. + */ +typedef struct +{ + int listenerFd; /**< Rx fd for status cnf */ + unsigned int handleAddr; /**< Handle address for status cnf */ + MSG_MESSAGE_ID_T sentMsgId; /**< The ID of a sent message for updating message status */ +} MSG_PROXY_INFO_S; + + +/** + * @brief Aux data structure for MSG_CMD_REG_INCOMING_MSG_CB. \n + * This stucture contains the information about the receiver for msgType and port. + */ +typedef struct +{ + int listenerFd; + MSG_MAIN_TYPE_T msgType; + unsigned short port; +} MSG_CMD_REG_INCOMING_MSG_CB_S; + + +/** + * @brief Aux data structure for MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB. \n + * This stucture contains the information about the receiver for msgType and port. + */ +typedef struct +{ + int listenerFd; + MSG_MAIN_TYPE_T msgType; + char appId[MAX_MMS_JAVA_APPID_LEN+1]; +} MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S; + + +/** + * @brief Aux data structure for MSG_CMD_REG_INCOMING_SYNCML_MSG_CB. \n + * This stucture contains the information about the receiver for msgType and port. + */ +typedef struct +{ + int listenerFd; + MSG_MAIN_TYPE_T msgType; +} MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S; + + +/** + * @brief Aux data structure for MSG_CMD_REG_INCOMING_LBS_MSG_CB_S. \n + * This stucture contains the information about the receiver for msgType and port. + */ +typedef struct +{ + int listenerFd; + MSG_MAIN_TYPE_T msgType; +} MSG_CMD_REG_INCOMING_LBS_MSG_CB_S; + + +/** + * @brief Aux data structure for MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S. \n + * This stucture contains the information about the sent Java MMS messge transactionId. + */ +typedef struct +{ + bool posted; + char id[MMS_TR_ID_LEN+1]; + char pduFileName[MAX_COMMON_INFO_SIZE+1]; +} MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S; + + +/** + * @brief Aux data structure for MSG_CMD_REG_SYNCML_MSG_OPERATION_CB. \n + * This stucture contains the information about the receiver for msgType and port. + */ +typedef struct +{ + int listenerFd; + MSG_MAIN_TYPE_T msgType; +} MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S; + + +typedef struct +{ + int alarm_id; + MSG_REQUEST_INFO_S reqInfo; +}MSG_SCHEDULED_MSG_S; + + +/*================================================================================================== + ENUMS +==================================================================================================*/ + +/** + * @brief Represents the values of a message main type. \n + * Three main types of a message are predefined : SMS, MMS, and Email. More main types of a message can be defined here. \n + * This enum is used as the value of MSG_MAIN_TYPE_T. + */ +enum _MSG_MAIN_TYPE_E +{ + MSG_UNKNOWN_TYPE = 0, /**< Unknown main type */ + MSG_SMS_TYPE, /**< SMS */ + MSG_MMS_TYPE, /**< MMS */ +}; + + +/** + * @brief Represents the values of a message sub type. \n + * Three sub types of a message are predefined : NORMAL, WAPPUSH, and CB. More sub types of a message can be defined here. \n + * This enum is used as the value of MSG_SUB_TYPE_T. + */ +enum _MSG_SUB_TYPE_E +{ + /* SMS Specific Message Type */ + MSG_NORMAL_SMS = 0, /**< Text SMS message */ + MSG_CB_SMS, /**< Cell Broadcasting message */ + MSG_JAVACB_SMS, /**< JAVA Cell Broadcasting message */ + MSG_TYPE0_SMS, /**< Short Message Type 0 */ + MSG_REPLACE_TYPE1_SMS, /**< Replace Short Message Type 1 */ + MSG_REPLACE_TYPE2_SMS, /**< Replace Short Message Type 2 */ + MSG_REPLACE_TYPE3_SMS, /**< Replace Short Message Type 3 */ + MSG_REPLACE_TYPE4_SMS, /**< Replace Short Message Type 4 */ + MSG_REPLACE_TYPE5_SMS, /**< Replace Short Message Type 5 */ + MSG_REPLACE_TYPE6_SMS, /**< Replace Short Message Type 6 */ + MSG_REPLACE_TYPE7_SMS, /**< Replace Short Message Type 7 */ + MSG_WAP_SI_SMS, /**< WAP Push Message SI */ + MSG_WAP_SL_SMS, /**< WAP Push Message SL */ + MSG_WAP_CO_SMS, /**< WAP Push Message CO */ + MSG_MWI_VOICE_SMS, /**< MWI Message Voice */ + MSG_MWI_FAX_SMS, /**< MWI Message Fax */ + MSG_MWI_EMAIL_SMS, /**< MWI Message Email */ + MSG_MWI_OTHER_SMS, /**< MWI Message Other */ + MSG_STATUS_REPORT_SMS, /**< SMS-STATUS-REPORT */ + MSG_SYNCML_CP, /**< SyncML Message CP */ + MSG_LBS_SMS, /**< LBS Message */ + MSG_REJECT_SMS, /**< Reject Message */ + MSG_CONCAT_SIM_SMS, /**< Concatenated Message in SIM */ + + /* MMS Specific Message Type */ + MSG_SENDREQ_MMS = 24, /**< MMS Send Request message */ + MSG_SENDCONF_MMS, /**< MMS Send Confirm message */ + MSG_NOTIFICATIONIND_MMS, /**< MMS Notification Indication message */ + MSG_GET_MMS, /**< MMS GET MMS message */ + MSG_NOTIFYRESPIND_MMS, /**< MMS Notify Response Indication message */ + MSG_RETRIEVE_MMS, /**< MMS Retrive MMS message */ + MSG_RETRIEVE_AUTOCONF_MMS, /**< MMS Retrieve Confirm message by auto retrieving*/ + MSG_RETRIEVE_MANUALCONF_MMS, /**< MMS Retrieve Confirm message by manual retrieving*/ + MSG_ACKNOWLEGEIND_MMS, /**< MMS Acknowledge Indication message */ + MSG_DELIVERYIND_MMS, /**< MMS Delivery Indication message */ + MSG_READRECIND_MMS, /**< MMS Read Receive Indication message */ + MSG_READORGIND_MMS, /**< MMS Read Origin Indication message */ + MSG_FORWARD_MMS, /**< MMS Forward message */ + MSG_FORWARDREQ_MMS, /**< MMS Forward Request message */ + MSG_FORWARDCONF_MMS, /**< MMS Forward Confirm message */ + MSG_READREPLY_MMS, /**< MMS Read Reply message */ + MSG_SENDREQ_JAVA_MMS, /**< MMS Send Request message for JAVA MMS */ +}; + + +/** + * @brief Represents the values of a message class type. \n + * This enum is used as the value of MSG_CLASS_TYPE_T. + */ +enum _MSG_CLASS_TYPE_E +{ + MSG_CLASS_0 = 0, /**< Immediately presented on the recipient device display */ + MSG_CLASS_1, /**< Stored in the mobile equipment or SIM (depending on memory availability) */ + MSG_CLASS_2, /**< Stored in SIM */ + MSG_CLASS_3, /**< Transferred to the terminal equipment (such as PDA or PC) which is connected to the mobile equipment */ + MSG_CLASS_NONE, +}; + + +/** + * @brief Represents the values of a message transaction type. \n + * This enum is used as the value of MSG_MMS_TRANSACTION_TYPE_T. + */ +enum _MSG_MMS_TRANSACTION_TYPE_E +{ + MSG_MMS_SEND_COMPLETE = 0, + MSG_MMS_RETRIEVE_COMPLETE, + MSG_MMS_UNKNOWN, +}; + +#endif + diff --git a/include/common/MsgMmsTypes.h b/include/common/MsgMmsTypes.h new file mode 100755 index 0000000..d3f0ff8 --- /dev/null +++ b/include/common/MsgMmsTypes.h @@ -0,0 +1,692 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_MMS_TYPES_H +#define MSG_MMS_TYPES_H + +/** + * @file MsgMmsTypes.h + * @brief Defines MMS types of messaging framework + * @version 1.0 + */ + +/** + * @section Introduction + * - Introduction : Overview on MMS message Types + * @section Program + * - Program : MMS message Types Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgTypes.h" + + +#include + + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_MMS_TYPES Messaging MMS Types + * @{ + */ + +/*================================================================================================== + DEFINES +==================================================================================================*/ + +/** + * @brief Defines the enabled MMS version + */ +#define MMS_V1_2 // MMS Version : MMS_V1_0 / MMS_V1_1 / MMS_V1_2 + +/** + * @brief Defines the enabled DRM support + */ +#define __SUPPORT_DRM__ + +/** + * @brief Defines the enabled JAVA MMS Application Id + */ +#define FEATURE_JAVA_MMS + +/** + * @brief Defines the maximum file name length + */ +#define MSG_FILENAME_LEN_MAX 255 + +/** + * @brief Defines the maximum message id length + */ +#define MSG_MSG_ID_LEN 100 + +/** + * @brief Defines the maximum in transition id length + */ +#define MAX_SMIL_TRANSIN_ID 100 + +/** + * @brief Defines the maximum out transition id length + */ +#define MAX_SMIL_TRANSOUT_ID 100 + +/** + * @brief Defines the maximum region id length + */ +#define MAX_SMIL_REGION_ID 151 + +/** + * @brief Defines the maximum transition id length + */ +#define MAX_SMIL_TRANSITION_ID 151 + +/** + * @brief Defines the maximum meta id length + */ +#define MAX_SMIL_META_ID 151 + +/** + * @brief Defines the maximum meta name length + */ +#define MAX_SMIL_META_NAME 100 + +/** + * @brief Defines the maximum meta content length + */ +#define MAX_SMIL_META_CONTENT 255 + +/** + * @brief Defines the maximum fit size + */ +#define MAX_SMIL_FIT_SIZE 31 + +/** + * @brief Defines the maximum pages in a MMS + */ +#define MMS_PAGE_MAX 20 + +/** + * @brief Defines the maximum media in a MMS + */ +#define MMS_MEDIA_MAX 60 + +/** + * @brief Defines the maximum alternate text length + */ +#define MAX_SMIL_ALT_LEN 255 + + +//font size +/** + * @brief Defines the small font size + */ +#define MMS_SMIL_FONT_SIZE_SMALL 24 + +/** + * @brief Defines the normal font size + */ +#define MMS_SMIL_FONT_SIZE_NORMAL 30 + +/** + * @brief Defines the large font size + */ +#define MMS_SMIL_FONT_SIZE_LARGE 36 + +//#ifdef MMS_SMIL_ANIMATE +#define MAX_SMIL_ANIMATE_ATTRIBUTE_NAME 100 +#define MAX_SMIL_ANIMATE_ATTRIBUTE_TYPE 100 +#define MAX_SMIL_ANIMATE_TARGET_ELEMENT 100 +#define MAX_SMIL_ANIMATE_CALC_MODE 100 +//#endif + +//#ifdef FEATURE_JAVA_MMS +#define MAX_MMS_JAVA_APPID_LEN 32 +//#endif + +#define CONV_THUMB_WIDTH 250 +#define CONV_THUMB_HEIGHT 170 + +#define MMS_TR_ID_LEN 40 +#define MMS_MSG_ID_LEN 40 +#define MMS_LOCATION_LEN 100 + +/*================================================================================================== + ENUMS +==================================================================================================*/ + +/** + * @brief Represents the values of a mime type. + */ +typedef enum _MimeType +{ + // 0 + MIME_ASTERISK = 0x0000, /**< Indicates the valid default mime type */ + + // 1 + MIME_APPLICATION_XML = 0x1000, /**< Indicates the application xml type */ + MIME_APPLICATION_WML_XML = 0x1001, /**< Indicates the application wml xml type */ + MIME_APPLICATION_XHTML_XML = 0x1002, /**< Indicates the application xhtml xml type */ + MIME_APPLICATION_JAVA_VM = 0x1003, /**< Indicates the application java vm type */ + MIME_APPLICATION_SMIL = 0x1004, /**< Indicates the application smil type */ + MIME_APPLICATION_JAVA_ARCHIVE = 0x1005, /**< Indicates the application java archive type */ + MIME_APPLICATION_JAVA = 0x1006, /**< Indicates the application java type */ + MIME_APPLICATION_OCTET_STREAM = 0x1007, /**< Indicates the application octect stream type */ + MIME_APPLICATION_STUDIOM = 0x1008, /**< Indicates the application studiom type */ + MIME_APPLICATION_FUNMEDIA = 0x1009, /**< Indicates the application fun media type */ + MIME_APPLICATION_MSWORD = 0x100a, /**< Indicates the application ms word type */ + MIME_APPLICATION_PDF = 0x100b, /**< Indicates the application pdf type */ + MIME_APPLICATION_SDP = 0x100c, /**< Indicates the application sdp type */ + MIME_APPLICATION_RAM = 0x100d, /**< Indicates the application ram type */ + MIME_APPLICATION_ASTERIC = 0x100e, /**< Indicates the application as main type and generic sub type */ + + // 16 + MIME_APPLICATION_VND_WAP_XHTMLXML = 0x1100, /**< Indicates the application wap xhtml xml type */ + MIME_APPLICATION_VND_WAP_WMLC = 0x1101, /**< Indicates the application wap wmlc type */ + MIME_APPLICATION_VND_WAP_WMLSCRIPTC = 0x1102, /**< Indicates the application wap wmlscrpitc type */ + MIME_APPLICATION_VND_WAP_WTA_EVENTC = 0x1103, /**< Indicates the application wap wta event type */ + MIME_APPLICATION_VND_WAP_UAPROF = 0x1104, /**< Indicates the application wap uaprof type */ + MIME_APPLICATION_VND_WAP_SIC = 0x1105, /**< Indicates the application wap sic type */ + MIME_APPLICATION_VND_WAP_SLC = 0x1106, /**< Indicates the application wap slc type */ + MIME_APPLICATION_VND_WAP_COC = 0x1107, /**< Indicates the application wap coc type */ + MIME_APPLICATION_VND_WAP_SIA = 0x1108, /**< Indicates the application wap sia type */ + MIME_APPLICATION_VND_WAP_CONNECTIVITY_WBXML = 0x1109, /**< Indicates the application wap connectivity wbxml type */ + MIME_APPLICATION_VND_WAP_MULTIPART_FORM_DATA = 0x110a, /**< Indicates the application wap multipart data type */ + MIME_APPLICATION_VND_WAP_MULTIPART_BYTERANGES = 0x110b, /**< Indicates the application wap multipart byte type */ + MIME_APPLICATION_VND_WAP_MULTIPART_MIXED = 0x110c, /**< Indicates the application wap multipart mixed type */ + MIME_APPLICATION_VND_WAP_MULTIPART_RELATED = 0x110d, /**< Indicates the application wap multipart related type */ + MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE = 0x110e, /**< Indicates the application wap multipart alternative type */ + MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC = 0x110f, /**< Indicates the application wap mulitpart as main type and generic sub type */ + MIME_APPLICATION_VND_WAP_WBXML = 0x1110, /**< Indicates the application wap wbxml type */ + MIME_APPLICATION_VND_OMA_DD_XML = 0x1111, /**< Indicates the application oma dd xml type */ + MIME_APPLICATION_VND_OMA_DRM_MESSAGE = 0x1112, /**< Indicates the application oma drm message type */ + MIME_APPLICATION_VND_OMA_DRM_CONTENT = 0x1113, /**< Indicates the application oma drm content type */ + MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML = 0x1114, /**< Indicates the application oma drm rights xml type */ + MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML = 0x1115, /**< Indicates the application oma drm rights wbxml type */ + MIME_APPLICATION_VND_OMA_DRM_RO_XML = 0x1116, /**< Indicates the application oma drm ro xml type */ + MIME_APPLICATION_VND_OMA_DRM_DCF = 0x1117, /**< Indicates the application oma drm dcf type */ + MIME_APPLICATION_VND_OMA_ROAPPDU_XML = 0x1118, /**< Indicates the application oma roap pdu xml type */ + MIME_APPLICATION_VND_OMA_ROAPTRIGGER_XML = 0x1119, /**< Indicates the application oma roap trigger xml type */ + MIME_APPLICATION_VND_SMAF = 0x111a, /**< Indicates the application smaf type */ + MIME_APPLICATION_VND_RN_REALMEDIA = 0x111b, /**< Indicates the application rn real media type */ + MIME_APPLICATION_VND_SUN_J2ME_JAVA_ARCHIVE = 0x111c, /**< Indicates the application j2me java archive type */ + MIME_APPLICATION_VND_EXCEL = 0x111e, /**< Indicates the application excel type */ + MIME_APPLICATION_VND_POWERPOINT = 0x111f, /**< Indicates the application power point type */ + MIME_APPLICATION_VND_MSWORD = 0x1120, /**< Indicates the application ms word type */ + + // 49 + MIME_APPLICATION_X_HDMLC = 0x1200, /**< Indicates the application x hdmlc type */ + MIME_APPLICATION_X_X968_USERCERT = 0x1201, /**< Indicates the application x x968 user certified type */ + MIME_APPLICATION_X_WWW_FORM_URLENCODED = 0x1202, /**< Indicates the application x www form url encoded type */ + MIME_APPLICATION_X_SMAF = 0x1203, /**< Indicates the application x smaf type */ + MIME_APPLICATION_X_FLASH = 0x1204, /**< Indicates the application x flash type */ + MIME_APPLICATION_X_EXCEL = 0x1205, /**< Indicates the application x excel type */ + MIME_APPLICATION_X_POWERPOINT = 0x1206, /**< Indicates the application x power point type */ + + // 56 + MIME_AUDIO_BASIC = 0x2000, /**< Indicates the audio basic type */ + MIME_AUDIO_MPEG = 0x2001, /**< Indicates the audio mpeg type */ + MIME_AUDIO_MP3 = 0x2002, /**< Indicates the audio mp3 type */ + MIME_AUDIO_MPG3 = 0x2003, /**< Indicates the audio mpg3 type */ + MIME_AUDIO_MPEG3 = 0x2004, /**< Indicates the audio mpeg3 type */ + MIME_AUDIO_MPG = 0x2005, /**< Indicates the audio mpg type */ + MIME_AUDIO_AAC = 0x2006, /**< Indicates the audio aac type */ + MIME_AUDIO_G72 = 0x2007, /**< Indicates the audio g72 type */ + MIME_AUDIO_AMR = 0x2008, /**< Indicates the audio amr type */ + MIME_AUDIO_AMR_WB = 0x2009, /**< Indicates the audio amr wb type */ + MIME_AUDIO_MMF = 0x200a, /**< Indicates the audio mmf type */ + MIME_AUDIO_SMAF = 0x200b, /**< Indicates the audio smaf type */ + MIME_AUDIO_IMELODY = 0x200c, /**< Indicates the audio imelody type */ + MIME_AUDIO_IMELODY2 = 0x200d, /**< Indicates the audio imelody2 type */ + MIME_AUDIO_MELODY = 0x200e, /**< Indicates the audio melody type */ + MIME_AUDIO_MID = 0x200f, /**< Indicates the audio mid type */ + MIME_AUDIO_MIDI = 0x2010, /**< Indicates the audio midi type */ + MIME_AUDIO_SP_MIDI = 0x2011, /**< Indicates the audio sp midi type */ + MIME_AUDIO_WAVE = 0x2012, /**< Indicates the audio wave type */ + MIME_AUDIO_WAV = 0x2013, /**< Indicates the audio wav type */ + MIME_AUDIO_3GPP = 0x2014, /**< Indicates the audio 3gpp type */ + MIME_AUDIO_MP4 = 0x2015, /**< Indicates the audio mp4 type */ + MIME_AUDIO_MP4A_LATM = 0x2016, /**< Indicates the audio mp4 latm type */ + MIME_AUDIO_M4A = 0x2017, /**< Indicates the audio m4a type */ + MIME_AUDIO_MPEG4 = 0x2018, /**< Indicates the audio mpeg4 type */ + MIME_AUDIO_WMA = 0x2019, /**< Indicates the audio wma type */ + MIME_AUDIO_XMF = 0x201a, /**< Indicates the audio xmf type */ + MIME_AUDIO_IMY = 0x201b, /**< Indicates the audio imy type */ + MIME_AUDIO_MOBILE_XMF = 0x201c, /**< Indicates the audio mobile xmf type */ + + //85 + MIME_AUDIO_VND_RN_REALAUDIO = 0x2100, /**< Indicates the audio rn real audio type */ + + // 86 + MIME_AUDIO_X_MPEG = 0x2200, /**< Indicates the audio x mpeg type */ + MIME_AUDIO_X_MP3 = 0x2201, /**< Indicates the audio x mp3 type */ + MIME_AUDIO_X_MPEG3 = 0x2202, /**< Indicates the audio x mpeg3 type */ + MIME_AUDIO_X_MPG = 0x2203, /**< Indicates the audio x mpg type */ + MIME_AUDIO_X_AMR = 0x2204, /**< Indicates the audio x amr type */ + MIME_AUDIO_X_MMF = 0x2205, /**< Indicates the audio x mmf type */ + MIME_AUDIO_X_SMAF = 0x2206, /**< Indicates the audio x smaf type */ + MIME_AUDIO_X_IMELODY = 0x2207, /**< Indicates the audio x imelody type */ + MIME_AUDIO_X_MIDI = 0x2208, /**< Indicates the audio x midi type */ + MIME_AUDIO_X_MPEGAUDIO = 0x2209, /**< Indicates the audio x mpeg type */ + MIME_AUDIO_X_PN_REALAUDIO = 0x220a, /**< Indicates the audio x pn real audio type */ + MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO = 0x220b, /**< Indicates the audio x pn multirate real audio type */ + MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO_LIVE = 0x220c, /**< Indicates the audio x pn multirate real audio live type */ + MIME_AUDIO_X_WAVE = 0x220d, /**< Indicates the audio x wave type */ + MIME_AUDIO_X_WAV = 0x220e, /**< Indicates the audio x wav type */ + MIME_AUDIO_X_MS_WMA = 0x220f, /**< Indicates the audio ms wma type */ + MIME_AUDIO_X_MID = 0x2210, /**< Indicates the audio mid type */ + MIME_AUDIO_X_MS_ASF = 0x2211, /**< Indicates the audio ms asf type */ + MIME_AUDIO_X_XMF = 0x2212, /**< Indicates the audio x xmf type */ + + // 105 + MIME_IMAGE_GIF = 0x3000, /**< Indicates the image gif type */ + MIME_IMAGE_JPEG = 0x3001, /**< Indicates the image jpeg type */ + MIME_IMAGE_JPG = 0x3002, /**< Indicates the image jpg type */ + MIME_IMAGE_TIFF = 0x3003, /**< Indicates the image tiff type */ + MIME_IMAGE_TIF = 0x3004, /**< Indicates the image tif type */ + MIME_IMAGE_PNG = 0x3005, /**< Indicates the image png type */ + MIME_IMAGE_WBMP = 0x3006, /**< Indicates the image wbmp type */ + MIME_IMAGE_PJPEG = 0x3007, /**< Indicates the image pjpeg type */ + MIME_IMAGE_BMP = 0x3008, /**< Indicates the image bmp type */ + MIME_IMAGE_SVG = 0x3009, /**< Indicates the image svg type */ + MIME_IMAGE_SVG1 = 0x300a, /**< Indicates the image svg1 type */ + + // 116 + MIME_IMAGE_VND_WAP_WBMP = 0x3100, /**< Indicates the image vnd wap wbmp type */ + + // 119 + MIME_IMAGE_X_BMP = 0x3200, /**< Indicates the image x bmp type */ + + // 120 + MIME_MESSAGE_RFC822 = 0x4000, /**< Indicates the message rfc822 type */ + + // 121 + MIME_MULTIPART_MIXED = 0x5000, /**< Indicates the multipart mixed type */ + MIME_MULTIPART_RELATED = 0x5001, /**< Indicates the multipart related type */ + MIME_MULTIPART_ALTERNATIVE = 0x5002, /**< Indicates the multipart alternative type */ + MIME_MULTIPART_FORM_DATA = 0x5003, /**< Indicates the multipart form data type */ + MIME_MULTIPART_BYTERANGE = 0x5004, /**< Indicates the multipart byte range type */ + MIME_MULTIPART_REPORT = 0x5005, /**< Indicates the multipart report type */ + MIME_MULTIPART_VOICE_MESSAGE = 0x5006, /**< Indicates the multipart voice message type */ + + // 128 + MIME_TEXT_TXT = 0x6000, /**< Indicates the text txt type */ + MIME_TEXT_HTML = 0x6001, /**< Indicates the text html type */ + MIME_TEXT_PLAIN = 0x6002, /**< Indicates the text plain type */ + MIME_TEXT_CSS = 0x6003, /**< Indicates the text css type */ + MIME_TEXT_XML = 0x6004, /**< Indicates the text xml type */ + MIME_TEXT_IMELODY = 0x6005, /**< Indicates the text imelody type */ + + // 134 + MIME_TEXT_VND_WAP_WMLSCRIPT = 0x6100, /**< Indicates the text wap wmlscript type */ + MIME_TEXT_VND_WAP_WML = 0x6101, /**< Indicates the text wap wml type */ + MIME_TEXT_VND_WAP_WTA_EVENT = 0x6102, /**< Indicates the text wap wta event type */ + MIME_TEXT_VND_WAP_CONNECTIVITY_XML = 0x6103, /**< Indicates the text wap connectivity xml type */ + MIME_TEXT_VND_WAP_SI = 0x6104, /**< Indicates the text wap si type */ + MIME_TEXT_VND_WAP_SL = 0x6105, /**< Indicates the text wap sl type */ + MIME_TEXT_VND_WAP_CO = 0x6106, /**< Indicates the text wap co type */ + MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR = 0x6107, /**< Indicates the text sun j2me type */ + + // 142 + MIME_TEXT_X_HDML = 0x6200, /**< Indicates the x html type */ + MIME_TEXT_X_VCALENDAR = 0x6201, /**< Indicates the x calendar type */ + MIME_TEXT_X_VCARD = 0x6202, /**< Indicates the x vcard type */ + MIME_TEXT_X_IMELODY = 0x6203, /**< Indicates the x imelody type */ + MIME_TEXT_X_IMELODY2 = 0x6204, /**< Indicates the x imelody2 type */ + MIME_TEXT_X_VNOTE = 0x6205, /**< Indicates the x vnote type */ + + // 148 + MIME_VIDEO_MPEG4 = 0x7000, /**< Indicates the mpeg4 type */ + MIME_VIDEO_MP4 = 0x7001, /**< Indicates the mp4 type */ + MIME_VIDEO_H263 = 0x7002, /**< Indicates the h263 type */ + MIME_VIDEO_3GPP = 0x7003, /**< Indicates the 3gpp type */ + MIME_VIDEO_3GP = 0x7004, /**< Indicates the 3gp type */ + MIME_VIDEO_AVI = 0x7005, /**< Indicates the avi type */ + MIME_VIDEO_SDP = 0x7006, /**< Indicates the sdp type */ + MIME_VIDEO_MP4_ES = 0x7007, /**< Indicates the mp4 es type */ + MIME_VIDEO_MPEG = 0x7008, /**< Indicates the mpeg type */ + + // 157 + MIME_VIDEO_VND_RN_REALVIDEO = 0x7100, /**< Indicates the pn real video type */ + MIME_VIDEO_VND_RN_REALMEDIA = 0x7101, /**< Indicates the pn multi rate real media type */ + + // 159 + MIME_VIDEO_X_MP4 = 0x7200, /**< Indicates the video x mp4 type */ + MIME_VIDEO_X_PV_MP4 = 0x7201, /**< Indicates the video x pv mp4 type */ + MIME_VIDEO_X_PN_REALVIDEO = 0x7202, /**< Indicates the x pn real video type */ + MIME_VIDEO_X_PN_MULTIRATE_REALVIDEO = 0x7203, /**< Indicates the x pn multi rate real video type */ + MIME_VIDEO_X_MS_WMV = 0x7204, /**< Indicates the x ms wmv type */ + MIME_VIDEO_X_MS_ASF = 0x7205, /**< Indicates the x ms asf type */ + MIME_VIDEO_X_PV_PVX = 0x7206, /**< Indicates the x pv pvx type */ + + MIME_TYPE_VALUE_MAX = 0x7207, /**< Indicates the maximum mime type */ + MIME_UNKNOWN = 0xffff /**< Indicates the unknown mime type */ + +} MimeType; + +/** + * @brief Represents the values of a DRM type. + */ +//#ifdef __SUPPORT_DRM__ +typedef enum +{ + MSG_DRM_TYPE_NONE = 0, /**< Indicates the drm type none */ + MSG_DRM_TYPE_FL = 1, /**< Indicates the forward lock */ /* 2004-07-09: forwardLock type */ + MSG_DRM_TYPE_CD = 2, /**< Indicates the combined delivery */ /* 2004-07-09: combined delivery type */ + MSG_DRM_TYPE_SD = 3, /**< Indicates the separate delivery */ /* 2004-07-09: seperate delivery type */ + MSG_DRM_TYPE_SSD = 4 /**< Indicates the special separate delivery */ // 2005-02-28: add Special Sperate Delivery +}MsgDrmType; +//#endif + +/** + * @brief Represents the values of a SMIL region type. + */ +typedef enum _REGION_FIT_TYPE_T +{ + MMSUI_IMAGE_REGION_FIT_HIDDEN, /**< Indicates the hidden fit type */ + MMSUI_IMAGE_REGION_FIT_MEET, /**< Indicates the meet fit type */ +}REGION_FIT_TYPE_T; + + +/** + * @brief Represents the values of a SMIL media type. + */ +typedef enum +{ + MMS_SMIL_MEDIA_INVALID = 0, /**< Indicates the invalid media type */ + MMS_SMIL_MEDIA_IMG, /**< Indicates the image media */ + MMS_SMIL_MEDIA_AUDIO, /**< Indicates the audio media */ + MMS_SMIL_MEDIA_VIDEO, /**< Indicates the video media */ + MMS_SMIL_MEDIA_TEXT, /**< Indicates the text media */ + MMS_SMIL_MEDIA_ANIMATE, /**< Indicates the animation media */ + MMS_SMIL_MEDIA_IMG_OR_VIDEO , /**< Indicates the image or video media */ + MMS_SMIL_MEDIA_MAX = 0xffffffff, /**< Indicates the maximum media type */ +}MmsSmilMediaType; + +/** + * @brief Represents the values of a SMIL transition type. + */ +typedef enum +{ + MMS_SMIL_TRANS_NONE = 0, /**< Indicates the transition type none */ /* default */ + MMS_SMIL_TRANS_SLIDEWIPE = 1, /**< Indicates the slide wipe transition */ + MMS_SMIL_TRANS_BARWIPE = 2, /**< Indicates the bar wipe transition */ + MMS_SMIL_TRANS_BARNDOORWIPE = 3, /**< Indicates the bar and door wipe transition */ + MMS_SMIL_TRANS_FADE = 4, /**< Indicates the fade transition */ + MMS_SMIL_TRANS_RANDOMBLOCK = 5, /**< Indicates the random block transition */ + MMS_SMIL_TRANS_ZOOMIN = 6, /**< Indicates the zoom in transition */ + MMS_SMIL_TRANS_IRISWIPE = 7, /**< Indicates the iris wipe transition */ + MMS_SMIL_TRANS_BOXWIPE = 8, /**< Indicates the box wipe transition */ + MMS_SMIL_TRANS_FOURBOXWIPE = 9, /**< Indicates the four box wipe transition */ + MMS_SMIL_TRANS_PUSHWIPE =10, /**< Indicates the push wipe transition */ + MMS_SMIL_TRANS_ELLIPSEWIPE = 11 /**< Indicates the ellipse wipe transition */ +}MmsSmilTransType; + +/** + * @brief Represents the values of a SMIL transition sub type. + */ +typedef enum +{ + MMS_SMIL_TRANS_SUB_NONE = 0, /**< Indicates the transition sub type none */ + MMS_SMIL_TRANS_SUB_FROM_LEFT = 1, /**< Indicates the from left transition */ /* slideWipe's default */ + MMS_SMIL_TRANS_SUB_FROM_TOP = 2, /**< Indicates the from top transition */ + MMS_SMIL_TRANS_SUB_FROM_BOTTOM = 3, /**< Indicates the from bottom transition */ + MMS_SMIL_TRANS_SUB_TOP_TO_BOTTOM = 4, /**< Indicates the from top to bottom transition */ /* barWipe's default */ + MMS_SMIL_TRANS_SUB_BOTTOM_TO_TOP = 5, /**< Indicates the from bottom to top transition */ + MMS_SMIL_TRANS_SUB_HORIZONTAL = 6, /**< Indicates the horizontal transition */ /* barDoorWipe's default */ + MMS_SMIL_TRANS_SUB_FROM_RIGHT = 7, /**< Indicates the from right transition */ + MMS_SMIL_TRANS_SUB_VERTICAL = 8 /**< Indicates the vertical transition */ +}MmsSmilTransSubType; + +/** + * @brief Represents the values of a text font type. + */ +typedef enum +{ + MMS_SMIL_FONT_TYPE_NONE = 0, /**< Indicates the font type none */ + MMS_SMIL_FONT_TYPE_NORMAL = 1, /**< Indicates the font type normal */ + MMS_SMIL_FONT_TYPE_ITALIC = 2, /**< Indicates the font type italic */ + MMS_SMIL_FONT_TYPE_BOLD = 3, /**< Indicates the font type bold */ + MMS_SMIL_FONT_TYPE_UNDERLINE = 4 /**< Indicates the font type underline */ +}MmsSmilFontType; + +/** + * @brief Represents the values of a MMS text direction. + */ +typedef enum _MmsTextDir{ + MMS_TEXT_DIRECTION_INVALID = -1, /**< Indicates the invalid direction */ + MMS_TEXT_DIRECTION_RIGHT = 0, /**< Indicates the right direction */ + MMS_TEXT_DIRECTION_DOWN, /**< Indicates the down direction */ // supported to GC +} MmsTextDirection; + +/** + * @brief Represents the values of MMS Read Report Sent Status. + */ +typedef enum +{ + MMS_RECEIVE_READ_REPORT_NO_SEND, // didn't send yet + MMS_RECEIVE_READ_REPORT_MUST_SEND, // didn't send yet but will send + MMS_RECEIVE_READ_REPORT_SENT, // sent + MMS_RECEIVE_READ_REPORT_NO_SENT, // required but, didn't send by user's choice +} MmsRecvReadReportSendStatus ; + +/** + * @brief Represents text information. + */ +typedef struct { + char szTransInId[MAX_SMIL_TRANSIN_ID]; /**< Indicates the In SMIL transition id */ + char szTransOutId[MAX_SMIL_TRANSOUT_ID]; /**< Indicates the Out SMIL transition id */ + int nRepeat; /**< Indicates the text needs to be displayed repeatedly */ + int nBegin; /**< Indicates the begin time */ + int nEnd; /**< Indicates the end time */ + int nDurTime; /**< Indicates the duration */ + int nBgColor; /**< Indicates the background color of the text */ + bool bBold; /**< Indicates whether the text is bold */ + bool bUnderLine; /**< Indicates whether the text is underlined */ + bool bItalic; /**< Indicates whether the text is Italic */ + bool bReverse; /**< Indicates whether the text is reversed */ + MmsTextDirection nDirection; /**< Indicates the text direction type. see enum MmsTextDirection */ + //MmsSmilFontType nFont; /**< Indicates the text font type. see enum MmsSmilFontType */ + int nSize; /**< Indicates the font size */ + int nColor; /**< Indicates the font color */ +}MmsSmilText; + +/** + * @brief Represents video information. + */ +typedef struct { + char szTransInId[MAX_SMIL_TRANSIN_ID]; /**< Indicates the In SMIL transition id */ + char szTransOutId[MAX_SMIL_TRANSOUT_ID]; /**< Indicates the Out SMIL transition id */ + int nRepeat; /**< Indicates the video needs to be displayed repeatedly */ + int nBegin; /**< Indicates the begin time */ + int nEnd; /**< Indicates the end time */ + int nDurTime; /**< Indicates the duration */ + int nBgColor; /**< Indicates the background color of the text */ +}MmsSmilAVI; + +/** + * @brief Represents media information. + */ +typedef struct +{ + MmsSmilMediaType mediatype; /**< Indicates the SMIL media type. see enum MmsSmilMediaType */ + + char szSrc[MSG_FILEPATH_LEN_MAX];/**< Indicates the media source name */ + char szFileName[MSG_FILENAME_LEN_MAX]; /**< Indicates the file name */ + char szFilePath[MSG_FILEPATH_LEN_MAX]; /**< Indicates the file path */ + char szContentID[MSG_MSG_ID_LEN+1]; /**< Indicates the content id */ + char regionId[MAX_SMIL_REGION_ID]; /**< Indicates the region id */ + char szAlt[MAX_SMIL_ALT_LEN]; /**< Indicates the alternative text to be displayed in failure case */ + MsgDrmType drmType; /**< Indicates the drm type. see enum MsgDrmType */ + char szDrm2FullPath[MSG_FILEPATH_LEN_MAX]; /**< Indicates the fullpath of the DRM */ + union{ + MmsSmilText sText; /**< Indicates the text attributes */ + MmsSmilAVI sAVI; /**< Indicates the video attributes */ + } sMedia; +}MMS_MEDIA_S; + +/** + * @brief Represents attachment information. + */ +typedef struct +{ + MimeType mediatype; /**< Indicates the file mime type. see enum MimeType */ + char szFileName[MSG_FILENAME_LEN_MAX]; /**< Indicates the file name */ + char szFilePath[MSG_FILEPATH_LEN_MAX]; /**< Indicates the file path */ + int fileSize; /**< Indicates the size of the file */ + MsgDrmType drmType; /**< Indicates the drm type. see enum MsgDrmType */ + char szDrm2FullPath[MSG_FILEPATH_LEN_MAX]; /**< Indicates the fullpath of the DRM */ +}MMS_ATTACH_S; + +/** + * @brief Represents SMIL page information. + */ +typedef struct +{ + int mediaCnt; /**< The count of the media */ + GList *medialist; /**< The pointer to media list */ + int nDur; /**< Indicates the duration of the page */ + int nBegin; /**< Indicates the begin time of the page */ + int nEnd; /**< Indicates the end time of the page */ + int nMin; /**< Indicates the min attribute of the page */ + int nMax; /**< Indicates the max attribute of the page */ + int nRepeat; /**< Indicates the page needs to be displayed repeatedly */ + +}MMS_PAGE_S; + +/** + * @brief Represents length information. + */ +typedef struct +{ + bool bUnitPercent; /**< Indicates the length is in percentage(%) or not */ + int value; /**< Indicates the value for length */ +}MMS_LENGTH; + +/** + * @brief Represents SMIL region information. + */ +typedef struct +{ + char szID[MAX_SMIL_REGION_ID]; /**< Indicates the ID of region information */ + MMS_LENGTH nLeft; /**< Indicates the left co-ordinate of the region */ + MMS_LENGTH nTop; /**< Indicates the top co-ordinate of the region */ + MMS_LENGTH width; /**< Indicates the width of the region */ + MMS_LENGTH height; /**< Indicates the width of the region */ // '%' rate should be supported + int bgColor; /**< Indicates the background color of the region */ + REGION_FIT_TYPE_T fit; /**< Indicates the fit type. see enum REGION_FIT_TYPE_T */ + +}MMS_SMIL_REGION; + +/** + * @brief Represents SMIL root layout information. + */ +typedef struct +{ + MMS_LENGTH width; /**< Indicates the width of the root layout */ + MMS_LENGTH height; /**< Indicates the height of the root layout */ // '%' rate should be supported + int bgColor; /**< Indicates the background color of the root layout */ +}MMS_SMIL_ROOTLAYOUT; + + +/** + * @brief Represents SMIL transition information. + */ +typedef struct +{ + char szID[MAX_SMIL_TRANSITION_ID]; /**< Indicates the ID of transition information */ + MmsSmilTransType nType; /**< Indicates the transition type. see enum MmsSmilTransType */ + MmsSmilTransSubType nSubType; /**< Indicates the transition sub type. see enum MmsSmilTransSubType */ + int nDur; /**< Indicates the transition duration */ +}MMS_SMIL_TRANSITION; + + +/** + * @brief Represents SMIL meta information. + */ +typedef struct +{ + char szID[MAX_SMIL_META_ID]; /**< Indicates the ID of meta information */ + char szName[MAX_SMIL_META_NAME]; /**< Indicates the Name */ + char szContent[MAX_SMIL_META_CONTENT]; /**< Indicates the content */ +}MMS_SMIL_META; + + +/** + * @brief Represents application id information for JAVA MMS msg. + */ +typedef struct +{ + bool valid; /**< Indicates whether application id information is used or not. */ + char appId[MAX_MMS_JAVA_APPID_LEN+1]; /**< application id, it should not exceed 32 chars */ + char replyToAppId[MAX_MMS_JAVA_APPID_LEN+1]; /**< reply to application id, application id, it should not exceeded 32 chars */ +}MMS_APPID_INFO_S; + + + +#define MAX_FULL_PATH_SIZE_S 160 // max length for internal file path + +typedef struct +{ + char szMsgID[MMS_MSG_ID_LEN+1]; + char retrievedFilePath[MAX_FULL_PATH_SIZE_S]; + char szTrID[MMS_TR_ID_LEN+1]; + MMS_APPID_INFO_S msgAppId; +}MMS_RECV_DATA_S; + + +/** + * @brief Represents MMS message data. + */ +typedef struct _MMS_MESSAGE_DATA_S +{ + char szSmilFilePath[MSG_FILEPATH_LEN_MAX]; /**< Indicates the SMIL file path */ + int pageCnt; /**< The count of the SMIL pages */ + GList *pagelist; /**< The pointer to SMIL pages list */ + int regionCnt; /**< The count of the SMIL regions */ + GList *regionlist; /**< The pointer to SMIL regions list */ + int attachCnt; /**< The count of the attachments */ + GList *attachlist; /**< The pointer to attachment list */ + int transitionCnt; /**< The count of the SMIL transitions information */ + GList *transitionlist; /**< The pointer to SMIL transitions list */ + int metaCnt; /**< The count of the SMIL meta information */ + GList *metalist; /**< The pointer to SMIL meta list */ + MMS_SMIL_ROOTLAYOUT rootlayout; /**< Indicates the root layout information */ + MMS_APPID_INFO_S msgAppId; +}MMS_MESSAGE_DATA_S; + +/** + * @} + */ + + + +#endif + diff --git a/include/common/MsgPluginInterface.h b/include/common/MsgPluginInterface.h new file mode 100755 index 0000000..c5b1ed3 --- /dev/null +++ b/include/common/MsgPluginInterface.h @@ -0,0 +1,1108 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + + /** + * @file MsgPluginInterface.h + * @brief Defines plug-ins API of messaging framework + * @version 1.0 + */ + +#ifndef MSG_PLUGIN_INTERFACE_H +#define MSG_PLUGIN_INTERFACE_H + +/** + * @section Introduction + * - Introduction : Overview on Messaging Plug-in API + * @section Program + * - Program : Messaging Plug-in API Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgTransportTypes.h" +#include "MsgStorageTypes.h" +#include "MsgSettingTypes.h" +#include "MsgInternalTypes.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_PLUGIN_API Messaging Plug-in API + * @{ + */ + +/*================================================================================================== + TYPE DEFINES +==================================================================================================*/ +typedef struct _MSG_PLUGIN_HANDLER_S MSG_PLUGIN_HANDLER_S; + +typedef struct _MSG_PLUGIN_LISTENER_S MSG_PLUGIN_LISTENER_S; + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + + /** + + * \par Description: + * A Prototype of the function which will be called when the plug-in is loaded at Message Framework. + * ALL Plug-in SHOULD implement this function. + * + * \par Purpose: + * Create plug-in handle for Message Framework. + * Message Framework will able to reach plugin functions by handle. + * + * \par Typical use case: + * Create plug-in handle. + * + * \par Method of function operation: + * Set handle information by plug-in. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins.. + * + * \param input - handle is Message handle. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_NULL_POINTER Plug-in handle is invalid. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +MSG_ERROR_T MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle); + + + /** + + * \par Description: + * A Prototype of the function which will be called when the plug-in is finalized at Message Framework. + * ALL Plug-in SHOULD implement this function. + * + * \par Purpose: + * Destroy plug-in handle for Message Framework. + * + * \par Typical use case: + * Destroy plug-in handle. + * + * \par Method of function operation: + * Remove handle information by plug-in. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins.. + * + * \param input - handle is Message handle. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_NULL_POINTER Plug-in handle is invalid. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +MSG_ERROR_T MsgPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle); + + + + +// Control API + /** + + * \par Description: + * A Prototype of the function which will be called when the plug-in is loaded at Message Framework. + * ALL Plug-in SHOULD implement this function. + * + * \par Purpose: + * Initializing plug-in. + * Precede jobs must done in this function. + * + * \par Typical use case: + * Initializing plug-in. + * + * \par Method of function operation: + * Make up pre-works for plug-in. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins.. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_REGEVENT Plug-in's error during operations. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgInitialize)(); + + + /** + + * \par Description: + * A Prototype of the function which will be called when the plug-in is loaded at Message Framework. + * ALL Plug-in SHOULD implement this function. + * + * \par Purpose: + * Create plug-in handle for Message Framework. + * Message Framework will able to reach plugin functions by handle. + * + * \par Typical use case: + * Create plug-in handle. + * + * \par Method of function operation: + * Set handle information by plug-in. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins.. + * + * \param input - handle is Message handle. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_NULL_POINTER Plug-in handle is invalid. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgFinalize)(); + + + /** + + * \par Description: + * A Prototype of the function which will be called when the plug-in is loaded at Message Framework. + * ALL Plug-in SHOULD implement this function. + * + * \par Purpose: + * Regist listeners to handle incomming messages.. + * . + * + * \par Typical use case: + * Regist listeners. + * + * \par Method of function operation: + * Set listener informations in plug-in. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins.. + * + * \param input - listener is callback listeners. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgRegisterListener)(MSG_PLUGIN_LISTENER_S *pListener); + + + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to check sim card status. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Checking sim card status for Message Framework. + * + * \par Typical use case: + * To check sim card status. + * + * \par Method of function operation: + * Check SIM card status and return result of sim card is changed or not. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins.. + * + * \param output - bChanged is a boolean type value which shows sim card status. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgCheckSimStatus)(MSG_SIM_STATUS_T *pStatus); + + + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to check device status. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Create plug-in handle for Message Framework. + * Message Framework will able to reach plugin functions by handle. + * + * \par Typical use case: + * Create plug-in handle. + * + * \par Method of function operation: + * Set handle information by plug-in. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins.. + * + * \param input - handle is Message handle. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_NULL_POINTER Plug-in handle is invalid. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgCheckDeviceStatus)(); + + +// Transport API + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to submit a message to send. + * ALL Plug-in SHOULD implement this function. + * + * \par Purpose: + * Send message.. + * + * \par Typical use case: + * To send messages. + * + * \par Method of function operation: + * Convert message data to raw message data. + * Send raw message data to selected network. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - pReqInfo is message data to send. + * \param input - bReqCb shows callback is required. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_TRANSPORT Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgSubmitRequest)(MSG_REQUEST_INFO_S *pReqInfo, bool bReqCb); + + +// Storage API + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to save a message to SIM card. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Save a message to SIM card. + * + * \par Typical use case: + * To save a message to SIM card.. + * + * \par Method of function operation: + * Convert message data to raw message data. + * Save the raw message data to SIM card. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - pMsgInfo is the information of message. + * \param output - pSimIdList is the list of messages saved in SIM card. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_SIM_MSG_FULL SIM card's capacity for SMS message is full. + * - MSG_ERR_PLUGIN_STORAGE Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgInitSimMessage)(); + + +// Storage API + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to save a message to SIM card. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Save a message to SIM card. + * + * \par Typical use case: + * To save a message to SIM card.. + * + * \par Method of function operation: + * Convert message data to raw message data. + * Save the raw message data to SIM card. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - pMsgInfo is the information of message. + * \param output - pSimIdList is the list of messages saved in SIM card. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_SIM_MSG_FULL SIM card's capacity for SMS message is full. + * - MSG_ERR_PLUGIN_STORAGE Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgSaveSimMessage)(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList); + + + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to delete a message in SIM card. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * delete a message in SIM card. + * + * \par Typical use case: + * To save a message to SIM card.. + * + * \par Method of function operation: + * delete a message data in SIM card which is indexed by ID. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - SimMsgId is the index of the message to delete. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_STORAGE Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgDeleteSimMessage)(MSG_SIM_ID_T SimMsgId); + + + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to set read status of message in SIM card. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Set read status of SIM cad message. + * + * \par Typical use case: + * To set read status of SIM card message. + * + * \par Method of function operation: + * Save the given read status to SIM card message. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - SimMsgId is the index of the message to set read status. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_STORAGE Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgSetReadStatus)(MSG_SIM_ID_T SimMsgId); + + + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to set read status of message in SIM card. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Set read status of SIM cad message. + * + * \par Typical use case: + * To set read status of SIM card message. + * + * \par Method of function operation: + * Save the given read status to SIM card message. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - SimMsgId is the index of the message to set read status. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_STORAGE Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgSetMemoryStatus)(MSG_ERROR_T Error); + + +// Setting API + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to save configuration of network to SIM card. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Save configuration information to SIM card. + * + * \par Typical use case: + * To save configuration information to SIM card. + * + * \par Method of function operation: + * Convert information data to raw data. + * Save raw data to SIM card. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - pSetting is information of configuration. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_SETTING Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgInitConfigData)(MSG_SIM_STATUS_T SimStatus); + + +// Setting API + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to save configuration of network to SIM card. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Save configuration information to SIM card. + * + * \par Typical use case: + * To save configuration information to SIM card. + * + * \par Method of function operation: + * Convert information data to raw data. + * Save raw data to SIM card. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - pSetting is information of configuration. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_SETTING Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgSetConfigData)(const MSG_SETTING_S *pSetting); + + + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to get configuration of network from SIM card. + * SMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Get configuration information from SIM card. + * + * \par Typical use case: + * To get configuration information from SIM card. + * + * \par Method of function operation: + * Convert raw data to information data. + * Get configuration data from SIM card. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - pSetting is information of configuration. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_SETTING Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgGetConfigData)(MSG_SETTING_S *pSetting); + +// MMS API +/** + +* \par Description: +* A Prototype of the function which will be called when Message Framework has to store MMS message. +* MMS Plug-in SHOULD implement this function. +* +* \par Purpose: +* Save MMS message to plug-in defined DB. +* +* \par Typical use case: +* To save MMS message to plug-in defined DB. +* +* \par Method of function operation: +* Convert MMS Message data to cetain format for plug-in. +* Save the certain format MMS message information to DB. +* +* \par Sync (or) Async: +* This is a Synchronous API. +* +* \par Important notes: +* This function MUST be implement by plug-ins. +* +* \param input - pMsgInfo is information of MMS message. +* \param input - pSendOptInfo is information of sending option. +* \param output - pFileData is the file path of saved MMS message. +* +* \return Return Type (int(MSG_ERROR_T)) \n +* - MSG_SUCCESS Success in operation. +* - MSG_ERR_PLUGIN_TRANSPORT Exception is occured in plug-in. +* +* \par Prospective clients: +* Internal/Plug-ins. +* +* \par Related functions: +* None +* +* \par Known issues/bugs: +* None +* +*/ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgAddMessage)(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char* pFileData); + + +/** + +* \par Description: +* A Prototype of the function which will be called when Message Framework has to process received MMS message indicator. +* MMS Plug-in SHOULD implement this function. +* +* \par Purpose: +* Process MMS message indicator. +* +* \par Typical use case: +* To process MMS message indicator. +* +* \par Method of function operation: +* Procces MMS Message indicator in options. +* +* \par Sync (or) Async: +* This is a Synchronous API. +* +* \par Important notes: +* This function MUST be implement by plug-ins. +* +* \param input - pMsgInfo is information of MMS message. +* \param input - pRequest is information of request options. +* \param output - bRejects shows the reject status. +* +* \return Return Type (int(MSG_ERROR_T)) \n +* - MSG_SUCCESS Success in operation. +* - MSG_ERR_PLUGIN_TRANSPORT Exception is occured in plug-in. +* +* \par Prospective clients: +* Internal/Plug-ins. +* +* \par Related functions: +* None +* +* \par Known issues/bugs: +* None +* +*/ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgProcessReceivedInd)(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S* pRequest, bool* bReject); + + +/** + +* \par Description: +* A Prototype of the function which will be called when Message Framework has to update MMS message. +* MMS Plug-in SHOULD implement this function. +* +* \par Purpose: +* Update MMS message to plug-in defined DB. +* +* \par Typical use case: +* To update MMS message to plug-in defined DB. +* +* \par Method of function operation: +* Convert MMS Message data to cetain format for plug-in. +* Update the certain format MMS message information to DB. +* +* \par Sync (or) Async: +* This is a Synchronous API. +* +* \par Important notes: +* This function MUST be implement by plug-ins. +* +* \param input - pMsgInfo is information of MMS message. +* \param input - pSendOptInfo is information of sending option. +* \param output - pFileData is the file path of saved MMS message. +* +* \return Return Type (int(MSG_ERROR_T)) \n +* - MSG_SUCCESS Success in operation. +* - MSG_ERR_PLUGIN_TRANSPORT Exception is occured in plug-in. +* +* \par Prospective clients: +* Internal/Plug-ins. +* +* \par Related functions: +* None +* +* \par Known issues/bugs: +* None +* +*/ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgUpdateMessage)(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char* pFileData); + + +/** + +* \par Description: +* A Prototype of the function which will be called when Message Framework has to get MMS message. +* MMS Plug-in SHOULD implement this function. +* +* \par Purpose: +* Get MMS message. +* +* \par Typical use case: +* To get MMS message. +* +* \par Method of function operation: +* Get MMS Message from certian plug-in defined DB. +* +* \par Sync (or) Async: +* This is a Synchronous API. +* +* \par Important notes: +* This function MUST be implement by plug-ins. +* +* \param output - pMsg is information of MMS message. +* \param output - pSendOptInfo is information of sending options. +* \param output - pMmsMsg is information of MMS messages detail data. +* \param output - pDestMsg is file path of MMS message. +* +* \return Return Type (int(MSG_ERROR_T)) \n +* - MSG_SUCCESS Success in operation. +* - MSG_ERR_PLUGIN_TRANSPORT Exception is occured in plug-in. +* +* \par Prospective clients: +* Internal/Plug-ins. +* +* \par Related functions: +* None +* +* \par Known issues/bugs: +* None +* +*/ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgGetMmsMessage)(MSG_MESSAGE_INFO_S* pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo, MMS_MESSAGE_DATA_S* pMmsMsg, char** pDestMsg); + + +/** + +* \par Description: +* A Prototype of the function which will be called when Message Framework has to update reject status of MMS message. +* MMS Plug-in SHOULD implement this function. +* +* \par Purpose: +* Update reject status of MMS message. +* +* \par Typical use case: +* To update reject status of MMS message. +* +* \par Method of function operation: +* Update reject status of MMS Message from certian plug-in defined DB. +* +* \par Sync (or) Async: +* This is a Synchronous API. +* +* \par Important notes: +* This function MUST be implement by plug-ins. +* +* \param input - pMsgInfo is information of MMS message. +* +* \return Return Type (int(MSG_ERROR_T)) \n +* - MSG_SUCCESS Success in operation. +* - MSG_ERR_PLUGIN_TRANSPORT Exception is occured in plug-in. +* +* \par Prospective clients: +* Internal/Plug-ins. +* +* \par Related functions: +* None +* +* \par Known issues/bugs: +* None +* +*/ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgUpdateRejectStatus)(MSG_MESSAGE_INFO_S *pMsgInfo); + + +/** + +* \par Description: +* A Prototype of the function which will be called when Message Framework has to compose read report for MMS message. +* MMS Plug-in SHOULD implement this function. +* +* \par Purpose: +* Compose read report for MMS message. +* +* \par Typical use case: +* To compose read report for MMS message. +* +* \par Method of function operation: +* Compose read report for MMS message. +* Send read report. +* +* \par Sync (or) Async: +* This is a Synchronous API. +* +* \par Important notes: +* This function MUST be implement by plug-ins. +* +* \param input - pMsgInfo is information of MMS message. +* +* \return Return Type (int(MSG_ERROR_T)) \n +* - MSG_SUCCESS Success in operation. +* - MSG_ERR_PLUGIN_TRANSPORT Exception is occured in plug-in. +* +* \par Prospective clients: +* Internal/Plug-ins. +* +* \par Related functions: +* None +* +* \par Known issues/bugs: +* None +* +*/ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgComposeReadReport)(MSG_MESSAGE_INFO_S *pMsgInfo); + + /** + + * \par Description: + * A Prototype of the function which will be called when Message Framework has to compose read report for MMS message. + * MMS Plug-in SHOULD implement this function. + * + * \par Purpose: + * Compose read report for MMS message. + * + * \par Typical use case: + * To compose read report for MMS message. + * + * \par Method of function operation: + * Compose read report for MMS message. + * Send read report. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be implement by plug-ins. + * + * \param input - pMsgInfo is information of MMS message. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_PLUGIN_TRANSPORT Exception is occured in plug-in. + * + * \par Prospective clients: + * Internal/Plug-ins. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + */ +/*================================================================================================*/ +typedef MSG_ERROR_T (*MsgPlgRestoreMsg)(MSG_MESSAGE_INFO_S *pMsg, char* pRcvdBody, int rcvdBodyLen, char* filePath); + + +// framework defined callbacks. +typedef void (*MsgPlgOnSentStatus)(MSG_SENT_STATUS_S *pSentStatus); +typedef void (*MsgPlgOnStorageChange)(MSG_STORAGE_CHANGE_TYPE_T storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo); +typedef MSG_ERROR_T (*MsgPlgOnMsgIncoming)(MSG_MESSAGE_INFO_S *pMsgInfo); +typedef MSG_ERROR_T (*MsgPlgOnInitSimBySat)(void); +typedef MSG_ERROR_T (*MsgPlgOnSyncMLMsgIncoming)(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLData); +typedef MSG_ERROR_T (*MsgPlgOnLBSMsgIncoming)(MSG_LBS_MESSAGE_DATA_S *pLBSData); +typedef MSG_ERROR_T (*MsgPlgOnMmsConfIncoming)(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_ID_T *pRequest); + + +/*================================================================================================== + STRUCTURES +==================================================================================================*/ +struct _MSG_PLUGIN_LISTENER_S +{ + MsgPlgOnSentStatus pfSentStatusCb; /** The function pointer of sent status callback. */ + MsgPlgOnStorageChange pfStorageChangeCb; /** The function pointer of storage change callback. */ + MsgPlgOnMsgIncoming pfMsgIncomingCb; /** The function pointer of receive message callback. */ + MsgPlgOnInitSimBySat pfInitSimBySatCb; /** The function pointer of init SIM callback. */ + MsgPlgOnSyncMLMsgIncoming pfSyncMLMsgIncomingCb; /** The function pointer of receive syncML message callback. */ + MsgPlgOnLBSMsgIncoming pfLBSMsgIncomingCb; /** The function pointer of receive LBS message callback. */ + MsgPlgOnMmsConfIncoming pfMmsConfIncomingCb; /** The function pointer of receive MMS conf */ +}; + + +struct _MSG_PLUGIN_HANDLER_S +{ + MsgPlgInitialize pfInitialize; /**< The function pointer of initialize. */ + MsgPlgFinalize pfFinalize; /**< The function pointer of finalize. */ + MsgPlgRegisterListener pfRegisterListener; /**< The function pointer of register listener. */ + MsgPlgCheckSimStatus pfCheckSimStatus; /**< The function pointer of check SIM status. */ + MsgPlgCheckDeviceStatus pfCheckDeviceStatus; /**< The function pointer of check device status. */ + MsgPlgSubmitRequest pfSubmitRequest; /**< The function pointer of submit request. */ + MsgPlgInitSimMessage pfInitSimMessage; /**< The function pointer of initialize SIM msg. */ + MsgPlgSaveSimMessage pfSaveSimMessage; /**< The function pointer of save SIM msg. */ + MsgPlgDeleteSimMessage pfDeleteSimMessage; /**< The function pointer of delete SIM msg. */ + MsgPlgSetReadStatus pfSetReadStatus; /**< The function pointer of set read status. */ + MsgPlgSetMemoryStatus pfSetMemoryStatus; /**< The function pointer of set memory status. */ + MsgPlgInitConfigData pfInitConfigData; /**< The function pointer of initialize of setting. */ + MsgPlgSetConfigData pfSetConfigData; /**< The function pointer of save setting. */ + MsgPlgGetConfigData pfGetConfigData; /**< The function pointer of get setting. */ + MsgPlgRestoreMsg pfRestoreMsg; + MsgPlgAddMessage pfAddMessage; /**< The function pointer of add Message. */ + MsgPlgProcessReceivedInd pfProcessReceivedInd; /**< The function pointer of Process Notification Ind. */ + MsgPlgUpdateMessage pfUpdateMessage; /**< The function pointer of Update MMS Message */ + MsgPlgGetMmsMessage pfGetMmsMessage; + MsgPlgUpdateRejectStatus pfUpdateRejectStatus; + MsgPlgComposeReadReport pfComposeReadReport; +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/common/MsgQueue.h b/include/common/MsgQueue.h new file mode 100755 index 0000000..c2eb8d3 --- /dev/null +++ b/include/common/MsgQueue.h @@ -0,0 +1,112 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __MsgThdSafeQ_H__ +#define __MsgThdSafeQ_H__ + +#include +#include "MsgMutex.h" +#include + +template class MsgThdSafeQ +{ +public: + MsgThdSafeQ(){}; + void pop_front (); + bool front(T* qItem); + void push_front(T const & input); + void push_back(T const & input); + int size(); + bool empty(); + void clear(); +private: + Mutex mx; + std::list q; +}; + +/* + mx variable guarantees atomic operation in multi-threaded environment. + For example, when a thread is executing Pop(), other threads + trying to execute one of Pop, Push, Size, Empty are locked. +*/ + +template void MsgThdSafeQ::pop_front() +{ + MutexLocker lock(mx); + if( q.empty() ) return; + + q.pop_front(); +} + +template bool MsgThdSafeQ::front(T* qItem) +{ + MutexLocker lock(mx); + if( qItem == NULL || q.empty() ) + return false; // Fail + + *qItem = q.front(); // copy + + return true; // Success +} + + +template void MsgThdSafeQ::push_back(T const & qItem) +{ + MutexLocker lock(mx); + q.push_back(qItem); +} + +template void MsgThdSafeQ::push_front(T const & qItem) +{ + MutexLocker lock(mx); + q.push_front(qItem); +} + + +template int MsgThdSafeQ::size() +{ + MutexLocker lock(mx); + return q.size(); +} + +template bool MsgThdSafeQ::empty() +{ + MutexLocker lock(mx); + return q.empty(); +} + +template void MsgThdSafeQ::clear() +{ + MutexLocker lock(mx); + q.clear(); +} + +#endif // __MsgThdSafeQ_H__ + diff --git a/include/common/MsgSettingTypes.h b/include/common/MsgSettingTypes.h new file mode 100755 index 0000000..eae10b3 --- /dev/null +++ b/include/common/MsgSettingTypes.h @@ -0,0 +1,685 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_SETTING_TYPES_H +#define MSG_SETTING_TYPES_H + +/** + * @file MsgSettingTypes.h + * @brief Defines setting types of messaging framework + * @version 1.0 + */ + +/** + * @section Introduction + * - Introduction : Overview on Messaging Setting Types + * @section Program + * - Program : Messaging Setting Types Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgTypes.h" + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_SETTING_TYPES Messaging Setting Types + * @{ + */ + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define SMSC_NAME_MAX 127 /* Max SMSC Name Length */ +#define SMSC_ADDR_MAX 20 /* Max SMSC Adress Length */ +#define SMSC_LIST_MAX 5 /* Max List Count of SMSC */ +#define CB_CHANNEL_NAME_MAX 32 /* cb channel name max size */ +#define CB_CHANNEL_MAX 30 /* cb channel max count */ +#define CB_LANG_TYPE_MAX 10 + +/*================================================================================================== + TYPES +==================================================================================================*/ + +/** + * @brief Represents an option type. \n + * The values for this type SHOULD be in _MSG_OPTION_TYPE_E. + */ +typedef unsigned int MSG_OPTION_TYPE_T; + + +/** + * @brief Represents an SMS network mode. \n + * The values for this type SHOULD be in _MSG_SMS_NETWORK_MODE_E. + */ +typedef unsigned char MSG_SMS_NETWORK_MODE_T; + + +/** + * @brief Represents the period of playing alert tone. \n + * The values for this type SHOULD be in _MSG_ALERT_TONE_E. + */ +typedef unsigned char MSG_ALERT_TONE_T; + + +/** + * @brief Represents the default storage to save SMS. \n + * The values for this type SHOULD be in _MSG_SMS_SAVE_STORAGE_E. + */ +typedef unsigned char MSG_SMS_SAVE_STORAGE_T; + + +/** + * @brief Represents the type of number for SMS center address. \n + * The values for this type SHOULD be in _MSG_SMS_TON_E. + */ +typedef unsigned char MSG_SMS_TON_T; + + +/** + * @brief Represents the numbering plan ID for SMS center address. \n + * The values for this type SHOULD be in _MSG_SMS_NPI_E. + */ +typedef unsigned char MSG_SMS_NPI_T; + + +/** + * @brief Represents the protocol ID for SMS center address. \n + * The values for this type SHOULD be in _MSG_SMS_PID_E. + */ +typedef unsigned char MSG_SMS_PID_T; + + +/** + * @brief Represents the validity period of SMS. \n + * The values for this type SHOULD be in _MSG_VAL_PERIOD_E. + */ +typedef unsigned char MSG_VAL_PERIOD_T; + + +/** + * @brief Represents the class type of MMS. \n + * The values for this type SHOULD be in _MSG_MMS_MSG_CLASS_TYPE_E. + */ +typedef unsigned char MSG_MMS_MSG_CLASS_TYPE_T; + + +/** + * @brief Represents the expiry time of MMS. \n + * The values for this type SHOULD be in _MSG_MMS_EXPIRY_TIME_E. + */ +typedef unsigned int MSG_MMS_EXPIRY_TIME_T; + + +/** + * @brief Represents the delivery time of MMS. \n + * The values for this type SHOULD be in _MSG_MMS_DELIVERY_TIME_E. + */ +typedef unsigned int MSG_MMS_DELIVERY_TIME_T; + + +/** + * @brief Represents the reply charging type of MMS. \n + * The values for this type SHOULD be in _MSG_MMS_REPLY_CHARGING_TYPE_E. + */ +typedef unsigned char MSG_MMS_REPLY_CHARGING_TYPE_T; + + +/** + * @brief Represents the creation mode of MMS. \n + * The values for this type SHOULD be in _MSG_MMS_CREATION_MODE_E. + */ +typedef unsigned char MSG_MMS_CREATION_MODE_T; + +/** + * @brief Represents the retrieve type for MMS home network. \n + * The values for this type SHOULD be in _MSG_MMS_HOME_RETRIEVE_TYPE_E. + */ +typedef unsigned char MSG_MMS_HOME_RETRIEVE_TYPE_T; + + +/** + * @brief Represents the retrieve type for MMS abroad network. \n + * The values for this type SHOULD be in _MSG_MMS_ABROAD_RETRIEVE_TYPE_E. + */ +typedef unsigned char MSG_MMS_ABROAD_RETRIEVE_TYPE_T; + + +/** + * @brief Represents the frequency of sending MMS read report. \n + * The values for this type SHOULD be in _MSG_MMS_SEND_READ_REPORT_E. + */ +typedef unsigned char MSG_MMS_SEND_READ_REPORT_T; + + +/** + * @brief Represents whether a push message is received or not. \n + * The values for this type SHOULD be in _MSG_PUSH_RECEIVE_TYPE_E. + */ +typedef unsigned char MSG_PUSH_RECEIVE_TYPE_T; + + +/** + * @brief Represents the service type for a push message. \n + * The values for this type SHOULD be in _MSG_PUSH_SERVICE_TYPE_E. + */ +typedef unsigned char MSG_PUSH_SERVICE_TYPE_T; + + +/** + * @brief Represents the language type for a cell broadcasting message. \n + * The values for this type SHOULD be in _MSG_CB_LANGUAGE_TYPE_E. + */ +typedef unsigned char MSG_CB_LANGUAGE_TYPE_T; + + +/** + * @brief Represents the SIM status from telephony. \n + * The values for this type SHOULD be in \ref _MSG_SIM_STATUS_E. + */ +typedef unsigned char MSG_SIM_STATUS_T; + + +/*================================================================================================== + STRUCTURES +==================================================================================================*/ + +/** + * @brief Represents SMSC address information. + */ +typedef struct +{ + MSG_SMS_TON_T ton; /**< Type of number */ + MSG_SMS_NPI_T npi; /**< Numbering plan ID */ + char address[SMSC_ADDR_MAX+1]; /**< SMSC address */ +} MSG_SMSC_ADDRESS_S; + + +/** + * @brief Represents SMSC data information. + */ +typedef struct +{ + MSG_SMS_PID_T pid; /**< Protocol idendifier */ + MSG_VAL_PERIOD_T valPeriod; /**< Validity period value */ + char name[SMSC_NAME_MAX+1]; /**< SMSC name */ + MSG_SMSC_ADDRESS_S smscAddr; /**< SMSC address structure */ +} MSG_SMSC_DATA_S; + + +/** + * @brief Represents the information of a cell broadcasting channel. + */ +typedef struct +{ + bool bActivate; /**< Indicates whether the CB channel is activate or passive. */ + unsigned int id; /**< Indicates the ID of a CB channel. */ + char name[CB_CHANNEL_NAME_MAX+1]; /**< Indicates the name of a CB channel. */ +} MSG_CB_CHANNEL_INFO_S; + + +/** + * @brief Represents cell broadcasting channel information. + */ +typedef struct +{ + int channelCnt; /**< The count of CB channels */ + MSG_CB_CHANNEL_INFO_S channelInfo[CB_CHANNEL_MAX]; /**< The structure of CB channel information */ +} MSG_CB_CHANNEL_S; + + +/** + * @brief Represents an general option. + */ +typedef struct +{ + bool bKeepCopy; /**< Indicates whether the SMS message copy is kept or not. */ + MSG_ALERT_TONE_T alertTone; /**< Indicates the period of playing alert tone. */ + bool bAutoErase; /**< Indicates whether the auto-erase option is enabled or not. */ +}MSG_GENERAL_OPT_S; + + +/** + * @brief Represents an SMS send option. + */ +typedef struct +{ + MSG_ENCODE_TYPE_T dcs; /**< Indicates the string encoding type. */ + MSG_SMS_NETWORK_MODE_T netMode; /**< Indicates the network mode (CS/PS) to send SMS. */ + bool bReplyPath; /**< Indicates whether the SMS reply path is set or not. */ + bool bDeliveryReport; /**< Indicates whether the SMS delivery report will be sent or not. */ + MSG_SMS_SAVE_STORAGE_T saveStorage; /**< Indicates the default storage to save SMS. */ +}MSG_SMS_SENDOPT_S; + + +/** + * @brief Represents an SMSC list. + */ +typedef struct +{ + int selected; /**< Selected SMSC index */ + int totalCnt; /**< The count of total SMSC addresses */ + MSG_SMSC_DATA_S smscData[SMSC_LIST_MAX]; /**< SMSC data information list*/ +}MSG_SMSC_LIST_S; + + +/** + * @brief Represents an MMS send option. + */ +typedef struct +{ + MSG_MMS_MSG_CLASS_TYPE_T msgClass; + MSG_PRIORITY_TYPE_T priority; /**< Indicates the priority of the message. */ + MSG_MMS_EXPIRY_TIME_T expiryTime; /**< Indicates the time when the message is to be removed from the MMSC. */ + MSG_MMS_DELIVERY_TIME_T deliveryTime; /**< Indicates the message transmission time which is set in the MMSC. */ + unsigned int customDeliveryTime; /**< Indicates the message transmission time which is set in the MMSC. */ + bool bSenderVisibility; /**< Indicates whether the address is hidden or not. */ + bool bDeliveryReport; /**< Indicates whether the delivery report will be sent or not. */ + bool bReadReply; /**< Indicates whether the read report will be sent or not. */ + bool bKeepCopy; /**< Indicates whether the message copy is kept or not. */ + bool bBodyReplying; /**< Indicates whether the body is included when replying or not. */ + bool bHideRecipients; /**< Indicates whether the recipients are hidden or not. */ + + MSG_MMS_REPLY_CHARGING_TYPE_T replyCharging; + unsigned int replyChargingDeadline; + unsigned int /*long*/ replyChargingSize; + + MSG_MMS_CREATION_MODE_T creationMode; +} MSG_MMS_SENDOPT_S; + + +/** + * @brief Represents an MMS receive option. + */ +typedef struct +{ + MSG_MMS_HOME_RETRIEVE_TYPE_T homeNetwork; /**< Indicates the retrieve type for MMS home network. */ + MSG_MMS_ABROAD_RETRIEVE_TYPE_T abroadNetwok; /**< Indicates the retrieve type for MMS abroad network. */ + bool readReceipt; /**< Indicates whether the read report will be sent or not. */ + bool bDeliveryReceipt; /**< Indicates whether the delivery report will be sent or not. */ + bool bRejectUnknown; /**< Indicates whether unknown addresses are rejected or not. */ + bool bRejectAdvertisement; /**< Indicates whether advertisement is rejected or not. */ +} MSG_MMS_RECVOPT_S; + + +/** + * @brief Represents an MMS style option. + */ +typedef struct +{ + unsigned int fontSize; + bool bFontStyleBold; + bool bFontStyleItalic; + bool bFontStyleUnderline; + unsigned int fontColorRed; + unsigned int fontColorGreen; + unsigned int fontColorBlue; + unsigned int fontColorHue; + unsigned int bgColorRed; + unsigned int bgColorGreen; + unsigned int bgColorBlue; + unsigned int bgColorHue; + unsigned int pageDur; + unsigned int pageCustomDur; + unsigned int pageDurManual; +} MSG_MMS_STYLEOPT_S; + + +/** + * @brief Represents a push message option. + */ +typedef struct +{ + bool bReceive; /**< Indicates whether the push message is received or not. */ + MSG_PUSH_SERVICE_TYPE_T serviceType; /**< Indicates the service type of a push message. */ +} MSG_PUSHMSG_OPT_S; + + +/** + * @brief Represents a cell broadcasting message option. + */ +typedef struct +{ + bool bReceive; /**< Indicates whether the CB message is received or not. */ + bool bAllChannel; /**< Indicates whether All Channel's CB message is received or not. */ + int maxSimCnt; /**< Indicates the number of channels which can be stored in SIM. */ + MSG_CB_CHANNEL_S channelData; /**< Indicates the cell broadcasting channel information. */ + bool bLanguage[CB_LANG_TYPE_MAX]; /**< Indicates whether the language name of a cell broadcasting message is set or not. */ +} MSG_CBMSG_OPT_S; + + +/** + * @brief Represents a voice mail number option. + */ +typedef struct +{ + char mailNumber[MAX_PHONE_NUMBER_LEN+1]; +} MSG_VOICEMAIL_OPT_S; + + +/** + * @brief Represents a MMS size option. + */ +typedef struct +{ + int nMsgSize; +} MSG_MSGSIZE_OPT_S; + + +/** + * @brief Represents setting information. + */ +typedef struct +{ + MSG_OPTION_TYPE_T type; /**< The option type in a setting */ + + union + { + MSG_GENERAL_OPT_S generalOpt; /**< General option */ + MSG_SMS_SENDOPT_S smsSendOpt; /**< SMS send option */ + MSG_SMSC_LIST_S smscList; /**< SMSC list option */ + MSG_MMS_SENDOPT_S mmsSendOpt; /**< MMS send option */ + MSG_MMS_RECVOPT_S mmsRecvOpt; /**< MMS receive option */ + MSG_MMS_STYLEOPT_S mmsStyleOpt; /**< MMS style option */ + MSG_PUSHMSG_OPT_S pushMsgOpt; /**< Push message option */ + MSG_CBMSG_OPT_S cbMsgOpt; /**< Cell broadcasting message option */ + MSG_VOICEMAIL_OPT_S voiceMailOpt; /**< voice mail option */ + MSG_MSGSIZE_OPT_S msgSizeOpt; /**< MMS size option */ + } option; +}MSG_SETTING_S; + + +/*================================================================================================== + ENUMS +==================================================================================================*/ + +/** + * @brief Represents the values of an option type. \n + * This enum is used as the value of MSG_OPTION_TYPE_T. + */ +enum _MSG_OPTION_TYPE_E +{ + MSG_GENERAL_OPT, /**< General option */ + MSG_SMS_SENDOPT, /**< SMS send option */ + MSG_SMSC_LIST, /**< SMSC list option */ + MSG_MMS_SENDOPT, /**< MMS send option */ + MSG_MMS_RECVOPT, /**< MMS receive option */ + MSG_MMS_CLASSOPT, /**< MMS class option such as personal, advertisement, and informational */ + MSG_MMS_STYLEOPT, /**< MMS style option */ + MSG_PUSHMSG_OPT, /**< Push message option */ + MSG_CBMSG_OPT, /**< Cell broadcasting message option */ + MSG_VOICEMAIL_OPT, /**< Voice mail option */ + MSG_MSGSIZE_OPT, /**< Message size option */ +}; + + +/** + * @brief Represents the values of an SMS network mode. \n + * This enum is used as the value of MSG_SMS_NETWORK_MODE_T. + */ +enum _MSG_SMS_NETWORK_MODE_E +{ + MSG_SMS_NETWORK_PS_ONLY = 0x01, /**< Packet switched */ + MSG_SMS_NETWORK_CS_ONLY = 0x02, /**< Circuit switched */ + MSG_SMS_NETWORK_PS_FIRST = 0x03, /**< Packet switching preferred */ +}; + + +/** + * @brief Represents the value of period of playing alert tone. \n + * The values for this type SHOULD be in MSG_ALERT_TONE_T. + */ +enum _MSG_ALERT_TONE_E +{ + MSG_ALERT_TONE_ONCE, + MSG_ALERT_TONE_2MINS, + MSG_ALERT_TONE_5MINS, + MSG_ALERT_TONE_10MINS, +}; + + +/** + * @brief Represents the value of a default storage to save SMS. \n + * The values for this type SHOULD be in MSG_SMS_SAVE_STORAGE_T. + */ +enum _MSG_SMS_SAVE_STORAGE_E +{ + MSG_SMS_SAVE_STORAGE_SIM, + MSG_SMS_SAVE_STORAGE_PHONE, +}; + + +/** + * @brief Represents the values of the type of number for SMS center address. \n + * This enum is used as the value of MSG_SMS_TON_T. + */ +enum _MSG_SMS_TON_E +{ + MSG_TON_UNKNOWN = 0, /**< Unknown */ + MSG_TON_INTERNATIONAL, /**< International */ + MSG_TON_NATIONAL, /**< National */ + MSG_TON_NETWORK, /**< Network */ + MSG_TON_SUBSCRIBER, /**< Subscriber */ + MSG_TON_ALPHANUMERIC, /**< Alpha numeric */ + MSG_TON_ABBREVIATED, /**< Abbreviated */ + MSG_TON_RESERVE, /**< Reserve */ +}; + + +/** + * @brief Represents the values of the numbering plan ID for SMS center address. \n + * This enum is used as the value of MSG_SMS_NPI_T. + */ +enum _MSG_SMS_NPI_E +{ + MSG_NPI_UNKNOWN = 0, /**< Unknown */ + MSG_NPI_ISDN = 1, /**< ISDN */ + MSG_NPI_DATA = 3, /**< Data */ + MSG_NPI_TELEX = 4, /**< Telex */ + MSG_NPI_SMSC = 5, /**< SMSC */ + MSG_NPI_NATIONAL = 8, /**< National */ + MSG_NPI_PRIVATE = 9, /**< Private */ + MSG_NPI_IDENTIFICATION_ERMES = 10, /**< Identification ermes */ + MSG_NPI_IDENTIFICATION_RESERVED = 0xF /**< Identification reserved */ +}; + + +/** + * @brief Represents the values of the protocol ID for SMS center address. \n + * This enum is used as the value of MSG_SMS_PID_T. + */ +enum _MSG_SMS_PID_E +{ + MSG_PID_NONE, /**< None */ + MSG_PID_TEXT, /**< Text */ + MSG_PID_VOICE, /**< Voice */ + MSG_PID_FAX, /**< Fax */ + MSG_PID_X400, /**< X400 */ + MSG_PID_ERMES, /**< Ermes */ + MSG_PID_EMAIL, /**< Email */ + MSG_PID_MAX /**< Default */ +}; + + +/** + * @brief Represents the values of the Validity Period for SMS center. \n + * This enum is used as the value of MSG_VAL_PERIOD_T. + */ +enum _MSG_VAL_PERIOD_E +{ + MSG_VAL_1DAY = 167, + MSG_VAL_2DAYS = 168, + MSG_VAL_1WEEK = 173, + MSG_VAL_2WEEKS = 180, + MSG_VAL_MAXIMUM = 255, +}; + + +enum _MSG_MMS_EXPIRY_TIME_E +{ + MSG_EXPIRY_TIME_MAXIMUM = 0, + MSG_EXPIRY_TIME_1DAY = 86400, + MSG_EXPIRY_TIME_2DAYS = 2*86400, + MSG_EXPIRY_TIME_1WEEK = 604800, + MSG_EXPIRY_TIME_2WEEKS = 2*604800, +}; + + +enum _MSG_MMS_DELIVERY_TIME_E +{ + MSG_DELIVERY_TIME_IMMEDIATLY = 0, + MSG_DELIVERY_TIME_1HOUR = 3600, + MSG_DELIVERY_TIME_1DAY = 86400, + MSG_DELIVERY_TIME_1WEEK = 604800, + MSG_DELIVERY_TIME_CUSTOM +}; + + +enum _MSG_MMS_MSG_CLASS_TYPE_E +{ + MSG_CLASS_PERSONAL, /** +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_STORAGE_TYPES_H +#define MSG_STORAGE_TYPES_H + + +/** + * @file MsgStorageTypes.h + * @brief Defines transport types of messaging framework + * @version 1.0 + */ + + +/** + * @section Introduction + * - Introduction : Overview on Messaging Storage Types + * @section Program + * - Program : Messaging Storage Types Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include + +#include "MsgTypes.h" + + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_STORAGE_TYPES Messaging Storage Types + * @{ + */ + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MAX_FOLDER_NAME_SIZE 20 +#define MAX_SEGMENT_NUM 12 + + +/*================================================================================================== + TYPES +==================================================================================================*/ + +/** + * @brief Represents a folder type. \n + * The values for this type SHOULD be in _MSG_FOLDER_TYPE_E. + */ +typedef unsigned char MSG_FOLDER_TYPE_T; + + +/** + * @brief Represents a sort type. \n + * The values for this type SHOULD be in \ref _MSG_SORT_TYPE_E. + */ +typedef unsigned char MSG_SORT_TYPE_T; + + +/** + * @brief Represents a Saved SIM message ID. + */ +typedef signed short MSG_SIM_ID_T; + + +/** + * @brief Represents a message type for quick panel. \n + * The values for this type SHOULD be in \ref _MSG_QUICKPANEL_TYPE_E. + */ +typedef unsigned char MSG_QUICKPANEL_TYPE_T; + + +/** + * @brief Represents a storage change CB type. \n + * The values for this type SHOULD be in \ref _MSG_STORAGE_CHANGE_TYPE_E. + */ +typedef unsigned char MSG_STORAGE_CHANGE_TYPE_T; + + +/*================================================================================================== + STRUCTURES +==================================================================================================*/ +/** + * @brief Represents the count of read/unread messages. + */ +typedef struct +{ + int nReadCnt; /**< The count of read messages */ + int nUnreadCnt; /**< The count of unread messages */ + int nSms; /**< The count of sms type messages */ + int nMms; /**< The count of mms type messages */ +} MSG_COUNT_INFO_S; + + +/** + * @brief Represents message thread view information list. + */ +typedef struct +{ + int nCount; /**< The count of message thread informatioin */ + msg_thread_view_t *msgThreadInfo; /**< The pointer to message thread informatioin */ +} MSG_THREAD_VIEW_LIST_S; + + +/** + * @brief Represents message information list. + */ +typedef struct +{ + int nCount; /**< The count of message informatioin */ + msg_message_t *msgInfo; /**< The pointer to message informatioin */ +}MSG_LIST_S; + + +/** + * @brief Represents message id list. + */ +typedef struct +{ + int nCount; /**< The count of message id informatioin */ + MSG_MESSAGE_ID_T *msgIdList; /**< The pointer to message id informatioin */ +}MSG_MSGID_LIST_S; + + +/** + * @brief Represents a reject message information. + */ +typedef struct +{ + MSG_MESSAGE_ID_T msgId; /**< Indicates the unique message ID. */ + char msgText[MAX_MSG_TEXT_LEN+1]; /**< Indicates the message text. */ + time_t displayTime; +} MSG_REJECT_MSG_INFO_S; + + +/** + * @brief Represents reject message list. + */ +typedef struct +{ + int nCount; /**< The count of reject message informatioin */ + MSG_REJECT_MSG_INFO_S *rejectMsgInfo; /**< The pointer to reject message informatioin */ +}MSG_REJECT_MSG_LIST_S; + + +/** + * @brief Represents folder information. + */ +typedef struct +{ + MSG_FOLDER_ID_T folderId; /**< Indicates the unique folder ID. */ + char folderName[MAX_FOLDER_NAME_SIZE+1]; /**< Indicates the name of the folder. */ + MSG_FOLDER_TYPE_T folderType; /**< Indicates the folder type. */ +} MSG_FOLDER_INFO_S; + + +/** + * @brief Represents a folder list. + */ +typedef struct +{ + int nCount; /**< The count of folder information */ + MSG_FOLDER_INFO_S *folderInfo; /**< The pointer to folder information */ +} MSG_FOLDER_LIST_S; + + +/** + * @brief Represents contact information. + */ +typedef struct +{ + MSG_CONTACT_ID_T contactId; /**< Indicates the unique contact ID. */ + char displayName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the display name of contact. */ + char firstName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the first name of contact. */ + char lastName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the last name of contact. */ + char imagePath[MAX_IMAGE_PATH_LEN+1]; /**< Indicates the image path of contact. */ +} MSG_CONTACT_INFO_S; + + +/** + * @brief Represents a sort rule. \n + * The sort rule structure includes a sort type and a sort order. \n + * Applications can use the sort rule when querying messages. + */ +typedef struct +{ + MSG_SORT_TYPE_T sortType; /**< Indicates the sort type */ + bool bAscending; /**< Indicates the sort order which is ascending or descending */ +}MSG_SORT_RULE_S; + + +/** + * @brief Represents SIM ID List. + */ +typedef struct +{ + unsigned int count; /**< The total number of SIM Msg ID*/ + MSG_SIM_ID_T simId[MAX_SEGMENT_NUM]; /**< The SIM Msg ID List */ +} SMS_SIM_ID_LIST_S; + + +/** + * @brief Represents recipien list information. + */ +typedef struct +{ + int recipientCnt; + MSG_ADDRESS_INFO_S* recipientAddr; +} MSG_RECIPIENTS_LIST_S; + + +/** + * @brief Represents search condition values. + */ +typedef struct +{ + MSG_FOLDER_ID_T folderId; + MSG_MESSAGE_TYPE_T msgType; + char *pAddressVal; + char *pSearchVal; + int reserved; +} MSG_SEARCH_CONDITION_S; + + +/** @brief Prototype of the function that will be called when the database of message framework is changed. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_storage_change_callback. + * The callback function runs in the application process, not in the framework process. + * @param[in] handle is Message handle. + * @param[in] user_param is a pointer to user data. + * @return void + */ +typedef void (*msg_storage_change_cb)(MSG_HANDLE_T handle, MSG_STORAGE_CHANGE_TYPE_T storageChangeType, MSG_MSGID_LIST_S *pMsgIdList, void *user_param); + + +/*================================================================================================== + ENUMS +==================================================================================================*/ + +/** + * @brief Represents the values of a storage type. \n + * This enum is used as the value of MSG_STORAGE_ID_T. + */ +enum _MSG_STORAGE_ID_E +{ + MSG_STORAGE_UNKNOWN = 0, /**< Storage Id is unknown. */ + MSG_STORAGE_PHONE, /**< Storage Id is Phone. */ + MSG_STORAGE_SIM, /**< Storage Id is SIM card. */ +}; + + +/** + * @brief Represents the values of a storage type. \n + * This enum is used as the value of MSG_FOLDER_ID_T. + */ +enum _MSG_FOLDER_ID_E +{ + MSG_IOSBOX_ID = -1, /**< Indicates INBOX, OUTBOX and SENTBOX group folder id. (Only for search option.) */ + MSG_ALLBOX_ID = 0, /**< Indicates INBOX, OUTBOX, SENTBOX and DRAFTBOX group folder id. (Only for search option.) */ + MSG_INBOX_ID = 1, + MSG_OUTBOX_ID = 2, + MSG_SENTBOX_ID = 3, + MSG_DRAFT_ID = 4, + MSG_CBMSGBOX_ID = 5, + + // new folder should be placed here + + MSG_MAX_FOLDER_ID +}; + + +/** + * @brief Represents the values of a folder type. \n + * This enum is used as the value of MSG_FOLDER_TYPE_T. + */ +enum _MSG_FOLDER_TYPE_E +{ + MSG_FOLDER_TYPE_INBOX = 1, /**< Inbox folder */ + MSG_FOLDER_TYPE_OUTBOX, /**< Outbox folder */ + MSG_FOLDER_TYPE_DRAFT, /**< Draft folder */ + MSG_FOLDER_TYPE_USER_DEF /**< Folder which is created by a user */ +}; + + +/** + * @brief Represents the values of a sort type. \n + * This enum is used as the value of MSG_SORT_TYPE_T. + */ +enum _MSG_SORT_TYPE_E +{ + MSG_SORT_BY_UNKNOWN = 0, /**< Unknown sort type */ + MSG_SORT_BY_DISPLAY_FROM, /**< Sort by display from */ + MSG_SORT_BY_DISPLAY_TO, /**< Sort by display to */ + MSG_SORT_BY_DISPLAY_TIME, /**< Sort by display time */ + MSG_SORT_BY_MSG_TYPE, /**< Sort by msg type */ + MSG_SORT_BY_READ_STATUS, /**< Sort by read status */ + MSG_SORT_BY_STORAGE_TYPE, /**< Sort by storage type */ + MSG_SORT_BY_THREAD_NAME, /**< Sort by name for thread view*/ + MSG_SORT_BY_THREAD_DATE, /**< Sort by date for thread view*/ + MSG_SORT_BY_THREAD_COUNT, /**< Sort by count for thread view*/ +}; + + +/** + * @brief Represents the values of a message type for quick panel. \n + * This enum is used as the value of MSG_QUICKPANEL_TYPE_T. + */ +enum _MSG_QUICKPANEL_TYPE_E +{ + MSG_QUICKPANEL_SMS = 0, + MSG_QUICKPANEL_MMS, + MSG_QUICKPANEL_DELIVER_REP, + MSG_QUICKPANEL_READ_REP, + MSG_QUICKPANEL_VOICEMAIL, + MSG_QUICKPANEL_MMS_NOTI, +}; + +/** + * @} + */ +enum _MSG_COUNT_LIMIT_MAILBOX_TYPE_E +{ + MSG_COUNT_LIMIT_INBOX_TYPE, + MSG_COUNT_LIMIT_OUTBOX_TYPE, + MSG_COUNT_LIMIT_SENTBOX_TYPE, + MSG_COUNT_LIMIT_DRAFTBOX_TYPE, + MSG_COUNT_LIMIT_CBMSGBOX_TYPE, + MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX, +}; + +enum _MSG_COUNT_LIMIT_MSG_TYPE_E +{ + MSG_COUNT_LIMIT_SMS_TYPE, + MSG_COUNT_LIMIT_MMS_TYPE, + MSG_COUNT_LIMIT_CB_TYPE, + MSG_COUNT_LIMIT_WAPPUSH_TYPE, + MSG_COUNT_LIMIT_PROVISION_TYPE, + MSG_COUNT_LIMIT_MSG_TYPE_MAX, +}; + +enum _MSG_STORAGE_CHANGE_TYPE_E +{ + // msg data + MSG_STORAGE_CHANGE_INSERT = 1, + MSG_STORAGE_CHANGE_UPDATE, + MSG_STORAGE_CHANGE_DELETE, + + // thread data + MSG_STORAGE_CHANGE_CONTACT, +}; + +#endif // MSG_STORAGE_TYPES_H + diff --git a/include/common/MsgThread.h b/include/common/MsgThread.h new file mode 100755 index 0000000..247a019 --- /dev/null +++ b/include/common/MsgThread.h @@ -0,0 +1,90 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __MSG_THREAD_H__ +#define __MSG_THREAD_H__ + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include "MsgDebug.h" + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgThread +{ +public: + MsgThread(): thd(0) {}; + + virtual void start() + { + MSG_DEBUG("MsgThread::Start() called"); + + if (pthread_create(&thd, NULL, &MsgThread::thdMain, this) < 0) + { + MSG_DEBUG("pthread_create() error"); + return; + } + + pthread_detach(thd); + } + + virtual void stop() + { + MSG_DEBUG("MsgThread::stop() called"); + } + + void wait() + { + MSG_DEBUG("MsgThread::Wait() called"); + void* pData; + pthread_join(thd, &pData); + } + +private: + static void* thdMain(void* pInst) + { + MSG_DEBUG("MsgThread::thdMain() called"); + MsgThread* pt = static_cast(pInst); + pt->run(); + return NULL; + } + + virtual void run() = 0; + + pthread_t thd; +}; + + +#endif //__MSG_THREAD_H__ + diff --git a/include/common/MsgTransportTypes.h b/include/common/MsgTransportTypes.h new file mode 100755 index 0000000..de08b24 --- /dev/null +++ b/include/common/MsgTransportTypes.h @@ -0,0 +1,191 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_TRANSPORT_TYPES_H +#define MSG_TRANSPORT_TYPES_H + +/** + * @file MsgTransportTypes.h + * @brief Defines transport types of messaging framework + * @version 1.0 + */ + +/** + * @section Introduction + * - Introduction : Overview on Messaging Transport Types + * @section Program + * - Program : Messaging Transport Types Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgTypes.h" +#include "MsgStorageTypes.h" +#include "MsgMmsTypes.h" + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_TRANSPORT_TYPES Messaging Transport Types + * @{ + */ + + +/*================================================================================================== + STRUCTURES +==================================================================================================*/ + +/** + * @brief Represents the status of a sent message. \n + * This stucture contains the information about the status of a sent message that application has submitted to the framework. + */ +typedef struct +{ + MSG_REQUEST_ID_T reqId; /**< Indicates the corresponding request Id. */ + MSG_NETWORK_STATUS_T status; /**< Indicates the status of the corresponding request. + Refer to enum _MSG_NETWORK_STATUS_E*/ +} MSG_SENT_STATUS_S; + + +/*================================================================================================== + DEFINES +==================================================================================================*/ + +/** @brief Prototype of the function that will be called when the status of the message which is already sent is changed. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_sent_status_callback. + * If the application sends a message, this callback function will be called to report its sending status. + * The application can get the request ID from sent_status to know which request is bound. + * The callback function runs in the application process, not in the framework process. + * The memory of sent_status is managed by MAPI, when the callback function is finished. + * @param[in] handle is Message handle. + * @param[in] sent_status is a pointer to an MSG_SENT_STATUS_S structure. + * @param[in] user_param is a pointer to user data. + * @return void + */ +typedef void (*msg_sent_status_cb)(MSG_HANDLE_T handle, MSG_SENT_STATUS_S *sent_status, void *user_param); + + +/** @brief Prototype of the function that will be called when the status of the message which is already sent is changed. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_sent_status_callback. + * If the application sends a message, this callback function will be called to report its sending status. + * The application can get the request ID from sent_status to know which request is bound. + * The callback function runs in the application process, not in the framework process. + * The memory of sent_status is managed by MAPI, when the callback function is finished. + * @param[in] sent_status is a pointer to an MSG_SENT_STATUS_S structure. + * @param[in] user_param is a pointer to user data. + * @return void + */ +typedef void (*msg_simple_sent_status_cb)(MSG_SENT_STATUS_S *sent_status, void *user_param); + + +/** @brief Prototype of the function that will be called when a new message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_sms_message_callback. + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * The memory for msg is managed by MAPI, when the callback function is finished. + * @param[in] handle is Message handle. + * @param[in] msg is a pointer to an msg_message_t structure. + * @param[in] user_param is a pointer to user data. + * @return void + */ +typedef void (*msg_sms_incoming_cb)(MSG_HANDLE_T handle, msg_message_t msg, void *user_param); + + +/** @brief Prototype of the function that will be called when a new MMS message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_mms_conf_message_callback. + * This callback function will be called when a new MMS message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * The memory for msg is managed by MAPI, when the callback function is finished. + * @param[in] handle is Message handle. + * @param[in] msg is a pointer to an msg_message_t structure. + * @param[in] user_param is a pointer to user data. + * @return void + */ +typedef void (*msg_mms_conf_msg_incoming_cb)(MSG_HANDLE_T handle, msg_message_t msg, void *user_param); + + +/** @brief Prototype of the function that will be called when a new SyncML message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_syncml_message_callback. + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * @param[in] handle is Message handle. + * @param[in] msg_type is MSG_SYNCML_MESSAGE_TYPE_T structure. + * @param[in] push_body is WAP Push body data. + * @param[in] push_body_len is the length of WAP Push body data. + * @param[in] user_param is a pointer to user data. + * @return void + */ +typedef void (*msg_syncml_msg_incoming_cb)(MSG_HANDLE_T handle, MSG_SYNCML_MESSAGE_TYPE_T msg_type, const char *push_body, int push_body_len, const char* wsp_header, int wsp_header_len, void *user_param); + + +/** @brief Prototype of the function that will be called when a new LBS message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_lbs_message_callback. + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * @param[in] hMsgHandle is Message handle. + * @param[in] push_header is push message header data. + * @param[in] push_body is push message body data. + * @param[in] push_body_len is push message body length. + * @param[in] user_param is a pointer to user data. + * @return void + */ +typedef void (*msg_lbs_msg_incoming_cb)(MSG_HANDLE_T handle, const char *push_header, const char *push_body, int push_body_len, void *user_param); + + +/** @brief Prototype of the function that will be called when a new SyncML message is received. + * Applications SHOULD implement this callback function and register it into Message handle. + * For how to register this callback function, please refer to msg_reg_syncml_message_callback. + * This callback function will be called when a new message is received and the message satisfies the filter list. + * The callback function runs in the application process, not in the framework process. + * @param[in] handle is Message handle. + * @param[in] user_param is a pointer to user data. + * @return void + */ +typedef void (*msg_syncml_msg_operation_cb)(MSG_HANDLE_T handle, int msgId, int extId, void *user_param); + + +/*================================================================================================== + TYPES +==================================================================================================*/ + + + +/** + * @} + */ + +#endif // MSG_TRANSPORT_TYPES_H + diff --git a/include/common/MsgTypes.h b/include/common/MsgTypes.h new file mode 100755 index 0000000..2379878 --- /dev/null +++ b/include/common/MsgTypes.h @@ -0,0 +1,743 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_TYPES_H +#define MSG_TYPES_H + +/** + * @file MsgTypes.h + * @brief Defines common types of messaging framework + * @version 1.0 + */ + +/** + * @section Introduction + * - Introduction : Overview on Message Common Types + * @section Program + * - Program : Message Common Types Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include +#include +#include + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_COMMON_TYPES Messaging Common Types + * @{ + */ + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MAX_TO_ADDRESS_CNT 10 +#define MAX_PHONE_NUMBER_LEN 20 +#define MAX_ADDRESS_VAL_LEN 254 +#define MAX_SIGN_VAL_LEN 128 +#define MAX_SUBJECT_LEN 120 +#define MAX_DISPLAY_NAME_LEN 195 +#define MAX_IMAGE_PATH_LEN 1024 +#define MAX_MSG_DATA_LEN 320 +#define MAX_MSG_TEXT_LEN 1530 +#define MAX_FILTER_VALUE_LEN 40 +#define MAX_COMMAND_LEN 1024 + +#define MAX_WAPPUSH_ID_LEN 40 +#define MAX_WAPPUSH_HREF_LEN 300 +#define MAX_WAPPUSH_CONTENTS_LEN 2048 + +#define MAX_PUSH_CACHEOP_INVALID_OBJECT_MAX 5 +#define MAX_PUSH_CACHEOP_INVALID_SERVICE_MAX 5 +#define MAX_PUSH_CACHEOP_MAX_URL_LEN 200 + +#define MAX_COMMON_INFO_SIZE 20 + +/** + * @brief Defines the maximum file path length + */ +#define MSG_FILEPATH_LEN_MAX 1024 + +#define DEPRECATED __attribute__((deprecated)) + +#ifndef EXPORT_API +#define EXPORT_API __attribute__ ((visibility("default"))) +#endif + +/*================================================================================================== + TYPES +==================================================================================================*/ + +/** + * @brief Defines Message handle. + */ +typedef struct MessagingHandle *MSG_HANDLE_T; + +typedef struct opq_message_s *msg_message_t; + +typedef struct opq_threadview_s *msg_thread_view_t; + +/** + * @brief Represents a messsage ID. + */ +typedef unsigned int MSG_MESSAGE_ID_T; + + +/** + * @brief Represents a reference ID. + */ +typedef unsigned int MSG_REFERENCE_ID_T; + + +/** + * @brief Represents a storage type. + See enum _MSG_STORAGE_ID_E + */ +typedef unsigned char MSG_STORAGE_ID_T; + + +/** + * @brief Represents a folder ID. + See enum _MSG_FOLDER_ID_E + */ +typedef char MSG_FOLDER_ID_T; + + +/** + * @brief Represents a request ID, which is unique for each request. + */ +typedef unsigned int MSG_REQUEST_ID_T; + + +/** + * @brief Represents a message priority. \n + * The values for this type SHOULD be in _MSG_PRIORITY_TYPE_E. + */ +typedef unsigned char MSG_PRIORITY_TYPE_T; + + +/** + * @brief Represents the network status of a message. \n + * The values for this type SHOULD be in _MSG_NETWORK_STATUS_E. + */ +typedef unsigned char MSG_NETWORK_STATUS_T; + + +/** + * @brief Represents an address type. \n + * The values for this type SHOULD be in _MSG_ADDRESS_TYPE_E. + */ +typedef unsigned char MSG_ADDRESS_TYPE_T; + + +/** + * @brief Represents an recipient type. \n + * The values for this type SHOULD be in _MSG_RECIPIENT_TYPE_E. + */ +typedef unsigned char MSG_RECIPIENT_TYPE_T; + + +/** + * @brief Represents the type of a message direction. \n + * The values for this type SHOULD be in _MSG_DIRECTION_TYPE_E. + */ +typedef unsigned char MSG_DIRECTION_TYPE_T; + + +/** + * @brief Represents an encoding type. \n + * The values for this type SHOULD be in _MSG_ENCODE_TYPE_E. + */ +typedef unsigned char MSG_ENCODE_TYPE_T; + + +/** + * @brief Represents an error code. \n + * The values for this type SHOULD be in _MSG_ERROR_E + */ +typedef int MSG_ERROR_T; + + +/** +\brief Represents WAP Push App Code. +*/ +typedef unsigned char MSG_PUSH_ACTION_T; + + +/** +\brief Represents SyncML Message Type. +*/ +typedef unsigned short MSG_SYNCML_MESSAGE_TYPE_T; + + +/** + * @brief Represents a Contact ID. + */ +typedef unsigned int MSG_CONTACT_ID_T; + + +/** + * @brief Represents a Delivery Report Status. + * The values for this type SHOULD be in _MSG_DELIVERY_REPORT_STATUS_E + */ +typedef int MSG_DELIVERY_REPORT_STATUS_T; + + +/** + * @brief Represents a Read Report Status. + * The values for this type SHOULD be in _MSG_READ_REPORT_STATUS_E + */ +typedef int MSG_READ_REPORT_STATUS_T; + + +/** + * @brief Represents a Message Type. + * The values for this type SHOULD be in _MSG_MESSAGE_TYPE_E +*/ +typedef unsigned short MSG_MESSAGE_TYPE_T; + + +/** + * @brief Represents a thread ID. \n + */ +typedef unsigned int MSG_THREAD_ID_T; + + +/*================================================================================================== + STRUCTURES +==================================================================================================*/ + +/** + * @brief Represents address information. + */ +typedef struct +{ + MSG_THREAD_ID_T threadId; /**< the thread ID of address */ + MSG_ADDRESS_TYPE_T addressType; /**< The type of an address in case of an Email or a mobile phone */ + MSG_RECIPIENT_TYPE_T recipientType; /**< The type of recipient address in case of To, Cc, and Bcc */ + MSG_CONTACT_ID_T contactId; /**< The contact ID of address */ + char addressVal[MAX_ADDRESS_VAL_LEN+1]; /**< The actual value of an address */ + char displayName[MAX_DISPLAY_NAME_LEN+1]; /**< The display name of an address */ +} MSG_ADDRESS_INFO_S; + + +/** + * @brief Represents port number information. + */ +typedef struct +{ + bool valid; /**< Indicates whether port information is used or not. */ + unsigned short dstPort; /**< Recipient port number, not greater than 16 bit */ + unsigned short srcPort; /**< Sender port number, not greater than 16 bit */ +} MSG_PORT_INFO_S; + + +/** + * @brief Represents MMS Sending Option Structure in application. + */ +typedef struct +{ + bool bReadReq; + time_t expiryTime; + bool bUseDeliveryCustomTime; + time_t deliveryTime; + MSG_PRIORITY_TYPE_T priority; +} MMS_SENDINGOPT_S; + + +/** + * @brief Represents SMS Sending Option Structure in application. + */ +typedef struct +{ + bool bReplyPath; +} SMS_SENDINGOPT_S; + + +/** + * @brief Represents MSG Sending Option Structure in application. + */ +typedef struct +{ + bool bSetting; + bool bDeliverReq; + bool bKeepCopy; + + union + { + MMS_SENDINGOPT_S mmsSendOpt; + SMS_SENDINGOPT_S smsSendOpt; + } option; +} MSG_SENDINGOPT_S; + + +typedef enum +{ + MMS_TIMETYPE_NONE = -1, // fixme: backward compatibility + MMS_TIMETYPE_ERROR = -1, // error return in Get method + MMS_TIMETYPE_RELATIVE = 0, // default + MMS_TIMETYPE_ABSOLUTE = 1 +}MmsTimeType; + + +typedef struct +{ + MmsTimeType type; + unsigned int time; +}MmsTimeStruct; + + +/** + * @brief Represents MMS Sending Option Structure in framework. + */ +typedef struct +{ + bool bReadReq; + bool bUseDeliveryCustomTime; + MSG_PRIORITY_TYPE_T priority; + MmsTimeStruct expiryTime; + MmsTimeStruct deliveryTime; +} MMS_SENDINGOPT_INFO_S; + + +/** + * @brief Represents SMS Sending Option Structure in framework. + */ +typedef struct +{ + bool bReplyPath; +} SMS_SENDINGOPT_INFO_S; + + +/** + * @brief Represents MSG Sending Option Structure in framework. + */ +typedef struct +{ + bool bSetting; + bool bDeliverReq; + bool bKeepCopy; + + union + { + MMS_SENDINGOPT_INFO_S mmsSendOptInfo; + SMS_SENDINGOPT_INFO_S smsSendOptInfo; + } option; +} MSG_SENDINGOPT_INFO_S; + + +/** + * @brief Represents a request in the application. \n + * Applications compose a request and send it to the framework via Message handle. \n + * This request ID is used to manage the request by the framework. + */ +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_t msg; /**< Indicates the message structure to be sent by applications. */ + MSG_SENDINGOPT_S sendOpt; +} MSG_REQUEST_S; + + +/** + * @brief Represents Address information list. + */ +typedef struct +{ + MSG_CONTACT_ID_T contactId; /**< The contact id of message common informatioin */ + MSG_ADDRESS_INFO_S msgAddrInfo; /**< The pointer to message common informatioin */ +} MSG_THREAD_LIST_INDEX_S; + + +/** + * @brief Represents Peer Count Info. + */ +typedef struct +{ + int totalCount; /**< Indicates the total number of messages from the Peer. */ + int unReadCount; /**< Indicates the unread messages from the Peer. */ + int smsMsgCount; /**< Indicates the SMS messages from the Peer. */ + int mmsMsgCount; /**< Indicates the MMS messages from the Peer. */ +}MSG_THREAD_COUNT_INFO_S; + + +/** + * @brief Represents the request information of Push Message (SI, SL). + */ +typedef struct +{ + MSG_PUSH_ACTION_T action; + unsigned long received; + unsigned long created; + unsigned long expires; + char id[MAX_WAPPUSH_ID_LEN]; + char href[MAX_WAPPUSH_HREF_LEN]; + char contents[MAX_WAPPUSH_CONTENTS_LEN]; +} MSG_PUSH_MESSAGE_S; + + +/** + * @brief Represents the request information of Push Message (CO). + */ +typedef struct +{ + int invalObjectCnt; + int invalServiceCnt; + char invalObjectUrl[MAX_PUSH_CACHEOP_INVALID_OBJECT_MAX][MAX_PUSH_CACHEOP_MAX_URL_LEN]; + char invalServiceUrl[MAX_PUSH_CACHEOP_INVALID_SERVICE_MAX][MAX_PUSH_CACHEOP_MAX_URL_LEN]; +} MSG_PUSH_CACHEOP_S; + + +/** + * @brief Represents the SyncML Message Information. + */ +typedef struct +{ + int extId; + int pinCode; + msg_message_t msg; +}MSG_SYNCML_MESSAGE_S; + + +/** + * @brief Represents the SyncML Message Data. + */ + typedef struct +{ + MSG_SYNCML_MESSAGE_TYPE_T syncmlType; + int pushBodyLen; + char pushBody[MAX_WAPPUSH_CONTENTS_LEN]; + int wspHeaderLen; + char wspHeader[MAX_WAPPUSH_CONTENTS_LEN]; +}MSG_SYNCML_MESSAGE_DATA_S; + + +/** + * @brief Represents the SyncML Message Data. + */ + typedef struct +{ + char pushHeader[MAX_WAPPUSH_CONTENTS_LEN]; + int pushBodyLen; + char pushBody[MAX_WAPPUSH_CONTENTS_LEN]; +}MSG_LBS_MESSAGE_DATA_S; + + + +/** + * @brief Represents the Report Status Data. + */ + typedef struct +{ + MSG_DELIVERY_REPORT_STATUS_T deliveryStatus; /**< Indicates the message ID of this message. */ + time_t deliveryStatusTime; /**< Indicates the display time related to the specific operation. */ //MAX_DISPLAY_TIME_LEN + MSG_READ_REPORT_STATUS_T readStatus; /**< Indicates the message ID of this message. */ + time_t readStatusTime; /**< Indicates the display time related to the specific operation. */ //MAX_DISPLAY_TIME_LEN +}MSG_REPORT_STATUS_INFO_S; + + +/*================================================================================================== + ENUMS +==================================================================================================*/ + +/** + * @brief Represents the type of Message. More members maybe added if needed \n + * This enum is used as the value of MSG_MESSAGE_TYPE_T. + */ + enum _MSG_MESSAGE_TYPE_E +{ + MSG_TYPE_INVALID = 0, /** < Invalid Type Message */ + + MSG_TYPE_SMS, /** < Normal SMS Message */ + MSG_TYPE_SMS_CB, /** < Cell Broadcasting SMS Message */ + MSG_TYPE_SMS_JAVACB, /** < JAVA Cell Broadcasting SMS Message */ + MSG_TYPE_SMS_WAPPUSH, /** < WAP Push SMS Message */ + MSG_TYPE_SMS_MWI, /** < MWI SMS Message */ + MSG_TYPE_SMS_SYNCML, /** < SyncML CP SMS Message */ + MSG_TYPE_SMS_REJECT, /** < Reject Message */ + + MSG_TYPE_MMS, /** < Normal MMS Message */ + MSG_TYPE_MMS_JAVA, /** < JAVA MMS Message */ + MSG_TYPE_MMS_NOTI, /** < MMS Notification Message */ +}; + + +/** + * @brief Represents the values of an error code. \n + * Success code is zero, but all error codes SHOULD be negative and smaller than MSG_ERROR_BEGIN. \n + * This enum is used as the value of MSG_ERROR_T. + */ +enum _MSG_ERROR_E +{ + MSG_SUCCESS = 0, /**< Successful */ + + MSG_ERR_NULL_MSGHANDLE = -1, /**< Message handle is NULL */ + MSG_ERR_NULL_POINTER = -2, /**< Pointer is NULL */ + MSG_ERR_NULL_MESSAGE = -3, /**< Message is NULL */ + MSG_ERR_INVALID_STORAGE_ID = -4, /**< Storage ID is invalid */ + MSG_ERR_INVALID_MSG_TYPE = -5, /**< Message type is invalid */ + + MSG_ERR_INVALID_STORAGE_REG= -6, /**< Storage registry is invalid */ + MSG_ERR_INVALID_MESSAGE_ID = -7, /**< Message ID is invalid */ + MSG_ERR_INVALID_MSGHANDLE = -8, /**< Message handle is invalid */ + MSG_ERR_INVALID_PARAMETER = -9, /**< Parameter is invalid */ + MSG_ERR_INVALID_MESSAGE = -10, /**< Message is invalid */ + + MSG_ERR_INVALID_PLUGIN_HANDLE = -11, /**< Plugin handle is invalid */ + MSG_ERR_MEMORY_ERROR = -12, /**< Memory is error */ + MSG_ERR_COMMUNICATION_ERROR = -13, /**< Communication between client and server is error */ + MSG_ERR_SIM_STORAGE_FULL = -14, /**< SIM Storage is full */ + MSG_ERR_TRANSPORT_ERROR = -15, /**< Transport event error */ + + MSG_ERR_CALLBACK_ERROR = -16, /**< Callback event error */ + MSG_ERR_STORAGE_ERROR = -17, /**< Storage event error */ + MSG_ERR_FILTER_ERROR = -18, /**< Filter event error */ + MSG_ERR_MMS_ERROR = -19, /**< MMS event error */ + MSG_ERR_MMPLAYER_CREATE = -20, /**< Multimedia Error*/ + + MSG_ERR_MMPLAYER_SET_ATTRS = -21, /**< Multimedia Error*/ + MSG_ERR_MMPLAYER_REALIZE = -22, /**< Multimedia Error*/ + MSG_ERR_MMPLAYER_PLAY = -23, /**< Multimedia Error*/ + MSG_ERR_MMPLAYER_STOP = -24, /**< Multimedia Error*/ + MSG_ERR_MMPLAYER_DESTROY = -25, /**< Multimedia Error*/ + + MSG_ERR_UNKNOWN = -26, /**< Unknown errors */ + + /* Start Database Errors */ + MSG_ERR_DB_CONNECT = -27, + MSG_ERR_DB_DISCONNECT = -28, + MSG_ERR_DB_EXEC = -29, + MSG_ERR_DB_GETTABLE = -30, + + MSG_ERR_DB_PREPARE = -31, + MSG_ERR_DB_STEP = -32, + MSG_ERR_DB_NORECORD= -33, + MSG_ERR_DB_STORAGE_INIT = -34, + MSG_ERR_DB_MAKE_DIR = -35, + + MSG_ERR_DB_ROW = -36, + MSG_ERR_DB_DONE = -37, + MSG_ERR_DB_GENERIC= -38, + MSG_ERR_DB_END = -39, + /* End Database Errors */ + + /* Start Setting Errors */ + MSG_ERR_SET_SETTING = -40, + MSG_ERR_SET_SIM_SET = -41, + MSG_ERR_SET_READ_ERROR = -42, + MSG_ERR_SET_WRITE_ERROR = -43, + MSG_ERR_SET_DELETE_ERROR = -44, + /* End Setting Errors */ + + /* Start Plugin Errors */ + MSG_ERR_PLUGIN_TAPIINIT = -45, + MSG_ERR_PLUGIN_REGEVENT = -46, + MSG_ERR_PLUGIN_TRANSPORT = -47, + MSG_ERR_PLUGIN_STORAGE = -48, + MSG_ERR_PLUGIN_SETTING = -49, + + MSG_ERR_PLUGIN_WAPDECODE = -50, + MSG_ERR_PLUGIN_TAPI_FAILED = -51, + MSG_ERR_PLUGIN_SIM_MSG_FULL = -52, + /* End Plugin Errors */ + + MSG_ERR_MESSAGE_COUNT_FULL = -53, + MSG_ERR_READREPORT_NOT_REQUESTED = -54, + MSG_ERR_READREPORT_ALEADY_SENT = -55, + + MSG_ERR_FILTER_DUPLICATED = -56, /**< Filter duplicate error */ + MSG_ERR_SECURITY_ERROR = -57, + MSG_ERR_NO_SIM = -58, + MSG_ERR_SERVER_NOT_READY= -59, +}; + + +/** + * @brief Represents the values of a message priority. \n + * This enum is used as the value of MSG_PRIORITY_TYPE_T. + */ +enum _MSG_PRIORITY_TYPE_E +{ + MSG_MESSAGE_PRIORITY_LOW, /**< Low priority */ + MSG_MESSAGE_PRIORITY_NORMAL, /**< Normal priority */ + MSG_MESSAGE_PRIORITY_HIGH, /**< High priority */ +}; + + +/** + * @brief Represents the values of a network status. \n + * This enum is used as the value of MSG_NETWORK_STATUS_T. + */ +enum _MSG_NETWORK_STATUS_E +{ + MSG_NETWORK_NOT_SEND = 0, /**< Message is not sending */ + MSG_NETWORK_SENDING, /**< Message is sending */ + MSG_NETWORK_SEND_SUCCESS, /**< Message is sent successfully */ + MSG_NETWORK_SEND_FAIL, /**< Message is failed to send */ + MSG_NETWORK_DELIVER_SUCCESS, /**< Message is delivered */ + MSG_NETWORK_DELIVER_FAIL, /**< Message is failed to deliver */ + MSG_NETWORK_RECEIVED, /**< Message is received */ + MSG_NETWORK_REQ_CANCELLED, /**< Request is cancelled */ + MSG_NETWORK_RETRIEVING, /**< Message is retrieving */ + MSG_NETWORK_RETRIEVE_SUCCESS, /**< Message is retrieved successfully */ + MSG_NETWORK_RETRIEVE_FAIL, /**< Message is failed to retrieve */ + MSG_NETWORK_SEND_TIMEOUT, /**< Message is failed to send by timeout */ +}; + + +/** + * @brief Represents the values of an address type. \n + * This enum is used as the value of MSG_ADDRESS_TYPE_T. +*/ +enum _MSG_ADDRESS_TYPE_E +{ + MSG_ADDRESS_TYPE_UNKNOWN = 0, /**< The address type is unknown. */ + MSG_ADDRESS_TYPE_PLMN, /**< The address type is for a phone number like +1012345678. */ + MSG_ADDRESS_TYPE_EMAIL, /**< The address type is for an email address like abc@example.email. */ +}; + + +/** + * @brief Represents the values of a recipient type. \n + * This enum is used as the value of MSG_RECIPIENT_TYPE_T. +*/ +enum _MSG_RECIPIENT_TYPE_E +{ + MSG_RECIPIENTS_TYPE_UNKNOWN = 0, /**< The recipient type is unknown. */ + MSG_RECIPIENTS_TYPE_TO, /**< The recipient type is for "To". */ + MSG_RECIPIENTS_TYPE_CC, /**< The recipient type is for "Cc". */ + MSG_RECIPIENTS_TYPE_BCC, /**< The recipient type is for "Bcc". */ +}; + + +/** + * @brief Represents the values of a direction type. \n + * This enum is used as the value of MSG_DIRECTION_TYPE_T. + */ +enum _MSG_DIRECTION_TYPE_E +{ + MSG_DIRECTION_TYPE_MO = 0, /**< The direction type is for mobile originated */ + MSG_DIRECTION_TYPE_MT, /**< The direction type is for mobile terminated */ +}; + + +/** + * @brief Represents the values of a string encoding type. \n + * This enum is used as the value of MSG_ENCODE_TYPE_T. + */ +enum _MSG_ENCODE_TYPE_E +{ + MSG_ENCODE_GSM7BIT = 0, /**< The string encoding type is GSM7BIT */ + MSG_ENCODE_8BIT, /**< The string encoding type is 8 BIT */ + MSG_ENCODE_UCS2, /**< The string encoding type is UCS2 */ + MSG_ENCODE_AUTO, /**< The string encoding type is AUTO */ +}; + + +/** + * @brief Represents the action type of Push Message. \n + * This enum is used as the value of MSG_PUSH_ACTION_T. + */ +enum _MSG_PUSH_ACTION_E +{ + // SI Action + MSG_PUSH_SI_ACTION_SIGNAL_NONE = 0x00, + MSG_PUSH_SI_ACTION_SIGNAL_LOW, + MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM, + MSG_PUSH_SI_ACTION_SIGNAL_HIGH, + MSG_PUSH_SI_ACTION_DELETE, + + // SL Action + MSG_PUSH_SL_ACTION_EXECUTE_LOW, + MSG_PUSH_SL_ACTION_EXECUTE_HIGH, + MSG_PUSH_SL_ACTION_CACHE, +}; + + +/** + * @brief Represents the type of SyncML Message. \n + * This enum is used as the value of MSG_SYNCML_MESSAGE_TYPE_T. + */ + enum _MSG_SYNCML_MESSAGE_TYPE_E + { + DM_WBXML, /** < DM WBXML SyncML Message */ + DM_XML, /** < DM XML SyncML Message */ + DM_NOTIFICATION, /** < DM Notification SyncML Message */ + + DS_NOTIFICATION, /** < DS Notification SyncML Message */ + DS_WBXML, /** < DS WBXML SyncML Message */ + + CP_XML, /** < CP XML SyncML Message */ + CP_WBXML, /** < CP WBXML SyncML Message */ + + OTHERS, /** < Unknown SyncML Message */ + }; + + +/** + * @brief Represents the values of a Delivery Report Status. \n + * This enum is used as the value of MSG_DELIVERY_REPORT_STATUS_T. +*/ + enum _MSG_DELIVERY_REPORT_STATUS_E + { + MSG_DELIVERY_REPORT_NONE = -1, /**< Indicates the status unavailable */ + MSG_DELIVERY_REPORT_EXPIRED = 0, /**< Indicates the expired status of message */ + MSG_DELIVERY_REPORT_SUCCESS = 1, /**< Indicates the success status of message */ + MSG_DELIVERY_REPORT_REJECTED = 2, /**< Indicates the rejected status of message */ + MSG_DELIVERY_REPORT_DEFERRED = 3, /**< Indicates the deferred status of message */ + MSG_DELIVERY_REPORT_UNRECOGNISED = 4, /**< Indicates the unrecongnised status of message */ + MSG_DELIVERY_REPORT_INDETERMINATE = 5, /**< Indicates the unrecongnised status of message */ + MSG_DELIVERY_REPORT_FORWARDED = 6, /**< Indicates the forwarded status of message */ + MSG_DELIVERY_REPORT_UNREACHABLE = 7, /**< Indicates the unreachable status of message */ + MSG_DELIVERY_REPORT_ERROR = 8, /**< Indicates the error status of message */ + }; + + +/** + * @brief Represents the values of a Read Report Status. \n + * This enum is used as the value of MSG_READ_REPORT_STATUS_T. +*/ +enum _MSG_READ_REPORT_STATUS_E + { + MSG_READ_REPORT_NONE = -1, /**< Indicates the status unavailable */ + MSG_READ_REPORT_IS_READ = 0, /**< Indicates the message is read */ + MSG_READ_REPORT_IS_DELETED = 1 /**< Indicates the message is deleted */ + }; + +/** + * @} + */ + +#endif // MSG_TYPES_H + diff --git a/include/framework/MsgCmdHandler.h b/include/framework/MsgCmdHandler.h new file mode 100755 index 0000000..669f0ae --- /dev/null +++ b/include/framework/MsgCmdHandler.h @@ -0,0 +1,109 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_CMD_HANDLER_H +#define MSG_CMD_HANDLER_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgCmdTypes.h" +#include "MsgInternalTypes.h" + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgAddSyncMLMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgUpdateMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgUpdateReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgUpdateThreadReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgUpdateProtectedStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgDeleteMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgDeleteAllMessageInFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgMoveMessageToStorageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgCountMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgCountMsgByTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetFolderViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +int MsgAddFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgUpdateFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgDeleteFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetFolderListHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +int MsgInitSimBySatHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetMsgTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetConversationViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +int MsgCountMsgByContactHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetQuickPanelDataHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgResetDatabaseHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetMemSizeHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetReportStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +int MsgSetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgCancelReqHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +int MsgRegSentStatusCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgRegIncomingMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgRegIncomingMMSConfMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgRegIncomingLBSMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgRegSyncMLMsgOperationCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgIncomingLBSMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgSyncMLMsgOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +MSG_ERROR_T MsgPrepareScheduledMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOpt, int ListenerFd); +int MsgCreateScheduledAlarm(MSG_MESSAGE_INFO_S *pMsgInfo); +int MsgScheduledAlarmCB(int AlarmId, void *pUserParam); +int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgAddFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgUpdateFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgDeleteFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetFilterListHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgSetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent); +int MsgGetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent); + +#endif // MSG_CMD_HANDLER_H diff --git a/include/framework/MsgDeliverHandler.h b/include/framework/MsgDeliverHandler.h new file mode 100755 index 0000000..7ec1ce9 --- /dev/null +++ b/include/framework/MsgDeliverHandler.h @@ -0,0 +1,55 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_DELIVER_HANDLER_H +#define MSG_DELIVER_HANDLER_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgPluginInterface.h" +#include "MsgTypes.h" + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +MSG_ERROR_T MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_ID_T reqID); +MSG_ERROR_T MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti); +MSG_ERROR_T MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti); +MSG_ERROR_T MsgHandleMMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti); + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSG_SVC_PKG_NAME_BROWSER "org.tizen.browser" + +#endif // MSG_DELIVER_HANDLER_H + diff --git a/include/framework/MsgPluginConfig.h b/include/framework/MsgPluginConfig.h new file mode 100755 index 0000000..8bc7e8e --- /dev/null +++ b/include/framework/MsgPluginConfig.h @@ -0,0 +1,108 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_PLUGIN_CONFIG_H +#define MSG_PLUGIN_CONFIG_H + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include +#include +#include +#include "MsgDebug.h" +#include "MsgTypes.h" +#include "MsgCppTypes.h" + +class MsgPlgToken +{ + int tokenType; // not defined 0, title: 1, msgtype: 2, libpath: 3 + char tokenVal[256]; // null-terminated char array + +public: + MsgPlgToken(char* pstr=NULL) : tokenType(TOK_UNDEFINED) + { + if(pstr) + { + tokenize(pstr); + } + else + { + bzero(tokenVal, 256); + } + } + + MsgPlgToken& operator = (const MsgPlgToken& rhs) + { + if (this != &rhs) + { + tokenType = rhs.tokenType; + strncpy(tokenVal, rhs.tokenVal, 255); + } + + return *this; + } + + int getType() const { return tokenType; } // not defined 0, title: 1, msgtype: 2, libpath: 3 + const char* getVal(void) const { return tokenVal; } + void getVal(CharVector& vec) const { vec.assign(tokenVal, tokenVal+strlen(tokenVal));} + int tokenize(char* pStr); + + enum { TOK_UNDEFINED=0, TOK_PLG_TITLE, TOK_PLG_TYPE, TOK_PLG_PATH }; + + void reset() { tokenType = TOK_UNDEFINED; } + operator void*() const { + return (tokenType==TOK_UNDEFINED)? NULL:(void*) this; + } +}; + +typedef std::vector MsgPlgTokenVec; +typedef std::map MsgConfigMap; + +class MsgPlgConfig +{ + MsgConfigMap configMap; + void insert(const MsgPlgToken& tokTitle, const MsgPlgToken& tokMsgType, const MsgPlgToken& tokLibPath); + +public: + MsgPlgConfig(FILE* fp); + + /* access method for tokens */ + const CharVector& title(unsigned int pos);// const; // iteration with ith position i=0, .. , itemCount-1 + inline int titleCount() const { return configMap.size(); } + + void token(const CharVector& key, unsigned int pos, MsgPlgToken& retTok);// const; + void token(int i, unsigned int pos, MsgPlgToken& retTok);// const; + int tokenCount(const CharVector& key) { return configMap[key].size(); } // const leads to error why? +}; + +#endif // MSG_PLUGIN_CONFIG_H diff --git a/include/framework/MsgPluginManager.h b/include/framework/MsgPluginManager.h new file mode 100755 index 0000000..796db16 --- /dev/null +++ b/include/framework/MsgPluginManager.h @@ -0,0 +1,128 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_PLUGIN_MANAGER_H +#define MSG_PLUGIN_MANAGER_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include + +#include "MsgTypes.h" +#include "MsgPluginInterface.h" +#include "MsgPluginConfig.h" + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSG_PLUGIN_CFG_PATH "/usr/share/msg-service/" +#define MSG_PLUGIN_CFG_NAME "plugin.cfg" + + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgPlugin +{ +public: + MsgPlugin(MSG_MAIN_TYPE_T plgType = MSG_UNKNOWN_TYPE, const char* libPath = NULL); + ~MsgPlugin(); + + MSG_ERROR_T initialize(); + void finalize(); + + MSG_ERROR_T submitReq(MSG_REQUEST_INFO_S *pReqInfo, bool bReqCb); + MSG_ERROR_T registerListener(MSG_PLUGIN_LISTENER_S *pListener); + MSG_ERROR_T checkSimStatus(MSG_SIM_STATUS_T *pStatus); + MSG_ERROR_T checkDeviceStatus(); + + MSG_ERROR_T initSimMessage(); + MSG_ERROR_T saveSimMessage(MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList); + MSG_ERROR_T deleteSimMessage(MSG_SIM_ID_T SimMsgId); + MSG_ERROR_T setReadStatus(MSG_SIM_ID_T SimMsgId); + MSG_ERROR_T setMemoryStatus(MSG_ERROR_T Error); + + MSG_ERROR_T initConfigData(MSG_SIM_STATUS_T SimStatus); + MSG_ERROR_T setConfigData(const MSG_SETTING_S *pSetting); + MSG_ERROR_T getConfigData(MSG_SETTING_S *pSetting); + + // MMS handlers + MSG_ERROR_T addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData); + MSG_ERROR_T updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData); + MSG_ERROR_T processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject); + MSG_ERROR_T getMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg); + MSG_ERROR_T updateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo); + MSG_ERROR_T composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo); + + MSG_ERROR_T restoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char* pRecvBody, int rcvdBodyLen, char* filePath); + + operator void*() const { + return (mSupportedMsg==MSG_UNKNOWN_TYPE)? NULL:(void*) this; + } + +private: + MSG_MAIN_TYPE_T mSupportedMsg; + MSG_PLUGIN_HANDLER_S mPlgHandler; + + void* mLibHandler; // plugin library pointer +}; + + +/*================================================================================================== + GLOBAL VARIABLES +==================================================================================================*/ +typedef std::map MsgPluginMap; + + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgPluginManager +{ +public: + static MsgPluginManager* instance(); + + void initialize(); + void finalize(); + MsgPlugin* getPlugin(MSG_MAIN_TYPE_T mainType); + void loadPlugins(const char* path); + +private: + MsgPluginManager(); + ~MsgPluginManager(); + + static MsgPluginManager* pInstance; + MsgPluginMap plgMap; +}; + +#endif // MSG_PLUGIN_MANAGER_H + diff --git a/include/framework/MsgSettingHandler.h b/include/framework/MsgSettingHandler.h new file mode 100755 index 0000000..b0fe3a9 --- /dev/null +++ b/include/framework/MsgSettingHandler.h @@ -0,0 +1,75 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_SETTING_HANDLER_H +#define MSG_SETTING_HANDLER_H + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgSettingTypes.h" + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +MSG_ERROR_T MsgInitSimConfig(MSG_SIM_STATUS_T SimStatus); + +MSG_ERROR_T MsgSetConfigData(const MSG_SETTING_S *pSetting); +MSG_ERROR_T MsgGetConfigData(MSG_SETTING_S *pSetting); + +MSG_ERROR_T MsgSetGeneralOpt(const MSG_SETTING_S *pSetting); +MSG_ERROR_T MsgSetSMSSendOpt(const MSG_SETTING_S *pSetting); +MSG_ERROR_T MsgSetSMSCList(const MSG_SETTING_S *pSetting, bool bSetSim); +MSG_ERROR_T MsgSetMMSSendOpt(const MSG_SETTING_S *pSetting); +MSG_ERROR_T MsgSetMMSRecvOpt(const MSG_SETTING_S *pSetting); +MSG_ERROR_T MsgSetMMSStyleOpt(const MSG_SETTING_S *pSetting); +MSG_ERROR_T MsgSetPushMsgOpt(const MSG_SETTING_S *pSetting); +MSG_ERROR_T MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim); +MSG_ERROR_T MsgSetVoiceMailOpt(const MSG_SETTING_S *pSetting); +MSG_ERROR_T MsgSetMsgSizeOpt(const MSG_SETTING_S *pSetting); + +void MsgGetGeneralOpt(MSG_SETTING_S *pSetting); +void MsgGetSMSSendOpt(MSG_SETTING_S *pSetting); +void MsgGetSMSCList(MSG_SETTING_S *pSetting); +void MsgGetMMSSendOpt(MSG_SETTING_S *pSetting); +void MsgGetMMSRecvOpt(MSG_SETTING_S *pSetting); +void MsgGetMMSStyleOpt(MSG_SETTING_S *pSetting); +void MsgGetPushMsgOpt(MSG_SETTING_S *pSetting); +void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting); +void MsgGetVoiceMailOpt(MSG_SETTING_S *pSetting); +void MsgGetMsgSizeOpt(MSG_SETTING_S *pSetting); + +MSG_ERROR_T MsgSetConfigInSim(const MSG_SETTING_S *pSetting); + + +#endif + diff --git a/include/framework/MsgStorageHandler.h b/include/framework/MsgStorageHandler.h new file mode 100755 index 0000000..3483721 --- /dev/null +++ b/include/framework/MsgStorageHandler.h @@ -0,0 +1,140 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_STORAGE_HANDLER_H +#define MSG_STORAGE_HANDLER_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgStorageTypes.h" +#include "MsgSettingTypes.h" +#include "MsgMmsTypes.h" +#include "MsgTransportTypes.h" +#include "MsgInternalTypes.h" + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +MSG_ERROR_T MsgStoConnectDB(); +MSG_ERROR_T MsgStoDisconnectDB(); + +MSG_ERROR_T MsgStoInitDB(bool bSimChanged); + +MSG_ERROR_T MsgCreateAddressTable(); +MSG_ERROR_T MsgCreateFolderTable(); +MSG_ERROR_T MsgCreateMsgTable(); +MSG_ERROR_T MsgCreateSimMessageTable(); +MSG_ERROR_T MsgCreateWAPMessageTable(); +MSG_ERROR_T MsgCreateCBMessageTable(); +MSG_ERROR_T MsgCreateSyncMLMessageTable(); +MSG_ERROR_T MsgCreateScheduledMessageTable(); +MSG_ERROR_T MsgCreateSmsSendOptTable(); +MSG_ERROR_T MsgCreateFilterTable(); +MSG_ERROR_T MsgCreateMmsMsgTable(); +MSG_ERROR_T MsgCreateMmsAttributeTable(); +MSG_ERROR_T MsgAddDefaultFolders(); +MSG_ERROR_T MsgAddDefaultAddress(); +MSG_ERROR_T MsgStoResetDatabase(); + +MSG_ERROR_T MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo, int addrIdx = 0); +MSG_ERROR_T MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo, int addrIdx = 0); +MSG_ERROR_T MsgStoUpdateReadStatus(MSG_MESSAGE_ID_T MsgId, bool bRead); +MSG_ERROR_T MsgStoUpdateThreadReadStatus(MSG_THREAD_ID_T ThreadId); +MSG_ERROR_T MsgStoUpdateProtectedStatus(MSG_MESSAGE_ID_T MsgId, bool bProtected); +MSG_ERROR_T MsgStoDeleteMessage(MSG_MESSAGE_ID_T MsgId, bool bCheckIndication); +MSG_ERROR_T MsgStoDeleteAllMessageInFolder(MSG_FOLDER_ID_T FolderId, bool bOnlyDB, MSG_MSGID_LIST_S *pMsgIdList); +MSG_ERROR_T MsgStoMoveMessageToFolder(MSG_MESSAGE_ID_T MsgId, MSG_FOLDER_ID_T DestFolderId); +MSG_ERROR_T MsgStoMoveMessageToStorage(const MSG_MESSAGE_ID_T MsgId, const MSG_STORAGE_ID_T DestStorageId); +MSG_ERROR_T MsgStoCountMessage(MSG_FOLDER_ID_T FolderId, MSG_COUNT_INFO_S *pCountInfo); +MSG_ERROR_T MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount); +MSG_ERROR_T MsgStoGetMessage(MSG_MESSAGE_ID_T MsgId, MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo); +MSG_ERROR_T MsgStoGetFolderViewList(MSG_FOLDER_ID_T FolderId, const MSG_SORT_RULE_S *pSortRule, MSG_LIST_S *pMsgFolderViewList); +MSG_ERROR_T MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int ExtId, int PinCode); +MSG_ERROR_T MsgStoGetMsgType(MSG_MESSAGE_ID_T msgId, MSG_MESSAGE_TYPE_S* pMsgType); +MSG_ERROR_T MsgStoGetText(MSG_MESSAGE_ID_T MsgId, char *pSubject, char *pMsgText); +MSG_ERROR_T MsgStoGetQuickPanelData(MSG_QUICKPANEL_TYPE_T Type, MSG_MESSAGE_INFO_S *pMsg); +MSG_ERROR_T MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, MSG_THREAD_VIEW_LIST_S *pThreadViewList); +MSG_ERROR_T MsgStoGetConversationViewList(MSG_THREAD_ID_T ThreadId, MSG_LIST_S *pConvViewList); +MSG_ERROR_T MsgStoDeleteThreadMessageList(MSG_THREAD_ID_T ThreadId, MSG_MSGID_LIST_S *pMsgIdList); +MSG_ERROR_T MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo); +MSG_ERROR_T MsgStoSearchMessage(const char *pSearchString, MSG_THREAD_VIEW_LIST_S *pThreadViewList); +MSG_ERROR_T MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, MSG_LIST_S *pMsgList); +MSG_ERROR_T MsgStoGetMsgIdList(MSG_REFERENCE_ID_T RefId, MSG_MSGID_LIST_S *pMsgIdList); +MSG_ERROR_T MsgStoGetRejectMsgList(const char *pNumber, MSG_REJECT_MSG_LIST_S *pRejectMsgList); +MSG_ERROR_T MsgStoGetReportStatus(MSG_MESSAGE_ID_T msgId, MSG_REPORT_STATUS_INFO_S* pReportStatus); +MSG_ERROR_T MsgStoGetThreadUnreadCnt(MSG_THREAD_ID_T ThreadId, int *cnt); + +// Folder +MSG_ERROR_T MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo); +MSG_ERROR_T MsgStoUpdateFolder(const MSG_FOLDER_INFO_S *pFolderInfo); +MSG_ERROR_T MsgStoDeleteFolder(MSG_FOLDER_ID_T FolderId); +MSG_ERROR_T MsgStoGetFolderList(MSG_FOLDER_LIST_S *pFolderList); + +// Sim Operation related Functions +MSG_ERROR_T MsgInitSimMessage(MSG_SIM_STATUS_T SimStatus); +MSG_ERROR_T MsgStoClearSimMessageInDB(); + +// Internal Function +MSG_ERROR_T MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort); +MSG_ERROR_T MsgStoGetSmsSendOpt(MSG_MESSAGE_ID_T MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt); +MSG_ERROR_T MsgStoGetMmsSendOpt(MSG_MESSAGE_ID_T MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt); + +// Scheduled Msg +MSG_ERROR_T MsgStoAddScheduledMessage(MSG_MESSAGE_ID_T MsgID, int AlarmId, int ListenerFd); +MSG_ERROR_T MsgStoGetScheduledMessage(int AlarmId, MSG_REQUEST_INFO_S *pReqInfo, int *pListenerFd); +MSG_ERROR_T MsgStoDeleteScheduledMessage(MSG_MESSAGE_ID_T MsgId); + +// SyncML Msg +MSG_ERROR_T MsgStoGetSyncMLExtId(MSG_MESSAGE_ID_T msgId, int *extId); +bool MsgStoCheckSyncMLMsgInThread(MSG_THREAD_ID_T threadId); + +MSG_ERROR_T MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg); +MSG_ERROR_T MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo); +MSG_ERROR_T MsgStoSetReadReportSendStatus(MSG_MESSAGE_ID_T msgId, int readReportSendStatus); + + +/////////////////////////////////////////////////////////////////////////////////// +MSG_ERROR_T MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg); +MSG_ERROR_T MsgStoUpdateNetworkStatus(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_NETWORK_STATUS_T Status); +MSG_ERROR_T MsgStoGetSubject(MSG_MESSAGE_ID_T MsgId, char* pSubject); +MSG_ERROR_T MsgStoGetRecipientList(MSG_MESSAGE_ID_T msgId, MSG_RECIPIENTS_LIST_S *pRecipientList); +MSG_ERROR_T MsgStoGetReadStatus(MSG_MESSAGE_ID_T MsgId, bool *pReadStatus); +MSG_ERROR_T MsgStoGetAddrInfo(MSG_MESSAGE_ID_T MsgId, MSG_ADDRESS_INFO_S *pAddrInfo); + +/////////////////////////////////////////////////////////////////////////////////// + +MSG_ERROR_T MsgStoResetNetworkStatus(); +MSG_ERROR_T MsgStoCleanAbnormalMmsData(); +MSG_ERROR_T MsgStoCheckReadReportStatus(MSG_MESSAGE_ID_T msgId); + +#endif // MSG_STORAGE_HANDLER_H + diff --git a/include/framework/MsgSubmitHandler.h b/include/framework/MsgSubmitHandler.h new file mode 100755 index 0000000..8e18b85 --- /dev/null +++ b/include/framework/MsgSubmitHandler.h @@ -0,0 +1,54 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_SUBMIT_HANDLER_H +#define MSG_SUBMIT_HANDLER_H + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgInternalTypes.h" + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +MSG_ERROR_T MsgSubmitReq(MSG_REQUEST_INFO_S* pReq, bool bScheduled); +MSG_ERROR_T MsgSubmitReqSMS(MSG_REQUEST_INFO_S *pReqInfo); +MSG_ERROR_T MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo, bool bScheduled); + +MSG_ERROR_T MsgCancelReq(MSG_REQUEST_ID_T reqId); +MSG_ERROR_T MsgUpdateSentMsg(MSG_MESSAGE_ID_T MsgId, MSG_NETWORK_STATUS_T Status); + +void MsgCopyReqInfo(MSG_REQUEST_INFO_S *pSrc, int addrIdx, MSG_REQUEST_INFO_S *pDest); + +#endif // MSG_SUBMIT_HANDLER_H + diff --git a/include/framework/MsgTransManager.h b/include/framework/MsgTransManager.h new file mode 100755 index 0000000..ee39fff --- /dev/null +++ b/include/framework/MsgTransManager.h @@ -0,0 +1,137 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_TRANSACTION_MANAGER_H +#define MSG_TRANSACTION_MANAGER_H + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include + +#include "MsgMutex.h" +#include "MsgIpcSocket.h" +#include "MsgCmdTypes.h" +#include "MsgInternalTypes.h" +#include "MsgTransportTypes.h" + + + +/*================================================================================================== + DEFINITION +==================================================================================================*/ +typedef std::map handler_map; +typedef std::map sentmsg_map; +typedef std::map fd_map; +typedef std::list newmsg_list; +typedef std::list mmsconf_list; +typedef std::list syncmlmsg_list; +typedef std::list lbsmsg_list; +typedef std::list javamms_list; +typedef std::list syncmlop_list; + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +void MsgContactChangedCallback(); + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgTransactionManager +{ +public: + static MsgTransactionManager* instance(); + + void run(); + void write(int fd, const char* buf, int len); + + // methods for sent status event + void insertSentMsg(int reqId, MSG_PROXY_INFO_S* pChInfo); + MSG_PROXY_INFO_S* getProxyInfo(int reqId); + void delProxyInfo(int reqId); + + void setSentStatusCB(int listenerFd); + void setIncomingMsgCB(MSG_CMD_REG_INCOMING_MSG_CB_S *pCbInfo); + void setMMSConfMsgCB(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S *pCbinfo); + void setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCbinfo); + void setLBSMsgCB(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCbinfo); + void setJavaMMSList(MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S *pTrId); + void setSyncMLMsgOperationCB(MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCbinfo); + void setStorageChangeCB(int listenerFd); + + javamms_list& getJavaMMSList(); + + void broadcastIncomingMsgCB(const MSG_ERROR_T err, const MSG_MESSAGE_INFO_S *msgInfo); + void broadcastMMSConfCB(const MSG_ERROR_T err, const MSG_MESSAGE_INFO_S *msgInfo, const MMS_RECV_DATA_S *mmsRecvData); + void broadcastSyncMLMsgCB(const MSG_ERROR_T err, const MSG_SYNCML_MESSAGE_DATA_S *syncMLData); + void broadcastLBSMsgCB(const MSG_ERROR_T err, const MSG_LBS_MESSAGE_DATA_S *lbsData); + void broadcastSyncMLMsgOperationCB(const MSG_ERROR_T err, const int msgId, const int extId); + void broadcastStorageChangeCB(const MSG_ERROR_T err, const MSG_STORAGE_CHANGE_TYPE_T storageChangeType, const MSG_MSGID_LIST_S *pMsgIdList); + + void setTMStatus(); + void getTMStatus(); + +private: + MsgTransactionManager(); + ~MsgTransactionManager(); + + void handleRequest(int fd); + void cleanup(int fd); + bool checkPrivilege(MSG_CMD_TYPE_T CmdType, const char *pCookie); + + static MsgTransactionManager* pInstance; + + static MsgIpcServerSocket servSock; + bool running; + + handler_map handlerMap; + + sentmsg_map sentMsgMap; // req_id, listener_fd, msghandle_addr + fd_map statusCBFdMap; // src_fd, true if registered + + newmsg_list newMsgCBList; // src_fd, msgType, port if registered + mmsconf_list newMMSConfMsgCBList; // src_fd, msgType, port if registered + syncmlmsg_list newSyncMLMsgCBList; // src_fd, msgType, port if registered + lbsmsg_list newLBSMsgCBList; // src_fd, msgType, port if registered + javamms_list javaMMSList; // trId list to distinguish sent Java MMS msg when sendconf received + syncmlop_list operationSyncMLMsgCBList; // src_fd, msgType, port if registered + + fd_map storageChangeFdMap; // src_fd, true if registered + + Mutex mx; + CndVar cv; +}; + +#endif //MSG_TRANSACTION_MANAGER_H + diff --git a/include/mapi/MapiControl.h b/include/mapi/MapiControl.h new file mode 100755 index 0000000..b8cbff8 --- /dev/null +++ b/include/mapi/MapiControl.h @@ -0,0 +1,207 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +/** + * @file MapiControl.h + * @brief Defines control API of messaging framework + * @version 1.0 + */ + +#ifndef MAPI_CONTROL_H +#define MAPI_CONTROL_H + +/** + * @section Introduction + * - Introduction : Overview on Messaging Control API + * @section Program + * - Program : Messaging Control API Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ + +#include "MsgTypes.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_CONTROL_API Messaging Control API + * @{ + */ + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +/** + + * \par Description: + * Opens a channel between an application and messaging framework. + * + * \par Purpose: + * For application to utilize the services of Messaging Framework, this API should be called to establish connection between the application and Messaging Framework. + * + * \par Typical use case: + * Any application which utilizes the services of Messaging Framework needs to call this API. + * + * \par Method of function operation: + * Check for Message Server ready status. If ready connect to the Messaging Server socket and pass the handle application. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The handle parameter returned must be used by application for further API calls to Messaging Service \n + * - memory for the handle need not be allocated by the application \n + * - An error will be returned in case Messaging Service is not running. + * + * \param MSG_HANDLE_T input - handle to be passed for all Messaging Services . + * + * \return Return Type (int) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * - MSG_ERR_MEMORY_ERROR - Memory error. + * - MSG_ERR_COMMUNICATION_ERROR - Communication error between client and server \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * + * err = msg_open_msg_handle(&msgHandle); + * + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_open_msg_handle() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_open_msg_handle(MSG_HANDLE_T *handle); + + +/** + + * \par Description: + * Closes the channel between application and messaging framework. + * + * \par Purpose: + * Once application utilizes services of Messaging Service, this API needs to be invoked the close the channel between application and Messaging Service. + * + * \par Typical use case: + * Any application which has completed using services of Messaging Framework needs to call this API. + * + * \par Method of function operation: + * Closes the connection to Messaging Service and deleted the reference to the handle object + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The handle parameter returned must be used by application for further API calls to Messaging Service \n + * - memory for the handle need not be allocated by the application \n + * - An error will be returned in case Messaging Service is not running. + * + * \param MSG_HANDLE_T input - handle to be passed for all Messaging Services . + * + * \return Return Type (int) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * - MSG_ERR_COMMUNICATION_ERROR - Communication error between client and server \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_close_msg_handle(&msgHandle); + * + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_close_msg_handle() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_close_msg_handle(MSG_HANDLE_T *handle); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // MAPI_STORAGE_H + diff --git a/include/mapi/MapiMessage.h b/include/mapi/MapiMessage.h new file mode 100755 index 0000000..a70b3c7 --- /dev/null +++ b/include/mapi/MapiMessage.h @@ -0,0 +1,4937 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +/** + * @file MapiMessage.h + * @brief Defines message data API of messaging framework + * @version 1.0 + */ + +#ifndef MAPI_MESSAGE_H +#define MAPI_MESSAGE_H + +/** + * @section Introduction + * - Introduction : Overview on message data related API + * @section Program + * - Program : message data related API Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ + +#include "MsgTypes.h" +#include "MsgMmsTypes.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_DATA_API Messaging Data API + * @{ + */ + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +/** + + * \par Description: + * Allocate the memory for new message, which is used for composing SMS or MMS. + * + * \par Purpose: + * This API is used to create Message object and should be called before any operation on the message object. + * + * \par Typical use case: + * Before performing common operations on Messages such as Send, Save, Load, etc., this API should be called to create the message object. + * + * \par Method of function operation: + * Creates the Message Object and initiaizes the members to default values. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The type msg_message_t represents message object and hides the details of message object. + * - Memory for the Message abject need NOT be created by the called \n + * - You can set or get the value of message object using the below APIs. + * - You should release the memory using msg_release_message(), unless memory leaks. + * + * \param none. + * + * \return Return Type (msg_message_t) \n + * - msg_message_t - valid message object is returned upon success \n + * - NULL - In case of error in allocation of message object \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg = msg_new_message(); + * + * if (msg == NULL) + * { + * sprintf(str, "msg_new_message() Fail"); + * print(str); + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +msg_message_t msg_new_message(void); + + +/** + + * \par Description: + * Free the memory of msg_message_t, which is created by msg_new_message(). + * + * \par Purpose: + * This API is used to release memory created by message creation. + * + * \par Typical use case: + * After using message object for send/save scenario, release message need to be called. + * + * \par Method of function operation: + * Frees the memory allocated to message object and deletes the object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object to be destroyed . + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg = msg_new_message(); + * ... + * err = msg_release_message(&msg); + * + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_release_message() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_release_message(msg_message_t *msg); + + + +/** + + * \par Description: + * Set message id field to the passed msg_id. + * + * \par Purpose: + * This API is used to set the Message Id of the message object + * + * \par Typical use case: + * Explicitly set the msgId member of message object. + * + * \par Method of function operation: + * Set the msgId member of msg_message_t to the passed msgId. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param int input - Message Id to be set to the message id. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * err = msg_set_message_id(msg, 0); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_release_message() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_message_id(msg_message_t msg, int msg_id); + + +/** + + * \par Description: + * Get the message id in message object. + * + * \par Purpose: + * This API is used to get the Message Id of the message object + * + * \par Typical use case: + * Msg Id is needed to perform many operations on the message object. + * + * \par Method of function operation: + * Returns the Message Id of the message object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object whose msgId is returned. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * msgId = msg_get_message_id(msg); + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_message_id(msg_message_t msg); + + +/** + + * \par Description: + * Check if the message object is an SMS Message + * + * \par Purpose: + * This API is used to to check if the message object is SMS type message + * + * \par Typical use case: + * To check if the message object type is SMS. + * + * \par Method of function operation: + * Compares the message object against SMS message type. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, nothing happens. + * - If msg is invalid, undefined behavior happens. + * + * \param msg_message_t input - message object which is to be decided if its SMS. + * + * \return Return Type (bool) \n + * - true - If message object is SMS \n + * - false - If message object is not SMS. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * if( msg_is_sms(msg) ) + * { + * sprintf(str, "Message object is SMS"); + * print(str); + * } + *... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +bool msg_is_sms(msg_message_t msg); + + + +/** + + * \par Description: + * Check if the message object is an MMS Message + * + * \par Purpose: + * This API is used to to check if the message object is MMS type message + * + * \par Typical use case: + * To check if the message object type is MMS. + * + * \par Method of function operation: + * Compares the message object against MMS message type. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object which is to be decided if its MMS. + * + * \return Return Type (bool) \n + * - true - If message object is MMS \n + * - false - If message object is not MMS. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * if( msg_is_mms(msg) ) + * { + * sprintf(str, "Message object is MMS"); + * print(str); + * } + *... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +bool msg_is_mms(msg_message_t msg); + + +/** + + * \par Description: + * Set storage id field to the passed storage_id. + * + * \par Purpose: + * This API is used to set the Storage Id of the message object + * + * \par Typical use case: + * Message objects can be saved in either phone memory or SIM card, this API helps in setting the same. + * + * \par Method of function operation: + * Set the storageId member of msg_message_t to the passed Storage Id. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param MSG_STORAGE_ID_T input - Storage Id to be set to the message storage id. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * MSG_STORAGE_ID_T storageId = 0; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * err = msg_set_storage_id(msg, storageId); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_storage_id() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_storage_id(msg_message_t opq_msg, MSG_STORAGE_ID_T storage_id); + + +/** + + * \par Description: + * Gets storage id field of the message object. + * + * \par Purpose: + * This API is used to get Storage Id of the message object + * + * \par Typical use case: + * * Message objects can be saved in either phone memory or SIM card, this API helps in getting the same. + * + * \par Method of function operation: + * Returnsthe storageId member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * + * \return Return Type (int (MSG_ERROR_T when negative, enum _MSG_STORAGE_ID_E when positive)) \n + * - storageId - Returns the storage Id defined by enum _MSG_STORAGE_ID_E. \n + * - MSG_ERR_NULL_POINTER msg is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * MSG_STORAGE_ID_T storageId = 0; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * storageId = msg_get_storage_id(msg); + * + * sprintf(str, "msg_set_storage_id() storageId [%d]", storageId); + * print(str); + * + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_storage_id(msg_message_t opq_msg); + + +/** + + * \par Description: + * Check if the message object is saved in SIM card + * + * \par Purpose: + * This API is used to to check if the message object is saved in SIM card + * + * \par Typical use case: + * Message can be stored in Phone memory or SIM card, to check this we can use this API. + * + * \par Method of function operation: + * Checks if storage Id is SIM and returns boolean. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * + * \return Return Type (bool) \n + * - true - If message object is stored in SIM \n + * - false - If message object is not stored in SIM. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * if( msg_is_in_sim(msg) ) + * { + * sprintf(str, "Message object stored in SIM"); + * print(str); + * } + *... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +bool msg_is_in_sim(msg_message_t msg); + + +/** + + * \par Description: + * Set the message type field to msg_type. + * + * \par Purpose: + * This API is used to set the Message Type of the message object + * + * \par Typical use case: + * Message Objects can be SMS, MMS, etc message types, this API helps to set the message type. + * + * \par Method of function operation: + * Set the msgType member of msg_message_t to the passed msgType. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param MSG_MESSAGE_TYPE_T input - Message type to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_message_t msg; + * MSG_ERROR_T err = MSG_SUCCESS; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * err = msg_set_message_type(msg, MSG_TYPE_SMS); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_message_type() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_message_type(msg_message_t msg, MSG_MESSAGE_TYPE_T msg_type); + + +/** + + * \par Description: + * Gets Message type field of the message object. + * + * \par Purpose: + * This API is used to get Message Type of the message object + * + * \par Typical use case: + * Message Objects can be SMS, MMS, etc message types, this API helps to get the message type. + * + * \par Method of function operation: + * Returns the msgType member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgType is to be set. + * + * \return Return Type (int) \n + * - msgType - Returns the Message type of the Message object passed \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_message_t msg; + * MSG_ERROR_T err = MSG_SUCCESS; + * int msgType = 0; + + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * msgType = msg_get_message_type(msg); + * + * sprintf(str, "msg_get_message_type() Type [%d]", msgType); + * print(str); + * + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_message_type(msg_message_t msg); + + +/** + + * \par Description: + * Set the folder id field to folder_id. + * + * \par Purpose: + * This API is used to sets the Folder Id of the message object + * + * \par Typical use case: + * Message Objects can be associated with different folders such as Inbox, Outbox, Sent, etc. this API enables to set the folder id. + * + * \par Method of function operation: + * Set the folderId member of msg_message_t to the passed folder_id. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param MSG_FOLDER_ID_T input - Folder Id to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * MSG_FOLDER_ID_T folder_id = MSG_INBOX_ID; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * err = msg_set_folder_id(msg, folder_id); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_folder_id() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_folder_id(msg_message_t msg, MSG_FOLDER_ID_T folder_id); + + +/** + + * \par Description: + * Gets Folder Id field of the message object. + * + * \par Purpose: + * This API is used to get Folder Id of the message object + * + * \par Typical use case: + * Message Objects can be associated with different folders such as Inbox, Outbox, Sent, etc. this API enables to get the folder id. + * + * \par Method of function operation: + * Returns the folderId member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type (int) \n + * - storageId - Returns the Folder Id of the Message object passed \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int folderId = 0; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_add_message(msgHandle, msg, &sendOpt); + * ... + * folderId = msg_get_folder_id(msg); + * + * sprintf(str, "msg_get_folder_id() Folder Id [%d]", folderId); + * print(str); + * + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_folder_id(msg_message_t msg); + + +/** + + * \par Description: + * Reset address field in message object. + * + * \par Purpose: + * This API is used for modifying the message object, such as forwarding a message. + * + * \par Typical use case: + * Message Object address field might be needed to reset. This API helps in the same. + * + * \par Method of function operation: + * Flushes the already set address list and reset to defaults. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * + * \return Return Type (bool) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0}; + * err = msg_get_message(msgHandle, (MSG_MESSAGE_ID_T)msgId, msg, &sendOpt); + * err = msg_reset_address(msg); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_release_message() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reset_address(msg_message_t msg); + + +/** + + * \par Description: + * Add recipient address in message object. + * + * \par Purpose: + * This API is used for adding address to the message object. + * + * \par Typical use case: + * Message Object recipient address field should be filled before message can be sent over the network. + * + * \par Method of function operation: + * The phone_num_list is added to the addressList member of the message object structure. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * \param phone_num_list input - concatenated number string, which is separated by ",", such as "1112223333, 4445556666". + * \param to_type input - to_type is one of enum _MSG_RECIPIENT_TYPE_E. + * + * \return Return Type (bool) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0}; + * err = msg_get_message(msgHandle, (MSG_MESSAGE_ID_T)msgId, msg, &sendOpt); + * err = msg_add_address(msg, "+1004", MSG_RECIPIENTS_TYPE_TO); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_release_message() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_add_address(msg_message_t msg, const char* phone_num_list, MSG_RECIPIENT_TYPE_T to_type); + + +/** + + * \par Description: + * Return count of recipient address in message object. + * + * \par Purpose: + * This API is used for getting the count of recipient addresses in the message object. + * + * \par Typical use case: + * To get the count of the recipient list in the message object. + * + * \par Method of function operation: + * Returns the address count member of the message object.. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * + * \return Return Type (int) \n + * - recipient count \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int nCount; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0}; + * nCount = msg_get_address_count(msg); + * sprintf(str, "msg_add_address() nCount [%d]", nCount); + * print(str); + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_address_count(msg_message_t msg); + + +/** + + * \par Description: + * Return ith thread id in message object. + * + * \par Purpose: + * This API is used for getting the ith thread id in message object. + * + * \par Typical use case: + * Get the requested thread id from the message object. + * + * \par Method of function operation: + * Returns the ith thread id from the message object address list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * \param int input - thread id. + * + * \return Return Type (int) \n + * - thread id \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int nCount; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_get_ith_thread_id(msg, 0); + * if(err != MSG_SUCCESS) + * { + * sprintf(str, "msg_get_ith_thread_id() Fail [%d]", err); + * print(str); + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_ith_thread_id(msg_message_t msg, int ith); + + +/** + + * \par Description: + * Return ith recipient address in message object. + * + * \par Purpose: + * This API is used for getting the ith recipient address in message object. + * + * \par Typical use case: + * To get the requested recipient address index from the message object. + * + * \par Method of function operation: + * Returns the ith recipient address in address list from the message object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - You do not need to free the return value. It will be freed when you call msg_release_message(). + * - Also, the value is valid until msg_message_t is freed by calling msg_release_message(). + * + * \param msg_message_t input - message object. + * \param int input - recipient address index. + * + * \return Return Type (int) \n + * - thread id \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * const char* address; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * address = msg_get_ith_address(msg, 0); + * if(address != NULL && strlen(address) > 0) + * { + * sprintf(str, "msg_get_ith_address() address [%s]", address); + * print(str); + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +const char* msg_get_ith_address(msg_message_t msg, int ith); + + +/** + + * \par Description: + * Return ith recipient type in message object. + * + * \par Purpose: + * This API is used for getting the ith recipient type in message object. + * + * \par Typical use case: + * To get the requested recipient type from the message object. + * + * \par Method of function operation: + * Returns the ith recipient type in address list from the message object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * \param int input - recipient address index. + * + * \return Return Type (int) \n + * - thread id \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int r_type; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * r_type = msg_get_ith_recipient_type(msg, 0); + * sprintf(str, "msg_get_ith_recipient_type() r_type [%s]", r_type); + * print(str); + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_ith_recipient_type(msg_message_t msg, int ith); + + +/** + + * \par Description: + * Return ith recipient name which is associated with contact engine. + * + * \par Purpose: + * This API is used for getting the ith recipient name which is associated with contact engine. + * + * \par Typical use case: + * To get the requested recipient name from the message object which is associated with the contact engine. + * + * \par Method of function operation: + * Returns the ith recipient name of the address list from the message object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - You do not need to free the return value. It will be freed when you call msg_release_message(). + * - Also, the value is valid until msg_message_t is freed by calling msg_release_message(). + * + * \param msg_message_t input - message object. + * \param int input - recipient address index. + * + * \return Return Type (int) \n + * - thread id \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * const char* name; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * name = msg_get_ith_name(msg, 0); + * if(name != NULL && strlen(name) > 0) + * { + * sprintf(str, "msg_get_ith_recipient_type() name [%s]", name); + * print(str); + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +const char* msg_get_ith_name(msg_message_t msg, int ith); + + +/** + + * \par Description: + * Return ith recipient contact id which is associated with contact engine. + * + * \par Purpose: + * This API is used for getting the ith recipient contact id which is associated with contact engine. + * + * \par Typical use case: + * To get the requested recipient contact id from the message object which is associated with the contact engine. + * + * \par Method of function operation: + * Returns the ith recipient contact id in address list from the message object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, nothing happens. + * - If msg is invalid, undefined behavior happens. + * + * \param msg_message_t input - message object. + * \param int input - recipient address index. + * + * \return Return Type (int) \n + * - thread id \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int contact_id; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * ... + * contact_id = msg_get_ith_contact_id(msg, 0); + * sprintf(str, "msg_get_ith_contact_id() contact_id [%d]", contact_id); + * print(str); + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_ith_contact_id(msg_message_t msg, int ith); + + +/** + + * \par Description: + * Add reply address in message object. + * + * \par Purpose: + * This API is used for adding reply address to the message object. + * + * \par Typical use case: + * Message Object reply address field should be filled before message can be sent over the network. + * + * \par Method of function operation: + * The phone_num is set to the replyAddress of the message object structure. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * \param phone_num input - phone number such as "1112223333, 4445556666". + * + * \return Return Type (bool) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * - MSG_ERR_INVALID_PARAMETER - Input parameter is too long. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0}; + * err = msg_get_message(msgHandle, (MSG_MESSAGE_ID_T)msgId, msg, &sendOpt); + * err = msg_set_reply_address(msg, "+821030016057"); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_release_message() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_reply_address(msg_message_t opq_msg, const char* phone_num); + + +/** + + * \par Description: + * Set data field to mdata of size. SMS data is used for either of text or binary data. + * + * \par Purpose: + * This API is used to set the Message data field of the message object to the passed mdata parameter of size bytes. + * + * \par Typical use case: + * Message Object needs to be filled with the data member, in case of SMS data can be text or binary and in case of MMS data is the MIME encoded buffer. + * + * \par Method of function operation: + * Copies "size" bytes of mdata to the pData member of the message object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param const char* input - data to be set. + * \param int input - size of mdata to be set to message object + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * - MSG_ERR_INVALID_PARAMETER class_type is not one of enum _MSG_CLASS_TYPE_E. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * const char *msg_body = "Sample Message Body"; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * ... + * msg = msg_new_message(); + * + * ... + * ... + * err = msg_sms_set_message_body(msg, msg_body, strlen(msg_body)); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_sms_set_message_body() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_sms_set_message_body(msg_message_t msg, const char* mdata, int size); + + +/** + + * \par Description: + * Return data field in message object. SMS data is used for either of text or binary data. + * + * \par Purpose: + * This API is used for getting the data field of the message object. + * + * \par Typical use case: + * Message Object needs to be filled with the data member, in case of SMS data can be text or binary and in case of MMS data is the MIME encoded buffer. + * + * \par Method of function operation: + * Returns the storageId member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * + * \return Return Type (const char* (message body)) \n + * - char array - Message body data \n + * - NULL - Error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * const char *msg_body; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * msg_body = msg_sms_get_message_body(msg); + * if (msg_body != NULL && strlen(msg_body) > 0) + * { + * sprintf(str, "msg_sms_set_message_body() msg_body [%s]", msg_body); + * print(str); + * } + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ + /*================================================================================================*/ +const char* msg_sms_get_message_body(msg_message_t msg); + + +/** + + * \par Description: + * Return data field in message object. MMS data is used for text. + * + * \par Purpose: + * This API is used for getting the data field of the message object. + * + * \par Typical use case: + * Message Object needs to be filled with the data member, in case of SMS data can be text or binary and in case of MMS data is the MIME encoded buffer. + * + * \par Method of function operation: + * Returns the storageId member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * + * \return Return Type (const char* (message body)) \n + * - char array - Message body data \n + * - NULL - Error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * const char *msg_body; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * msg_body = msg_mms_get_text_contents(msg); + * if (msg_body != NULL && strlen(msg_body) > 0) + * { + * sprintf(str, "msg_mms_get_text_contents() msg_body [%s]", msg_body); + * print(str); + * } + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ + /*================================================================================================*/ +const char* msg_mms_get_text_contents(msg_message_t msg); + + +/** + + * \par Description: + * Gets the size of data field in message object. + * + * \par Purpose: + * This API is used for getting the size of data field in message object. + * + * \par Typical use case: + * Size of the Message data field can be useful in various scenarios such as restrict sending large MMS, display size to user, etc. + * + * \par Method of function operation: + * Returns the dataSize member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type (int) \n + * - int - Size of the data in the Message Object + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msg_body_size; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * msg_body_size = msg_get_message_body_size(msg); + * sprintf(str, "msg_sms_set_message_body() msg_body_size [%d]", msg_body_size); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_message_body_size(msg_message_t msg); + + +/** + + * \par Description: + * Sets subject field of the message object to subject. This API is used for MMS. + * + * \par Purpose: + * This API is used for setting the subject field of the message object + * + * \par Typical use case: + * MMS message object may contain subject field, this API enables to set the same. + * + * \par Method of function operation: + * Set the subject member of msg_message_t to the passed subject. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param const char* input - Subject to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * const char* subject = "Test Subject"; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_set_subject(msg, subject); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_subject() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_subject(msg_message_t msg, const char* subject); + + +/** + + * \par Description: + * Returns the subject field of the message object. This API is used for MMS. + * + * \par Purpose: + * This API is used for getting the subject field of the message object + * + * \par Typical use case: + * MMS message object may contain subject field, this API enables to get the same. + * + * \par Method of function operation: + * Returns the subject member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type (const char*) \n + * - const char - MMS message subject \n + * - NULL - Message object/Subject field is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * char* msg_subject; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * msg_subject = msg_get_subject(msg); + * if(msg_subject != NULL && strlen(msg_subject) > 0) + * { + * sprintf(str, "msg_get_subject() msg_subject [%s]", msg_subject); + * print(str); + * } + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +const char* msg_get_subject(msg_message_t msg); + + +/** + + * \par Description: + * Set time field to msg_time of the message object. \n + * If you need to update time in message object, use this API with passing time() in time.h. + * + * \par Purpose: + * This API is used for setting the message time of the message object + * + * \par Typical use case: + * Message object should contain the time field before it is sent over the network. + * + * \par Method of function operation: + * Set the msg_time member of msg_message_t to the passed msg_time. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param const char* input - Subject to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * time_t curTime = time(NULL); + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... +* msg = msg_new_message(); +* err = msg_set_time(msgInfo, curTime); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_time() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_time(msg_message_t msg, time_t msg_time); + + +/** + + * \par Description: + * Return the time field in message object. + * + * \par Purpose: + * This API is used for getting the time field of the message object + * + * \par Typical use case: + * Message object should contain the time field before it is sent over the network. + * + * \par Method of function operation: + * Returns the msg_time member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type (time_t) \n + * - time_t - Message time value \n + * - NULL - Message object is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * time_t msg_time; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * msg_time = msg_get_time(msg); + * sprintf(str, "msg_get_time() msg_time [%s]", ctime(msg_time)); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +time_t* msg_get_time(msg_message_t msg); + + +/** + + * \par Description: + * Set network status to status. Network status represents the status result when you send/receive the message. + * + * \par Purpose: + * This API is used for setting the network status field of the message object + * + * \par Typical use case: + * Network status represents the status result when you send/receive the message. + * + * \par Method of function operation: + * Set the networkStatus member of msg_message_t to the passed status. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param int input - status is one of enum _MSG_NETWORK_STATUS_E. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err= msg_set_network_status(msg, MSG_NETWORK_SEND_SUCCESS); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_network_status() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_network_status(msg_message_t msg, MSG_NETWORK_STATUS_T status); + + +/** + + * \par Description: + * Returns the network status of message object. Network status represents the status result when you send/receive the message. + * + * \par Purpose: + * This API is used for getting the networkStatus field of the message object + * + * \par Typical use case: + * Network status represents the status result when you send/receive the message. + * + * \par Method of function operation: + * Returns the networkStatus member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type (int (MSG_ERROR_T when negative, enum _MSG_NETWORK_STATUS_E when positive)) \n + * - positive int enum _MSG_NETWORK_STATUS_E. + * - MSG_ERR_NULL_POINTER msg is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int network_status; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * network_status = msg_get_network_status(msg); + *sprintf(str, "msg_get_network_status() network_status [%d]", network_status); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_network_status(msg_message_t msg); + + +/** + + * \par Description: + * Set message data encode type to encoding_type. The message data is encoded with one of GSM-7, ascii, ucs2, or auto. + * + * \par Purpose: + * This API is used for setting the encode type field of the message object + * + * \par Typical use case: + * The message data is encoded with one of GSM-7, ascii, ucs2, or auto. + * + * \par Method of function operation: + * Set the encodeType member of msg_message_t to the passed encoding_type. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * \param MSG_ENCODE_TYPE_T input - encode type to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_set_encode_type(msgInfo, MSG_ENCODE_GSM7BIT); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_encode_type() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_encode_type(msg_message_t msg, MSG_ENCODE_TYPE_T encoding_type); + + +/** + + * \par Description: + * Return message data encode type. The message data is encoded with one of GSM-7, ascii, ucs2, or auto. + * + * \par Purpose: + * This API is used for getting the encode type field of the message object + * + * \par Typical use case: + * The message data is encoded with one of GSM-7, ascii, ucs2, or auto. + * + * \par Method of function operation: + * Returns the encodeType member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type (int) \n + * - positive int enum MSG_ENCODE_TYPE_T. + * - MSG_ERR_NULL_POINTER msg is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int encode_type; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * encode_type = msg_get_encode_type(msg); + * sprintf(str, "msg_get_network_status() encode_type [%d]", encode_type); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_encode_type(msg_message_t msg); + + +/** + + * \par Description: + * Set message read status to read_flag. + * + * \par Purpose: + * This API is used to set read status to bRead field of the message object + * + * \par Typical use case: + * Read status can be set using this API. + * + * \par Method of function operation: + * Set the bRead member of msg_message_t to the passed read_flag. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * \param bool input - read status to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_set_read_status(msg, true); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_read_status() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_read_status(msg_message_t msg, bool read_flag); + + +/** + + * \par Description: + * Return true if the message is read. + * + * \par Purpose: + * This API is used to check if the message object is read. + * + * \par Typical use case: + * Read status can be checked using this API. + * + * \par Method of function operation: + * Checks if message object is read and returns bool. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * + * \return Return Type (bool) \n + * - true - If message object is read \n + * - false - If message object is not read. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * if( msg_is_read(msgInfo) ) + * { + * sprintf(str, "Message object is read"); + * print(str); + * } + *... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +bool msg_is_read(msg_message_t msg); + + +/** + + * \par Description: + * Set message protect status to protect_flag. + * + * \par Purpose: + * This API is used to set message protect status to protect_flag. + * + * \par Typical use case: + * Message protect status can be set using this API. + * + * \par Method of function operation: + * Set the bProtected member of msg_message_t to the passed protect_flag. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * \param bool input - protect status to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_set_protect_status(msg, true); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_protect_status() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_protect_status(msg_message_t msg, bool protect_flag); + + +/** + + * \par Description: + * Return true if the message is protected. + * + * \par Purpose: + * This API is used to check if the message object is protected. + * + * \par Typical use case: + * Protected status can be checked using this API. + * + * \par Method of function operation: + * Checks if message object is protected and returns bool. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * + * \return Return Type (bool) \n + * - true - If message object is protected \n + * - false - If message object is not protected. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * if( msg_is_protected(msgInfo) ) + * { + * sprintf(str, "Message object is protected"); + * print(str); + * } + *... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +bool msg_is_protected(msg_message_t msg); + + +/** + + * \par Description: + * Set message backup status to backup_flag. + * + * \par Purpose: + * This API is used to set message backup status to backup_flag. + * + * \par Typical use case: + * Message backup status can be set using this API. + * + * \par Method of function operation: + * Set the bBackup member of msg_message_t to the passed backup_flag. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * \param bool input - backup status to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_set_backup_status(msg, true); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_backup_status() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_backup_status(msg_message_t opq_msg, bool backup_flag); + + +/** + + * \par Description: + * Return true if the message is a backup. + * + * \par Purpose: + * This API is used to check if the message object is a backup. + * + * \par Typical use case: + * Backup status can be checked using this API. + * + * \par Method of function operation: + * Checks if message object is a backup and returns bool. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object. + * + * \return Return Type (bool) \n + * - true - If message object is a backup \n + * - false - If message object is not a backup. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int msgId; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * if( msg_is_backup(msgInfo) ) + * { + * sprintf(str, "Message object is a backup"); + * print(str); + * } + *... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +bool msg_is_backup(msg_message_t opq_msg); + + +/** + + * \par Description: + * Set message priority to priority. + * + * \par Purpose: + * This API is used to set message priority to priority. + * + * \par Typical use case: + * Message priority can be set using this API. + * + * \par Method of function operation: + * Set the priority member of msg_message_t to the passed priority. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * \param bool input - priority status to be set. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_set_priority_info(msgInfo, MSG_MESSAGE_PRIORITY_NORMAL); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_priority_info() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_priority_info(msg_message_t msg, MSG_PRIORITY_TYPE_T priority); + + +/** + + * \par Description: + * Return priority value in message object. + * + * \par Purpose: + * This API is used for getting the priority field of the message object + * + * \par Typical use case: + * Message priority can be got using this API. + * + * \par Method of function operation: + * Returns the priority member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type int (MSG_ERROR_T when negative, enum _MSG_PRIORITY_TYPE_E) \n + * - positive int enum _MSG_PRIORITY_TYPE_E. + * - MSG_ERR_NULL_POINTER msg is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int priority; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * priority = msg_get_priority_info(msg); + * sprintf(str, "msg_get_priority_info() priority [%d]", priority); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_priority_info(msg_message_t msg); + + +/** + + * \par Description: + * Set message direction to direction. + * + * \par Purpose: + * This API is used to set message direction to direction. + * + * \par Typical use case: + * Message direction can be set using this API. + * + * \par Method of function operation: + * Set the direction member of msg_message_t to the passed direction. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * \param int input - defined in enum _MSG_DIRECTION_TYPE_E. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_set_direction_info(msgInfo, MSG_DIRECTION_TYPE_MT); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_direction_info() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_direction_info(msg_message_t msg, MSG_DIRECTION_TYPE_T direction); + + +/** + + * \par Description: + * Return direction information in message object. + * + * \par Purpose: + * This API is used for getting the direction information in message object. + * + * \par Typical use case: + * Message direction can be got using this API. + * + * \par Method of function operation: + * Returns the direction member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type int (MSG_ERROR_T when negative, enum _MSG_DIRECTION_TYPE_E when positive) \n + * - positive int enum _MSG_DIRECTION_TYPE_E. + * - MSG_ERR_NULL_POINTER msg is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int direction; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * direction = msg_get_direction_info(msg); + * sprintf(str, "msg_get_direction_info() direction [%d]", direction); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_direction_info(msg_message_t msg); + + +/** + + * \par Description: + * Set message port to dst_prt and src_port. + * + * \par Purpose: + * This API is used to set message port to dst_prt and src_port. + * + * \par Typical use case: + * Message source and destinatin ports are used in case of Push message. + * + * \par Method of function operation: + * Set the msgPort member of msg_message_t to the passed source and destination port. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * \param src_port is the port of origin. + * \param dst_port is the destination port for recipient. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_set_port(msg, 656, 656); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_port() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_port(msg_message_t msg, unsigned short dst_port, unsigned short src_port); + + +/** + + * \par Description: + * Return destination port number in message object. + * + * \par Purpose: + * This API is used for getting destination port number in message object. + * + * \par Typical use case: + * Recipient destinatin port be got using this API. + * + * \par Method of function operation: + * Returns the destination port from msgPort member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type (int (MSG_ERROR_T when negative, destination port number when positive)) \n + * - positive int Destination port + * - MSG_ERR_NULL_POINTER msg is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int dest_port; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * dest_port = msg_get_dest_port(msg); + * sprintf(str, "msg_get_dest_port() dest_port [%d]", dest_port); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_dest_port(msg_message_t msg); + + +/** + + * \par Description: + * Return source port number in message object. + * + * \par Purpose: + * This API is used for getting source port number in message object. + * + * \par Typical use case: + * Recipient source port be got using this API. + * + * \par Method of function operation: + * Returns the source port from msgPort member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type int (MSG_ERROR_T when negative, destination port number when positive) \n + * - positive int source port. + * - MSG_ERR_NULL_POINTER msg is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int source_port; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * source_port = msg_get_src_port(msg); + * sprintf(str, "msg_get_src_port() source_port [%d]", source_port); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_src_port(msg_message_t msg); + + +/** + + * \par Description: + * Set scheduled time to time_to_send, which is used for scheduled send. + * + * \par Purpose: + * This API is used to set scheduled time to time_to_send, which is used for scheduled send. + * + * \par Typical use case: + * Used to set Schedule Message feature on Message object + * + * \par Method of function operation: + * Set the scheduledTime member of msg_message_t to the passed time_to_send. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * \param int input - defined in enum _MSG_DIRECTION_TYPE_E. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * time_t scheduledTime; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * time(&scheduledTime); + * + * err = msg_set_scheduled_time(msgInfo, scheduledTime); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_set_scheduled_time() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * ... + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_scheduled_time(msg_message_t msg, time_t time_to_send); + + + +/** + + * \par Description: + * Return pointer to scheduled time in message object, which can be used for ctime(time_t*) parameter + * + * \par Purpose: + * This API is used for getting the scheduled time in message object. + * + * \par Typical use case: + * Used to get Schedule Message feature on Message object + * + * \par Method of function operation: + * Returns the scheduledTime member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type time_t \n + * - time_t Message scheduled time. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * time_t time_to_send; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * time_to_send = msg_get_scheduled_time(msg); + * sprintf(str, "msg_get_scheduled_time() time_to_send [%d]", time_to_send); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +time_t* msg_get_scheduled_time(msg_message_t msg); + + + +/** + + * \par Description: + * Get attachment count from MMS message. + * + * \par Purpose: + * This API is used for getting the attachment count in message object. + * + * \par Typical use case: + * Used to get attachment count feature on Message object + * + * \par Method of function operation: + * Returns the attachCount member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type int \n + * - int Message attachment count. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * int attach_count; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * attach_count = msg_get_attachment_count(msg); + * sprintf(str, "msg_get_attachment_count() attach_count [%d]", attach_count); + * print(str); + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_attachment_count(msg_message_t opq_msg); + + +/** + + * \par Description: + * Returns the thumbnail path field of the message object. This API is used for MMS. + * + * \par Purpose: + * This API is used for getting the thumbnail path field of the message object + * + * \par Typical use case: + * MMS message object may contain thumbnail path field, this API enables to get the same. + * + * \par Method of function operation: + * Returns the thumbnail path member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object. + * + * \return Return Type (const char*) \n + * - const char - MMS message thumbnail path \n + * - NULL - Message object/thumbnail path field is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * char* msg_thumbnail_path; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(hMsgHandle, 1, msg, &sendOpt); + * ... + * msg_thumbnail_path = msg_get_thumbnail_path(msg); + * if(msg_subject != NULL && strlen(msg_subject) > 0) + * { + * sprintf(str, "msg_get_thumbnail_path() msg_thumbnail_path [%s]", msg_thumbnail_path); + * print(str); + * } + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ +/*================================================================================================*/ +const char* msg_get_thumbnail_path(msg_message_t opq_msg); + + + +/** + + * \par Description: + * Set message data to MMS msg_data. This API is used for constructing MMS data. + * + * \par Purpose: + * This API is used to set the Message data field of the message object to the passed MMS message data. + * + * \par Typical use case: + * Compose the MMS_MESSAGE_DATA_S structure using msg_mms_* API and then this API can be called to set the MMS body. + * + * \par Method of function operation: + * Serialized "size" bytes of mdata to the pData member of the message object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is NULL, no action is done + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param const char* input - data to be set. + * \param int input - size of mdata to be set to message object + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * - MSG_ERR_INVALID_PARAMETER class_type is not one of enum _MSG_CLASS_TYPE_E. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * Refer to msg_mms_* APIs. + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * ... + * mms_data = msg_mms_create_message(); + * ... + * ... + * err = msg_mms_set_message_body(msgInfo, mms_data); + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_mms_set_message_body() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * err = msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_mms_set_message_body(msg_message_t msg, const MMS_MESSAGE_DATA_S *msg_data); + + +/** + + * \par Description: + * Return pointer to MMS data in message object. + * + * \par Purpose: + * This API is used for getting pointer to MMS data in message object. + * + * \par Typical use case: + * Get the filled MMS data fromthe Message Object. + * + * \par Method of function operation: + * Returns the storageId member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg is invalid, behavior is undefined + * + * \param msg_message_t input - message object whose msgId is to be set. + * \param MMS_MESSAGE_DATA_S - body is passed by pointer, which contains MMS message data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * - MSG_ERR_INVALID_PARAMETER class_type is not one of enum _MSG_CLASS_TYPE_E. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * MMS_MESSAGE_DATA_S msgBody = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * msg_get_message(msgHandle, 1, msg, &sendOpt); + * + * ... + * err = msg_mms_get_message_body(msg, &msgBody); + * // access msgBody members using msg_mms_get_* APIs + * + * .. + * err = msg_release_message(&msg); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_get_message_body(msg_message_t msg, MMS_MESSAGE_DATA_S *body ); + + +/** + + * \par Description: + * Adds a SMIL page to MMS message data. + * + * \par Purpose: + * This API is used for adding a SMIL page to MMS message data. + * + * \par Typical use case: + * Add SMIL Page information to the MMS Message Object. + * + * \par Method of function operation: + * Returns the storageId member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * The memory for a SMIL page will be allocated and copied in this function. \n + * Applications need to call msg_mms_release_page_list to free the memory. \n + * However, if this function is failed, the memory for a SMIL page is NOT allocated in this function. + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param int - duration is time interval to play MMS SMIL page. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MMS_PAGE_S* - Newly added MMS_PAGE_S object is returned \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_PAGE_S* page[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * page[0] = msg_mms_add_page(mms_data, 5440); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_PAGE_S* msg_mms_add_page(MMS_MESSAGE_DATA_S *msg_data, const int duration); + + +/** + + * \par Description: + * Adds a SMIL region to MMS message data. + * + * \par Purpose: + * This API is used for adding a SMIL page to MMS message data. + * + * \par Typical use case: + * Add SMIL Page information to the MMS Message Object. + * + * \par Method of function operation: + * Allocates and assigns MMS_SMIL_REGION to region list member of MMS Message data object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * The memory for a SMIL page will be allocated and copied in this function. \n + * Applications need to call msg_mms_release_page_list to free the memory. \n + * However, if this function is failed, the memory for a SMIL page is NOT allocated in this function. + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param const char* - szID is a pointer to SMIL region. + * \param const int - x coordinate of SMIL region. + * \param const int - y coordinate of SMIL region. + * \param const int - width of SMIL region. + * \param const int - height of SMIL region. + * \param int - background color of SMIL region. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MMS_SMIL_REGION* - Newly added MMS_SMIL_REGION object is returned \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_PAGE_S* page[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * MMS_SMIL_REGION *mms_region; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * ... + * msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + * mms_region = msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + * page[0] = msg_mms_add_page(mms_data, 5440); + * + * .. + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_SMIL_REGION* msg_mms_add_region(MMS_MESSAGE_DATA_S *msg_data, const char* szID, const int x, const int y, const int width, const int height, int bgcolor); + + +/** + + * \par Description: + * Adds a media to SMIL page. + * + * \par Purpose: + * This API is used for adding media to SMIL page of the MMS Message Data object. + * + * \par Typical use case: + * Add media to SMIL Page information of the MMS Message Object. + * + * \par Method of function operation: + * Allocates and assigns MMS_MEDIA_S to media list member of MMS Message data object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * The memory for a SMIL page will be allocated and copied in this function. \n + * Applications need to call msg_mms_release_page_list to free the memory. \n + * However, if this function is failed, the memory for a SMIL page is NOT allocated in this function. + * + * \param MMS_PAGE_S* - page is a pointer to SMIL page. + * \param const MmsSmilMediaType - mediatype is a value to point the media category. + * \param const char* - regionid is a pointer of region, media to be displayed. + * \param char* - filepath is a pointer of media file location. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MMS_MEDIA_S* - Newly added MMS_MEDIA_S object is returned \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_PAGE_S* page[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * MMS_SMIL_REGION *mms_region; + * MMS_MEDIA_S* media[5]; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * page[0] = msg_mms_add_page(mms_data, 5440); + * media [0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/abc/xyz.jpg"); + * + * .. + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_MEDIA_S* msg_mms_add_media(MMS_PAGE_S *page, const MmsSmilMediaType mediatype, const char* regionid, char* filepath); + + +/** + + * \par Description: + * Adds an attachment to MMS message data. + * + * \par Purpose: + * This API is used for adding an attachment to MMS message data. + * + * \par Typical use case: + * Adds attachment to SMIL Page information of the MMS Message Object. + * + * \par Method of function operation: + * Adds the filepath to attach list member of MMS Message data object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * The memory for a SMIL page will be allocated and copied in this function. \n + * Applications need to call msg_mms_release_page_list to free the memory. \n + * However, if this function is failed, the memory for a SMIL page is NOT allocated in this function. + * + * \param MMS_PAGE_S* - page is a pointer to SMIL page. + * \param const MmsSmilMediaType - mediatype is a value to point the media category. + * \param const char* - regionid is a pointer of region, media to be displayed. + * \param char* - filepath is a pointer of media file location. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MMS_MEDIA_S* - Newly added MMS_MEDIA_S object is returned \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * MMS_ATTACH_S* attachment[1]; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * attachment[0] = msg_mms_add_attachment(mms_data, (char*)"/opt/abc/xyz.jpg"); + * + * .. + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_ATTACH_S* msg_mms_add_attachment(MMS_MESSAGE_DATA_S *msg_data, char *filepath); + + +/** + + * \par Description: + * Adds a SMIL transition information to MMS message data. + * + * \par Purpose: + * This API is used for adding a SMIL transition information to MMS message data. + * + * \par Typical use case: + * Adds SMIL transition information of the MMS Message data. + * + * \par Method of function operation: + * Allocates and assigns MMS_SMIL_TRANSITION to transition list member of MMS Message data object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * The memory for a SMIL page will be allocated and copied in this function. \n + * Applications need to call msg_mms_release_page_list to free the memory. \n + * However, if this function is failed, the memory for a SMIL page is NOT allocated in this function. + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param MMS_SMIL_TRANSITION * - transition is a pointer to SMIL transition information. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * MSG_SUCCESS Success in operation. + * MSG_ERR_INVALID_PARAMETER Parameter is invalid. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * MMS_SMIL_TRANSITION transition; + * err = msg_mms_add_transition(mms_data, &transition); + * .. + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_add_transition(MMS_MESSAGE_DATA_S *msg_data, MMS_SMIL_TRANSITION *transition); + + +/** + + * \par Description: + * Adds SMIL meta information to MMS message data. + * + * \par Purpose: + * This API is used for adding SMIL meta information to MMS message data. + * + * \par Typical use case: + * Adds SMIL meta information of the MMS Message data. + * + * \par Method of function operation: + * Allocates and assigns MMS_SMIL_META to meta list member of MMS Message data object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * The memory for a SMIL page will be allocated and copied in this function. \n + * Applications need to call msg_mms_release_page_list to free the memory. \n + * However, if this function is failed, the memory for a SMIL page is NOT allocated in this function. + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param MMS_SMIL_META * - meta is a pointer to SMIL meta information. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * MSG_SUCCESS Success in operation. + * MSG_ERR_INVALID_PARAMETER Parameter is invalid. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * MMS_SMIL_META meta; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * MMS_MEDIA_S* media = NULL; + * media = msg_mms_add_meta(mms_data, &meta); + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_add_meta(MMS_MESSAGE_DATA_S *msg_data, MMS_SMIL_META *meta); + + +/* MMS-1.3-con-601 */ +/** + + * \par Description: + * Gets a SMIL page information of the current MMS message. + * + * \par Purpose: + * This API is used to get a SMIL page information + * + * \par Typical use case: + * Gets SMIL Page information of the MMS Message Object. + * + * \par Method of function operation: + * Returns the page_idx page from the pagelist member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after SMIL page is added. \n + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param int page_idx - page_idx is the index of the SMIL page to be returned. + * + * \return Return Type (MMS_PAGE_S*) \n + * - MMS_PAGE_S* - page_idx MMS_PAGE_S object is returned \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_PAGE_S* page[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * page[0] = msg_mms_get_page(mms_data, 0); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_PAGE_S* msg_mms_get_page(MMS_MESSAGE_DATA_S *msg_data, int page_idx); + + +/** + + * \par Description: + * Gets a SMIL region information of the current MMS message. + * + * \par Purpose: + * This API is used to gets a SMIL region information. + * + * \par Typical use case: + * Gets SMIL region information of the current MMS Message Object. + * + * \par Method of function operation: + * Returns the media_idx media from the current media list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after SMIL region is added. + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param int input - region_idx is the index of the SMIL region to be returned. + * + * \return Return Type (MMS_SMIL_REGION*) \n + * - MMS_SMIL_REGION* - pointer to MMS_SMIL_REGION structure. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_SMIL_REGION* region[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * region[0] = msg_mms_get_smil_region(mms_data, 0); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_SMIL_REGION* msg_mms_get_smil_region(MMS_MESSAGE_DATA_S *msg_data, int region_idx); + + +/** + + * \par Description: + * Gets a media information in a SMIL page of the current MMS message. + * + * \par Purpose: + * This API is used to get a media information in a SMIL page + * + * \par Typical use case: + * Gets media information of the current MMS Message Object. + * + * \par Method of function operation: + * Returns the media_idx media from the current media list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after media is added. \n + * + * \param int input - media_idx is the index of the media to be returned. \n + * \param MMS_PAGE_S* - page is a pointer to SMIL page. + * + * \return Return Type (MMS_MEDIA_S*) \n + * - MMS_MEDIA_S* - pointer to MMS_MEDIA_S structure. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MEDIA_S* media[2]; + * MMS_PAGE_S *page[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * media[0] = msg_mms_get_media(page, 0); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_MEDIA_S* msg_mms_get_media(MMS_PAGE_S *page, int media_idx); + +/** + + * \par Description: + * Gets a attachment information of the current MMS message. + * + * \par Purpose: + * This API is used to get a attachment information + * + * \par Typical use case: + * Gets attachment information of the MMS Message Object. + * + * \par Method of function operation: + * Returns the attach_idx attachment from the attachlist member of msg_message_t. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after attachment is added. \n + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param int input - attach_idx is the index of the attachment to be returned. + * + * \return Return Type (MMS_ATTACH_S*) \n + * - MMS_ATTACH_S* - pointer to MMS_ATTACH_S structure. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_ATTACH_S* attachment[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * attachment[0] = msg_mms_get_attachment(mms_data, 0); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_ATTACH_S* msg_mms_get_attachment(MMS_MESSAGE_DATA_S *msg_data, int attach_idx); + + +/** + + * \par Description: + * Gets a SMIL transition information of the current MMS message. + * + * \par Purpose: + * This API is used to get a SMIL transition information. + * + * \par Typical use case: + * Gets SMIL transition information of the current MMS Message Object. + * + * \par Method of function operation: + * Returns the transition_idx transition from the current transition list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after SMIL transition is added. + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param int input - transition_idx is the index of the SMIL transition to be returned. + * + * \return Return Type (MMS_SMIL_TRANSITION*) \n + * - MMS_SMIL_TRANSITION* - pointer to MMS_SMIL_TRANSITION structure. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * MMS_SMIL_TRANSITION* pTrans = msg_mms_get_transition(mms_data, 0); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_SMIL_TRANSITION* msg_mms_get_transition(MMS_MESSAGE_DATA_S *msg_data, int transition_idx); + + +/** + + * \par Description: + * Gets a SMIL meta information of the current MMS message. + * + * \par Purpose: + * This API is used to get a SMIL meta information. + * + * \par Typical use case: + * Gets SMIL meta information of the current MMS Message Object. + * + * \par Method of function operation: + * Returns the meta_idx meta from the current meta list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after SMIL meta is added. + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * \param int input - meta_idx is the index of the SMIL meta to be returned. + * + * \return Return Type (MMS_SMIL_META*) \n + * - MMS_SMIL_META* - pointer to MMS_SMIL_META structure. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * MMS_SMIL_META* pMeta = msg_mms_get_meta(mms_data, 0); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_SMIL_META* msg_mms_get_meta(MMS_MESSAGE_DATA_S *msg_data, int meta_idx); + + +/** + + * \par Description: + * Release a SMIL page list of the current MMS message. + * + * \par Purpose: + * This API is used to release a SMIL page list + * + * \par Typical use case: + * Release SMIL page list of the MMS message object + * + * \par Method of function operation: + * Release SMIL page list of MMS_MESSAGE_DATA_S object + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after SMIL page is added. \n + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * MSG_SUCCESS Success in operation. + * MSG_ERR_NULL_POINTER Parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_PAGE_S* page[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * ... + * page[0] = msg_mms_add_page(mms_data, 5440); + * ... + * page[0] = msg_mms_get_page(0); + * + * msg_mms_release_page_list(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_release_page_list(MMS_MESSAGE_DATA_S *msg_data); + + +/** + + * \par Description: + * Release a SMIL region list of the current MMS message. + * + * \par Purpose: + * This API is used to release a SMIL region list + * + * \par Typical use case: + * Release SMIL region list of the MMS message object + * + * \par Method of function operation: + * Release SMIL region list of MMS_MESSAGE_DATA_S object + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after SMIL region is added. \n + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * MSG_SUCCESS Success in operation. + * MSG_ERR_NULL_POINTER Parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_PAGE_S* page[2]; + * MMS_MESSAGE_DATA_S* mms_data; + * MMS_SMIL_REGION *mms_region; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * ... + * msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + * mms_region = msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + * page[0] = msg_mms_add_page(mms_data, 5440); + * ... + * msg_mms_release_region_list(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_release_region_list(MMS_MESSAGE_DATA_S *msg_data); + + +/** + + * \par Description: + * Release an attachment list of the current MMS message. + * + * \par Purpose: + * This API is used to release an attachment list + * + * \par Typical use case: + * Release an attachment list of the MMS message object + * + * \par Method of function operation: + * Release an attachment list of MMS_MESSAGE_DATA_S object + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after attachment is added. \n + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * MSG_SUCCESS Success in operation. + * MSG_ERR_NULL_POINTER Parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * MMS_ATTACH_S* attachment[1]; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * attachment[0] = msg_mms_add_attachment(mms_data, (char*)"/opt/abc/xyz.jpg"); + * + * .. + * msg_mms_release_attachment_list(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_release_attachment_list(MMS_MESSAGE_DATA_S *msg_data); + + +/** + + * \par Description: + * Release a SMIL transition list of the current MMS message. + * + * \par Purpose: + * This API is used to release a SMIL transition list + * + * \par Typical use case: + * Release a SMIL transition list of the MMS message object + * + * \par Method of function operation: + * Release a SMIL transition list of MMS_MESSAGE_DATA_S object + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after SMIL transition is added. \n + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * MSG_SUCCESS Success in operation. + * MSG_ERR_NULL_POINTER Parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * MMS_ATTACH_S* attachment[1]; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * MMS_SMIL_TRANSITION transition; + * err = msg_mms_add_transition(mms_data, &transition); + * .. + * msg_mms_release_transition_list(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_release_transition_list(MMS_MESSAGE_DATA_S *msg_data); + + +/** + + * \par Description: + * Release a SMIL meta list of the current MMS message. + * + * \par Purpose: + * This API is used to release a SMIL meta list + * + * \par Typical use case: + * Release a SMIL meta list of the MMS message object + * + * \par Method of function operation: + * Release a SMIL meta list of MMS_MESSAGE_DATA_S object + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called only after SMIL meta is added. \n + * + * \param MMS_MESSAGE_DATA_S - msg_data is a pointer to MMS message data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * MSG_SUCCESS Success in operation. + * MSG_ERR_NULL_POINTER Parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * MMS_SMIL_META meta; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * MMS_MEDIA_S* media = NULL; + * media = msg_mms_add_meta(mms_data, &meta); + * ... + * msg_mms_release_meta_list(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_release_meta_list(MMS_MESSAGE_DATA_S *msg_data); + + +/** + + * \par Description: + * Creates a MMS message data + * + * \par Purpose: + * This API creates a MMS message data + * + * \par Typical use case: + * MMS Message object should be created before adding Page, SMIL, attachment information. + * + * \par Method of function operation: + * Allocates and returns a pointer to MMS_MESSAGE_DATA_S. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * The created MMS_MESSAGE_DATA_S object should be explicitly destroyed using msg_mms_destroy_message() + * + * \param None input + * + * \return Return Type (MMS_MESSAGE_DATA_S*) \n + * - MMS_MESSAGE_DATA_S* - pointer to newly created MMS_MESSAGE_DATA_S structure. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_MESSAGE_DATA_S* msg_mms_create_message(void); + + +/** + + * \par Description: + * Set the MMS root-layout + * + * \par Purpose: + * This API is used for adding a SMIL page to MMS message data. + * + * \par Typical use case: + * Add SMIL Page information to the MMS Message Object. + * + * \par Method of function operation: + * Sets the rootlayout member to the passed root layout. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * None + * + * \param MMS_MESSAGE_DATA_S* - msg is a pointer to mms message data. + * \param const int - width of root-layout + * \param const int - height of root-layout + * \param int - background color of root-layout + * + * \return Return Type (MMS_SMIL_ROOTLAYOUT*) \n + * - MMS_SMIL_ROOTLAYOUT* - pointer to MMS_SMIL_ROOTLAYOUT object is returned \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * MMS_MESSAGE_DATA_S* mms_data; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * ... + * msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + * .. + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +MMS_SMIL_ROOTLAYOUT* msg_mms_set_rootlayout(MMS_MESSAGE_DATA_S* msg, const int width, const int height, const int bgcolor); + + +/** + + * \par Description: + * Destroy the created MMS message data. + * + * \par Purpose: + * This API destroys the created MMS message data. + * + * \par Typical use case: + * To free memory allocated with create message API. + * + * \par Method of function operation: + * Frees the memory associated with MMS_MESSAGE_DATA_S object . + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + *This function MUST be called only after MMS message is created by msg_mms_create_message. + * + * \param + * MMS_MESSAGE_DATA_S input - msg is a pointer to MMS message data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * MSG_SUCCESS Success in operation. + * MSG_ERR_NULL_POINTER Parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * mms_data = msg_mms_create_message(); + * + * ... + * msg_mms_destroy_message(mms_data); + * ... + * \endcode + */ + /*================================================================================================*/ +int msg_mms_destroy_message(MMS_MESSAGE_DATA_S* msg); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/mapi/MapiSetting.h b/include/mapi/MapiSetting.h new file mode 100755 index 0000000..808a8c0 --- /dev/null +++ b/include/mapi/MapiSetting.h @@ -0,0 +1,176 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MAPI_SETTING_H +#define MAPI_SETTING_H + +/** + * @section Introduction + * - Introduction : Overview on Messaging Setting API + * @section Program + * - Program : Messaging Setting API Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ + +#include "MsgSettingTypes.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_SETTING_API Messaging Setting API + * @{ + */ + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +/** + + * \par Description: + * Sets a Messaging option such as SMS/MMS sending options, Push settings etc.. + * + * \par Purpose: + * This API is used to set message options. + * + * \par Typical use case: + * Used in setting the messaging options such as SMS/MMS sending options, Push message settings etc. + * + * \par Method of function operation: + * Stores the MSG_SETTING_S settings to storage such as gconf, etc. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * None + * + * \param input - MSG_HANDLE_T handle is Message handle. + * \param input - MSG_SETTING_S setting is a pointer to setting information. + * + * \return Return Type int (MSG_ERROR_T) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_SET_WRITE_ERROR Setting configuration is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SETTING_S setting; + * MSG_ERROR_T err; + * + * ... + * err = msg_set_config(msgHandle, &setting); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_set_config(MSG_HANDLE_T handle, const MSG_SETTING_S *setting); + + +/** + + * \par Description: + * Retrieve a Messaging option such as SMS/MMS sending options, Push settings etc.. + * + * \par Purpose: + * This API is used to getting message options. + * + * \par Typical use case: + * Used in setting the messaging options such as SMS/MMS sending options, Push message settings etc. + * + * \par Method of function operation: + * Stores the MSG_SETTING_S settings to storage such as gconf, etc. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * None + * + * \param input - MSG_HANDLE_T handle is Message handle. + * \param input - MSG_SETTING_S setting is a pointer to setting information. + * + * \return Return Type int (MSG_ERROR_T) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_SET_READ_ERROR Getting configuration is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SETTING_S setting; + * MSG_ERROR_T err; + * + * ... + * err = msg_get_config(msgHandle, &setting); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_config(MSG_HANDLE_T handle, MSG_SETTING_S *setting); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // MAPI_SETTING_H + diff --git a/include/mapi/MapiStorage.h b/include/mapi/MapiStorage.h new file mode 100755 index 0000000..f7bd550 --- /dev/null +++ b/include/mapi/MapiStorage.h @@ -0,0 +1,3043 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +/** + * @file MapiStorage.h + * @brief Defines storage API of messaging framework + * @version 1.0 + */ + +#ifndef MAPI_STORAGE_H +#define MAPI_STORAGE_H + +/** + * @section Introduction + * - Introduction : Overview on Messaging Storage API + * @section Program + * - Program : Messaging Storage API Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ + +#include "MsgStorageTypes.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_STORAGE_API Messaging Storage API + * @{ + */ + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +/** + + * \par Description: + * Saves a message to the database. + * + * \par Purpose: + * This API is used to save Message object to the database. + * + * \par Typical use case: + * Save Message feature is used when the message is to be stored to persistent memory for later reference. + * + * \par Method of function operation: + * Sets up the database connection and inserts the message to message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - Mandatory fields of a message structure MUST be valid, otherwise the function will be failed. + * + * \param input - MSG_HANDLE_T handle is Message handle. + * \param input - msg_message_t msg is a pointer to an msg_message_t structure. + * \param input - send_opt is a pointer to an MSG_SENDINGOPT_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_message_t msg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_add_message(handle, (msg_message_t) &msg, &sendingOpt); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_add_message(MSG_HANDLE_T handle, const msg_message_t msg, const MSG_SENDINGOPT_S *send_opt); + + +/** + + * \par Description: + * Adds a SyncML message to the database. + * + * \par Purpose: + * This API is used to save a SyncML message to the database. + * + * \par Typical use case: + * Save Message feature is used when the message is to be stored to persistent memory for later reference. + * + * \par Method of function operation: + * Sets up the database connection and inserts the syncml message to message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - Mandatory fields of a message structure MUST be valid, otherwise the function will be failed. + * + * \param input - MSG_HANDLE_T handle is Message handle. + * \param input - MSG_SYNCML_MESSAGE_S syncml_msg is a pointer to an MSG_SYNCML_MESSAGE_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_NULL_POINTER - pMsg is NULL. + * - MSG_ERR_INVALID_MSGHANDLE - Message handle is invalid. + * - MSG_ERR_MSGHANDLE_NOT_CONNECTED - Message handle is not connected. + * - MSG_ERR_STORAGE_FULL - Storage is FULL. + * - MSG_ERR_COMMUNICATION_ERROR - Communication between client and server is error. + * - MSG_ERR_MEMORY_ERROR - Memory is error. + * - MSG_ERR_MAX_NUMBER_REACHED - Max number is reached. + * - MSG_ERR_PLUGIN - Generic error code for plugin. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * int err = msg_add_syncml_message(msgHandle, &syncMLMsg); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_add_syncml_message(MSG_HANDLE_T handle, const MSG_SYNCML_MESSAGE_S *syncml_msg); + + +/** + + * \par Description: + * Updates a message in the database. + * + * \par Purpose: + * This API is used to update a message in the database. + * + * \par Typical use case: + * Update message feature is used when a previously saved message is to be updated. + * + * \par Method of function operation: + * Sets up the database connection and set the message's new values to message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The function is to update message data for the message indentified by the given msgId as long as the given values are valid. + * - msg->msgId MUST NOT be updated because msg->msgId is a unique Id on platform. + * - If applications want to move a message between folders, applications SHOULD call msg_move_to_folder. + * - msg->storageId MUST NOT be updated. + * - The function will return MSG_ERR_INVALID_MESSAGE, if inputting a new msg->storageId. + * - If applications want to move the message between storages, applications SHOULD call msg_move_to_storage. + * + * \param input - handle is Message handle. + * \param input - msg is a pointer to an msg_message_t structure. + * \param input - send_opt is a pointer to an MSG_SENDINGOPT_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_update_message(hMsgHandle, pMsg, &sendOpt); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_update_message(MSG_HANDLE_T handle, const msg_message_t msg, const MSG_SENDINGOPT_S *send_opt); + + +/** + + * \par Description: + * Updates a message's read status in the database. + * + * \par Purpose: + * This API is used to Updates a message's read status in the database. + * + * \par Typical use case: + * Update message's read status for a previously saved message. + * + * \par Method of function operation: + * Sets up the database connection and updates the message's read status to message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_id is Message ID. + * \parem input - read is boolean for indicating whether a message is read or not. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_update_message(hMsgHandle, pMsg, &sendOpt); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_update_read_status(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, bool read); + + +/** + + * \par Description: + * Updates a message's protected status in the database. + * + * \par Purpose: + * This API is used to Updates a message's protected status in the database. + * + * \par Typical use case: + * Update message's protected status for a previously saved message. + * + * \par Method of function operation: + * Sets up the database connection and updates the message's protected status to message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_id is Message ID. + * \parem input - is_protected is boolean for indicating whether a message is protected or not. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_update_protected_status(hMsgHandle, 0, true); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_update_protected_status(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, bool is_protected); + + +/** + + * \par Description: + * Deletes a message by Message ID from the database. + * + * \par Purpose: + * This API is used to delete a message by Message ID from the database. + * + * \par Typical use case: + * Deletes a previously saved message from the database. + * + * \par Method of function operation: + * Sets up the database connection and deletes a message by Message ID from the message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_id is the ID of the Message to be deleted. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_delete_message(msgHandle, 0); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_delete_message(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id); + + +/** + + * \par Description: + * Deletes all messages in the specified folder from the database. + * + * \par Purpose: + * This API is used to delete all messages in the specified folder from the database. + * + * \par Typical use case: + * Deletes all messages in the specified folder from the database. + * + * \par Method of function operation: + * Sets up the database connection and Deletes all messages in the specified folder from the message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - folder_id is the ID of the folder to be deleted. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_delete_all_msgs_in_folder(msgHandle, MSG_DRAFT_ID); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_delete_all_msgs_in_folder(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id, bool bOnlyDB); + + + +/** + + * \par Description: + * Moves a message to the specified folder in the database. + * + * \par Purpose: + * This API is used to move a message to the specified folder the database. + * + * \par Typical use case: + * Deletes all messages in the specified folder from the database. + * + * \par Method of function operation: + * Sets up the database connection and Deletes all messages in the specified folder from the message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_id is the ID of the message to be moved. + * \param input - dest_folder_id is the ID of the destination folder. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_move_msg_to_folder(hMsgHandle, 0, MSG_OUTBOX_ID); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_move_msg_to_folder(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, MSG_FOLDER_ID_T dest_folder_id); + + +/** + + * \par Description: + * Moves a message to the other storage. + * + * \par Purpose: + * This API is usd to move a message to the other storage. + * + * \par Typical use case: + * Moves a message to the other storage type. + * + * \par Method of function operation: + * Sets up the database connection and moves a messages to specified storage type. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_id is the ID of the message to be moved. + * \param input - storage_id is the ID of the destination storage. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_move_msg_to_storage( msgHandle, 0, MSG_STORAGE_PHONE); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_move_msg_to_storage(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, MSG_STORAGE_ID_T storage_id); + + +/** + + * \par Description: + * Gets the number of messages in the specified folder from the database. + * + * \par Purpose: + * This API is used to get the number of messages in the specified folder from the database. + * + * \par Typical use case: + * Gets the number of messages in the specified folder from the database. + * + * \par Method of function operation: + * Sets up the database connection and Gets the number of messages in the specified folder from the message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - folder_id is the ID of the folder to be counted. + * \param output - count_info is a pointer to an MSG_COUNT_INFO_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_COUNT_INFO_S countInfo; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_count_message(msgHandle, MSG_OUTBOX_ID, &countInfo) +* if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_count_message(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id, MSG_COUNT_INFO_S *count_info); + + +/** + + * \par Description: + * Gets the number of messages of specific message type. + * + * \par Purpose: + * This API is used to get the number of messages of specific type. + * + * \par Typical use case: + * Gets the count of message of specific types such as SMS, MMS. + * + * \par Method of function operation: + * Sets up the database connection and queries the number of messages in the specified folder from the message table based on required message type. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_type is the message type to be counted. + * \param output - msg_count is a pointer to the number of message. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_COUNT_INFO_S countInfo; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_count_msg_by_type(msgHandle, MSG_TYPE_SMS, &countInfo); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_count_msg_by_type(MSG_HANDLE_T handle, MSG_MESSAGE_TYPE_T msg_type, int *msg_count); + + +/** + + * \par Description: + * Gets the number of messages of specific address. + * + * \par Purpose: + * This API is used to get the number of messages from a specific address. + * + * \par Typical use case: + * Get the count of messages from the specified address + * + * \par Method of function operation: + * Sets up the database connection and queries the number of messages based on address from the message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If addr_info is NULL, nothing happens. + * + * \param input - handle is Message handle. + * \param input - addr_info is a pointer to an MSG_ADDRESS_INFO_LIST_S structure. + * \param input - msg_thread_count_list is a pointer to an MSG_THREAD_COUNT_INFO_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_COUNT_INFO_S countInfo; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_count_msg_by_type(msgHandle, MSG_TYPE_SMS, &countInfo); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_count_msg_by_contact(MSG_HANDLE_T handle, const MSG_THREAD_LIST_INDEX_S *addr_info, MSG_THREAD_COUNT_INFO_S *msg_thread_count_list); + + +/** + + * \par Description: + * Gets the detail information of a message from the database. + * + * \par Purpose: + * This API is used to get the number of messages from a specific address. + * + * \par Typical use case: + * Get the count of messages from the specified address + * + * \par Method of function operation: + * Sets up the database connection and queries the number of messages based on address from the message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If addr_info is NULL, nothing happens. + * - Applications need to call msg_release_message to free the memory. + * - However, if this function is failed, the memory for the message is NOT allocated in this function. + * +handle is Message handle. + * \param input - handle is Message handle. + * \param input - msg_id is the ID of the Message to be returned. + * \param output - msg is a pointer to an msg_message_t structure. + * \param input - send_opt is a pointer to an MSG_SENDINGOPT_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * - None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * + * ... + * msg_message_t msg = msg_new_message(); + * MSG_SENDINGOPT_S sendOpt = {0, }; + * ... + * err = msg_get_message(msgHandle, 0, msg, &sendOpt); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_message(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, msg_message_t msg, MSG_SENDINGOPT_S *send_opt); + + +/** + + * \par Description: + * Returns the common information list of messages with selected folder id. + * + * \par Purpose: + * This API is used to get the common information list of messages with selected folder id from database. + * + * \par Typical use case: + * Get the common information from the specified folder from database. + * + * \par Method of function operation: + * Sets up the database connection and queries the common information based on selected folder id from the message and folder tables. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The memory for a message will be allocated in this function. + * - Applications need to call msg_release_folder_view_list to free the memory. + * - However, if this function is failed, the memory for the message is NOT allocated in this function. + * + * \param input - handle is Message handle. + * \param input - folder_id is the ID of the folder to be returned. + * \param input - sort_rule indicates a sort type and sort order for querying messages. + * \param output - msg_folder_view_list is a pointer to an MSG_FOLDER_VIEW_LIST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * - None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * + * ... + * MSG_FOLDER_VIEW_LIST_S folderViewList; + * ... + * err = msg_get_folder_view_list(hMsgHandle, 0, NULL, &folderViewList); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_folder_view_list(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id, const MSG_SORT_RULE_S *sort_rule, MSG_LIST_S *msg_folder_view_list); + + +/** + + * \par Description: + * Returns the information of all peers to whom messages have been sent or recieved. + * + * \par Purpose: + * This API is used to get the information of all peers to whom messages have been sent or recieved. + * + * \par Typical use case: + * Get the common information from the specified folder from database. + * + * \par Method of function operation: + * Frees the memory occupied by MSG_FOLDER_VIEW_LIST_S object and its members. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The memory for a list will be allocated in this function. + * - Applications need to call msg_release_thread_view_list to free the memory. + * - However, if this function is failed, the memory for a list is NOT allocated in this function. + * + * \param input - handle is Message handle. + * \param input - sort_rule indicates a sort type and sort order for querying messages. + * \param output - msg_thread_view_list is a pointer to an MSG_THREAD_VIEW_LIST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * + * ... + * MSG_THREAD_VIEW_LIST_S threadViewList; + * ... + * err = msg_get_thread_view_list(hMsgHandle, NULL, &threadViewList); + * ... + * msg_release_thread_view_list(&threadViewList); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * \endcode + */ +/*================================================================================================*/ +int msg_get_thread_view_list(MSG_HANDLE_T handle, const MSG_SORT_RULE_S *sort_rule, MSG_THREAD_VIEW_LIST_S *msg_thread_view_list); + + +/** + + * \par Description: + * Frees the memory of MSG_PEER_INFO_LIST_S allocated in msg_get_thread_view_list. + * + * \par Purpose: + * This API is used to get the information of all peers to whom messages have been sent or recieved. + * + * \par Typical use case: + * Get the common information from the specified folder from database. + * + * \par Method of function operation: + * Frees the memory occupied by MSG_FOLDER_VIEW_LIST_S object and its members. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The memory for a list will be allocated in this function. + * - Applications need to call msg_release_thread_view_list to free the memory. + * - However, if this function is failed, the memory for a list is NOT allocated in this function. + * + * \param input - msg_thread_view_list is a pointer to an MSG_THREAD_VIEW_LIST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * + * ... + * MSG_THREAD_VIEW_LIST_S threadViewList; + * ... + * err = msg_get_thread_view_list(hMsgHandle, NULL, &threadViewList); + * ... + * msg_release_thread_view_list(&threadViewList); + * ... + * \endcode + */ +/*================================================================================================*/ +void msg_release_thread_view_list(MSG_THREAD_VIEW_LIST_S *msg_thread_view_list); + + +/** + + * \par Description: + * Returns the common information list of messages with selected thread_id. + * + * \par Purpose: + * This API is used to get the common information list of messages with selected thread_id. + * + * \par Typical use case: + * Gets the common information list of messages with the selected thread id from the database. + * + * \par Method of function operation: + * Connects to the database and queries the common infomation of list messages with the provided thread id. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The memory for a list will be allocated in this function. + * - Applications need to call msg_release_conversation_view_list to free the memory. + * - However, if this function is failed, the memory for a list is NOT allocated in this function. + * + * \param input - hMsgHandle is Message handle. + * \param input - thread_id is the ID of the thread to be returned. + * \param output - msg_conv_view_list is a pointer to an MSG_CONV_VIEW_LIST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * - None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * ... + * MSG_CONV_VIEW_LIST_S convViewList; + * ... + * err = msg_get_conversation_view_list(hMsgHandle, ThreadId, &convViewList); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * msg_release_conversation_view_list(&convViewList); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_conversation_view_list(MSG_HANDLE_T handle, MSG_THREAD_ID_T thread_id, MSG_LIST_S *msg_conv_view_list); + + +/** + + * \par Description: + * Deletes all the Messages Sent/Received from the selected list. + * + * \par Purpose: + * This API is used to delete all the Messages Sent/Received from the selected list. + * + * \par Typical use case: + * Deletes all messages sent/received from the selected list. + * + * \par Method of function operation: + * Sets up the database connection and deletes all messages sent/received from a selected list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If addr_info is NULL, nothing happens. + * + * \param input - handle is Message handle. + * \param input - thread_id is the ID of the thread to be deleted. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_SYNCML_MESSAGE_S syncMLMsg; + * MSG_SENDINGOPT_S sendingOpt = {0}; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_delete_thread_message_list(hMsgHandle, 0); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_delete_thread_message_list(MSG_HANDLE_T handle, MSG_THREAD_ID_T thread_id); + + +/** + + * \par Description: + * Adds a new folder. + * + * \par Purpose: + * This API is used to add a new folder. + * + * \par Typical use case: + * Adds a new folder with the specified folder info + * + * \par Method of function operation: + * Sets up the database connection and add a new folder to the folder table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None. + * + * \param - handle is Message handle. + * \param - folder_info is a pointer to an MSG_FOLDER_INFO_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * Make Folder + * MSG_FOLDER_INFO_S folderInfo; + * ... + * err = msg_open_msg_handle(&msgHandle); + * + * folderInfo.folderId = 1; + * folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; + * ... + * + * err = msg_add_folder(hMsgHandle, &folderInfo); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_add_folder(MSG_HANDLE_T handle, const MSG_FOLDER_INFO_S *folder_info); + + +/** + + * \par Description: + * Updates the folder info. + * + * \par Purpose: + * This API is used to add a new folder. + * + * \par Typical use case: + * Adds a new folder with the specified folder info + * + * \par Method of function operation: + * Sets up the database connection and add a new folder to the folder table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None. + * + * \param - handle is Message handle. + * \param - folder_info is a pointer to an MSG_FOLDER_INFO_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * Make Folder + * MSG_FOLDER_INFO_S folderInfo; + * ... + * err = msg_open_msg_handle(&msgHandle); + * + * folderInfo.folderId = 2; + * folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; + * ... + * err = msg_update_folder(msgHandle, &folderInfo); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_update_folder(MSG_HANDLE_T handle, const MSG_FOLDER_INFO_S *folder_info); + + +/** + + * \par Description: + * Deletes an exisiting folder. + * + * \par Purpose: + * This API is used to delete an existing folder. + * + * \par Typical use case: + * Deletes an existing folder. + * + * \par Method of function operation: + * Sets up the database connection and deletes an existing folder to the folder table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None. + * + * \param input - handle is Message handle. + * \param input - folder_id is the ID of the folder to be deleted. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * err = msg_delete_folder(hMsgHandle, MSG_INBOX_ID); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_delete_folder(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id); + + +/** + + * \par Description: + * Returns the information list of folders. + * + * \par Purpose: + * This API is used to get the information list of folders. + * + * \par Typical use case: + * Gets the folder list information. + * + * \par Method of function operation: + * Sets up the database connection and queries for the folder list information. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None. + * + * \param input - handle is Message handle. + * \param output - folder_list is a pointer to an MSG_FOLDER_LIST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_FOLDER_LIST_S folderList; + + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * err = msg_get_folder_list(msgHandle, &folderList); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * msg_release_folder_list(&folderList); + * \endcode + */ +/*================================================================================================*/ +int msg_get_folder_list(MSG_HANDLE_T handle, MSG_FOLDER_LIST_S *folder_list); + + + +/** + + * \par Description: + * Releases the memory of a folder list. + * + * \par Purpose: + * This API is used to get the information list of folders. + * + * \par Typical use case: + * Gets the folder list information. + * + * \par Method of function operation: + * Sets up the database connection and queries for the folder list information. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If folder_list is NULL, nothing happens. + * - If folder_list is invalid, undefined behavior happens. + * + * \param input - folder_list is a pointer to an MSG_FOLDER_LIST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_FOLDER_LIST_S folderList; + + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * err = msg_get_folder_list(msgHandle, &folderList); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * msg_release_folder_list(&folderList); + * \endcode + */ +/*================================================================================================*/ +void msg_release_folder_list(MSG_FOLDER_LIST_S *folder_list); + + +/** + + * \par Description: + * Creates the specified number of messages in database. + * + * \par Purpose: + * This API is used to generate specified number of messages in the database + * + * \par Typical use case: + * Generate large number of messages in the database. + * + * \par Method of function operation: + * Creates the specified number of messages in database for specified message type in the specified folder + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_type is one of enum _MSG_MESSAGE_TYPE_E. + * \param input - folder_id is the folder for the test messages. + * \param input - num_msg is the number of messages. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Parameter is invalid. + * - MSG_ERR_INVALID_FOLDER_ID Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_FOLDER_LIST_S folderList; + + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * err = msg_generate_message(msgHandle, MSG_TYPE_SMS, MSG_INBOX_ID, 100); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_generate_message(MSG_HANDLE_T handle, MSG_MESSAGE_TYPE_T msg_type, MSG_FOLDER_ID_T folder_id, unsigned int num_msg); +int msg_generate_sms(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id, unsigned int num_msg) DEPRECATED; + + +/** + + * \par Description: + * Returns the Message Data to be used by the Quick Panel. + * + * \par Purpose: + * This API is used to get the Message Datato be used by the Quick Panel. + * + * \par Typical use case: + * Quick panel needs the message information to show new message notification. + * + * \par Method of function operation: + * Connects to database and queries for information needed by the quick panel. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - type is the type of message that Quick Panel need. + * \param output - msg is a pointer to an msg_message_t structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Parameter is invalid. + * - MSG_ERR_INVALID_FOLDER_ID Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_message_t msgInfo; + + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * err = msg_get_quick_panel_data(msgHandle, MSG_QUICKPANEL_SMS, msgInfo); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_quick_panel_data(MSG_HANDLE_T handle, MSG_QUICKPANEL_TYPE_T type, msg_message_t msg); + + +/** + + * \par Description: + * Resets the Messaging database. + * + * \par Purpose: + * This API is used to reset the messaging database. + * + * \par Typical use case: + * Completely delete the messaging database. + * + * \par Method of function operation: + * Connects to database and deletes all the messaging tables. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * err = msg_reset_database(msgHandle); + * if (err != MSG_SUCCESS) + *{ + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reset_database(MSG_HANDLE_T handle); + + +/** + + * \par Description: + * Returns the total size used for message contents. + * + * \par Purpose: + * This API is used to get the total size used for message contents. + * + * \par Typical use case: + * To get the total space used by message contents. + * + * \par Method of function operation: + * Uses linux system calls to query the space used by message contents. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param output - memsize is a pointer to the size. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * int memsize = 0; + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * err = msg_get_mem_size(msgHandle, &memsize); + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_mem_size(MSG_HANDLE_T handle, unsigned int* memsize); + + +/** + + * \par Description: + * Return thread id in thread view object. + * + * \par Purpose: + * This API is used to get the thread id field in folder view object. + * + * \par Typical use case: + * Returns thread id value in thread view object. + * + * \par Method of function operation: + * Returns the threadId member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type int (MSG_ERROR_T when negative, msg_id when positive) \n + * - positive int thread id. + * - MSG_ERR_NULL_POINTER msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * MSG_ERROR_T err; + * + * ... + * err = msg_thread_view_get_thread_id(&msgThreadInfo); + * if(msg_size > 0) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_thread_view_get_thread_id(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return address value in thread view object. + * + * \par Purpose: + * This API is used to get the address value in thread view object. + * + * \par Typical use case: + * Returns address value in thread view object. + * + * \par Method of function operation: + * Returns the threadAddr member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * - You do not need to free the return value. It will be freed when you call msg_release_thread_view_list(). + * - Also, the value is valid until msg_thread_view_t is freed by calling msg_release_thread_view_list(). + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type int const char* (address value) \n + * - const char* address value. + * - NULL msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * char* addr = NULL; + * + * ... + * addr = msg_thread_view_get_address(&msgThreadInfo); + * if(addr != 0 && strlen(addt) > 0) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +const char* msg_thread_view_get_address(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return display name value in thread view object. + * + * \par Purpose: + * This API is used to get the display name value in thread view object. + * + * \par Typical use case: + * Returns address value in thread view object. + * + * \par Method of function operation: + * Returns the threadName member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * - You do not need to free the return value. It will be freed when you call msg_release_thread_view_list(). + * - Also, the value is valid until msg_thread_view_t is freed by calling msg_release_thread_view_list(). + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type int const char* (display name) \n + * - const char* display name. + * - NULL msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * char* disp_name = NULL; + * + * ... + * disp_name = msg_thread_view_get_name(&msgThreadInfo); + * if(disp_name != 0 && strlen(disp_name) > 0) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +const char* msg_thread_view_get_name(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return image path in thread view object. + * + * \par Purpose: + * This API is used to get the image path value in thread view object. + * + * \par Typical use case: + * Returns image path value in thread view object. + * + * \par Method of function operation: + * Returns the threadImagePath member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * - You do not need to free the return value. It will be freed when you call msg_release_thread_view_list(). + * - Also, the value is valid until msg_thread_view_t is freed by calling msg_release_thread_view_list(). + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type int const char* (thread image path) \n + * - const char* thread image path. + * - NULL msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * char* img_path = NULL; + * + * ... + * img_path = msg_thread_view_get_name(&msgThreadInfo); + * if(img_path != 0 && strlen(img_path) > 0) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +const char* msg_thread_view_get_image_path(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return the message type field in thread view object. + * + * \par Purpose: + * This API is used to get the message type field value in thread view object. + * + * \par Typical use case: + * Returns the message type value in thread view object. + * + * \par Method of function operation: + * Returns the msgType member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * - You do not need to free the return value. It will be freed when you call msg_release_thread_view_list(). + * - Also, the value is valid until msg_thread_view_t is freed by calling msg_release_thread_view_list(). + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type (int (MSG_ERROR_T when negative, msg_type when positive)) \n + * - positive int enum _MSG_MESSAGE_TYPE_E. + * - EINVAL msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * MSG_MESSAGE_TYPE_T msg_type; + * + * ... + * msg_type = msg_thread_view_get_message_type(&msgThreadInfo); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_thread_view_get_message_type(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return data field in thread view object. + * + * \par Purpose: + * This API is used to get the data field value in thread view object. + * + * \par Typical use case: + * Returns data value in thread view object. + * + * \par Method of function operation: + * Returns the threadData member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * - You do not need to free the return value. It will be freed when you call msg_release_thread_view_list(). + * - Also, the value is valid until msg_thread_view_t is freed by calling msg_release_thread_view_list(). + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type int const char* (message data) \n + * - const char* message data. + * - NULL msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * char* msg_data = NULL; + * + * ... + * msg_data = msg_thread_view_get_data(&msgThreadInfo); + * if(msg_data != 0 && strlen(msg_data) > 0) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +const char* msg_thread_view_get_data(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return time field in thread view object. + * + * \par Purpose: + * This API is used to get the time field value in thread view object. + * + * \par Typical use case: + * Returns time value in thread view object. + * + * \par Method of function operation: + * Returns the threadTime member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * - You do not need to free the return value. It will be freed when you call msg_release_thread_view_list(). + * - Also, the value is valid until msg_thread_view_t is freed by calling msg_release_thread_view_list(). + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type (time_t) \n + * - time_t message time. + * - NULL thread view object is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * time_t msg_time; + * + * ... + * msg_time = msg_thread_view_get_time(&msgThreadInfo); + * ... + * \endcode + */ +/*================================================================================================*/ +time_t* msg_thread_view_get_time(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return direction field in thread view object. + * + * \par Purpose: + * This API is used to get the direction field value in thread view object. + * + * \par Typical use case: + * Returns direction value in thread view object. + * + * \par Method of function operation: + * Returns the direction member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type (time_t) \n + * - positive int enum _MSG_DIRECTION_TYPE_E. + * - MSG_ERR_NULL_POINTER msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * int direction; + * + * ... + * direction = msg_thread_view_get_direction(&msgThreadInfo); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_thread_view_get_direction(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return contact id field in thread view object. + * + * \par Purpose: + * This API is used to get the contact id field value in thread view object. + * + * \par Typical use case: + * Returns contact id value in thread view object. + * + * \par Method of function operation: + * Returns the contactId member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type (int (MSG_ERROR_T when negative, contact id when positive)) \n + * - positive int contact id + * - MSG_ERR_NULL_POINTER msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * int contact_id; + * + * ... + * contact_id = msg_thread_view_get_contact_id(&msgThreadInfo); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_thread_view_get_contact_id(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return unread message count field in thread view object. + * + * \par Purpose: + * This API is used to get the unread message count field value in thread view object. + * + * \par Typical use case: + * Returns unread message count value in thread view object. + * + * \par Method of function operation: + * Returns the unreadCnt member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type nt (MSG_ERROR_T when negative, unread message count when positive) \n + * - positive int unread message count \n + * - MSG_ERR_NULL_POINTER msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * int unread_count; + * + * ... + * unread_count= msg_thread_view_get_unread_cnt(&msgThreadInfo); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_thread_view_get_unread_cnt(msg_thread_view_t msg_thread); + + + +/** + + * \par Description: + * Return sms message count field in thread view object. + * + * \par Purpose: + * This API is used to get the sms message count field value in thread view object. + * + * \par Typical use case: + * Returns sms message count value in thread view object. + * + * \par Method of function operation: + * Returns the smsCnt member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type int (MSG_ERROR_T when negative, sms message count when positive) \n + * - positive int sms message count + * - MSG_ERR_NULL_POINTER msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * int sms_count; + * + * ... + * sms_count= msg_thread_view_get_sms_cnt(&msgThreadInfo); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_thread_view_get_sms_cnt(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Return mms message count field in thread view object. + * + * \par Purpose: + * This API is used to get the mms message count field value in thread view object. + * + * \par Typical use case: + * Returns mms message count value in thread view object. + * + * \par Method of function operation: + * Returns the mmsCnt member of thread view object msg. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If msg_thread is NULL, nothing happens. + * - If msg_thread is invalid, undefined behavior happens. + * + * \param msg_thread_view_t input - msg_thread is a thread view object. + * + * \return Return Type int (MSG_ERROR_T when negative, mms message count when positive) \n + * - positive int sms message count + * - MSG_ERR_NULL_POINTER msg_thread is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * msg_thread_view_t msgThreadInfo; + * int mms_count; + * + * ... + * mms_count= msg_thread_view_get_mms_cnt(&msgThreadInfo); + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_thread_view_get_mms_cnt(msg_thread_view_t msg_thread); + + +/** + + * \par Description: + * Search messages or addresses which including a string that applcation want to find. + * + * \par Purpose: + * This API is used to search messages or addresses from storage. + * + * \par Typical use case: + * Search messages or addresses from storage. + * + * \par Method of function operation: + * search messages or addresses from storage. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * None + * + * \param input - MSG_HANDLE_T handle is Message handle. + * \param input - search_string is the string to search. + * \param output - msg_thread_view_list is a pointer to an MSG_THREAD_VIEW_LIST_S structure. + * + * \return Return Type int (MSG_ERROR_T) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * ... + * char* search_string = "hello"; + * MSG_THREAD_VIEW_LIST_S threadViewList; + * ... + * err = msg_search_message_for_thread_view(&msgHandle, search_string, &threadViewList); + * + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_search_message_for_thread_view(MSG_HANDLE_T handle, const char *search_string, MSG_THREAD_VIEW_LIST_S *msg_thread_view_list); + + +/** + + * \par Description: + * Search messages or addresses which including a string that applcation want to find. + * + * \par Purpose: + * This API is used to search messages or addresses from storage. + * + * \par Typical use case: + * Search messages or addresses from storage. + * + * \par Method of function operation: + * search messages or addresses from storage. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * None + * + * \param input - MSG_HANDLE_T handle is Message handle. + * \param input - search_string is the string to search. + * \param input - offset is the offset of the search result. + * \param input - limit is the limit of the search result. + * \param output - msg_list is a pointer to an MSG_LIST_S structure. + * + * \return Return Type int (MSG_ERROR_T) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * ... + * MSG_LIST_S msg_list; + * int offset = 0; + * int limit = 10; + * + * MSG_SEARCH_CONDITION_S searchCon; + * + * searchCon.msgType = MSG_TYPE_SMS; + * searchCon.folderId = MSG_INBOX_ID; + * searchCon.pSearchVal = "keyString"; + * searchCon.pAddressVal = "01000000000"; + * + * ... + * err = msg_search_message(hMsgHandle, &searchCon, offset, limit, &msgList); + * + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_search_message(MSG_HANDLE_T handle, const MSG_SEARCH_CONDITION_S *msg_search_conditions, int offset, int limit, MSG_LIST_S *msg_list); + + +/** + + * \par Description: + * Free the memory of msg_message_t, which is created by msg_new_message(). + * + * \par Purpose: + * This API is used to release memory created by message creation. + * + * \par Typical use case: + * After using message object for send/save scenario, release message need to be called. + * + * \par Method of function operation: + * Frees the memory allocated to message object and deletes the object. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param msg_message_t input - message object to be destroyed . + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Successfully connected to Messaging Service \n + * - MSG_ERR_NULL_POINTER - Input parameter is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * msg_message_t msg; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * msg = msg_new_message(); + * ... + * err = msg_release_message(&msg); + * + * if (err != MSG_SUCCESS) + * { + * sprintf(str, "msg_release_message() Fail [%d]", err); + * print(str); + * + * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code. + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_release_message_list(MSG_LIST_S *msg_list); + + +/** + + * \par Description: + * Get message ID list that application wants to find by reference ID. + * + * \par Purpose: + * This API is used to get message ID list from storage. + * + * \par Typical use case: + * Get message ID list from storage. + * + * \par Method of function operation: + * Get message ID list from storage. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * None + * + * \param input - MSG_HANDLE_T handle is Message handle. + * \param input - ref_id is the reference id of message group. + * \param output - msg_msgid_list is a pointer to an MSG_MSGID_LIST_S structure. + * + * \return Return Type int (MSG_ERROR_T) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * ... + * MSG_REFERENCE_ID_T refId = 0; + * MSG_MSGID_LIST_S msgIdList; + * ... + * err = msg_get_msgid_list(hMsgHandle, refId, &msgIdList); + * + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_msgid_list(MSG_HANDLE_T handle, MSG_REFERENCE_ID_T ref_id, MSG_MSGID_LIST_S *msg_msgid_list); + + +/** + + * \par Description: + * Frees the memory of MSG_MSGID_LIST_S allocated in msg_get_msgid_list. + * + * \par Purpose: + * This API is used to free the memory of MSG_MSGID_LIST_S allocated in msg_get_msgid_list. + * + * \par Typical use case: + * To free the memory of MSG_MSGID_LIST_S and its members which was allocated in msg_get_msgid_list. + * + * \par Method of function operation: + * To free the memory of MSG_MSGID_LIST_S and its members which was allocated in msg_get_msgid_list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If MSG_MSGID_LIST_S is NULL, nothing happens. + * - If MSG_MSGID_LIST_S is invalid, undefined behavior happens. + * + * \param input - MSG_MSGID_LIST_S structure. + * + * \return Return Type (void) \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * - None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * ... + * MSG_REFERENCE_ID_T refId = 0; + * MSG_MSGID_LIST_S msgIdList; + * ... + * err = msg_get_msgid_list(hMsgHandle, refId, &msgIdList); + * + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * msg_release_msgid_list(&msgIdList); + * ... + * \endcode + */ +/*================================================================================================*/ +void msg_release_msgid_list(MSG_MSGID_LIST_S *msg_msgid_list); + + +/** + + * \par Description: + * Get reject message list that application wants to find by phone number. + * + * \par Purpose: + * This API is used to get reject message list from storage. + * + * \par Typical use case: + * Get reject message list from storage. + * + * \par Method of function operation: + * Get reject message list from storage. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * None + * + * \param input - MSG_HANDLE_T handle is Message handle. + * \param input - phone_num is the string of phone number to find. + * \param output - msg_reject_msg_list is a pointer to an MSG_REJECT_MSG_LIST_S structure. + + * \return Return Type int (MSG_ERROR_T) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_PARAMETER Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * ... + * char* phone_num = "01030016057"; + * MSG_REJECT_MSG_LIST_S rejectMsgList; + * ... + * err = msg_get_reject_msg_list(hMsgHandle, phone_num, &rejectMsgList); + * + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_reject_msg_list(MSG_HANDLE_T handle, const char* phone_num, MSG_REJECT_MSG_LIST_S *msg_reject_msg_list); + + +/** + + * \par Description: + * Frees the memory of MSG_REJECT_MSG_LIST_S allocated in msg_get_reject_msg_list. + * + * \par Purpose: + * This API is used to free the memory of MSG_REJECT_MSG_LIST_S allocated in msg_get_reject_msg_list. + * + * \par Typical use case: + * To free the memory of MSG_REJECT_MSG_LIST_S and its members which was allocated in msg_get_reject_msg_list. + * + * \par Method of function operation: + * To free the memory of MSG_REJECT_MSG_LIST_S and its members which was allocated in msg_get_reject_msg_list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - If MSG_REJECT_MSG_LIST_S is NULL, nothing happens. + * - If MSG_REJECT_MSG_LIST_S is invalid, undefined behavior happens. + * + * \param input - MSG_REJECT_MSG_LIST_S structure. + * + * \return Return Type (void) \n + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * - None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_ERROR_T err = MSG_SUCCESS; + * ... + * char* phone_num = "01030016057"; + * MSG_REJECT_MSG_LIST_S rejectMsgList; + * ... + * err = msg_get_reject_msg_list(hMsgHandle, phone_num, &rejectMsgList); + * + * if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * msg_release_reject_msg_list(&rejectMsgList); + * ... + * \endcode + */ +/*================================================================================================*/ +void msg_release_reject_msg_list(MSG_REJECT_MSG_LIST_S *msg_reject_msg_list); + + +/** + + * \par Description: + * Registers a callback function about the change of storage status to Message handle. + * + * \par Purpose: + * This API is used to register a callback function about the change of storage status "msg_storage_change_cb" to Message handle. + * + * \par Typical use case: + * Register a callback function about the change of storage status. + * + * \par Method of function operation: + * Adds the msg_storage_change_cb API to a callback function list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called after Message handle is opened. + * + * \param input - handle is Message handle. + * \param input - cb is a function to be called. + * \param input - user_param is a pointer to user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = msg_reg_storage_change_callback(msgHandle, &storageCB, NULL); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * return; + * } + * + * void storageCB(MSG_HANDLE_T handle, MSG_THREAD_ID_T threadId, MSG_MESSAGE_ID_T msgId, void *user_param) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reg_storage_change_callback(MSG_HANDLE_T handle, msg_storage_change_cb cb, void *user_param); + + +/** + + * \par Description: + * Gets the report status information of message. + * + * \par Purpose: + * This API is used to get the report status information of specified message. + * + * \par Typical use case: + * Gets the report status information of specified message from the database. + * + * \par Method of function operation: + * Sets up the database connection and Gets the report status information of specified message from the report table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_id is the ID of the message. + * \param output - report_status is a pointer to a MSG_REPORT_STATUS_INFO_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS - Success in operation. + * - MSG_ERR_INVALID_PARAMETER - Parameter is invalid. + * - MSG_ERR_STORAGE_ERROR - Storage is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * MSG_HANDLE_T msgHandle = NULL; + * MSG_REPORT_STATUS_INFO_S reportStatus; + * + * ... + * + * err = msg_open_msg_handle(&msgHandle); + * + * ... + * + * err = msg_get_report_status(msgHandle, msgID, &reportStatus) +* if( err != MSG_SUCCESS ) + * { + * printf("err [%d]", err); + * return err; + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_get_report_status(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, MSG_REPORT_STATUS_INFO_S *report_status); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // MAPI_STORAGE_H + diff --git a/include/mapi/MapiTransport.h b/include/mapi/MapiTransport.h new file mode 100755 index 0000000..840ad9f --- /dev/null +++ b/include/mapi/MapiTransport.h @@ -0,0 +1,997 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +/** + * @file MapiTransport.h + * @brief Defines transport API of messaging framework + * @version 1.0 + */ + +#ifndef MAPI_TRANSPORT_H +#define MAPI_TRANSPORT_H + +/** + * @section Introduction + * - Introduction : Overview on Messaging Transport API + * @section Program + * - Program : Messaging Transport API Reference + */ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ + +#include "MsgTransportTypes.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @ingroup MESSAGING_FRAMEWORK + * @defgroup MESSAGING_TRANSPORT_API Messaging Transport API + * @{ + */ + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +/** + + * \par Description: + * Submits a request to the Messaging Framework. + * + * \par Purpose: + * This API is used to submit a request to the Messaging Framework. + * + * \par Typical use case: + * Submit a request to Messaging Service such as Send Message, Forward etc. + * + * \par Method of function operation: + * Sets up the database connection and inserts the message to message table. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - The result information will be sent back by using the callback function, msg_sent_status_cb. + * - Applications MUST fill in the valid message type. + * - reqId will be filled in the framework. + * + * \param input - handle is Message handle. + * \param input - req is a pointer to an MSG_REQUEST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. + * - MSG_ERR_NULL_POINTER Pointer is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * MSG_REQUEST_S req; + * + * req.msg = msg; + * req.sendOpt = sendOpt; + + * err = msg_submit_req(msgHandle, &req); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_submit_req(MSG_HANDLE_T handle, MSG_REQUEST_S *req); + + +/** + + * \par Description: + * Registers sent status callback function to Message handle. + * + * \par Purpose: + * This API is used to register sent status callback function "msg_sent_status_cb" to Message handle. + * + * \par Typical use case: + * Register for sent status callback. + * + * \par Method of function operation: + * Adds the msg_sent_status_cb API to sent status callback list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called after Message handle is opened. + * + * \param input - handle is Message handle. + * \param input - cb is a function to be called. + * \param input - user_param is a pointer to user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * MSG_REQUEST_S req; + * + * req.msg = msg; + * req.sendOpt = sendOpt; + + * err = msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback"); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * return; + * } + + * void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reg_sent_status_callback(MSG_HANDLE_T handle, msg_sent_status_cb cb, void *user_param); + + +/** + + * \par Description: + * Registers incoming SMS callback to Message handle. + * + * \par Purpose: + * This API is used to Registers incoming SMS callback function "msg_sms_incoming_cb" to Message handle. + * + * \par Typical use case: + * Register incoming SMS message callback. + * + * \par Method of function operation: + * Adds the msg_sms_incoming_cb API to incoming SMS callback list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called after Message handle is opened. + * + * \param input - handle is Message handle. + * \param input - cb is a function to be called. + * \param input - port is used for listening. If port is not used, please assign 0 to it. + * \param input - user_param is a pointer to user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * MSG_REQUEST_S req; + * + * req.msg = msg; + * req.sendOpt = sendOpt; + + * err = msg_reg_sms_message_callback(msgHandle, &incomingSmsCB, 0, (void*)"sms message callback"); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * return; + * } + * + * void incomingSmsCB(MSG_HANDLE_T Handle, msg_message_t msg, void *pUserParam) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reg_sms_message_callback(MSG_HANDLE_T handle, msg_sms_incoming_cb cb, unsigned short port, void *user_param); + + +/** + + * \par Description: + * Registers incoming MMS callback to Message handle. + * + * \par Purpose: + * This API is used to Registers incoming MMS callback function "msg_mms_conf_msg_incoming_cb" to Message handle. + * + * \par Typical use case: + * Register incoming SMS message callback. + * + * \par Method of function operation: + * Adds the msg_mms_conf_msg_incoming_cb API to incoming MMS callback list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called after Message handle is opened. + * + * \param input - handle is Message handle. + * \param input - handle is Message handle. + * \param input - cb is a function to be called. + * \param input - app_id is used for listening. If appId is not used, please assign NULL to it. + * \param input - user_param is a pointer to user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * MSG_REQUEST_S req; + * + * req.msg = msg; + * req.sendOpt = sendOpt; + + * err = msg_reg_mms_conf_message_callback(msgHandle, &incomingMmsConfCB, NULL, NULL); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * return; + * } + * + * void incomingMmsConfCB(MSG_HANDLE_T Handle, msg_message_t msg, void *pUserParam) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reg_mms_conf_message_callback(MSG_HANDLE_T handle, msg_mms_conf_msg_incoming_cb cb, const char *app_id, void *user_param); + + +/** + + * \par Description: + * Registers incoming SyncML Message callback to Message handle. + * + * \par Purpose: + * This API is used to Registers incoming SyncML Message callback function "msg_syncml_msg_incoming_cb" to Message handle. + * + * \par Typical use case: + * Register incoming SMS message callback. + * + * \par Method of function operation: + * Adds the msg_syncml_msg_incoming_cb API to incoming SyncML callback list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called after Message handle is opened. + * + * \param input - handle is Message handle. + * \param input - cb is a function to be called. + * \param input - user_param is a pointer to user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = err = msg_reg_syncml_message_callback(msgHandle, &syncMLCB, NULL); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * return; + * } + * + * void syncMLCB(MSG_HANDLE_T hMsgHandle, MSG_SYNCML_MESSAGE_TYPE_T msgType, const char* pPushHeader, int PushHeaderLen, const char* pPushBody, int PushBodyLen, void *pUserParam) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reg_syncml_message_callback(MSG_HANDLE_T handle, msg_syncml_msg_incoming_cb cb, void *user_param); + + +/** + + * \par Description: + * Registers incoming LBS Message callback to Message handle. + * + * \par Purpose: + * This API is used to Registers incoming LBS Message callback function "msg_lbs_msg_incoming_cb" to Message handle. + * + * \par Typical use case: + * Register incoming SMS message callback. + * + * \par Method of function operation: + * Adds the msg_lbs_msg_incoming_cb API to incoming LBS Message callback list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called after Message handle is opened. + * + * \param input - handle is Message handle. + * \param input - cb is a function to be called. + * \param input - user_param is a pointer to user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = msg_reg_lbs_message_callback(msgHandle, &lbsCB, NULL); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * return; + * } + * + * void lbsCB(MSG_HANDLE_T hMsgHandle, const char* pPushHeader, const char* pPushBody, int pushBodyLen, void *pUserParam) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reg_lbs_message_callback(MSG_HANDLE_T handle, msg_lbs_msg_incoming_cb cb, void *user_param); + + +/** + + * \par Description: + * Registers incoming LBS Message callback to Message handle. + * + * \par Purpose: + * This API is used to Registers incoming LBS Message callback function "msg_lbs_msg_incoming_cb" to Message handle. + * + * \par Typical use case: + * Register incoming SMS message callback. + * + * \par Method of function operation: + * Adds the msg_lbs_msg_incoming_cb API to incoming LBS Message callback list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called after Message handle is opened. + * + * \param input - handle is Message handle. + * \param input - cb is a function to be called. + * \param input - user_param is a pointer to user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = msg_reg_lbs_message_callback(msgHandle, &lbsCB, NULL); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * return; + * } + * + * void lbsCB(MSG_HANDLE_T hMsgHandle, const char* pPushHeader, const char* pPushBody, int pushBodyLen, void *pUserParam) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_reg_syncml_message_operation_callback(MSG_HANDLE_T handle, msg_syncml_msg_operation_cb cb, void *user_param); + + +/** + + * \par Description: + * Registers incoming LBS Message callback to Message handle. + * + * \par Purpose: + * This API is used to Registers incoming LBS Message callback function "msg_lbs_msg_incoming_cb" to Message handle. + * + * \par Typical use case: + * Register incoming SMS message callback. + * + * \par Method of function operation: + * Adds the msg_lbs_msg_incoming_cb API to incoming LBS Message callback list. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * This function MUST be called after Message handle is opened. + * + * \param input - handle is Message handle. + * \param input - cb is a function to be called. + * \param input - user_param is a pointer to user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = msg_reg_lbs_message_callback(msgHandle, &lbsCB, NULL); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * return; + * } + * + * void lbsCB(MSG_HANDLE_T hMsgHandle, const char* pPushHeader, const char* pPushBody, int pushBodyLen, void *pUserParam) + * { + * ... + * } + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_syncml_message_operation(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msgId); + + +/** + + * \par Description: + * Sends SMS. It is a synchronous API which has been blocked until sent status arrives. + * + * \par Purpose: + * This API is used to sends SMS. + * + * \par Typical use case: + * Sends a SMS Message + * + * \par Method of function operation: + * It is a synchronous API which has been blocked until sent status arrives. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - phone_num is the list of phone numbers. It is separated by ",". + * \param input - sms_text is a SMS text. + * \param input - cb is a function to be called. + * \param input - user_param is for user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_NULL_POINTER Invalid parameter. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = msg_sms_send("01000000000,01000000000", "1234567890", sentStatusCB, NULL); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_sms_send(const char *phone_num, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param); + + +/** + + * \par Description: + * Submits request to send SMS message. + * + * \par Purpose: + * This API is used to submit request to send SMS message. + * + * \par Typical use case: + * Submits request to send SMS message. + * + * \par Method of function operation: + * Submits a request to send SMS. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - phone_num is the list of phone numbers. It is separated by ",". + * \param input - sms_text is a SMS text. + * \param input - cb is a function to be called. + * \param input - user_param is for user data. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_NULL_POINTER Invalid parameter. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * MSG_REQUEST_S req; + * + * req.msg = msg; + * req.sendOpt = sendOpt; + * + * err = msg_sms_send_message(msgHandle, &req); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_sms_send_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); + + +/** + + * \par Description: + * Submits request to send MMS message. + * + * \par Purpose: + * This API is used to submit request to send MMS message. + * + * \par Typical use case: + * Submits request to send MMS message. + * + * \par Method of function operation: + * Submits a request to send MMS. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - req is a pointer to an MSG_REQUEST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_NULL_POINTER Invalid parameter. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * MSG_REQUEST_S req; + * + * req.msg = msg; + * req.sendOpt = sendOpt; + * + * err = msg_mms_send_message(msgHandle, &req); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_mms_send_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); + + +/** + + * \par Description: + * Submits request to send MMS read report request. + * + * \par Purpose: + * This API is used to submit request to send MMS read report request. + * + * \par Typical use case: + * Submits request to send MMS read report request. + * + * \par Method of function operation: + * Submits a request to send MMS read report request. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - msg_id is a message id, which is a positive integer. + * \param input - mms_read_status is status whether message was read or not. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_NULL_POINTER Invalid parameter. + * - MSG_ERR_MEMORY_ERROR Memory is error. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = err = msg_mms_send_read_report(NULL, 0, MSG_READ_REPORT_IS_READ); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_mms_send_read_report(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msgId, MSG_READ_REPORT_STATUS_T mms_read_status); + + +/** + + * \par Description: + * Submits request to send forward MMS request. + * + * \par Purpose: + * This API is used to submit request to send forward MMS request. + * + * \par Typical use case: + * Submits request to send forward MMS request. + * + * \par Method of function operation: + * Submits a request to send forward MMS request. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - req is a pointer to an MSG_REQUEST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. + * - MSG_ERR_NULL_POINTER Pointer is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = err = msg_mms_send_read_report(NULL, 0, MSG_READ_REPORT_IS_READ); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_mms_forward_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); + + +/** + + * \par Description: + * Submits request to retrieve MMS request. + * + * \par Purpose: + * This API is used to submit request to retrieve MMS request. + * + * \par Typical use case: + * Submits request to retrieve MMS request. + * + * \par Method of function operation: + * Submits a request to send forward MMS request. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - req is a pointer to an MSG_REQUEST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. + * - MSG_ERR_NULL_POINTER Pointer is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = msg_mms_retrieve_message(handle, &req); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_mms_retrieve_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); + + +/* reject_msg_support */ +/** + + * \par Description: + * Submits request to reject MMS message. + * + * \par Purpose: + * This API is used to submit request to reject MMS message. + * + * \par Typical use case: + * Submits request to reject MMS message. + * + * \par Method of function operation: + * Submits a request to send forward reject MMS message. + * + * \par Sync (or) Async: + * This is a Synchronous API. + * + * \par Important notes: + * - None + * + * \param input - handle is Message handle. + * \param input - req is a pointer to an MSG_REQUEST_S structure. + * + * \return Return Type (int(MSG_ERROR_T)) \n + * - MSG_SUCCESS Success in operation. + * - MSG_ERR_INVALID_MSGHANDLE Message handle is invalid. + * - MSG_ERR_NULL_POINTER Pointer is NULL. + * + * \par Prospective clients: + * External/Native Apps using Messaging Services. + * + * \par Related functions: + * None + * + * \par Known issues/bugs: + * None + * + * \par Sample code: + * \code + * ... + * + * int err = MSG_SUCCESS; + * + * err = msg_mms_reject_message(handle, &req); + * if (err != MSG_SUCCESS) + * { + * ... + * } + * + * ... + * \endcode + */ +/*================================================================================================*/ +int msg_mms_reject_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // MAPI_TRANSPORT_H + diff --git a/include/msg_helper/MsgHelper.h b/include/msg_helper/MsgHelper.h new file mode 100755 index 0000000..1e2dd5c --- /dev/null +++ b/include/msg_helper/MsgHelper.h @@ -0,0 +1,65 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_HELPER_H +#define MSG_HELPER_H + + +#include "MsgTypes.h" + +/*================================================================================================== + DEFINES +==================================================================================================*/ + +#define MSG_SOUND_START "SOUND_START" +#define MSG_SOUND_STOP "SOUND_STOP" + +#define MAX_SOUND_FILE_LEN 1024 + +#define DEFAULT_FILE "/usr/share/media/Sherbet.wav" +#define ALERT_ON_CALL_TONE "/opt/etc/msg-service/alert_on_call.mp3" + +#define HAPTIC_TEST_ITERATION 1 +#define MSG_VIBRATION_INTERVAL 3000 + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +// SoundPlayer +MSG_ERROR_T MsgSoundPlayUninit(); +void MsgSoundPlayStart(); +void MsgSoundPlayStop(); +int MsgSoundPlayMelody(char *pMsgToneFilePath, bool bIncreasing); +void MsgSoundPlayVibration(); + + +#endif // MSG_HELPER_H diff --git a/include/proxy/MsgHandle.h b/include/proxy/MsgHandle.h new file mode 100755 index 0000000..32aea36 --- /dev/null +++ b/include/proxy/MsgHandle.h @@ -0,0 +1,137 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_HANDLE_H +#define MSG_HANDLE_H + +#ifndef __cplusplus +#error "This is a C++ header file; it requires C++ to compile." +#endif + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgStorageTypes.h" +#include "MsgTransportTypes.h" +#include "MsgSettingTypes.h" +#include "MsgCmdTypes.h" +#include "MsgInternalTypes.h" +#include "MsgIpcSocket.h" + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ + +class MsgHandle +{ + public: + MsgHandle(); + virtual ~MsgHandle(); + + // Control + void openHandle(); + void closeHandle(MsgHandle* pHandle); + + // Transport + MSG_ERROR_T submitReq(MSG_REQUEST_S* pReq); + MSG_ERROR_T cancelReq(MSG_REQUEST_ID_T reqId); + + MSG_ERROR_T regSentStatusCallback(msg_sent_status_cb onStatusChanged, void *pUserParam); + MSG_ERROR_T regSmsMessageCallback(msg_sms_incoming_cb onMsgIncoming, unsigned short port, void *pUserParam); + MSG_ERROR_T regMmsConfMessageCallback(msg_mms_conf_msg_incoming_cb onMMSConfMsgIncoming, const char *pAppId, void *pUserParam); + MSG_ERROR_T regSyncMLMessageCallback(msg_syncml_msg_incoming_cb onSyncMLMsgIncoming, void *pUserParam); + MSG_ERROR_T regLBSMessageCallback(msg_lbs_msg_incoming_cb onLBSMsgIncoming, void *pUserParam); + + MSG_ERROR_T regSyncMLMessageOperationCallback(msg_syncml_msg_operation_cb onSyncMLMsgOperation, void *pUserParam); + + MSG_ERROR_T operateSyncMLMessage(MSG_MESSAGE_ID_T msgId); + + // Storage + int addMessage(const MSG_MESSAGE_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt); + MSG_ERROR_T addSyncMLMessage(const MSG_SYNCML_MESSAGE_S *pSyncMLMsg); + MSG_ERROR_T updateMessage(const MSG_MESSAGE_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt); + MSG_ERROR_T updateReadStatus(MSG_MESSAGE_ID_T MsgId, bool bRead); + MSG_ERROR_T updateProtectedStatus(MSG_MESSAGE_ID_T MsgId, bool bProtected); + MSG_ERROR_T deleteMessage(MSG_MESSAGE_ID_T MsgId); + MSG_ERROR_T deleteAllMessagesInFolder(MSG_FOLDER_ID_T FolderId, bool bOnlyDB); + MSG_ERROR_T moveMessageToFolder(MSG_MESSAGE_ID_T MsgId, MSG_FOLDER_ID_T DestFolderId); + MSG_ERROR_T moveMessageToStorage(MSG_MESSAGE_ID_T MsgId, MSG_STORAGE_ID_T DestStorageId); + MSG_ERROR_T countMessage(MSG_FOLDER_ID_T FolderId, MSG_COUNT_INFO_S *pCountInfo); + MSG_ERROR_T countMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount); + MSG_ERROR_T countMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList); + MSG_ERROR_T getMessage(MSG_MESSAGE_ID_T MsgId, MSG_MESSAGE_S *pMsg, MSG_SENDINGOPT_S *pSendOpt); + MSG_ERROR_T getFolderViewList(MSG_FOLDER_ID_T FolderId, const MSG_SORT_RULE_S *pSortRule, MSG_LIST_S *pMsgFolderViewList); + MSG_ERROR_T addFolder(const MSG_FOLDER_INFO_S *pFolderInfo); + MSG_ERROR_T updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo); + MSG_ERROR_T deleteFolder(MSG_FOLDER_ID_T FolderId); + MSG_ERROR_T getFolderList(MSG_FOLDER_LIST_S *pFolderList); + + MSG_ERROR_T getThreadViewList(const MSG_SORT_RULE_S *pSortRule, MSG_THREAD_VIEW_LIST_S *pThreadViewList); + MSG_ERROR_T getConversationViewList(MSG_THREAD_ID_T ThreadId, MSG_LIST_S *pConvViewList); + MSG_ERROR_T deleteThreadMessageList(MSG_THREAD_ID_T thread_id); + MSG_ERROR_T getQuickPanelData(MSG_QUICKPANEL_TYPE_T Type, MSG_MESSAGE_S *pMsg); + MSG_ERROR_T resetDatabase(); + MSG_ERROR_T getMemSize(unsigned int* memsize); + + // Setting + MSG_ERROR_T setConfig(const MSG_SETTING_S *pSetting); + MSG_ERROR_T getConfig(MSG_SETTING_S *pSetting); + + // ETC + MSG_ERROR_T searchMessage(const char *pSearchString, MSG_THREAD_VIEW_LIST_S *pThreadViewList); + MSG_ERROR_T searchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, MSG_LIST_S *pMsgList); + MSG_ERROR_T getMsgIdList(MSG_REFERENCE_ID_T RefId, MSG_MSGID_LIST_S *pMsgIdList); + MSG_ERROR_T getRejectMsgList(const char *pNumber, MSG_REJECT_MSG_LIST_S *pRejectMsgList); + MSG_ERROR_T regStorageChangeCallback(msg_storage_change_cb onStorageChange, void *pUserParam); + MSG_ERROR_T getReportStatus(MSG_MESSAGE_ID_T msg_id, MSG_REPORT_STATUS_INFO_S *pReport_status); + + void convertMsgStruct(const MSG_MESSAGE_INFO_S *pSource, MSG_MESSAGE_S *pDest); + void convertSendOptStruct(const MSG_SENDINGOPT_INFO_S* pSrc, MSG_SENDINGOPT_S* pDest, MSG_MESSAGE_TYPE_S msgType); + + private: + void connectSocket(); + void disconnectSocket(); + void write(const char *pCmd, int CmdSize, char **ppEvent); + void read(char **ppEvent); + void generateConnectionId(char *ConnectionId); + void convertMsgStruct(const MSG_MESSAGE_S *pSource, MSG_MESSAGE_INFO_S *pDest); + void convertSendOptStruct(const MSG_SENDINGOPT_S* pSrc, MSG_SENDINGOPT_INFO_S* pDest, MSG_MESSAGE_TYPE_S msgType); + int getSettingCmdSize(MSG_OPTION_TYPE_T optionType); + + char mConnectionId[20]; + short mCounter; + + char mCookie[MAX_COOKIE_LEN]; + + MsgIpcClientSocket mClientSock; +}; + +#endif // MSG_HANDLE_H + diff --git a/include/proxy/MsgProxyListener.h b/include/proxy/MsgProxyListener.h new file mode 100755 index 0000000..fc2b8c4 --- /dev/null +++ b/include/proxy/MsgProxyListener.h @@ -0,0 +1,164 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __MSG_PROXY_LISTENER_H__ +#define __MSG_PROXY_LISTENER_H__ + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgIpcSocket.h" +#include "MsgTypes.h" +#include "MsgMutex.h" +#include "MsgHandle.h" + +#include +#include +#include + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +typedef struct +{ + MsgHandle* hAddr; + msg_sent_status_cb pfSentStatusCB; + void* userParam; +} MSG_SENT_STATUS_CB_ITEM_S; + +typedef struct +{ + MsgHandle* hAddr; + msg_sms_incoming_cb pfIncomingCB; + int port; + void* userParam; +} MSG_INCOMING_CB_ITEM_S; + +typedef struct +{ + MsgHandle* hAddr; + msg_mms_conf_msg_incoming_cb pfMMSConfIncomingCB; + char appId[MAX_MMS_JAVA_APPID_LEN+1]; + void* userParam; +} MSG_MMS_CONF_INCOMING_CB_ITEM_S; + +typedef struct +{ + MsgHandle* hAddr; + msg_syncml_msg_incoming_cb pfSyncMLIncomingCB; + void* userParam; +} MSG_SYNCML_INCOMING_CB_ITEM_S; + +typedef struct +{ + MsgHandle* hAddr; + msg_lbs_msg_incoming_cb pfLBSMsgIncoming; + void* userParam; +} MSG_LBS_INCOMING_CB_ITEM_S; + +typedef struct +{ + MsgHandle* hAddr; + msg_syncml_msg_operation_cb pfSyncMLOperationCB; + void* userParam; +} MSG_SYNCML_OPERATION_CB_ITEM_S; + +typedef struct +{ + MsgHandle* hAddr; + msg_storage_change_cb pfStorageChangeCB; + void* userParam; +} MSG_STORAGE_CHANGE_CB_ITEM_S; + + +typedef std::list MsgSentStatusCBList; +typedef std::list MsgNewMessageCBList; +typedef std::list MsgNewMMSConfMessageCBList; +typedef std::list MsgNewSyncMLMessageCBList; +typedef std::list MsgNewLBSMessageCBList; +typedef std::list MsgOperationSyncMLMessageCBList; +typedef std::list MsgStorageChangeCBList; + + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgProxyListener +{ +public: + static MsgProxyListener* instance(); + + void start(); + void stop(); + + bool regSentStatusEventCB(MsgHandle* pMsgHandle, msg_sent_status_cb pfSentStatus, void *pUserParam); + bool regMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_sms_incoming_cb pfNewMessage, int port, void *pUserParam); + bool regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam); + bool regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam); + bool regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam); + bool regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam); + bool regStorageChangeEventCB(MsgHandle* pMsgHandle, msg_storage_change_cb pfStorageChangeOperation, void *pUserParam); + + void clearListOfClosedHandle(MsgHandle* pMsgHandle); + + void handleEvent(const MSG_EVENT_S* ptr); + + int getRemoteFd(); + int readFromSocket(char** buf, int* len); + +private: + MsgProxyListener(); + ~MsgProxyListener(); + + static MsgProxyListener* pInstance; + + unsigned int running; + + MsgIpcClientSocket cliSock; + + Mutex mx; + CndVar cv; + + MsgSentStatusCBList sentStatusCBList; + MsgNewMessageCBList newMessageCBList; + MsgNewMMSConfMessageCBList newMMSConfMessageCBList; + MsgNewSyncMLMessageCBList newSyncMLMessageCBList; + MsgNewLBSMessageCBList newLBSMessageCBList; + MsgOperationSyncMLMessageCBList operationSyncMLMessageCBList; + MsgStorageChangeCBList storageChangeCBList; + + GIOChannel *channel; + guint eventSourceId; +}; + +#endif // __MSG_PROXY_LISTENER_H__ + diff --git a/include/utils/MsgContact.h b/include/utils/MsgContact.h new file mode 100755 index 0000000..4705b6e --- /dev/null +++ b/include/utils/MsgContact.h @@ -0,0 +1,66 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_CONTACT_H +#define MSG_CONTACT_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgStorageTypes.h" +#include "MsgInternalTypes.h" + + +typedef void (*MsgContactChangeCB)(); + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +MSG_ERROR_T MsgOpenContactSvc(); +MSG_ERROR_T MsgCloseContactSvc(); + +MSG_ERROR_T MsgInitContactSvc(MsgContactChangeCB cb); + +MSG_ERROR_T MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_INFO_S *pContactInfo); + +void MsgSyncContact(); + +bool MsgInsertContact(MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber); +bool MsgUpdateContact(int index, int type); +bool MsgDeleteContact(int index); + +int MsgGetContactNameOrder(); + +int MsgContactSVCBeginTrans(); +int MsgContactSVCEndTrans(bool bSuccess); + + +#endif //MSG_CONTACT_H + diff --git a/include/utils/MsgDebug.h b/include/utils/MsgDebug.h new file mode 100755 index 0000000..4b0541e --- /dev/null +++ b/include/utils/MsgDebug.h @@ -0,0 +1,186 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __MSG_DEBUG_H__ +#define __MSG_DEBUG_H__ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include +#include +#include +#include + +#include "MsgTypes.h" +#include "MsgCmdTypes.h" + +extern "C"{ + #include +}; + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define USER_TAG "MSG_FW" + +//#define DLOG_ENABLE +//#define LOG_ENABLE + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +int get_tid(); + + +#if defined(DLOG_ENABLE) + +#define MSG_FATAL(fmt, ...) \ + do \ + {\ + SLOG(LOG_ERROR, USER_TAG, "[%s: %s(): %d] ERROR << " fmt " >>\n\n", rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\ + } while (0) + +#define MSG_DEBUG(fmt, ...)\ + do\ + {\ + SLOG(LOG_DEBUG, USER_TAG, "[%s: %s(): %d] " fmt"\n\n", rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\ + } while (0) + +#define MSG_BEGIN() \ + do\ + {\ + SLOG(LOG_DEBUG, USER_TAG, "[%s: %s(): %d] BEGIN >>>> \n\n", rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__ );\ + } while( 0 ) + +#define MSG_END() \ + do\ + {\ + SLOG(LOG_DEBUG, USER_TAG, "[%s: %s(): %d] END <<<< \n\n", rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__ );\ + } \ + while( 0 ) + +#define MSG_PROFILE_BEGIN(pfid) \ + unsigned int __prf_l1_##pfid = __LINE__; \ + struct timeval __prf_1_##pfid; \ + struct timeval __prf_2_##pfid; \ + do { \ + gettimeofday(&__prf_1_##pfid, 0); \ + } while (0) + +#define MSG_PROFILE_END(pfid) \ + unsigned int __prf_l2_##pfid = __LINE__;\ + do { \ + gettimeofday(&__prf_2_##pfid, 0);\ + long __ds = __prf_2_##pfid.tv_sec - __prf_1_##pfid.tv_sec;\ + long __dm = __prf_2_##pfid.tv_usec - __prf_1_##pfid.tv_usec;\ + if ( __dm < 0 ) { __ds--; __dm = 1000000 + __dm; } \ + SLOG(LOG_DEBUG, USER_TAG, "**PROFILE** [MSGFW: %s: %s() %u ~ %u] " #pfid \ + " -> Elapsed Time: %u.%06u seconds\n", \ + rindex(__FILE__, '/')+1, \ + __FUNCTION__, \ + __prf_l1_##pfid, \ + __prf_l2_##pfid, \ + (unsigned int)(__ds), \ + (unsigned int)(__dm)); \ + } while (0) + +#elif defined(LOG_ENABLE) + +#define MSG_FATAL(fmt, ...) \ + do \ + {\ + printf("\n[%d] [MSGFW: %s: %s(): %d] *FAILED* << " fmt" >>\n", get_tid(), rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\ + } while (0) + +#define MSG_DEBUG(fmt, ...) \ + do\ + {\ + printf("\n[%d] [MSGFW: %s: %s(): %d] " fmt"\n", get_tid(), rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\ + } while (0) + +#define MSG_BEGIN() \ + do\ + {\ + printf("\n[%d] BEGIN >>>> %s() at [MSGFW: %s: %d]\n", get_tid(),__FUNCTION__, rindex(__FILE__, '/')+1, __LINE__ );\ + } while( 0 ) + +#define MSG_END() \ + do\ + {\ + printf("\n[%d] END <<<< %s() at [MSGFW: %s: %d]\n", get_tid(), __FUNCTION__, rindex(__FILE__, '/')+1, __LINE__); \ + } \ + while( 0 ) + +#define MSG_PROFILE_BEGIN(pfid) \ + unsigned int __prf_l1_##pfid = __LINE__; \ + struct timeval __prf_1_##pfid; \ + struct timeval __prf_2_##pfid; \ + do { \ + gettimeofday(&__prf_1_##pfid, 0); \ + } while (0) + +#define MSG_PROFILE_END(pfid) \ + unsigned int __prf_l2_##pfid = __LINE__;\ + do { \ + gettimeofday(&__prf_2_##pfid, 0);\ + long __ds = __prf_2_##pfid.tv_sec - __prf_1_##pfid.tv_sec;\ + long __dm = __prf_2_##pfid.tv_usec - __prf_1_##pfid.tv_usec;\ + if ( __dm < 0 ) { __ds--; __dm = 1000000 + __dm; } \ + printf("**PROFILE** [MSGFW: %s: %s() %u ~ %u] " #pfid \ + " -> Elapsed Time: %u.%06u seconds\n", \ + rindex(__FILE__, '/')+1, \ + __FUNCTION__, \ + __prf_l1_##pfid, \ + __prf_l2_##pfid, \ + (unsigned int)(__ds), \ + (unsigned int)(__dm)); \ + } while (0) + +#else + +#define MSG_FATAL(fmt, ...) +#define MSG_DEBUG(fmt, ...) +#define MSG_BEGIN() +#define MSG_END() + +#define MSG_PROFILE_BEGIN(pfid) +#define MSG_PROFILE_END(pfid) + +#endif + +const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType); +const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType); + +#endif //__MSG_DEBUG_H__ + diff --git a/include/utils/MsgDrmWrapper.h b/include/utils/MsgDrmWrapper.h new file mode 100755 index 0000000..f77909d --- /dev/null +++ b/include/utils/MsgDrmWrapper.h @@ -0,0 +1,92 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __MSG_DRM_WRAPPER_H_ +#define __MSG_DRM_WRAPPER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* MSG_DRMHANDLE; + +typedef enum { + MMS_DRM_RIGHT_PLAY, //video + MSG_DRM_RIGHT_DISPLAY, //image + MSG_DRM_RIGHT_EXECUTE, //game + MSG_DRM_RIGHT_PRINT, + MSG_DRM_RIGHT_EXPORT, +} MSG_DRM_RIGHT_TYPE; + +typedef enum { + MSG_MODE_FILE, + MSG_MODE_STREAM +} MSG_DRM_OPENMODE; + +typedef enum { + MSG_DRM_NONE = 0, + MSG_DRM_FORWARD_LOCK, + MSG_DRM_COMBINED_DELIVERY, + MSG_DRM_SEPARATE_DELIVERY +} MSG_DRM_TYPE; + + +bool MsgDrmRegisterFile(MSG_DRM_OPENMODE eMode, char *pBuffer, int nSize); +bool MsgDrmUnregisterFile(char *szFilename); + +bool MsgDrmIsDrmFile(const char *szFilePath); + +bool MsgDrmGetMimeTypeEx(const char *szFileName, char *szMimeType, int nMimeTypeLen); +bool MsgDrmGetContentID(const char *szFileName, char *szContentID, int nContentIDLen); +bool MsgDrmGetDrmType(const char *szFileName, MSG_DRM_TYPE *eDRMType); + + +bool MsgDrmOpen(MSG_DRM_OPENMODE eMode, const char *pBuffer, int nSize, MSG_DRMHANDLE *pHandle); +bool MsgDrmClose(MSG_DRMHANDLE); +bool MsgDrmGetMimeType(MSG_DRMHANDLE pHandle, char *szMimeType, int nMimeTypeLen); +int MsgDrmGetStreamSize(MSG_DRMHANDLE pHandle); +bool MsgDrmGetStream(MSG_DRMHANDLE pHandle, int nStreamSize, unsigned char *pStream); + +bool MsgDrmIsAvailable(MSG_DRMHANDLE pHandle); +bool MsgDrmConsumeRights(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType, long nMiliSecs); +bool MsgDrmOnStart(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType); +bool MsgDrmOnPause(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType); +bool MsgDrmOnResume(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType); +bool MsgDrmOnStop(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType); + + +bool MsgDrmConvertDmtoDcfType(char *inputFile, char *outputFile); +bool MsgDrmIsConvertedFL(char *szFilePath); +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/utils/MsgException.h b/include/utils/MsgException.h new file mode 100755 index 0000000..8b5ea19 --- /dev/null +++ b/include/utils/MsgException.h @@ -0,0 +1,99 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_EXCEPTION_H +#define MSG_EXCEPTION_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include + +using namespace std; + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define THROW(errCode, debugFmt,...) \ +do {\ + char __debugBuf[256];\ + snprintf(__debugBuf, 256, debugFmt, ##__VA_ARGS__);\ + MsgException e(errCode, __debugBuf);\ + MSG_FATAL("%s [%d]", e.what(), e.errorCode());\ + throw e; \ +} while(0) + + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgException : public runtime_error //public exception +{ +public: + MsgException(int errCode, const string& msg = "") + : runtime_error( errorStrings[errCode] + " : " + msg), eCode(errCode) + {} + + enum + { + SUCCESS = 0, + + INVALID_PARAM, + INVALID_RESULT, + SELECT_ERROR, + IPC_ERROR, + OUT_OF_RANGE = 5, + + SMS_PLG_ERROR, + MMS_PLG_ERROR, + PLUGIN_ERROR, + SENT_STATUS_ERROR, + INCOMING_MSG_ERROR = 10, + + FILE_ERROR, + SECURITY_ERROR, + SERVER_READY_ERROR = 13, + + // dont erase NUM_ERRORS. place a new error code in ahead of NUM_ERRORS + NUM_ERRORS + }; + + int errorCode() { return eCode; } + +private: + static string errorStrings[NUM_ERRORS]; + int eCode; +}; + +#endif //#ifndef __MSG_EXCEPTION_H__ + + diff --git a/include/utils/MsgGconfWrapper.h b/include/utils/MsgGconfWrapper.h new file mode 100755 index 0000000..2da9c67 --- /dev/null +++ b/include/utils/MsgGconfWrapper.h @@ -0,0 +1,72 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_GCONF_WRAPPER_H +#define MSG_GCONF_WRAPPER_H + +//#define USE_GCONF +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgInternalTypes.h" + +#ifdef USE_GCONF +#include +#include +#else +#include +#endif + +/*================================================================================================== + STRUCTURES +==================================================================================================*/ +#ifdef USE_GCONF +typedef struct _MSG_GOBJECT_CLIENT_S +{ + GObject* object; +}MSG_GOBJECT_CLIENT_S; +#endif + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +MSG_ERROR_T MsgSettingSetString(const char *pKey, const char *pSetValue); +MSG_ERROR_T MsgSettingSetInt(const char *pKey, int nSetValue); +MSG_ERROR_T MsgSettingSetBool(const char *pKey, bool bSetValue); + +char* MsgSettingGetString(const char *pKey); +int MsgSettingGetInt(const char *pKey); +int MsgSettingGetBool(const char *pKey, bool *pVal); + +MSG_ERROR_T MsgSettingHandleNewMsg(int SmsCnt, int MmsCnt); +MSG_ERROR_T MsgSettingSetIndicator(int SmsCnt, int MmsCnt); + +#endif // MSG_GCONF_WRAPPER_H diff --git a/include/utils/MsgIpcSocket.h b/include/utils/MsgIpcSocket.h new file mode 100755 index 0000000..601a7de --- /dev/null +++ b/include/utils/MsgIpcSocket.h @@ -0,0 +1,130 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __IPCSocket_H__ +#define __IPCSocket_H__ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include + +#include "MsgTypes.h" +#include "MsgCppTypes.h" + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSG_MAX_IPC_SIZE 50000 // 50 * 1000 = sizeof(msg common info) * max message count +#define MAX_NUM_IPC_CLIENT 10 + +#define MSG_SOCKET_PATH "/tmp/.msgfw_socket" + +#define CUSTOM_SOCKET_ERROR -1 +#define CUSTOM_SOCKET_BACKLOG 10 + + +/*================================================================================================== + ENUM +==================================================================================================*/ +typedef enum +{ + CLOSE_CONNECTION_BY_SIGNAL = 0, + CLOSE_CONNECTION_BY_USER = -17, +} IPC_CONTROL_E; + + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgIpcClientSocket +{ +public: + MsgIpcClientSocket(); +// ~MsgIpcClientSocket(); + + int maxFd() { return (maxfd+1); } + fd_set fdSet() { return fds; } + int fd() { return sockfd; } + + MSG_ERROR_T connect(const char *path); + MSG_ERROR_T close(); + /* write msg to ipc server */ + int write(const char* buf, int len); + /* read msg from ipc server */ + int read(char** buf, int* len); + void addfd(int fd); + int getRemoteFd() {return remotefd; } +private: + int readn(char *buf, int len ); + int writen (const char *buf, int len); + + int sockfd, remotefd, maxfd; + fd_set fds; +}; + + +class MsgIpcServerSocket +{ +public: + MsgIpcServerSocket(); + ~MsgIpcServerSocket() { mapFds.clear(); } + int maxFd() { return (maxfd+1); } + fd_set fdSet() { return fds; } + int fd() { return sockfd; } + + MSG_ERROR_T open(const char *path); + MSG_ERROR_T accept(); + void close(int fd); + + /* read msg from client of fd */ + int read(int fd, char** buf, int* len ); + /* write msg to ipc client */ + int write(int fd, const char* buf, int len); + void addfd(int fd); + void setSockfd(int fd) { sockfd = fd; } + +private: + int readn(int fd, char *buf, int len ); + int writen (int fd, const char *buf, int len); + + /* server socket fd */ + int sockfd; + + /* information about IPC clients, it is used for select() */ + fd_set fds; + int maxfd; + std::map mapFds; +}; + +#endif //__IPCSocket_H__ + diff --git a/include/utils/MsgMemory.h b/include/utils/MsgMemory.h new file mode 100755 index 0000000..f16e2e1 --- /dev/null +++ b/include/utils/MsgMemory.h @@ -0,0 +1,90 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __MSG_MEMORY_H__ +#define __MSG_MEMORY_H__ + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include +#include + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define GETSP() ({ unsigned int sp; asm volatile ("mov %0,sp " : "=r"(sp) ); sp;}) +#define BUF_SIZE 256 +#define PAGE_SIZE (1 << 12) +#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) +#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) +#define PAGE_ALIGN(addr) _ALIGN_DOWN(addr, PAGE_SIZE) + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +static inline void +stack_trim(void) +{ + unsigned int sp; + char buf[BUF_SIZE]; + FILE* file; + unsigned int stacktop; + int found = 0; + + sp = GETSP(); + + snprintf(buf, BUF_SIZE, "/proc/%d/maps",getpid()); + file = fopen(buf,"r"); + while(fgets(buf, BUF_SIZE, file) != NULL) { + if(strstr(buf, "[stack]")){ + found = 1; + break; + } + } + fclose(file); + + if(found) { + sscanf(buf,"%x-",&stacktop); + if(madvise((void*)PAGE_ALIGN(stacktop), PAGE_ALIGN(sp)-stacktop, MADV_DONTNEED) < 0) + perror("stack madvise fail"); + } +} + + +void MsgReleaseMemory(); + + +#endif // __MSG_MEMORY_H__ + diff --git a/include/utils/MsgMmsMessage.h b/include/utils/MsgMmsMessage.h new file mode 100755 index 0000000..652942a --- /dev/null +++ b/include/utils/MsgMmsMessage.h @@ -0,0 +1,74 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_MMS_MESSAGE_H +#define MSG_MMS_MESSAGE_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgTypes.h" +#include "MsgMmsTypes.h" + +int msg_verify_number(const char *raw, char *trimmed); +int msg_verify_email(const char *raw); +MSG_ERROR_T _MsgMmsAddPage(MMS_MESSAGE_DATA_S *pMsgData, MMS_PAGE_S *pPage); +MSG_ERROR_T _MsgMmsAddMedia(MMS_PAGE_S *pPage, MMS_MEDIA_S *pMedia); +MSG_ERROR_T _MsgMmsAddSmilDoc(char *pSmil, MMS_MESSAGE_DATA_S *pMsgData); +MSG_ERROR_T _MsgMmsAddAttachment(MMS_MESSAGE_DATA_S *pMsgData, MMS_ATTACH_S *pMedia); +MSG_ERROR_T _MsgMmsAddRegion(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_REGION * pRegion); +MSG_ERROR_T _MsgMmsAddTransition(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_TRANSITION *pTransition); +MSG_ERROR_T _MsgMmsAddMeta(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_META *pMeta); + +bool _MsgMmsFindMatchedMedia(MMS_MESSAGE_DATA_S *pMsgData, char *pszFilePath); + +MMS_PAGE_S *_MsgMmsGetPage(MMS_MESSAGE_DATA_S *pMsgData, int pageIdx); +MMS_SMIL_REGION *_MsgMmsGetSmilRegion(MMS_MESSAGE_DATA_S *pMsgData, int regionIdx); +MMS_MEDIA_S *_MsgMmsGetMedia(MMS_PAGE_S *pPage, int mediaIdx); +MMS_ATTACH_S *_MsgMmsGetAttachment(MMS_MESSAGE_DATA_S *pMsgData, int attachIdx); +MMS_SMIL_TRANSITION *_MsgMmsGetTransition(MMS_MESSAGE_DATA_S *pMsgData, int transitionIdx); +MMS_SMIL_META *_MsgMmsGetMeta(MMS_MESSAGE_DATA_S *pMsgData, int metaIdx); +int _MsgMmsGetPageCount(MMS_MESSAGE_DATA_S *pMsgData); +int _MsgMmsGetAttachCount(MMS_MESSAGE_DATA_S *pMsgData); +int _MsgMmsGetTransitionCount(MMS_MESSAGE_DATA_S *pMsgData); +int _MsgMmsGetMetaCount(MMS_MESSAGE_DATA_S *pMsgData); + +MSG_ERROR_T _MsgMmsReleasePageList(MMS_MESSAGE_DATA_S *pMsgData); +MSG_ERROR_T _MsgMmsReleaseRegionList(MMS_MESSAGE_DATA_S *pMsgData); +MSG_ERROR_T _MsgMmsReleaseAttachList(MMS_MESSAGE_DATA_S *pMsgData); +MSG_ERROR_T _MsgMmsReleaseMetaList(MMS_MESSAGE_DATA_S *pMsgData); +MSG_ERROR_T _MsgMmsReleaseTransitionList(MMS_MESSAGE_DATA_S *pMsgData); + +char *_MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, unsigned int *pSize); +bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pBody, char *pFileData); +bool _MsgMmsSetRootLayout(MMS_MESSAGE_DATA_S *pMmsMsg, MMS_SMIL_ROOTLAYOUT *pRootlayout); + + +#endif // MSG_MMS_MESSAGE_H diff --git a/include/utils/MsgMutex.h b/include/utils/MsgMutex.h new file mode 100755 index 0000000..77fba6e --- /dev/null +++ b/include/utils/MsgMutex.h @@ -0,0 +1,100 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef __MSG_MUTEX_H__ +#define __MSG_MUTEX_H__ + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include +#include +#include +#include + +using namespace std; + +int GetMsgReady(); +void WaitMsgReady(int sec); + +class Mutex +{ +public: + Mutex(){ pthread_mutex_init(&m, 0); } + void lock(){ pthread_mutex_lock(&m); } + void unlock(){ pthread_mutex_unlock(&m); } + pthread_mutex_t* pMutex() { return &m; } + +private: + pthread_mutex_t m; +}; + +class MutexLocker +{ +public: + MutexLocker(Mutex& mx) + { + pm = &mx; + pm->lock(); + } + + ~MutexLocker() + { + pm->unlock(); + } + +private: + Mutex *pm; +}; + +class CndVar +{ +public: + CndVar(){ pthread_cond_init(&c, 0); } + void wait(pthread_mutex_t* m) { pthread_cond_wait(&c, m); } + int timedwait(pthread_mutex_t* m, int sec) + { + struct timeval now = {0}; + struct timespec timeout = {0}; + gettimeofday(&now, NULL); + timeout.tv_sec = now.tv_sec+sec; + timeout.tv_nsec = now.tv_usec; + int retcode = pthread_cond_timedwait(&c, m, &timeout); + return retcode; + } + void signal(){ pthread_cond_signal(&c); } + void broadcast(){ pthread_cond_broadcast(&c); } + +private: + pthread_cond_t c; +}; + +#endif //__MUTEX_H__ + diff --git a/include/utils/MsgNotificationWrapper.h b/include/utils/MsgNotificationWrapper.h new file mode 100755 index 0000000..1225377 --- /dev/null +++ b/include/utils/MsgNotificationWrapper.h @@ -0,0 +1,74 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_QUICKPANEL_WRAPPER_H +#define MSG_QUICKPANEL_WRAPPER_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgInternalTypes.h" +#include "MsgSqliteWrapper.h" + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define NORMAL_MSG_ICON_PATH "/opt/apps/org.tizen.message/res/icons/default/small/org.tizen.message.png" +#define VOICE_MSG_ICON_PATH "/opt/apps/org.tizen.message/res/icons/default/small/org.tizen.message.voice.png" +#define CB_MSG_ICON_PATH "/opt/apps/org.tizen.message/res/icons/default/small/org.tizen.message.cb.png" +#define NOTI_MSG_ICON_PATH "/opt/apps/org.tizen.message/res/icons/default/small/org.tizen.message.noti.png" + +#define MSG_APP_PACKAGE_NAME "message" +#define MSG_APP_LOCALEDIR "/opt/apps/org.tizen.message/res/locale" + +#define SENDING_MULTIMEDIA_MESSAGE_FAILED "IDS_MSGF_POP_SENDING_MULTIMEDIA_MESSAGE_FAILED" +#define MULTIMEDIA_MESSAGE_SENT "IDS_MSGF_POP_MULTIMEDIA_MESSAGE_SENT" +#define RETRIEVING_MESSAGE_FAILED "IDS_MSGF_POP_RETRIEVING_MESSAGE_FAILED" +#define MESSAGE_RETRIEVED "IDS_MSGF_BODY_MESSAGE_RETRIEVED" + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +MSG_ERROR_T MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg); + +MSG_ERROR_T MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId, MSG_DELIVERY_REPORT_STATUS_T Status); + +MSG_ERROR_T MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg); + +MSG_ERROR_T MsgDeleteNotiByMsgId(MSG_MESSAGE_ID_T msgId); + +MSG_ERROR_T MsgDeleteNotiByThreadId(MSG_THREAD_ID_T ThreadId); + +MSG_ERROR_T MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg); + +#endif // MSG_QUICKPANEL_WRAPPER_H diff --git a/include/utils/MsgSoundPlayer.h b/include/utils/MsgSoundPlayer.h new file mode 100755 index 0000000..540215c --- /dev/null +++ b/include/utils/MsgSoundPlayer.h @@ -0,0 +1,46 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_SOUND_PLAYER_H +#define MSG_SOUND_PLAYER_H + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +void MsgSoundPlayStart(); +void MsgSoundPlayStop(); + +bool MsgSoundSetRepeatAlarm(); +bool MsgSoundCreateRepeatAlarm(int RepeatTime); +int MsgSoundRepeatAlarmCB(int TimerId, void *pUserParam); +int MsgSoundGetUnreadMsgCnt(); + +#endif // MSG_SOUND_PLAYER_H + diff --git a/include/utils/MsgSqliteWrapper.h b/include/utils/MsgSqliteWrapper.h new file mode 100755 index 0000000..d3a1fb7 --- /dev/null +++ b/include/utils/MsgSqliteWrapper.h @@ -0,0 +1,107 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_SQLITE_WRAPPER_H +#define MSG_SQLITE_WRAPPER_H + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgTypes.h" + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSGFW_DB_NAME "/opt/dbspace/.msg_service.db" + +#define MSGFW_MESSAGE_TABLE_NAME "MSG_MESSAGE_TABLE" +#define MSGFW_FOLDER_TABLE_NAME "MSG_FOLDER_TABLE" +#define MSGFW_ADDRESS_TABLE_NAME "MSG_ADDRESS_TABLE" +#define MSGFW_SIM_MSG_TABLE_NAME "MSG_SIM_TABLE" +#define MSGFW_FILTER_TABLE_NAME "MSG_FILTER_TABLE" +#define MSGFW_PUSH_MSG_TABLE_NAME "MSG_PUSH_TABLE" +#define MSGFW_CB_MSG_TABLE_NAME "MSG_CBMSG_TABLE" +#define MMS_PLUGIN_MESSAGE_TABLE_NAME "MSG_MMS_MESSAGE_TABLE" +#define MMS_PLUGIN_ATTRIBUTE_TABLE_NAME "MSG_MMS_ATTR_TABLE" +#define MSGFW_SYNCML_MSG_TABLE_NAME "MSG_SYNCML_TABLE" +#define MSGFW_SCHEDULED_MSG_TABLE_NAME "MSG_SCHEDULED_TABLE" +#define MSGFW_SMS_SENDOPT_TABLE_NAME "MSG_SMS_SENDOPT_TABLE" +#define MSGFW_REPORT_TABLE_NAME "MSG_REPORT_TABLE" + +#define MAX_QUERY_LEN 3072 +#define MAX_FOLDER_NAME_LEN 20 +#define MAX_ACCOUNT_NAME_LEN 51 + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +void MsgReleaseMemoryDB(); + + +/*================================================================================================== + CLASS DEFINITIONS +==================================================================================================*/ +class MsgDbHandler +{ +public: + MsgDbHandler(); + ~MsgDbHandler(); + + MSG_ERROR_T connect(); + MSG_ERROR_T disconnect(); + + bool checkTableExist(const char *pTableName); + MSG_ERROR_T execQuery(const char *pQuery); + MSG_ERROR_T getTable(const char *pQuery, int *pRowCnt); + void freeTable(); + MSG_ERROR_T bindText(const char *pBindStr, int index); + MSG_ERROR_T bindBlob(const void * pBindBlob, int size, int index); + MSG_ERROR_T prepareQuery(const char *pQuery); + MSG_ERROR_T stepQuery(); + void finalizeQuery(); + int columnInt(int ColumnIndex); + const unsigned char* columnText(int ColumnIndex); + const void* columnBlob(int ColumnIndex); + MSG_ERROR_T beginTrans(); + MSG_ERROR_T endTrans(bool Success); + int getColumnToInt(int RowIndex); + char getColumnToChar(int RowIndex); + void getColumnToString(int RowIndex, int Length, char *pString); + MSG_ERROR_T getRowId(const char *pTableName, unsigned int *pRowId); + +private: + + +}; + +#endif // MSG_SQLITE_WRAPPER_H + diff --git a/include/utils/MsgUtilFile.h b/include/utils/MsgUtilFile.h new file mode 100755 index 0000000..c5b9dda --- /dev/null +++ b/include/utils/MsgUtilFile.h @@ -0,0 +1,77 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_UTIL_FILE_H +#define MSG_UTIL_FILE_H + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define FM_READ_WRITE_BUFFER_MAX (1024*1024*3) + +#define TPDU_LOG_FILE "/opt/etc/msg-service/tpduLog.txt" + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +/** file operation wrapper - for avoding runtime error */ +FILE* MsgOpenFile(const char* filepath, const char* opt); +void MsgCloseFile(FILE* pFile); +int MsgFseek(FILE* pFile, long int offset, int origin); +size_t MsgWriteFile(const char* pData, size_t size, size_t count, FILE *pFile); +size_t MsgReadFile(void *pData, size_t size, size_t count, FILE *pFile); +long int MsgFtell(FILE *pFile); +int MsgFflush(FILE *pFile); +int MsgFsync(FILE *pFile); + +bool MsgCreateFileName(char *pFileName); +bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize); +bool MsgReadFileForDecode(FILE* pFile, char* pBuf, int length, int* nSize); +bool MsgWriteDataFromEncodeBuffer(FILE* pFile, char* pInBuffer, int *pPtr, int maxLen, int* pOffset ); +bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize); +void MsgDeleteFile(const char *pFileName); +bool MsgGetFileSize(const char *pFilePath, int* nSize); +int MsgGetFileSize(const char *pFileName); +FILE* MsgOpenMMSFile(char *pFileName); +bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength); +char* MsgOpenAndReadMmsFile(const char* szFilePath, int offset, int size, int* npSize ); +bool MsgWriteSmilFile(const char *pFilePath,char *pData, int DataSize); +int MsgReadSmilFile(const char *pFileName, char **ppData); +void MsgDeleteSmilFile(const char *pFilePath); +int MsgRmRf(char *pDirPath); +unsigned int MsgDu(const char *pDirPath); +bool MsgAppendFile(const char *pFilePath, const char *pData, int DataSize); +void MsgMmsInitDir(); + + +#endif // MSG_UTIL_FILE_H + diff --git a/include/utils/MsgUtilFunction.h b/include/utils/MsgUtilFunction.h new file mode 100755 index 0000000..555ac37 --- /dev/null +++ b/include/utils/MsgUtilFunction.h @@ -0,0 +1,115 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_UTIL_FUNCTION_H +#define MSG_UTIL_FUNCTION_H + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgStorageTypes.h" +#include "MsgSettingTypes.h" +#include "MsgInternalTypes.h" +#include "MsgCmdTypes.h" + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ + +// Encoders +int MsgEncodeCountInfo(MSG_COUNT_INFO_S *pCountInfo, char **ppDest); + +int MsgEncodeCountByMsgType(int MsgCount, char **ppDest); + +int MsgEncodeRecipientList(MSG_RECIPIENTS_LIST_S *pRecipientList, char **ppDest); + +int MsgEncodeMsgId(MSG_MESSAGE_ID_T *pMsgId, char **ppDest); + +int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest); + +int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char **ppDest); + +int MsgEncodeFolderViewList(MSG_LIST_S *pFolderViewList, char **ppDest); + +int MsgEncodeFolderList(MSG_FOLDER_LIST_S *pFolderList, char **ppDest); + +int MsgEncodeSetting(MSG_SETTING_S *pSetting, char **ppDest); + +int MsgEncodeMsgType(MSG_MESSAGE_TYPE_S *pMsgType, char **ppDest); + +int MsgEncodeThreadViewList(MSG_THREAD_VIEW_LIST_S *pThreadViewList, char **ppDest); + +int MsgEncodeConversationViewList(MSG_LIST_S *pConvViewList, char **ppDest); + +int MsgEncodeMsgGetContactCount(MSG_THREAD_COUNT_INFO_S *threadCountInfo, char **ppDest); + +int MsgEncodeMemSize(unsigned int *memsize, char **ppDest); + +int MsgEncodeSyncMLOperationData(int msgId, int extId, char **ppDest); + +int MsgEncodeStorageChangeData(const MSG_STORAGE_CHANGE_TYPE_T storageChangeType, const MSG_MSGID_LIST_S *pMsgIdList, char **ppDest); + +int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, char **ppDest); + + +// Decoders +void MsgDecodeMsgId(char *pSrc, MSG_MESSAGE_ID_T *pMsgId); + +void MsgDecodeCountInfo(char *pSrc, MSG_COUNT_INFO_S *pCountInfo); + +void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo); + +void MsgDecodeFolderViewList(char *pSrc, MSG_LIST_S *pFolderViewList); + +void MsgDecodeRecipientList(char *pSrc, MSG_RECIPIENTS_LIST_S *pRecipientList); + +void MsgDecodeFolderList(char *pSrc, MSG_FOLDER_LIST_S *pFolderList); + +void MsgDecodeSetting(char *pSrc, MSG_SETTING_S *pSetting); + +void MsgDecodeMsgType(char *pSrc, MSG_MESSAGE_TYPE_S* pMsgType); + +void MsgDecodeThreadViewList(char *pSrc, MSG_THREAD_VIEW_LIST_S *pThreadViewList); + +void MsgDecodeConversationViewList(char *pSrc, MSG_LIST_S *pConvViewList); + +void MsgDecodeContactCount(char *pSrc, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList); + +void MsgDecodeMemSize(char *pSrc, unsigned int *memsize); + +void MsgDecodeReportStatus(char *pSrc, MSG_REPORT_STATUS_INFO_S *pReportStatus); + + +// Event Encoder +int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, MSG_ERROR_T MsgError, void **ppEvent); + + +#endif // MSG_UTIL_FUNCTION_H diff --git a/include/utils/MsgUtilStorage.h b/include/utils/MsgUtilStorage.h new file mode 100755 index 0000000..6da900c --- /dev/null +++ b/include/utils/MsgUtilStorage.h @@ -0,0 +1,69 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#ifndef MSG_UTIL_STORAGE_H +#define MSG_UTIL_STORAGE_H + + +/*================================================================================================== + INCLUDE FILES +==================================================================================================*/ +#include "MsgInternalTypes.h" +#include "MsgStorageTypes.h" +#include "MsgSqliteWrapper.h" + + +/*================================================================================================== + FUNCTION PROTOTYPES +==================================================================================================*/ +// Common Function +unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsgInfo, unsigned int AddrId); +MSG_ERROR_T MsgStoSetReadStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId, bool bRead); +MSG_ERROR_T MsgStoGetOldestMessage(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsgInfo, MSG_MESSAGE_ID_T *pMsgId); +MSG_ERROR_T MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S* pMsgType, MSG_FOLDER_ID_T FolderId); +MSG_ERROR_T MsgStoCountMsgByLimitCategory(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount, MSG_FOLDER_ID_T folderId ); +int MsgStoCheckMsgCntLimit(const MSG_MESSAGE_TYPE_S* pMsgType, MSG_FOLDER_ID_T FolderId); + +MSG_ERROR_T MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_ADDRESS_INFO_S *pAddrInfo, unsigned int *pAddrId); +MSG_ERROR_T MsgStoUpdateAddress(MsgDbHandler *pDbHandle, unsigned int AddrId); +MSG_ERROR_T MsgStoClearAddressTable(MsgDbHandler *pDbHandle); +bool MsgExistAddress(MsgDbHandler *pDbHandle, const char *pAddress, unsigned int *pAddrId); + +int MsgStoGetUnreadCnt(MsgDbHandler *pDbHandle, MSG_MAIN_TYPE_T MsgType); +MSG_ERROR_T MsgStoAddContactInfo(MsgDbHandler *pDbHandle, MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber); +MSG_ERROR_T MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int ContactId); +MSG_ERROR_T MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int ContactId, const char *pNumber); +MSG_ERROR_T MsgStoGetMmsRawFilePath(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T msgId, char *pFilePath); +bool MsgStoCheckReadReportRequested(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId); +bool MsgStoCheckReadReportIsSent(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId); +char *MsgStoReplaceString(const char *org_str, const char *old_str, const char *new_str); + +#endif // MSG_UTIL_STORAGE_H + diff --git a/mapi/CMakeLists.txt b/mapi/CMakeLists.txt new file mode 100755 index 0000000..842c32a --- /dev/null +++ b/mapi/CMakeLists.txt @@ -0,0 +1,54 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(msg-server CXX) + +SET(CMAKE_SKIP_BUILD_RPATH TRUE) +SET(VERSION_MAJOR 0) +SET(VERSION "${VERSION_MAJOR}.1.0") + +IF("${CMAKE_BUILD_TYPE}" STREQUAL "") + SET(CMAKE_BUILD_TYPE "Debug") +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") + +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall") + +########################################################## +# Define MAPI +########################################################## + +SET(MAPI-SRCS + ${CMAKE_SOURCE_DIR}/mapi/MapiControl.cpp + ${CMAKE_SOURCE_DIR}/mapi/MapiSetting.cpp + ${CMAKE_SOURCE_DIR}/mapi/MapiStorage.cpp + ${CMAKE_SOURCE_DIR}/mapi/MapiTransport.cpp + ${CMAKE_SOURCE_DIR}/mapi/MapiMessage.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/proxy + ${CMAKE_SOURCE_DIR}/include/utils + ${CMAKE_SOURCE_DIR}/include/mapi +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(mapi_pkgs REQUIRED glib-2.0 dlog) + +FOREACH(flag ${mapi_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_LIBRARY(${MAPI-LIB} SHARED ${MAPI-SRCS}) +TARGET_LINK_LIBRARIES(${MAPI-LIB} ${mapi_pkgs_LDFLAGS} ${UTILS-LIB} ${TRANS-PROXY-LIB}) +SET_TARGET_PROPERTIES(${MAPI-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR}) +SET_TARGET_PROPERTIES(${MAPI-LIB} PROPERTIES VERSION ${VERSION}) + +INSTALL(TARGETS ${MAPI-LIB} DESTINATION lib COMPONENT RuntimeLibraries) + diff --git a/mapi/MapiControl.cpp b/mapi/MapiControl.cpp new file mode 100755 index 0000000..c5876ee --- /dev/null +++ b/mapi/MapiControl.cpp @@ -0,0 +1,104 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgHandle.h" +#include "MsgDebug.h" +#include "MsgException.h" +#include "MapiControl.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +EXPORT_API int msg_open_msg_handle(MSG_HANDLE_T *handle) +{ + MsgHandle* pHandle = new MsgHandle(); + + if (handle == NULL) + { + MSG_FATAL("Input Paramter is NULL"); + return -EINVAL; + } + + // Create MsgHandle + *handle = (MSG_HANDLE_T)pHandle; + + if (*handle == NULL) + return -EINVAL; + + try + { + // Connect to Socket + pHandle->openHandle(); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + + if (e.errorCode() == MsgException::SERVER_READY_ERROR) + return MSG_ERR_SERVER_NOT_READY; + else + return MSG_ERR_COMMUNICATION_ERROR; + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_close_msg_handle(MSG_HANDLE_T *handle) +{ + if (handle == NULL || *handle == NULL) + { + MSG_FATAL("Input Paramter is NULL"); + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)(*handle); + + try + { + // Disconnect to Socket + pHandle->closeHandle(pHandle); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_COMMUNICATION_ERROR; + } + + // Destroy MsgHandle + delete (MsgHandle*)(*handle); + (*handle) = NULL; + + return MSG_SUCCESS; +} + diff --git a/mapi/MapiMessage.cpp b/mapi/MapiMessage.cpp new file mode 100755 index 0000000..c6f299a --- /dev/null +++ b/mapi/MapiMessage.cpp @@ -0,0 +1,1485 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgTypes.h" +#include "MsgMmsTypes.h" +#include "MsgMmsMessage.h" +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgHandle.h" +#include "MsgException.h" +#include "MapiMessage.h" +#include "MsgInternalTypes.h" +#include "MsgDrmWrapper.h" + + +static MSG_ERROR_T msg_mms_release_message(MMS_MESSAGE_DATA_S* msg_data); + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +EXPORT_API msg_message_t msg_new_message(void) +{ + MSG_MESSAGE_S *msg = new MSG_MESSAGE_S; + + memset(msg, 0x00, sizeof(MSG_MESSAGE_S)); + + /* set default value to message*/ + msg->msgId = 0; + msg->folderId = MSG_DRAFT_ID; + msg->referenceId = 0; + msg->msgType.mainType= MSG_SMS_TYPE; + msg->msgType.subType = MSG_NORMAL_SMS; + msg->msgType.classType = MSG_CLASS_NONE; + msg->storageId = MSG_STORAGE_PHONE; + msg->nAddressCnt = 0; + time_t curTime = time(NULL); + msg->displayTime = curTime; + msg->networkStatus = MSG_NETWORK_NOT_SEND; + msg->encodeType = MSG_ENCODE_AUTO; + msg->bRead = false; + msg->bProtected = false; + msg->bBackup = false; + msg->priority = MSG_MESSAGE_PRIORITY_NORMAL; + msg->direction = MSG_DIRECTION_TYPE_MO; + msg->msgPort.valid = false; + msg->dataSize = 0; + msg->pData = NULL; + msg->pMmsData = NULL; + msg->scheduledTime = 0; + + return (msg_message_t) msg; +} + + +EXPORT_API int msg_release_message(msg_message_t *opq_msg) +{ + if (opq_msg == NULL) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S* msg = NULL; + + msg = (MSG_MESSAGE_S*)(*opq_msg); + + if (msg != NULL) + { + MSG_DEBUG("main type : %d, data size : %d", msg->msgType.mainType, msg->dataSize); + + if (msg->pData) + { + delete [] static_cast(msg->pData); + msg->pData = NULL; + } + + if (msg->pMmsData) + { + delete [] static_cast(msg->pMmsData); + msg->pMmsData = NULL; + } + + delete (MSG_MESSAGE_S*)(*opq_msg); + *opq_msg = NULL; + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_set_message_id(msg_message_t opq_msg, int msg_id) +{ + if ( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->msgId = msg_id; + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_message_id(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + return msg->msgId; +} + + +EXPORT_API int msg_set_message_type(msg_message_t opq_msg, MSG_MESSAGE_TYPE_T msg_type) +{ + if (!opq_msg) + { + MSG_FATAL("msg or text is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*)opq_msg; + + if (msg_type == MSG_TYPE_SMS) + { + msg->msgType.mainType = MSG_SMS_TYPE; + msg->msgType.subType = MSG_NORMAL_SMS; + } + else if (msg_type == MSG_TYPE_MMS) + { + msg->msgType.mainType = MSG_MMS_TYPE; + msg->msgType.subType = MSG_SENDREQ_MMS; + } + else if (msg_type == MSG_TYPE_MMS_JAVA) + { + msg->msgType.mainType = MSG_MMS_TYPE; + msg->msgType.subType = MSG_SENDREQ_JAVA_MMS; + } + else if (msg_type == MSG_TYPE_SMS_SYNCML) + { + msg->msgType.mainType = MSG_SMS_TYPE; + msg->msgType.subType = MSG_SYNCML_CP; + } + else if (msg_type == MSG_TYPE_SMS_REJECT) + { + msg->msgType.mainType = MSG_SMS_TYPE; + msg->msgType.subType = MSG_REJECT_SMS; + } + else + { + MSG_FATAL("invalid msg_type [%d]", msg_type); + return MSG_ERR_INVALID_PARAMETER; + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_message_type(msg_message_t opq_msg) +{ + if (!opq_msg) + { + MSG_FATAL("msg or msg_type is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*)opq_msg; + + if (msg->msgType.mainType == MSG_SMS_TYPE) + { + if (msg->msgType.subType == MSG_CB_SMS) + return MSG_TYPE_SMS_CB; + else if (msg->msgType.subType == MSG_JAVACB_SMS) + return MSG_TYPE_SMS_JAVACB; + else if (msg->msgType.subType == MSG_WAP_SI_SMS || msg->msgType.subType == MSG_WAP_SL_SMS) + return MSG_TYPE_SMS_WAPPUSH; + else if (msg->msgType.subType == MSG_MWI_VOICE_SMS || msg->msgType.subType == MSG_MWI_FAX_SMS + || msg->msgType.subType == MSG_MWI_EMAIL_SMS || msg->msgType.subType == MSG_MWI_OTHER_SMS) + return MSG_TYPE_SMS_MWI; + else if (msg->msgType.subType == MSG_SYNCML_CP) + return MSG_TYPE_SMS_SYNCML; + else if (msg->msgType.subType == MSG_REJECT_SMS) + return MSG_TYPE_SMS_REJECT; + else + return MSG_TYPE_SMS; + } + else if (msg->msgType.mainType == MSG_MMS_TYPE) + { + if (msg->msgType.subType == MSG_NOTIFICATIONIND_MMS) + return MSG_TYPE_MMS_NOTI; + else if (msg->msgType.subType == MSG_SENDREQ_JAVA_MMS) + return MSG_TYPE_MMS_JAVA; + else + return MSG_TYPE_MMS; + } + else + return MSG_TYPE_INVALID; +} + + +EXPORT_API bool msg_is_sms(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or msg_type is NULL"); + return false; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return (msg->msgType.mainType == MSG_SMS_TYPE); +} + + +EXPORT_API bool msg_is_mms(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or msg_type is NULL"); + return false; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return (msg->msgType.mainType == MSG_MMS_TYPE); +} + + +EXPORT_API int msg_set_storage_id(msg_message_t opq_msg, MSG_STORAGE_ID_T storage_id) +{ + if( !opq_msg) + { + MSG_FATAL("msg or storage is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if (storage_id != MSG_STORAGE_PHONE && storage_id != MSG_STORAGE_SIM) + { + MSG_FATAL("unsupported storage [%d]", storage_id); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + msg->storageId = storage_id; + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_storage_id(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + return msg->storageId; +} + + +EXPORT_API bool msg_is_in_sim(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or folder is NULL"); + return false; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + return (msg->storageId == MSG_STORAGE_SIM); +} + + +EXPORT_API int msg_set_folder_id(msg_message_t opq_msg, MSG_FOLDER_ID_T folder_id) +{ + if( !opq_msg) + { + MSG_FATAL("msg or is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if (folder_id < MSG_INBOX_ID || folder_id > MSG_MAX_FOLDER_ID) + { + MSG_FATAL("wrong folder ID [%d]", folder_id); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + msg->folderId = folder_id; + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_folder_id(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + return msg->folderId; +} + + +EXPORT_API int msg_reset_address(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + msg->nAddressCnt = 0; + + for (int i=0 ; i < MAX_TO_ADDRESS_CNT ; i++) + { + msg->addressList[i].threadId = 0; + msg->addressList[i].addressType = MSG_ADDRESS_TYPE_UNKNOWN; + msg->addressList[i].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN; + msg->addressList[i].contactId = 0; + msg->addressList[i].addressVal[0] = '\0'; + msg->addressList[i].displayName[0] = '\0'; + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_add_address(msg_message_t opq_msg, const char* phone_num_list, MSG_RECIPIENT_TYPE_T to_type ) +{ + if( !opq_msg || !phone_num_list) + { + MSG_FATAL("msg or text or type is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if (to_type < MSG_RECIPIENTS_TYPE_TO || to_type > MSG_RECIPIENTS_TYPE_BCC) + { + MSG_FATAL("unsupported recipient type [%d]", to_type); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + + if(msg->msgType.mainType == MSG_SMS_TYPE) + { + char trimmed_num[strlen(phone_num_list)+1]; + bzero(trimmed_num, strlen(phone_num_list)+1); + + MSG_ERROR_T retVal = msg_verify_number(phone_num_list, trimmed_num); + + if ( retVal != MSG_SUCCESS ) + return retVal; + + int i = msg->nAddressCnt; + for( char* cur_num = strtok(trimmed_num,", "); cur_num && (i < MAX_TO_ADDRESS_CNT); + cur_num = strtok(NULL,", "), i++) + { + if (strlen(cur_num) > MAX_ADDRESS_VAL_LEN) + { + MSG_DEBUG("Phone number is too long [%s], and sending is skipped", cur_num); + continue; + } + + /* fill the destination number in msgReq */ + msg->nAddressCnt++; + msg->addressList[i].addressType = MSG_ADDRESS_TYPE_PLMN; // telephone number + msg->addressList[i].recipientType = to_type; // recipient type + snprintf(msg->addressList[i].addressVal, MAX_ADDRESS_VAL_LEN, "%s", cur_num); + MSG_DEBUG("SMS AddressVal = [%s]", msg->addressList[i].addressVal); + } + + } + else + { + char phone_num_list_tmp[strlen(phone_num_list)+1]; + bzero(phone_num_list_tmp, strlen(phone_num_list)+1); + + strncpy(phone_num_list_tmp, phone_num_list, strlen(phone_num_list)); + + MSG_ERROR_T retVal = msg_verify_email(phone_num_list_tmp); + + if ( retVal != MSG_SUCCESS ) + return retVal; + + int i = msg->nAddressCnt; + for( char* cur_num = strtok(phone_num_list_tmp,", "); cur_num && (i < MAX_TO_ADDRESS_CNT); + cur_num = strtok(NULL,", "), i++) + { + if (strlen(cur_num) > MAX_ADDRESS_VAL_LEN) + { + MSG_DEBUG("Phone number is too long [%s], and sending is skipped", cur_num); + continue; + } + + char trimmed_num[strlen(cur_num)+1]; + bzero(trimmed_num, strlen(cur_num)+1); + + retVal = msg_verify_number(cur_num, trimmed_num); + + if(retVal == MSG_SUCCESS) + { + /* fill the destination number in msgReq */ + msg->nAddressCnt++; + msg->addressList[i].addressType = MSG_ADDRESS_TYPE_PLMN; // telephone number + msg->addressList[i].recipientType = to_type; // recipient type + snprintf(msg->addressList[i].addressVal, MAX_ADDRESS_VAL_LEN, "%s", trimmed_num); + MSG_DEBUG("MMS Number AddressVal = [%s]", msg->addressList[i].addressVal); + } + else + { + /* fill the destination number in msgReq */ + msg->nAddressCnt++; + msg->addressList[i].addressType = MSG_ADDRESS_TYPE_EMAIL; // telephone number + msg->addressList[i].recipientType = to_type; // recipient type + snprintf(msg->addressList[i].addressVal, MAX_ADDRESS_VAL_LEN, "%s", cur_num); + MSG_DEBUG("MMS Email AddressVal = [%s]", msg->addressList[i].addressVal); + } + } + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_address_count(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or count is NULL"); + return MSG_ERR_NULL_POINTER; + } + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return msg->nAddressCnt; +} + + +EXPORT_API int msg_get_ith_thread_id(msg_message_t opq_msg, int ith) +{ + if( !opq_msg) + { + MSG_FATAL("msg or text or type is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + if( ith < msg->nAddressCnt ) + { + return msg->addressList[ith].threadId; + } + else + { + MSG_FATAL("Requested address count %d exceeds max %d in msg", ith, msg->nAddressCnt); + return MSG_ERR_UNKNOWN; + } +} + + +EXPORT_API const char* msg_get_ith_address(msg_message_t opq_msg, int ith) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or addr is NULL"); + return NULL; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + if( ith < msg->nAddressCnt ) + { + return msg->addressList[ith].addressVal; + } + else + { + MSG_FATAL("Requested address count %d exceeds max %d in msg", ith, msg->nAddressCnt); + return NULL; + } +} + + +EXPORT_API int msg_get_ith_recipient_type(msg_message_t opq_msg, int ith) +{ + if( !opq_msg) + { + MSG_FATAL("msg or text or type is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + if( ith < msg->nAddressCnt ) + { + return msg->addressList[ith].recipientType; + } + else + { + MSG_FATAL("Requested address count %d exceeds max %d in msg", ith, msg->nAddressCnt); + return MSG_ERR_UNKNOWN; + } +} + + +EXPORT_API const char* msg_get_ith_name(msg_message_t opq_msg, int ith) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or addr is NULL"); + return NULL; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + if( ith < msg->nAddressCnt ) + { + return msg->addressList[ith].displayName; + } + else + { + MSG_FATAL("Requested address count %d exceeds max %d in msg", ith, msg->nAddressCnt); + return NULL; + } +} + + +EXPORT_API int msg_get_ith_contact_id(msg_message_t opq_msg, int ith) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or addr is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + if( ith < msg->nAddressCnt ) + { + return msg->addressList[ith].contactId; + } + else + { + MSG_FATAL("Requested address count %d exceeds max %d in msg", ith, msg->nAddressCnt); + return MSG_ERR_UNKNOWN; + } +} + + +EXPORT_API int msg_set_reply_address(msg_message_t opq_msg, const char* phone_num) +{ + if( !opq_msg || !phone_num) + { + MSG_FATAL("msg or text or type is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if (strlen(phone_num) > MAX_PHONE_NUMBER_LEN) + { + MSG_DEBUG("Phone number is too long [%s]", phone_num); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + char trimmed_num[strlen(phone_num)+1]; + bzero(trimmed_num, strlen(phone_num)+1); + + MSG_ERROR_T retVal = msg_verify_number(phone_num, trimmed_num); + + if (retVal != MSG_SUCCESS) + return retVal; + + snprintf(msg->replyAddress, MAX_PHONE_NUMBER_LEN, "%s", phone_num); + + MSG_DEBUG("Reply Address Number : [%s]", msg->replyAddress); + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_sms_set_message_body(msg_message_t opq_msg, const char* mdata, int size) +{ + if (!opq_msg || !mdata) { + MSG_FATAL("msg or text is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if (size <= 0) { + MSG_FATAL("msg size is invalid"); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + if(msg->msgType.mainType == MSG_MMS_TYPE) { +/** Temporary added codes for Binary MMS. */ + if (msg->pMmsData) + delete [] static_cast(msg->pMmsData); + + msg->dataSize = size; + + msg->pMmsData = (void*)new char[msg->dataSize+1]; + + memset(msg->pMmsData, 0x00, msg->dataSize+1); + + memcpy((char *)msg->pMmsData, mdata, msg->dataSize); + +/** End. */ + } else if (msg->msgType.mainType == MSG_SMS_TYPE) { + if (msg->pData) + delete [] static_cast(msg->pData); + + msg->dataSize = size; + + msg->pData = (void*)new char[msg->dataSize+1]; + + memcpy((char *)msg->pData, mdata, msg->dataSize); + + ((char*) msg->pData)[msg->dataSize] = '\0'; + + } else { + return MSG_ERR_INVALID_MSG_TYPE; + } + + return MSG_SUCCESS; + +} + + +EXPORT_API const char* msg_sms_get_message_body(msg_message_t opq_msg) +{ + if (!opq_msg) { + MSG_FATAL("msg is NULL"); + return NULL; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + + if (msg->msgType.mainType == MSG_SMS_TYPE) { + + return (char*) msg->pData; + + } else if (msg->msgType.mainType == MSG_MMS_TYPE) { + + return (char*) msg->pMmsData; + + } else { + MSG_FATAL("msg type is invalid."); + return NULL; + } + +} + + +EXPORT_API const char* msg_mms_get_text_contents(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return NULL; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + if(msg->msgType.mainType != MSG_MMS_TYPE) + { + MSG_FATAL("msg is not mms type."); + return NULL; + } + + return (char*) msg->pData; +} + + +EXPORT_API int msg_get_message_body_size(msg_message_t opq_msg ) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return msg->dataSize; +} + + +EXPORT_API int msg_set_subject(msg_message_t opq_msg, const char* subject ) +{ + if( !opq_msg || !subject ) + { + MSG_FATAL("msg or subject is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + snprintf(msg->subject, MAX_SUBJECT_LEN+1,"%s", subject); + + return MSG_SUCCESS; +} + + +EXPORT_API const char* msg_get_subject(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return NULL; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + return msg->subject; +} + + +EXPORT_API int msg_set_time(msg_message_t opq_msg, time_t msg_time) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + msg->displayTime = msg_time; + return MSG_SUCCESS; +} + + +EXPORT_API time_t* msg_get_time(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return NULL; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + return &(msg->displayTime); +} + +EXPORT_API int msg_set_network_status(msg_message_t opq_msg, MSG_NETWORK_STATUS_T status) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->networkStatus = status; + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_network_status(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or status is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return msg->networkStatus; +} + + +EXPORT_API int msg_set_encode_type(msg_message_t opq_msg, MSG_ENCODE_TYPE_T encoding_type) +{ + if( !opq_msg) + { + MSG_FATAL("msg or encoding_type is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if( encoding_type != MSG_ENCODE_GSM7BIT && + encoding_type != MSG_ENCODE_8BIT && + encoding_type != MSG_ENCODE_UCS2 && + encoding_type != MSG_ENCODE_AUTO ) + { + MSG_FATAL("Encoding_type has invalid value [%d]", encoding_type); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->encodeType = encoding_type; + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_encode_type(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return msg->encodeType; +} + + +EXPORT_API int msg_set_read_status(msg_message_t opq_msg, bool read_flag) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->bRead = read_flag; + return MSG_SUCCESS; +} + + +EXPORT_API bool msg_is_read(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return false; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + return msg->bRead; +} + + +EXPORT_API int msg_set_protect_status(msg_message_t opq_msg, bool protect_flag) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->bProtected = protect_flag; + return MSG_SUCCESS; +} + + +EXPORT_API bool msg_is_protected(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or protected is NULL"); + return false; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return msg->bProtected; +} + + +EXPORT_API int msg_set_backup_status(msg_message_t opq_msg, bool backup_flag) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->bBackup = backup_flag; + return MSG_SUCCESS; +} + + +EXPORT_API bool msg_is_backup(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or protected is NULL"); + return false; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return msg->bBackup; +} + + +EXPORT_API int msg_set_priority_info(msg_message_t opq_msg, MSG_PRIORITY_TYPE_T priority) +{ + if( !opq_msg) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->priority = priority; + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_priority_info(msg_message_t opq_msg) +{ + if( !opq_msg) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return msg->priority; +} + + +EXPORT_API int msg_set_direction_info(msg_message_t opq_msg, MSG_DIRECTION_TYPE_T direction) +{ + if( !opq_msg) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->direction= direction; + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_direction_info(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return msg->direction; +} + + +EXPORT_API int msg_set_port(msg_message_t opq_msg, unsigned short dst_port, unsigned short src_port) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if( !dst_port && !src_port ) + return MSG_SUCCESS; + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->msgPort.valid = true; + msg->msgPort.dstPort = dst_port; + msg->msgPort.srcPort = src_port; + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_dest_port(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or dst_port or src_port is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + if( msg->msgPort.valid ) + return msg->msgPort.dstPort; + else + return 0; +} + + +EXPORT_API int msg_get_src_port(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg or dst_port or src_port is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + if( msg->msgPort.valid ) + return msg->msgPort.srcPort; + else + return 0; +} + + +EXPORT_API int msg_set_scheduled_time(msg_message_t opq_msg, time_t time_to_send) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if( !time_to_send ) + return MSG_SUCCESS; + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + msg->scheduledTime = time_to_send; + + return MSG_SUCCESS; +} + + +EXPORT_API time_t* msg_get_scheduled_time(msg_message_t opq_msg) +{ + if( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return NULL; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + return &(msg->scheduledTime); +} + + +EXPORT_API int msg_get_attachment_count(msg_message_t opq_msg) +{ + if ( !opq_msg ) + { + MSG_FATAL("msg is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S* msg = (MSG_MESSAGE_S*) opq_msg; + + return msg->attachCount; +} + +EXPORT_API const char* msg_get_thumbnail_path(msg_message_t opq_msg) +{ + if (!opq_msg) + { + MSG_FATAL("msg is NULL"); + return NULL; + } + + MSG_MESSAGE_S* pMsg = (MSG_MESSAGE_S*)opq_msg; + + return pMsg->thumbPath; +} + + +static MSG_ERROR_T msg_mms_release_message(MMS_MESSAGE_DATA_S* msg_data) +{ + _MsgMmsReleasePageList(msg_data); + _MsgMmsReleaseRegionList(msg_data); + _MsgMmsReleaseAttachList(msg_data); + _MsgMmsReleaseTransitionList(msg_data); + _MsgMmsReleaseMetaList(msg_data); + return MSG_SUCCESS; +} + + +EXPORT_API int msg_mms_set_message_body(msg_message_t opq_msg, const MMS_MESSAGE_DATA_S *msg_data) +{ + if (!opq_msg || !msg_data) { + MSG_FATAL("msg or msg_data is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S* msg = (MSG_MESSAGE_S*) opq_msg; + + if (msg->msgType.mainType != MSG_MMS_TYPE) { + MSG_FATAL("msg is not mms type."); + return MSG_ERR_INVALID_MSG_TYPE; + } + + if (msg->pMmsData) { + if (msg->dataSize > 0) + delete[] ((char*) msg->pMmsData); + } + + msg->dataSize = 0; + + msg->pMmsData = _MsgMmsSerializeMessageData(msg_data, &(msg->dataSize)); + + MSG_DEBUG("msg->dataSize : [%d]", msg->dataSize); + + if (msg->dataSize <= 0) { + MSG_FATAL("msg size is invalid"); + return MSG_ERR_INVALID_PARAMETER; + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_mms_get_message_body(msg_message_t opq_msg, MMS_MESSAGE_DATA_S *body ) +{ + if (!opq_msg || !body) { + MSG_FATAL("msg or body is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_MESSAGE_S *msg = (MSG_MESSAGE_S*) opq_msg; + + if (msg->msgType.mainType != MSG_MMS_TYPE) { + MSG_FATAL("msg is not mms type."); + return MSG_ERR_INVALID_MSG_TYPE; + } + + if (msg->pMmsData == NULL) { + MSG_FATAL("msg->pMmsData is NULL"); + return MSG_ERR_NULL_POINTER; + } + + _MsgMmsDeserializeMessageData(body, (char*)msg->pMmsData); + + return MSG_SUCCESS; +} + + +EXPORT_API MMS_PAGE_S* msg_mms_add_page(MMS_MESSAGE_DATA_S *msg_data, const int duration) +{ + if(msg_data == NULL) + return NULL; + + MMS_PAGE_S* page = (MMS_PAGE_S*)calloc(sizeof(MMS_PAGE_S), 1); + page->nDur = duration; + + _MsgMmsAddPage(msg_data, page); + + return page; +} + + +EXPORT_API MMS_SMIL_REGION* msg_mms_add_region(MMS_MESSAGE_DATA_S *msg_data, const char* szID, const int x, const int y, const int width, const int height, const int bgcolor) +{ + if(msg_data == NULL || szID == NULL) + return NULL; + + MMS_SMIL_REGION* region = (MMS_SMIL_REGION *)calloc( sizeof(MMS_SMIL_REGION), 1 ); + + strncpy(region->szID, szID, MAX_SMIL_REGION_ID-1); + region->bgColor = bgcolor; + region->nLeft.value = x; + region->nLeft.bUnitPercent = true; + region->nTop.value = y; + region->nTop.bUnitPercent = true; + region->width.value = width; + region->width.bUnitPercent = true; + region->height.value = height; + region->height.bUnitPercent = true; + region->fit = MMSUI_IMAGE_REGION_FIT_MEET; + + _MsgMmsAddRegion(msg_data, region); + + return region; +} + + +EXPORT_API MMS_MEDIA_S* msg_mms_add_media(MMS_PAGE_S *page, const MmsSmilMediaType mediatype, const char* regionid, char* filepath) +{ + if(page == NULL || filepath == NULL) + return NULL; + + if (MsgDrmIsDrmFile(filepath)) { + MSG_DRM_TYPE drm_type = MSG_DRM_NONE; + + if (MsgDrmGetDrmType(filepath, &drm_type)) { + if (drm_type == MSG_DRM_FORWARD_LOCK || drm_type == MSG_DRM_COMBINED_DELIVERY) { + MSG_FATAL("file is a FL content"); + return NULL; + } + } + } + + MMS_MEDIA_S* media = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); + char *filename = NULL; + + media->mediatype = mediatype; + + if(regionid) + strncpy(media->regionId, regionid, MAX_SMIL_REGION_ID-1); + + strncpy(media->szFilePath, filepath, MSG_FILEPATH_LEN_MAX-1); + + filename = strrchr(filepath, '/'); + strncpy(media->szFileName, filename + 1, MSG_FILENAME_LEN_MAX-1); + strncpy(media->szContentID, filename + 1, MSG_MSG_ID_LEN); + + _MsgMmsAddMedia(page, media); + + return media; +} + + +EXPORT_API MMS_ATTACH_S* msg_mms_add_attachment(MMS_MESSAGE_DATA_S *msg_data, char *filepath) +{ + if(msg_data == NULL || filepath == NULL) + return NULL; + + if (MsgDrmIsDrmFile(filepath)) { + MSG_DRM_TYPE drm_type = MSG_DRM_NONE; + + if (MsgDrmGetDrmType(filepath, &drm_type)) { + if (drm_type == MSG_DRM_FORWARD_LOCK || drm_type == MSG_DRM_COMBINED_DELIVERY) { + MSG_FATAL("file is a FL content"); + return NULL; + } + } + } + + MMS_ATTACH_S* attach = (MMS_ATTACH_S*)calloc(sizeof(MMS_ATTACH_S), 1); + char *filename = NULL; + + attach->mediatype = MIME_UNKNOWN; + attach->fileSize = -1; + strncpy(attach->szFilePath, filepath, MSG_FILEPATH_LEN_MAX-1); + filename = strrchr(filepath, '/'); + strncpy(attach->szFileName, filename + 1, MSG_FILENAME_LEN_MAX-1); + + _MsgMmsAddAttachment(msg_data, attach); + + return attach; +} + + +EXPORT_API int msg_mms_add_transition(MMS_MESSAGE_DATA_S *msg_data, MMS_SMIL_TRANSITION *transition) +{ + if(msg_data == NULL || transition == NULL) + return MSG_ERR_NULL_POINTER; + + MMS_SMIL_TRANSITION *pTransition = (MMS_SMIL_TRANSITION *)calloc(sizeof(MMS_SMIL_TRANSITION), 1); + + if (transition->szID[0] != '0') + strncpy(pTransition->szID, transition->szID, MAX_SMIL_TRANSITION_ID); + + pTransition->nType = transition->nType; + pTransition->nSubType = transition->nSubType; + pTransition->nDur = transition->nDur; + + _MsgMmsAddTransition(msg_data, pTransition); + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_mms_add_meta(MMS_MESSAGE_DATA_S *msg_data, MMS_SMIL_META *meta) +{ + if(msg_data == NULL || meta == NULL) + return MSG_ERR_NULL_POINTER; + + MMS_SMIL_META *pMeta = (MMS_SMIL_META *)calloc(sizeof(MMS_SMIL_META), 1); + + if (meta->szID[0] != '0') + strncpy(pMeta->szID, meta->szID, MAX_SMIL_TRANSITION_ID); + + if (meta->szName[0] != '0') + strncpy(pMeta->szName, meta->szName, MAX_SMIL_META_NAME); + + if (meta->szContent[0] != '0') + strncpy(pMeta->szContent, meta->szContent, MAX_SMIL_META_NAME); + + _MsgMmsAddMeta(msg_data, pMeta); + + return MSG_SUCCESS; +} + + +EXPORT_API MMS_PAGE_S *msg_mms_get_page(MMS_MESSAGE_DATA_S *msg_data, int page_idx) +{ + if (msg_data == NULL) + return NULL; + + if (page_idx < 0) + return NULL; + + return _MsgMmsGetPage(msg_data, page_idx); +} + + +EXPORT_API MMS_SMIL_REGION* msg_mms_get_smil_region(MMS_MESSAGE_DATA_S *msg_data, int region_idx) +{ + if (msg_data == NULL) + return NULL; + + if (region_idx < 0) + return NULL; + + return _MsgMmsGetSmilRegion(msg_data, region_idx); +} + + +EXPORT_API MMS_MEDIA_S* msg_mms_get_media(MMS_PAGE_S *page, int media_idx) +{ + if (page == NULL || media_idx < 0) + return NULL; + + return _MsgMmsGetMedia(page, media_idx); +} + + +EXPORT_API MMS_ATTACH_S* msg_mms_get_attachment(MMS_MESSAGE_DATA_S *msg_data, int attach_idx) +{ + if (msg_data == NULL) + return NULL; + + if ( attach_idx <0 ) + return NULL; + + return _MsgMmsGetAttachment(msg_data, attach_idx); +} + + +EXPORT_API MMS_SMIL_TRANSITION* msg_mms_get_transition(MMS_MESSAGE_DATA_S *msg_data, int transition_idx) +{ + if (msg_data == NULL) + return NULL; + + if (transition_idx < 0) + return NULL; + + return _MsgMmsGetTransition(msg_data, transition_idx); +} + + +EXPORT_API MMS_SMIL_META* msg_mms_get_meta(MMS_MESSAGE_DATA_S *msg_data, int meta_idx) +{ + if (msg_data == NULL) + return NULL; + + if (meta_idx < 0) + return NULL; + + return _MsgMmsGetMeta(msg_data, meta_idx); +} + + +EXPORT_API int msg_mms_release_page_list(MMS_MESSAGE_DATA_S *msg_data) +{ + if (msg_data == NULL) + return MSG_ERR_NULL_POINTER; + + MSG_ERROR_T err = MSG_SUCCESS; + + err = _MsgMmsReleasePageList(msg_data); + + return err; +} + + +EXPORT_API int msg_mms_release_region_list(MMS_MESSAGE_DATA_S *msg_data) +{ + if (msg_data == NULL) + return MSG_ERR_NULL_POINTER; + + MSG_ERROR_T err = MSG_SUCCESS; + + err = _MsgMmsReleaseRegionList(msg_data); + + return err; +} + + +EXPORT_API int msg_mms_release_attachment_list(MMS_MESSAGE_DATA_S *msg_data) +{ + if (msg_data == NULL) + return MSG_ERR_NULL_POINTER; + + MSG_ERROR_T err = MSG_SUCCESS; + + err = _MsgMmsReleaseAttachList(msg_data); + + return err; +} + + +EXPORT_API int msg_mms_release_transition_list(MMS_MESSAGE_DATA_S *msg_data) +{ + if (msg_data == NULL) + return MSG_ERR_NULL_POINTER; + + MSG_ERROR_T err = MSG_SUCCESS; + + err = _MsgMmsReleaseTransitionList(msg_data); + + return err; +} + + +EXPORT_API int msg_mms_release_meta_list(MMS_MESSAGE_DATA_S *msg_data) +{ + if (msg_data == NULL) + return MSG_ERR_NULL_POINTER; + + MSG_ERROR_T err = MSG_SUCCESS; + + err = _MsgMmsReleaseMetaList(msg_data); + + return err; +} + + +EXPORT_API MMS_MESSAGE_DATA_S* msg_mms_create_message(void) +{ + MMS_MESSAGE_DATA_S *mmsmsg = (MMS_MESSAGE_DATA_S *)calloc(sizeof(MMS_MESSAGE_DATA_S), 1); + + return mmsmsg; +} + + +EXPORT_API MMS_SMIL_ROOTLAYOUT* msg_mms_set_rootlayout(MMS_MESSAGE_DATA_S* msg, const int width, const int height, const int bgcolor) +{ + if (msg == NULL) + return NULL; + + msg->rootlayout.width.value = width; + msg->rootlayout.width.bUnitPercent = true; + msg->rootlayout.height.value = height; + msg->rootlayout.height.bUnitPercent = true; + msg->rootlayout.bgColor = bgcolor; + + return (MMS_SMIL_ROOTLAYOUT *)&(msg->rootlayout); +} + + +EXPORT_API int msg_mms_destroy_message(MMS_MESSAGE_DATA_S* msg) +{ + if (msg == NULL) + return MSG_ERR_NULL_POINTER; + + msg_mms_release_message(msg); + + free(msg); + + msg = NULL; + + return MSG_SUCCESS; +} + diff --git a/mapi/MapiSetting.cpp b/mapi/MapiSetting.cpp new file mode 100755 index 0000000..6a2cba9 --- /dev/null +++ b/mapi/MapiSetting.cpp @@ -0,0 +1,90 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgHandle.h" +#include "MsgDebug.h" +#include "MsgException.h" +#include "MapiSetting.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +EXPORT_API int msg_set_config(MSG_HANDLE_T handle, const MSG_SETTING_S *setting) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || setting == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->setConfig(setting); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_SET_WRITE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_get_config(MSG_HANDLE_T handle, MSG_SETTING_S *setting) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || setting == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->getConfig(setting); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_SET_READ_ERROR; + } + + return err; +} + diff --git a/mapi/MapiStorage.cpp b/mapi/MapiStorage.cpp new file mode 100755 index 0000000..8f9c9c4 --- /dev/null +++ b/mapi/MapiStorage.cpp @@ -0,0 +1,1366 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgHandle.h" +#include "MsgDebug.h" +#include "MsgException.h" +#include "MapiMessage.h" +#include "MapiStorage.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +EXPORT_API int msg_add_message(MSG_HANDLE_T handle, const msg_message_t opq_msg, const MSG_SENDINGOPT_S *send_opt) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || opq_msg == NULL || send_opt == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + MSG_MESSAGE_S* pMsg = (MSG_MESSAGE_S*) opq_msg; + + try + { + err = pHandle->addMessage(pMsg, send_opt); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_add_syncml_message(MSG_HANDLE_T handle, const MSG_SYNCML_MESSAGE_S *syncml_msg) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || syncml_msg == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->addSyncMLMessage(syncml_msg); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_update_message(MSG_HANDLE_T handle, const msg_message_t opq_msg, const MSG_SENDINGOPT_S *send_opt) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || opq_msg == NULL || send_opt == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + MSG_MESSAGE_S* pMsg = (MSG_MESSAGE_S*) opq_msg; + + if (pMsg->nAddressCnt > 1) + { + MSG_DEBUG("Multiple Address cannot be updated [%d]", pMsg->nAddressCnt); + return -EINVAL; + } + + try + { + err = pHandle->updateMessage(pMsg, send_opt); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_update_read_status(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, bool read) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->updateReadStatus(msg_id, read); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_update_protected_status(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, bool is_protected) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->updateProtectedStatus(msg_id, is_protected); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_delete_message(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->deleteMessage(msg_id); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_delete_all_msgs_in_folder(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id, bool bOnlyDB) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->deleteAllMessagesInFolder(folder_id, bOnlyDB); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_move_msg_to_folder(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, MSG_FOLDER_ID_T dest_folder_id) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->moveMessageToFolder(msg_id, dest_folder_id); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_move_msg_to_storage(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, MSG_STORAGE_ID_T storage_id) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + if (storage_id != MSG_STORAGE_PHONE && storage_id != MSG_STORAGE_SIM) + { + MSG_FATAL("unsupported storage [%d]", storage_id); + return MSG_ERR_INVALID_PARAMETER; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->moveMessageToStorage(msg_id, storage_id); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_count_message(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id, MSG_COUNT_INFO_S *count_info) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->countMessage(folder_id, count_info); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_count_msg_by_type(MSG_HANDLE_T handle, MSG_MESSAGE_TYPE_T msg_type, int *msg_count) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + MSG_MESSAGE_TYPE_S msgType = {0}; + + if (msg_type == MSG_TYPE_SMS) + { + msgType.mainType = MSG_SMS_TYPE; + msgType.subType = MSG_NORMAL_SMS; + } + else if (msg_type == MSG_TYPE_SMS_WAPPUSH) + { + msgType.mainType = MSG_SMS_TYPE; + msgType.subType = MSG_WAP_SI_SMS; + } + else if (msg_type == MSG_TYPE_MMS) + { + msgType.mainType = MSG_MMS_TYPE; + msgType.subType = MSG_SENDREQ_MMS; + } + + try + { + err = pHandle->countMsgByType(&msgType, msg_count); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_count_msg_by_contact(MSG_HANDLE_T handle, const MSG_THREAD_LIST_INDEX_S *addr_info, MSG_THREAD_COUNT_INFO_S *msg_thread_count_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || addr_info == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->countMsgByContact(addr_info, msg_thread_count_list); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_get_message(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, msg_message_t opq_msg, MSG_SENDINGOPT_S *send_opt) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || !opq_msg) + { + MSG_FATAL("handle or opq_msg is NULL"); + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + MSG_MESSAGE_S* pMsg = (MSG_MESSAGE_S*) opq_msg; + + try + { + err = pHandle->getMessage(msg_id, pMsg, send_opt); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_get_folder_view_list(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id, const MSG_SORT_RULE_S *sort_rule, MSG_LIST_S *msg_folder_view_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + if (sort_rule == NULL) + { + MSG_SORT_RULE_S sortRule = {0}; + + sortRule.sortType = MSG_SORT_BY_READ_STATUS; + sortRule.bAscending = true; + + err = pHandle->getFolderViewList(folder_id, &sortRule, msg_folder_view_list); + } + else + { + err = pHandle->getFolderViewList(folder_id, sort_rule, msg_folder_view_list); + } + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_get_thread_view_list(MSG_HANDLE_T handle, const MSG_SORT_RULE_S *sort_rule, MSG_THREAD_VIEW_LIST_S *msg_thread_view_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + if (sort_rule == NULL) + { + MSG_SORT_RULE_S sortRule = {0}; + + sortRule.sortType = MSG_SORT_BY_THREAD_DATE; + sortRule.bAscending = false; + + err = pHandle->getThreadViewList(&sortRule, msg_thread_view_list); + } + else + { + err = pHandle->getThreadViewList(sort_rule, msg_thread_view_list); + } + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API void msg_release_thread_view_list(MSG_THREAD_VIEW_LIST_S *msg_thread_view_list) +{ + if (msg_thread_view_list == NULL) + { + return; + } + + // Memory Free + if(msg_thread_view_list->msgThreadInfo != NULL) + { + if(msg_thread_view_list->nCount > 0) + { + for(int i=0; inCount; i++) + delete [] (MSG_THREAD_VIEW_S*)msg_thread_view_list->msgThreadInfo[i]; + } + + //free peer info list + delete [] msg_thread_view_list->msgThreadInfo; + msg_thread_view_list->msgThreadInfo = NULL; + } + + msg_thread_view_list->nCount = 0; +} + + +EXPORT_API int msg_get_conversation_view_list(MSG_HANDLE_T handle, MSG_THREAD_ID_T thread_id, MSG_LIST_S *msg_conv_view_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->getConversationViewList(thread_id, msg_conv_view_list); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_delete_thread_message_list(MSG_HANDLE_T handle, MSG_THREAD_ID_T thread_id) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->deleteThreadMessageList(thread_id); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_add_folder(MSG_HANDLE_T handle, const MSG_FOLDER_INFO_S *folder_info) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || folder_info == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->addFolder(folder_info); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_update_folder(MSG_HANDLE_T handle, const MSG_FOLDER_INFO_S *folder_info) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || folder_info == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->updateFolder(folder_info); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_delete_folder(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->deleteFolder(folder_id); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_get_folder_list(MSG_HANDLE_T handle, MSG_FOLDER_LIST_S *folder_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->getFolderList(folder_list); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API void msg_release_folder_list(MSG_FOLDER_LIST_S *folder_list) +{ + if (folder_list == NULL) + { + return; + } + + // Memory Free + if (folder_list->folderInfo != NULL) + { + free(folder_list->folderInfo); + folder_list->folderInfo = NULL; + } + + folder_list->nCount = 0; +} + + +EXPORT_API int msg_generate_message(MSG_HANDLE_T handle, MSG_MESSAGE_TYPE_T msg_type, MSG_FOLDER_ID_T folder_id, unsigned int num_msg) +{ + if (handle == NULL) + { + MSG_DEBUG("Handle is NULL"); + return -EINVAL; + } + + if (folder_id >= MSG_MAX_FOLDER_ID) + { + MSG_DEBUG("folderId is invalid [%d]", folder_id); + return -EINVAL; + } + + MSG_DEBUG("type : %d, folder : %d, num_msg : %d", msg_type, folder_id, num_msg); + + int err = 0; + MSG_SENDINGOPT_S sendingOpt = {0}; + sendingOpt.bSetting = false; + + char strMsg[20] = {0}; + char prefix[10] ="0103001"; +// int postfix = 8111; + int postfix = 0; + + srand(getpid()); + // Make Message + MSG_MESSAGE_S msgInfo = {0, }; //structure is used to enhance performance + + for (unsigned int i = 0; i < num_msg; i++) + { + bzero(&msgInfo, sizeof(MSG_MESSAGE_S)); + + msgInfo.msgId = 0; // It should be set 0 + msgInfo.folderId = folder_id; + + if (msg_type == MSG_TYPE_MMS) + { + msgInfo.msgType.mainType = MSG_MMS_TYPE; + //msgInfo.msgType.subType = MSG_RETRIEVE_MMS; + msgInfo.msgType.subType = MSG_SENDREQ_MMS; + } + else + { + msgInfo.msgType.mainType = MSG_SMS_TYPE; + msgInfo.msgType.subType = MSG_NORMAL_SMS; + + snprintf(strMsg, sizeof(strMsg), "test msg %d", i); + msgInfo.dataSize = strlen(strMsg); + msgInfo.pData = strMsg; + } + + msgInfo.storageId = MSG_STORAGE_PHONE; + + msgInfo.nAddressCnt = 1; + + msgInfo.addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN; + + postfix = rand()%10000; + snprintf(msgInfo.addressList[0].addressVal, MAX_ADDRESS_VAL_LEN+1, "%s%04d", prefix, postfix); + + msgInfo.addressList[0].recipientType = MSG_RECIPIENTS_TYPE_TO; + + time(&(msgInfo.displayTime)); + + msgInfo.networkStatus = MSG_NETWORK_NOT_SEND; + msgInfo.bRead = false; + msgInfo.bProtected = false; + msgInfo.priority = MSG_MESSAGE_PRIORITY_NORMAL; + + if (folder_id == MSG_OUTBOX_ID || folder_id == MSG_SENTBOX_ID) + msgInfo.direction = MSG_DIRECTION_TYPE_MO; + else + msgInfo.direction = MSG_DIRECTION_TYPE_MT; + + if (msg_type == MSG_TYPE_MMS) + { + snprintf(msgInfo.subject, MAX_SUBJECT_LEN+1, "subject %d", i); + + if(folder_id == MSG_INBOX_ID) msgInfo.networkStatus = MSG_NETWORK_RETRIEVE_SUCCESS; + + MMS_MESSAGE_DATA_S* mms_data; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + //------------> 1st Slide Composing + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + //------------> 2nd Slide Composing + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + msg_mms_set_message_body((msg_message_t)&msgInfo, mms_data); + + msg_mms_destroy_message(mms_data); + } + + err = msg_add_message(handle, (msg_message_t)&msgInfo, &sendingOpt); + + if (msg_type == MSG_TYPE_MMS && msgInfo.pMmsData) //free pMmsData directly. It is added to enhance performance + delete [] static_cast(msgInfo.pMmsData); + + if (err < 0) + { + MSG_DEBUG("err [%d]", err); + return err; + } + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_generate_sms(MSG_HANDLE_T handle, MSG_FOLDER_ID_T folder_id, unsigned int num_msg) +{ + MSG_DEBUG("folder %d, num_msg %d", folder_id, num_msg); + + if (handle == NULL) + { + MSG_DEBUG("Handle is NULL"); + return -EINVAL; + } + + if (folder_id >= MSG_MAX_FOLDER_ID) + { + MSG_DEBUG("folderId is invalid"); + return -EINVAL; + } + + int err = 0; + + // Make Message + MSG_MESSAGE_S msgInfo = {0}; + char strMsg[20] = {0}; + + char prefix[10] ="0103001"; + int postfix = 0; + + MSG_SENDINGOPT_S sendingOpt = {0}; + sendingOpt.bSetting = false; + + srand(getpid()); + + for (unsigned int i = 0; i < num_msg; i++) + { + bzero(&msgInfo, sizeof(msgInfo)); + msgInfo.msgId = 0; // It should be set 0 + msgInfo.folderId = folder_id; + + msgInfo.msgType.mainType = MSG_SMS_TYPE; + msgInfo.msgType.subType = 0; + + msgInfo.storageId = MSG_STORAGE_PHONE; + + snprintf(strMsg, sizeof(strMsg), "test %d", i); + msgInfo.dataSize = strlen(strMsg); + msgInfo.pData = strMsg; + + msgInfo.addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN; + postfix = rand()%10000; + snprintf(msgInfo.addressList[0].addressVal, MAX_ADDRESS_VAL_LEN+1, "%s%04d", prefix, postfix); + msgInfo.addressList[0].recipientType = MSG_RECIPIENTS_TYPE_TO; + msgInfo.nAddressCnt = 1; + + time(&(msgInfo.displayTime)); + + msgInfo.networkStatus = MSG_NETWORK_NOT_SEND; + msgInfo.bRead = false; + msgInfo.bProtected = false; + msgInfo.priority = MSG_MESSAGE_PRIORITY_NORMAL; + msgInfo.direction = MSG_DIRECTION_TYPE_MO; + + err = msg_add_message(handle, (msg_message_t) &msgInfo, &sendingOpt); + + if (err < 0) + { + MSG_DEBUG("err [%d]", err); + return err; + } + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_quick_panel_data(MSG_HANDLE_T handle, MSG_QUICKPANEL_TYPE_T type, msg_message_t opq_msg) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || !opq_msg ) + { + MSG_FATAL("handle or opq_msg is NULL"); + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + MSG_MESSAGE_S* pMsg = (MSG_MESSAGE_S*) opq_msg; + + try + { + err = pHandle->getQuickPanelData(type, pMsg); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_reset_database(MSG_HANDLE_T handle) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->resetDatabase(); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_get_mem_size(MSG_HANDLE_T handle, unsigned int* memsize) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->getMemSize(memsize); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; + +} + + +EXPORT_API int msg_thread_view_get_thread_id(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return -EINVAL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->threadId; +} + + +EXPORT_API const char* msg_thread_view_get_address(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return NULL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->threadAddr; +} + + +EXPORT_API const char* msg_thread_view_get_name(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return NULL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->threadName; +} + + +EXPORT_API const char* msg_thread_view_get_image_path(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return NULL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->threadImagePath; +} + + +EXPORT_API int msg_thread_view_get_message_type(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return -EINVAL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + if (pMsg->threadType.mainType == MSG_SMS_TYPE) + { + if (pMsg->threadType.subType == MSG_CB_SMS) + return MSG_TYPE_SMS_CB; + else if (pMsg->threadType.subType == MSG_JAVACB_SMS) + return MSG_TYPE_SMS_JAVACB; + else if (pMsg->threadType.subType == MSG_WAP_SI_SMS || pMsg->threadType.subType == MSG_WAP_SL_SMS) + return MSG_TYPE_SMS_WAPPUSH; + else if (pMsg->threadType.subType == MSG_MWI_VOICE_SMS || pMsg->threadType.subType == MSG_MWI_FAX_SMS + || pMsg->threadType.subType == MSG_MWI_EMAIL_SMS || pMsg->threadType.subType == MSG_MWI_OTHER_SMS) + return MSG_TYPE_SMS_MWI; + else if (pMsg->threadType.subType == MSG_SYNCML_CP) + return MSG_TYPE_SMS_SYNCML; + else if (pMsg->threadType.subType == MSG_REJECT_SMS) + return MSG_TYPE_SMS_REJECT; + else + return MSG_TYPE_SMS; + } + else if (pMsg->threadType.mainType == MSG_MMS_TYPE) + { + if (pMsg->threadType.subType == MSG_NOTIFICATIONIND_MMS) + return MSG_TYPE_MMS_NOTI; + else if (pMsg->threadType.subType == MSG_SENDREQ_JAVA_MMS) + return MSG_TYPE_MMS_JAVA; + else + return MSG_TYPE_MMS; + } + else + return MSG_TYPE_INVALID; +} + + +EXPORT_API const char* msg_thread_view_get_data(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return NULL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->threadData; +} + + +EXPORT_API time_t* msg_thread_view_get_time(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return NULL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return &(pMsg->threadTime); +} + + +EXPORT_API int msg_thread_view_get_direction(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return -EINVAL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->direction; +} + + +EXPORT_API int msg_thread_view_get_contact_id(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return -EINVAL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->contactId; +} + + +EXPORT_API int msg_thread_view_get_unread_cnt(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return -EINVAL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->unreadCnt; +} + + +EXPORT_API int msg_thread_view_get_sms_cnt(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return -EINVAL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->smsCnt; +} + + +EXPORT_API int msg_thread_view_get_mms_cnt(msg_thread_view_t msg_thread) +{ + if (msg_thread == NULL) + { + MSG_FATAL("msg_thread is NULL"); + return -EINVAL; + } + + MSG_THREAD_VIEW_S* pMsg = (MSG_THREAD_VIEW_S*)msg_thread; + + return pMsg->mmsCnt; +} + + +EXPORT_API int msg_search_message_for_thread_view(MSG_HANDLE_T handle, const char *search_string, MSG_THREAD_VIEW_LIST_S *msg_thread_view_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || search_string == NULL) + { + return -EINVAL; + } + + if (strlen(search_string) <= 0 || strlen(search_string) > MAX_MSG_TEXT_LEN) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->searchMessage(search_string, msg_thread_view_list); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_search_message(MSG_HANDLE_T handle, const MSG_SEARCH_CONDITION_S *msg_search_conditions, int offset, int limit, MSG_LIST_S *msg_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || msg_search_conditions == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->searchMessage(msg_search_conditions, offset, limit, msg_list); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API int msg_release_message_list(MSG_LIST_S *msg_list) +{ + if (msg_list == NULL) + { + MSG_FATAL("msg_list is NULL"); + return MSG_ERR_NULL_POINTER; + } + + + // Memory Free + if (msg_list->msgInfo!= NULL) + { + if(msg_list->nCount > 0) + { + for(int i=0; inCount; i++) + msg_release_message(&(msg_list->msgInfo[i])); + } + + delete [] msg_list->msgInfo; + msg_list->msgInfo = NULL; + } + + msg_list->nCount = 0; + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_get_msgid_list(MSG_HANDLE_T handle, MSG_REFERENCE_ID_T ref_id, MSG_MSGID_LIST_S *msg_msgid_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->getMsgIdList(ref_id, msg_msgid_list); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API void msg_release_msgid_list(MSG_MSGID_LIST_S *msg_msgid_list) +{ + if (msg_msgid_list == NULL) + { + return; + } + + // Memory Free + if(msg_msgid_list->msgIdList != NULL) + { + //free peer info list + delete [] msg_msgid_list->msgIdList; + msg_msgid_list->msgIdList = NULL; + } + + msg_msgid_list->nCount = 0; +} + + +EXPORT_API int msg_get_reject_msg_list(MSG_HANDLE_T handle, const char *phone_num, MSG_REJECT_MSG_LIST_S *msg_reject_msg_list) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->getRejectMsgList(phone_num, msg_reject_msg_list); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + + +EXPORT_API void msg_release_reject_msg_list(MSG_REJECT_MSG_LIST_S *msg_reject_msg_list) +{ + if (msg_reject_msg_list == NULL) + { + return; + } + + // Memory Free + if(msg_reject_msg_list->rejectMsgInfo != NULL) + { + //free peer info list + delete [] msg_reject_msg_list->rejectMsgInfo; + msg_reject_msg_list->rejectMsgInfo = NULL; + } + + msg_reject_msg_list->nCount = 0; +} + + +EXPORT_API int msg_reg_storage_change_callback(MSG_HANDLE_T handle, msg_storage_change_cb cb, void *user_param) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || cb == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->regStorageChangeCallback(cb, user_param); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_CALLBACK_ERROR; + } + + return err; +} + + +EXPORT_API int msg_get_report_status(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msg_id, MSG_REPORT_STATUS_INFO_S *report_status) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || msg_id < 1) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->getReportStatus(msg_id, report_status); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_STORAGE_ERROR; + } + + return err; +} + diff --git a/mapi/MapiTransport.cpp b/mapi/MapiTransport.cpp new file mode 100755 index 0000000..540373a --- /dev/null +++ b/mapi/MapiTransport.cpp @@ -0,0 +1,616 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgHandle.h" +#include "MsgDebug.h" +#include "MsgException.h" +#include "MapiTransport.h" +#include "MapiControl.h" +#include "MapiStorage.h" +#include "MapiMessage.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +EXPORT_API int msg_submit_req(MSG_HANDLE_T handle, MSG_REQUEST_S *req) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL ||req == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->submitReq(req); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_TRANSPORT_ERROR; + } + + return err; +} + + +EXPORT_API int msg_reg_sent_status_callback(MSG_HANDLE_T handle, msg_sent_status_cb cb, void *user_param) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || cb == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->regSentStatusCallback(cb, user_param); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_CALLBACK_ERROR; + } + + return err; +} + + +EXPORT_API int msg_reg_sms_message_callback(MSG_HANDLE_T handle, msg_sms_incoming_cb cb, unsigned short port, void *user_param) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || cb == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->regSmsMessageCallback(cb, port, user_param); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_CALLBACK_ERROR; + } + + return err; +} + + +EXPORT_API int msg_reg_mms_conf_message_callback(MSG_HANDLE_T handle, msg_mms_conf_msg_incoming_cb cb, const char *app_id, void *user_param) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || cb == NULL) + { + return -EINVAL; + } + + if (app_id && strlen(app_id) > MAX_MMS_JAVA_APPID_LEN) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->regMmsConfMessageCallback(cb, app_id, user_param); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_CALLBACK_ERROR; + } + + return err; +} + + +EXPORT_API int msg_reg_syncml_message_callback(MSG_HANDLE_T handle, msg_syncml_msg_incoming_cb cb, void *user_param) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || cb == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->regSyncMLMessageCallback(cb, user_param); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_CALLBACK_ERROR; + } + + return err; +} + + +EXPORT_API int msg_reg_lbs_message_callback(MSG_HANDLE_T handle, msg_lbs_msg_incoming_cb cb, void *user_param) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || cb == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->regLBSMessageCallback(cb, user_param); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_CALLBACK_ERROR; + } + + return err; +} + + +EXPORT_API int msg_reg_syncml_message_operation_callback(MSG_HANDLE_T handle, msg_syncml_msg_operation_cb cb, void *user_param) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || cb == NULL) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->regSyncMLMessageOperationCallback(cb, user_param); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_CALLBACK_ERROR; + } + + return err; +} + + +EXPORT_API int msg_syncml_message_operation(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msgId) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || msgId < 1) + { + return -EINVAL; + } + + MsgHandle* pHandle = (MsgHandle*)handle; + + try + { + err = pHandle->operateSyncMLMessage(msgId); + } + catch (MsgException& e) + { + MSG_FATAL("%s", e.what()); + return MSG_ERR_TRANSPORT_ERROR; + } + + return err; +} + + +static MSG_HANDLE_T msgHandle = NULL; +static msg_simple_sent_status_cb sentStatusCallback = NULL; + +static void sent_status_cb_func(MSG_HANDLE_T handle, MSG_SENT_STATUS_S *sent_status, void *user_param) +{ + MSG_DEBUG("Sent Status [%d]", sent_status->status); + + msg_simple_sent_status_cb pfunc = sentStatusCallback; + + pfunc(sent_status, user_param); + + MSG_DEBUG("After entering callback function."); + + // Close control handle instance + // msg_close_msg_handle(&msgHandle); + + // MSG_DEBUG("After msg_close_msg_handle."); + +} + + +static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param) +{ + if (phone_num == NULL || sms_text == NULL || cb == NULL) + { + MSG_DEBUG("Invalid parameter [%s] [%s] [%s]", phone_num, sms_text, cb); + return -EINVAL; + } + + if (strlen(phone_num) > MAX_PHONE_NUMBER_LEN) + { + MSG_DEBUG("Phone Number is too long [%s]", phone_num); + return -EINVAL; + } + + MSG_REQUEST_S msgReq = {0}; + MSG_ERROR_T retVal = MSG_SUCCESS; + + // Open control handle instance + if ((retVal = msg_open_msg_handle(&msgHandle)) != MSG_SUCCESS) + { + MSG_DEBUG("MsgOpenMsgHandle is failed. Error Code = %d", retVal); + return retVal; + } + + msgReq.msg = msg_new_message(); + MSG_MESSAGE_S *reqmsg = (MSG_MESSAGE_S*) msgReq.msg; + /* when sending SMS */ + reqmsg->msgType.mainType = MSG_SMS_TYPE; + reqmsg->msgType.subType = MSG_NORMAL_SMS; + reqmsg->msgId = 0; + reqmsg->folderId = MSG_OUTBOX_ID; + + /* fill the destination number in msgReq */ + reqmsg->nAddressCnt = 1; + reqmsg->addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN; // telephone number + reqmsg->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_TO; // telephone number + memset(reqmsg->addressList, 0x00, MAX_ADDRESS_VAL_LEN); + strncpy(reqmsg->addressList[0].addressVal, phone_num, MAX_ADDRESS_VAL_LEN); + MSG_DEBUG("AddressVal = [%s]", reqmsg->addressList[0].addressVal); + + reqmsg->msgPort.valid = false; + + /* fill the msg text in msgReq */ + reqmsg->dataSize = strlen(sms_text); + reqmsg->pData = (void*)malloc(reqmsg->dataSize+1); + strncpy((char *)reqmsg->pData, sms_text, reqmsg->dataSize); + + sentStatusCallback = cb; + + // register sent status callback + retVal = msg_reg_sent_status_callback(msgHandle, sent_status_cb_func, user_param); + + if (retVal != MSG_SUCCESS) + { + MSG_DEBUG("msg_reg_sent_status_callback() is failed. Error Code = %d", retVal); + msg_close_msg_handle(&msgHandle); + return retVal; + } + + // sending message request + retVal = msg_submit_req(msgHandle, &msgReq); + + if (retVal != MSG_SUCCESS) + { + MSG_DEBUG("msg_submit_req() is failed. Error Code = %d", retVal); + msg_close_msg_handle(&msgHandle); + return retVal; + } + + /* Releasing msg_message_t is mandotory. Unless, memory leaks */ + msg_release_message(&(msgReq.msg)); + + return MSG_SUCCESS; +} + + +static int msg_verify_number(const char *raw, char *trimmed) +{ + if( !(raw && trimmed) ) + { + MSG_DEBUG("Phone Number is NULL"); + return MSG_ERR_NULL_POINTER; + } + + MSG_DEBUG("Phone Number is NULL"); + for( int i=0, j=0 ; raw[i] ; i++ ) + { + if ( (raw[i] >= '0' && raw[i] <= '9') || (raw[i] == ',') || raw[i] == ' ' || raw[i] == '+' ) + trimmed[j++] = raw[i]; + else if( raw[i] == '-') + continue; + else + { + MSG_DEBUG("Unacceptable character in telephone number: [%c]", raw[i]); + return MSG_ERR_INVALID_PARAMETER; + } + } + MSG_DEBUG("Trimming [%s]->[%s]", raw, trimmed); + return MSG_SUCCESS; +} + + +EXPORT_API int msg_sms_send(const char *phone_num_list, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param) +{ + if (phone_num_list == NULL || sms_text == NULL || cb == NULL) + { + MSG_DEBUG("Invalid parameter [%s] [%s] [%s]", phone_num_list, sms_text, cb); + return -EINVAL; + } + + char trimmed_num[strlen(phone_num_list)+1]; + bzero(trimmed_num, strlen(phone_num_list)+1); + + MSG_ERROR_T retVal = msg_verify_number(phone_num_list, trimmed_num); + + if ( retVal != MSG_SUCCESS ) + return retVal; + + for( char* cur_num = strtok(trimmed_num,", "); cur_num ; cur_num = strtok(NULL,", ")) + { + if (strlen(cur_num) > MAX_PHONE_NUMBER_LEN) + { + MSG_DEBUG("Phone number is too long [%s], and sending is skipped", cur_num); + continue; + } + + MSG_DEBUG("phone number: [%s]", cur_num); + MSG_DEBUG("text: [%s]", sms_text); + retVal = msg_send_single_sms(cur_num, sms_text, cb, user_param); + + if (retVal != MSG_SUCCESS) + return retVal; + } + + return MSG_SUCCESS; +} + + +EXPORT_API int msg_sms_send_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || !req) { + MSG_FATAL("handle or req is NULL"); + return MSG_ERR_NULL_POINTER; + } + + req->reqId = 1; // arbitrary number + + MSG_MESSAGE_S *reqmsg = (MSG_MESSAGE_S*) req->msg; + + if (reqmsg->dataSize <= 0) { + MSG_FATAL("msg size is invalid : [%d]", reqmsg->dataSize); + return MSG_ERR_INVALID_PARAMETER; + } + + if (reqmsg->msgType.mainType != MSG_SMS_TYPE) { + MSG_DEBUG("mainType is not SMS [%d]", reqmsg->msgType.mainType); + reqmsg->msgType.mainType = MSG_SMS_TYPE; + } + + if (reqmsg->msgType.subType > MSG_CONCAT_SIM_SMS) { + MSG_DEBUG("subType is not SMS [%d]", reqmsg->msgType.subType); + reqmsg->msgType.subType = MSG_NORMAL_SMS; + } + + reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed + reqmsg->networkStatus = MSG_NETWORK_SENDING; + + err = msg_submit_req(handle, req); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Sending Message is OK!"); + else + MSG_DEBUG("Sending Message is failed! [%d]", err); + + return err; +} + + +EXPORT_API int msg_mms_send_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || !req) + { + MSG_FATAL("handle or req is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + req->reqId = 1; // arbitrary number + + MSG_MESSAGE_S *reqmsg = (MSG_MESSAGE_S*) req->msg; + + if (reqmsg->dataSize <= 0) + { + MSG_FATAL("MMS data size is invalid"); + return MSG_ERR_INVALID_PARAMETER; + } + + reqmsg->msgType.mainType = MSG_MMS_TYPE; + reqmsg->msgType.subType = MSG_SENDREQ_MMS; + reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed + reqmsg->networkStatus = MSG_NETWORK_SENDING; + + err = msg_submit_req(handle, req); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Sending Message is OK!"); + else + MSG_DEBUG("Sending Message is failed! [%d]", err); + + return err; +} + + +EXPORT_API int msg_mms_send_read_report(MSG_HANDLE_T handle, MSG_MESSAGE_ID_T msgId, MSG_READ_REPORT_STATUS_T mms_read_status) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_REQUEST_S req = {0}; + + if (handle == NULL) + { + return MSG_ERR_INVALID_PARAMETER; + } + + req.reqId = 1; // arbitrary number + + req.msg = msg_new_message(); + + MSG_MESSAGE_S *reqmsg = (MSG_MESSAGE_S*) req.msg; + + reqmsg->msgPort.valid = false; + reqmsg->msgId = msgId; + reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed + reqmsg->msgType.mainType = MSG_MMS_TYPE; + reqmsg->msgType.subType = MSG_READREPLY_MMS; + + reqmsg->dataSize = sizeof(MSG_READ_REPORT_STATUS_T); + reqmsg->pMmsData = (char *)calloc(reqmsg->dataSize, 1); + + memcpy((char *)reqmsg->pMmsData, &mms_read_status, sizeof(MSG_READ_REPORT_STATUS_T)); + + MSG_DEBUG("mms_read_status [%d]", mms_read_status); + + err = msg_submit_req(handle, &req); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Sending Message is OK!"); + else + MSG_DEBUG("Sending Message is failed!"); + + free(reqmsg->pMmsData); + + return err; +} + + +EXPORT_API int msg_mms_forward_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || !req ) + { + MSG_FATAL("handle or req is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *reqmsg = (MSG_MESSAGE_S*) req->msg; + + req->reqId = 1; + + reqmsg->msgType.mainType = MSG_MMS_TYPE; + reqmsg->msgType.subType = MSG_FORWARD_MMS; + reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed + reqmsg->networkStatus = MSG_NETWORK_SENDING; + + err = msg_submit_req(handle, req); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Sending Message is OK!"); + else + MSG_DEBUG("Sending Message is failed!"); + + return err; +} + + +EXPORT_API int msg_mms_retrieve_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if ( handle == NULL|| !req) + { + MSG_FATAL("handle or req is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *reqmsg = (MSG_MESSAGE_S*) req->msg; + + reqmsg->msgType.mainType = MSG_MMS_TYPE; + reqmsg->msgType.subType = MSG_RETRIEVE_MMS; + reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed + reqmsg->networkStatus = MSG_NETWORK_RETRIEVING; + + err = msg_submit_req(handle, req); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Sending Message is OK!"); + else + MSG_DEBUG("Sending Message is failed!"); + + return err; +} + + +/* reject_msg_support */ +EXPORT_API int msg_mms_reject_message(MSG_HANDLE_T handle, MSG_REQUEST_S* req) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + if (handle == NULL || !req ) + { + MSG_FATAL("handle or req is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + MSG_MESSAGE_S *reqmsg = (MSG_MESSAGE_S*) req->msg; + + reqmsg->msgType.mainType = MSG_MMS_TYPE; + reqmsg->msgType.subType = MSG_NOTIFYRESPIND_MMS; + reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed + reqmsg->networkStatus = MSG_NETWORK_SENDING; + + err = msg_submit_req(handle, req); + + if (err == MSG_SUCCESS) + MSG_DEBUG("Sending Message is OK!"); + else + MSG_DEBUG("Sending Message is failed!"); + + return err; +} +/* reject_msg_support */ + diff --git a/msg-server b/msg-server new file mode 100755 index 0000000..48318db --- /dev/null +++ b/msg-server @@ -0,0 +1,9 @@ +#!/bin/sh +## A script for running msg-server in booting time. + +dlogutil -v threadtime -f /var/log/msgfw.log -r 1000 -n 10 MSG_FW & + +if [ ! -e /opt/etc/.hib_capturing ]; then +/usr/bin/msg-server & +fi + diff --git a/msg-service.pc.in b/msg-service.pc.in new file mode 100755 index 0000000..5d04123 --- /dev/null +++ b/msg-service.pc.in @@ -0,0 +1,10 @@ +prefix=/usr +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: MESSAGE-FRAMEWORK +Version: @VERSION@ +Description: Messaging Framework +Requires: glib-2.0 +Libs: -L${libdir} -lmsg_mapi +Cflags: -I${includedir} -I${includedir}/msg-service diff --git a/msg_helper/CMakeLists.txt b/msg_helper/CMakeLists.txt new file mode 100755 index 0000000..a33a996 --- /dev/null +++ b/msg_helper/CMakeLists.txt @@ -0,0 +1,46 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(msg-server CXX) + +SET(CMAKE_SKIP_BUILD_RPATH TRUE) + +IF("${CMAKE_BUILD_TYPE}" STREQUAL "") + SET(CMAKE_BUILD_TYPE "Debug") +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") + +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall") + +########################################################## +# Define Test App +########################################################## + +SET(MSG-HELPER-SRCS + ${CMAKE_SOURCE_DIR}/msg_helper/MsgSoundPlayer.cpp + ${CMAKE_SOURCE_DIR}/msg_helper/main.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/msg_helper + ${CMAKE_SOURCE_DIR}/include/utils +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(msg_helper_pkgs REQUIRED glib-2.0 dlog vconf devman_haptic mm-player mm-fileinfo mm-player svi) + +FOREACH(flag ${msg_helper_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_EXECUTABLE(msg-helper ${MSG-HELPER-SRCS}) +TARGET_LINK_LIBRARIES(msg-helper ${msg_helper_pkgs_LDFLAGS} ${UTILS-LIB}) + +INSTALL(TARGETS msg-helper DESTINATION bin) + diff --git a/msg_helper/MsgSoundPlayer.cpp b/msg_helper/MsgSoundPlayer.cpp new file mode 100755 index 0000000..ce38b02 --- /dev/null +++ b/msg_helper/MsgSoundPlayer.cpp @@ -0,0 +1,424 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgDebug.h" +#include "MsgCppTypes.h" +#include "MsgSettingTypes.h" +#include "MsgGconfWrapper.h" +#include "MsgHelper.h" + +#include +#include + +#include +#include +#include + + +extern void worker_done(); + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +static MMHandleType hPlayerHandle = 0; +static bool bPlaying = false; +static bool bVibrating = false; +static int dev_handle; + +pthread_mutex_t muMmPlay = PTHREAD_MUTEX_INITIALIZER; +pthread_cond_t cvMmPlay = PTHREAD_COND_INITIALIZER; + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +static gboolean MsgSoundMelodyTimeout(gpointer data) +{ + MSG_BEGIN(); + + MsgSoundPlayStop(); + if(!bPlaying && !bVibrating) + worker_done(); + + MSG_END(); + + return FALSE; +} + + +static gboolean MsgSoundVibTimeout(gpointer data) +{ + MSG_BEGIN(); + + int ret = 0; + + if (bVibrating == true) { + ret = device_haptic_stop_play(dev_handle); + + if (ret != 0) { + MSG_DEBUG("Fail to stop haptic : [%d]", ret); + } + + ret = device_haptic_close(dev_handle); + + if (ret != 0) { + MSG_DEBUG("Fail to close haptic : [%d]", ret); + } + + bVibrating = false; + } + + if(!bPlaying && !bVibrating) + worker_done(); + + MSG_END(); + + return FALSE; +} + + +static int MsgSoundPlayCallback(int message, void *param, void *user_param) +{ + switch (message) + { + case MM_MESSAGE_ERROR: + MSG_DEBUG("ERROR is happened."); + MsgSoundPlayUninit(); + break; + case MM_MESSAGE_BEGIN_OF_STREAM: + MSG_DEBUG("Play is started."); + break; + case MM_MESSAGE_END_OF_STREAM: + MSG_DEBUG("end of stream"); + MsgSoundPlayStop(); + if(!bPlaying && !bVibrating) + worker_done(); + break; + default: + MSG_DEBUG("message = %d", message); + break; + } + + return 1; +} + + +void* MsgPlayThread(void *data) +{ + MSG_BEGIN(); + + bool bSoundOn = false; + bool bVibrationOn = false; + int callStatus = 0; /* 0 - off, 1 - sound, 2 - vibration */ + int alertOnCall = 0; + + char *msg_tone_file_path = NULL; + AutoPtr buf(&msg_tone_file_path); + + char *tmpFileFath = NULL; + + tmpFileFath = MsgSettingGetString(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); + + if (tmpFileFath == NULL) { + msg_tone_file_path = new char[MAX_SOUND_FILE_LEN]; + strncpy(msg_tone_file_path, DEFAULT_FILE, MAX_SOUND_FILE_LEN-1); + } else { + msg_tone_file_path = new char[MAX_SOUND_FILE_LEN]; + strncpy(msg_tone_file_path, tmpFileFath, MAX_SOUND_FILE_LEN-1); + free(tmpFileFath); + tmpFileFath = NULL; + } + + MSG_DEBUG("Sound File [%s]", msg_tone_file_path); + + MsgSettingGetBool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &bSoundOn); + MsgSettingGetBool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &bVibrationOn); + + int err = MM_ERROR_NONE; + + err = mm_session_init(MM_SESSION_TYPE_NOTIFY); + + if(err != MM_ERROR_NONE) + MSG_DEBUG("MM Session Init Failed"); + else + MSG_DEBUG("MM Session Init Success : %d", err); + + hPlayerHandle = 0; + + err = mm_player_create(&hPlayerHandle); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("creating the player handle failed"); + return NULL; + } + + /* Setting the call back function msg_callback */ + mm_player_set_message_callback(hPlayerHandle, MsgSoundPlayCallback, (void *)hPlayerHandle); + + callStatus = MsgSettingGetInt(VCONFKEY_CALL_STATE); + MSG_DEBUG("Call Status = %d", callStatus); + + if (callStatus > VCONFKEY_CALL_OFF && callStatus < VCONFKEY_CALL_STATE_MAX) { + alertOnCall = MsgSettingGetInt(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT); + MSG_DEBUG("Alert On Call = %d", alertOnCall); + + if (alertOnCall == 0) { + MSG_DEBUG("Call is active & Alert on Call - Off"); + } else if (alertOnCall == 1) { + MSG_DEBUG("Call is active & Alert on Call - Sound"); + + if (bSoundOn) + MsgSoundPlayMelody(msg_tone_file_path, false); + } else if (alertOnCall == 2) { + MSG_DEBUG("Call is active & Alert on Call - Vibration"); + + if (bVibrationOn) + MsgSoundPlayVibration(); + } + } else{ + MSG_DEBUG("Call is not active"); + + if (bVibrationOn) { + MSG_DEBUG("Play vibration."); + MsgSoundPlayVibration(); + } + + if (bSoundOn) { + MSG_DEBUG("Play sound."); + MsgSoundPlayMelody(msg_tone_file_path, false); + } + } + + err = mm_session_finish(); + + if (err != MM_ERROR_NONE) + MSG_DEBUG("MM Session Finish Failed"); + else + MSG_DEBUG("MM Session Finish Success : %d", err); + + if(!bPlaying && !bVibrating) + worker_done(); + + MSG_END(); + + return NULL; +} + + +MSG_ERROR_T MsgSoundPlayUninit() +{ + MSG_BEGIN(); + + int err = MM_ERROR_NONE; + + /* Uninitializing the player module */ + err = mm_player_unrealize(hPlayerHandle); + + /* Destroying the player handle */ + err = mm_player_destroy(hPlayerHandle); + + pthread_mutex_lock(&muMmPlay); + + bPlaying = false; + + pthread_mutex_unlock(&muMmPlay); + + pthread_cond_signal(&cvMmPlay); + + hPlayerHandle = 0; + + MSG_END(); + + return MSG_SUCCESS; +} + + +void MsgSoundPlayStart() +{ + MSG_BEGIN(); + + pthread_mutex_lock(&muMmPlay); + + if (bPlaying == true) { + MSG_DEBUG("Ringtone is Playing..."); + pthread_mutex_unlock(&muMmPlay); + return; + } + + pthread_mutex_unlock(&muMmPlay); + + pthread_t tid; + + if (pthread_create(&tid, NULL, &MsgPlayThread, (void*)NULL) == 0) { + MSG_DEBUG("Ring alert thread created = %d", tid); + } else { + MSG_DEBUG("Creating Thread was failed"); + return; + } + + MSG_END(); +} + + +void MsgSoundPlayStop() +{ + MSG_BEGIN(); + + pthread_mutex_lock(&muMmPlay); + + if (bPlaying == false) { + MSG_DEBUG("Ringtone is Not Playing..."); + pthread_mutex_unlock(&muMmPlay); + return; + } + + pthread_mutex_unlock(&muMmPlay); + + /* Stop playing media contents */ + MSG_DEBUG("Before mm_player_stop, %p", hPlayerHandle); + + int err = mm_player_stop(hPlayerHandle); + + MSG_DEBUG("After mm_player_stop"); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("stopping the player handle failed"); + } + + MsgSoundPlayUninit(); + + MSG_END(); +} + + +int MsgSoundPlayMelody(char *pMsgToneFilePath, bool bIncreasing) +{ + int err = MM_ERROR_NONE; + + /* Setting fade in,out */ + err = mm_player_set_attribute(hPlayerHandle, NULL, "sound_priority", 2, NULL); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("error setting the profile attr"); + return err; + } + + /* Setting the Volume */ + err = mm_player_set_attribute(hPlayerHandle, NULL, "sound_volume_type", MM_SOUND_VOLUME_TYPE_NOTIFICATION, + "profile_uri", pMsgToneFilePath, strlen(pMsgToneFilePath), NULL); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("error setting the profile attr"); + return err; + } + + err = mm_player_realize(hPlayerHandle); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("mm_player_realize() error : [%d]", err); + return err; + } + + /* Add Timer to stop playing after 5 sec. */ + int g_contact_timer = -1; + g_contact_timer = g_timeout_add(5500, (GSourceFunc)MsgSoundMelodyTimeout, NULL); + + err = mm_player_start(hPlayerHandle); + + if (err != MM_ERROR_NONE) { + MSG_DEBUG("mm_player_start, FAIL [%x]", err); + bPlaying = false; + + return err; + } + + bPlaying = true; + + pthread_mutex_lock(&muMmPlay); + + while (bPlaying) + { + MSG_DEBUG("Ring Alert Playing"); + pthread_cond_wait(&cvMmPlay, &muMmPlay); + } + + pthread_mutex_unlock(&muMmPlay); + + MSG_DEBUG("Ring Alert Idle"); + + return err; +} + + +void MsgSoundPlayVibration() +{ + MSG_BEGIN(); + + int ret = 0; + int vibLevel = 0; + char ivtFilePath[MAX_SOUND_FILE_LEN] = {0,}; + + vibLevel = MsgSettingGetInt(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT); + + if (vibLevel > 0) { + bVibrating = true; + + dev_handle = device_haptic_open(DEV_IDX_0, 0); + + g_timeout_add(MSG_VIBRATION_INTERVAL , MsgSoundVibTimeout, NULL); + + /* set timer to stop vibration, then play melody */ + svi_get_path(SVI_TYPE_VIB, SVI_VIB_NOTIFICATION_MESSAGE, ivtFilePath, sizeof(ivtFilePath)); + ret = device_haptic_play_file(dev_handle, ivtFilePath, HAPTIC_TEST_ITERATION, vibLevel); + + if (ret != 0) { + MSG_DEBUG("Fail to play haptic : [%d]", ret); + } + } + + MSG_END(); +} + + +int MsgSoundGetUnreadMsgCnt() +{ + int unreadCnt = 0; + + /* Get SMS Count */ + unreadCnt = MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE); + + /* Get MMS Count */ + unreadCnt += MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE); + + MSG_DEBUG("unread count : [%d]", unreadCnt); + + return unreadCnt; +} diff --git a/msg_helper/main.cpp b/msg_helper/main.cpp new file mode 100755 index 0000000..b8a129a --- /dev/null +++ b/msg_helper/main.cpp @@ -0,0 +1,103 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include + +#include "MsgHelper.h" +#include "MsgUtilFile.h" +#include "MsgCppTypes.h" +#include "MsgDebug.h" + +static GMainLoop *loop; + +static gboolean _worker_done(void* data) +{ + if (g_main_loop_is_running(loop)) + g_main_loop_quit(loop); + + return 0; +} + +// may called by threads +void worker_done() +{ + g_idle_add(_worker_done,NULL); +} + +int main(int argc, char** argv) +{ + + MSG_DEBUG("############### Start msg_helper ###############"); + + g_thread_init(NULL); + + bool notEnd = false; + + if(argc < 1) + { + MSG_DEBUG("No arguments to run msg_helper."); + return 0; + } + + MSG_DEBUG("argv[0] [%s] ", argv[0]); + + if(strcmp(argv[0],MSG_SOUND_START)==0) + { + MsgSoundPlayStart(); + notEnd = true; + } + else if(strcmp(argv[0],MSG_SOUND_STOP)==0) + { + MsgSoundPlayStop(); + } + + if(notEnd) + { + loop = g_main_loop_new(NULL, FALSE); + + + if (loop != NULL) + { + MSG_DEBUG("Waiting for working jobs to be finished!!!"); + + // Run GMainLoop + g_main_loop_run(loop); + } + else + { + MSG_DEBUG("Fail to create g_main_loop!!!"); + } + } + + return 0; +} diff --git a/packaging/msg-service.spec b/packaging/msg-service.spec new file mode 100755 index 0000000..fa44c81 --- /dev/null +++ b/packaging/msg-service.spec @@ -0,0 +1,306 @@ +Name: msg-service +Version: 0.8.7 +Release: 5 +License: Samsung Proprietary +Summary: Messaging Framework Library +Group: System/Libraries +Source0: %{name}-%{version}.tar.gz + +Requires(post): /usr/bin/sqlite3 +Requires(post): /usr/bin/vconftool +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: cmake +BuildRequires: pkgconfig(alarm-service) +BuildRequires: pkgconfig(contacts-service) +BuildRequires: pkgconfig(db-util) +BuildRequires: pkgconfig(devman_haptic) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(drm-service) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(libcurl) +BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(libwbxml2) +BuildRequires: pkgconfig(media-thumbnail) +BuildRequires: pkgconfig(mm-fileinfo) +BuildRequires: pkgconfig(mm-player) +BuildRequires: pkgconfig(mm-session) +BuildRequires: pkgconfig(network) +BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(pmapi) +BuildRequires: pkgconfig(mmutil-imgp) +BuildRequires: pkgconfig(mmutil-jpeg) +BuildRequires: pkgconfig(security-server) +BuildRequires: pkgconfig(sensor) +BuildRequires: pkgconfig(svi) +BuildRequires: pkgconfig(tapi) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(capi-appfw-application) + +%description +Description: Messaging Framework Library + + +%package devel +License: Samsung Proprietary +Summary: Messaging Framework Library (development) +Requires: %{name} = %{version}-%{release} +Group: Development/Libraries + +%description devel +Description: Messaging Framework Library (development) + + +%package tools +License: Samsung Proprietary +Summary: Messaging server application +Requires: %{name} = %{version}-%{release} +Group: TO_BU / FILL_IN +Requires(post): /usr/bin/sqlite3 +Requires(post): /usr/bin/vconftool +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description tools +Description: Messaging server application + + +%package -n sms-plugin +License: Samsung Proprietary +Summary: SMS plugin library +Requires: %{name} = %{version}-%{release} +Group: System/Libraries +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description -n sms-plugin +Description: SMS plugin library + +%package -n mms-plugin +License: Samsung Proprietary +Summary: MMS plugin library +Requires: %{name} = %{version}-%{release} +Group: System/Libraries +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description -n mms-plugin +Description: MMS plugin library + +%prep +%setup -q + + +%build +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} +make %{?jobs:-j%jobs} + +%install + +rm -rf %{buildroot} +%make_install + +mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d +ln -s %{_sysconfdir}/rc.d/init.d/msg-server %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S70msg-server +mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d +ln -s %{_sysconfdir}/rc.d/init.d/msg-server %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S70msg-server + + + +mkdir -p %{buildroot}/opt/data/msg-service + +%post tools -p /sbin/ldconfig +%post -n sms-plugin -p /sbin/ldconfig +%post -n mms-plugin -p /sbin/ldconfig + +%post +/sbin/ldconfig + +if [ ! -f /opt/dbspace/.msg_service.db ] +then + sqlite3 /opt/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST; + + CREATE TABLE MSG_ADDRESS_TABLE(ADDRESS_ID INTEGER PRIMARY KEY, ADDRESS_TYPE INTEGER, RECIPIENT_TYPE INTEGER, ADDRESS_VAL TEXT, CONTACT_ID INTEGER, DISPLAY_NAME TEXT, FIRST_NAME TEXT, LAST_NAME TEXT, IMAGE_PATH TEXT, SYNC_TIME DATETIME, UNREAD_CNT INTEGER DEFAULT 0, SMS_CNT INTEGER DEFAULT 0, MMS_CNT INTEGER DEFAULT 0, MAIN_TYPE INTEGER NOT NULL, SUB_TYPE INTEGER NOT NULL, MSG_DIRECTION INTEGER NOT NULL, MSG_TIME DATETIME, MSG_TEXT TEXT); + CREATE TABLE MSG_FOLDER_TABLE(FOLDER_ID INTEGER PRIMARY KEY, FOLDER_NAME TEXT NOT NULL, FOLDER_TYPE INTEGER DEFAULT 0); + CREATE TABLE MSG_MESSAGE_TABLE(MSG_ID INTEGER PRIMARY KEY, ADDRESS_ID INTEGER, FOLDER_ID INTEGER, REFERENCE_ID INTEGER, STORAGE_ID INTEGER NOT NULL, MAIN_TYPE INTEGER NOT NULL, SUB_TYPE INTEGER NOT NULL, DISPLAY_TIME DATETIME, DATA_SIZE INTEGER DEFAULT 0, NETWORK_STATUS INTEGER DEFAULT 0, READ_STATUS INTEGER DEFAULT 0, PROTECTED INTEGER DEFAULT 0, PRIORITY INTEGER DEFAULT 0, MSG_DIRECTION INTEGER NOT NULL, SCHEDULED_TIME DATETIME, BACKUP INTEGER DEFAULT 0, SUBJECT TEXT, MSG_DATA TEXT, THUMB_PATH TEXT, MSG_TEXT TEXT, DELIVERY_REPORT_STATUS INTEGER DEFAULT 0, DELIVERY_REPORT_TIME DATETIME, READ_REPORT_STATUS INTEGER DEFAULT 0, READ_REPORT_TIME DATETIME, ATTACHMENT_COUNT INTEGER DEFAULT 0, FOREIGN KEY(ADDRESS_ID) REFERENCES MSG_ADDRESS_TABLE(ADDRESS_ID), FOREIGN KEY(FOLDER_ID) REFERENCES MSG_FOLDER_TABLE(FOLDER_ID)); + CREATE TABLE MSG_SIM_TABLE(MSG_ID INTEGER, SIM_ID INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_PUSH_TABLE(MSG_ID INTEGER, ACTION INTEGER, CREATED INTEGER, EXPIRES INTEGER, ID TEXT, HREF TEXT, CONTENT TEXT, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_CBMSG_TABLE(MSG_ID INTEGER, CB_MSG_ID INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_SYNCML_TABLE(MSG_ID INTEGER, EXT_ID INTEGER NOT NULL, PINCODE INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_SCHEDULED_TABLE(MSG_ID INTEGER, ALARM_ID INTEGER NOT NULL, LISTENER_FD INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_SMS_SENDOPT_TABLE(MSG_ID INTEGER, DELREP_REQ INTEGER NOT NULL, KEEP_COPY INTEGER NOT NULL, REPLY_PATH INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)); + CREATE TABLE MSG_FILTER_TABLE(FILTER_ID INTEGER PRIMARY KEY, FILTER_TYPE INTEGER NOT NULL, FILTER_VALUE TEXT NOT NULL); + CREATE TABLE MSG_MMS_MESSAGE_TABLE(REFERENCE_ID INTEGER, TRANSACTION_ID TEXT, MESSAGE_ID TEXT, FWD_MESSAGE_ID TEXT, CONTENTS_LOCATION TEXT, FILE_PATH TEXT, FOREIGN KEY(REFERENCE_ID) REFERENCES MSG_MESSAGE_TABLE(REFERENCE_ID)); + CREATE TABLE MSG_MMS_ATTR_TABLE(REFERENCE_ID INTEGER, VERSION INTEGER NOT NULL, DATA_TYPE INTEGER DEFAULT -1, DATE DATETIME, HIDE_ADDRESS INTEGER DEFAULT 0, ASK_DELIVERY_REPORT INTEGER DEFAULT 0, REPORT_ALLOWED INTEGER DEFAULT 0, READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0, ASK_READ_REPLY INTEGER DEFAULT 0, READ INTEGER DEFAULT 0, READ_REPORT_SEND_STATUS INTEGER DEFAULT 0, READ_REPORT_SENT INTEGER DEFAULT 0, PRIORITY INTEGER DEFAULT 0, KEEP_COPY INTEGER DEFAULT 0, MSG_SIZE INTEGER NOT NULL, MSG_CLASS INTEGER DEFAULT -1, EXPIRY_TIME DATETIME, CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0, DELIVERY_TIME DATETIME, MSG_STATUS INTEGER DEFAULT -1, FOREIGN KEY(REFERENCE_ID) REFERENCES MSG_MESSAGE_TABLE(REFERENCE_ID)); + + CREATE INDEX MSG_ADDRESS_INDEX ON MSG_ADDRESS_TABLE(ADDRESS_ID); + CREATE INDEX MSG_FOLDER_INDEX ON MSG_FOLDER_TABLE(FOLDER_ID); + CREATE INDEX MSG_MESSAGE_INDEX ON MSG_MESSAGE_TABLE(MSG_ID, ADDRESS_ID, FOLDER_ID); + + INSERT INTO MSG_FOLDER_TABLE VALUES (1, 'INBOX', 1); + INSERT INTO MSG_FOLDER_TABLE VALUES (2, 'OUTBOX', 2); + INSERT INTO MSG_FOLDER_TABLE VALUES (3, 'SENTBOX', 2); + INSERT INTO MSG_FOLDER_TABLE VALUES (4, 'DRAFT', 3); + INSERT INTO MSG_FOLDER_TABLE VALUES (5, 'CBMSGBOX', 1); + INSERT INTO MSG_FOLDER_TABLE VALUES (6, 'SPAMBOX', 4); + INSERT INTO MSG_FOLDER_TABLE VALUES (7, 'SMS TEMPLATE', 5); + INSERT INTO MSG_FOLDER_TABLE VALUES (8, 'MMS TEMPLATE', 5); + + INSERT INTO MSG_ADDRESS_TABLE VALUES (0, 0, 0, '', 0, '', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '');" +fi + +chown :6011 /opt/dbspace/.msg_service.db +chown :6011 /opt/dbspace/.msg_service.db-journal + + +chmod 660 /opt/dbspace/.msg_service.db +chmod 660 /opt/dbspace/.msg_service.db-journal + + +########## Setting Config Value ########## +# General Options +vconftool set -t bool db/msg/general/keep_copy 1 +vconftool set -t int db/msg/general/alert_tone 0 +vconftool set -t bool db/msg/general/auto_erase 0 +vconftool set -t bool db/msg/general/block_msg 0 + +# SMS Send Options +vconftool set -t int db/msg/sms_send/dcs 3 +vconftool set -t int db/msg/network_mode 2 +vconftool set -t bool db/msg/sms_send/reply_path 0 +vconftool set -t bool db/msg/sms_send/delivery_report 0 +vconftool set -t int db/msg/sms_send/save_storage 1 + +# MMS Send Options +vconftool set -t int db/msg/mms_send/msg_class 0 +vconftool set -t int db/msg/mms_send/priority 1 +vconftool set -t int db/msg/mms_send/expiry_time 0 +vconftool set -t int db/msg/mms_send/custom_delivery 0 +vconftool set -t bool db/msg/mms_send/sender_visibility 0 +vconftool set -t bool db/msg/mms_send/delivery_report 1 +vconftool set -t bool db/msg/mms_send/read_reply 1 +vconftool set -t bool db/msg/mms_send/keep_copy 0 +vconftool set -t bool db/msg/mms_send/body_replying 0 +vconftool set -t bool db/msg/mms_send/hide_recipients 0 +vconftool set -t bool db/msg/mms_send/report_allowed 1 +vconftool set -t int db/msg/mms_send/reply_charging 0 +vconftool set -t int db/msg/mms_send/reply_charging_deadline 0 +vconftool set -t int db/msg/mms_send/reply_charging_size 0 +vconftool set -t int db/msg/mms_send/delivery_time 0 +vconftool set -t int db/msg/mms_send/creation_mode 2 + +# MMS Receive Options +vconftool set -t int db/msg/mms_recv/home_network 0 +vconftool set -t int db/msg/mms_recv/abroad_network 0 +vconftool set -t bool db/msg/mms_recv/read_receipt 1 +vconftool set -t bool db/msg/mms_recv/delivery_receipt 1 +vconftool set -t bool db/msg/mms_recv/reject_unknown 0 +vconftool set -t bool db/msg/mms_recv/reject_advertisement 0 + +# MMS Receive Options +vconftool set -t int db/msg/mms_style/font_size 30 +vconftool set -t bool db/msg/mms_style/font_style/bold 0 +vconftool set -t bool db/msg/mms_style/font_style/italic 0 +vconftool set -t bool db/msg/mms_style/font_style/underline 0 +vconftool set -t int db/msg/mms_style/font_color/red 0 +vconftool set -t int db/msg/mms_style/font_color/green 0 +vconftool set -t int db/msg/mms_style/font_color/blue 0 +vconftool set -t int db/msg/mms_style/font_color/hue 255 +vconftool set -t int db/msg/mms_style/bg_color/red 255 +vconftool set -t int db/msg/mms_style/bg_color/green 255 +vconftool set -t int db/msg/mms_style/bg_color/blue 255 +vconftool set -t int db/msg/mms_style/bg_color/hue 255 +vconftool set -t int db/msg/mms_style/page_dur 2 +vconftool set -t int db/msg/mms_style/page_custom_dur 0 +vconftool set -t int db/msg/mms_style/page_dur_manual 0 + +# Push Msg Options +vconftool set -t bool db/msg/push_msg/recv_option 1 +vconftool set -t int db/msg/push_msg/service_load 1 + +# CB Msg Options +vconftool set -t bool db/msg/cb_msg/receive 0 +vconftool set -t bool db/msg/cb_msg/all_channel 0 +vconftool set -t int db/msg/cb_msg/max_sim_count 0 +vconftool set -t int db/msg/cb_msg/channel_count 0 +vconftool set -t bool db/msg/cb_msg/language/0 0 +vconftool set -t bool db/msg/cb_msg/language/1 0 +vconftool set -t bool db/msg/cb_msg/language/2 0 +vconftool set -t bool db/msg/cb_msg/language/3 0 +vconftool set -t bool db/msg/cb_msg/language/4 0 +vconftool set -t bool db/msg/cb_msg/language/5 0 +vconftool set -t bool db/msg/cb_msg/language/6 0 +vconftool set -t bool db/msg/cb_msg/language/7 0 +vconftool set -t bool db/msg/cb_msg/language/8 0 +vconftool set -t bool db/msg/cb_msg/language/9 0 + +# SOS Msg Options +vconftool set -t bool db/msg/sos_msg/send_option 0 +vconftool set -t int db/msg/sos_msg/recipient_count 0 +vconftool set -t int db/msg/sos_msg/repeat_count 0 +vconftool set -t string db/msg/sos_msg/msg_text "" +vconftool set -t int db/msg/sos_msg/alert_type 0 + +# Voice Mail Options +vconftool set -t string db/msg/voice_mail/voice_mail_number "12345678" + +# MMS Size Options +vconftool set -t int db/msg/size_opt/msg_size 300 + +vconftool set -t int db/badge/org.tizen.message 0 + +# Msg Count +vconftool set -t int db/msg/recv_sms 0 -u 0 +vconftool set -t int db/msg/recv_mms 0 -u 0 + +%postun -p /sbin/ldconfig + +%postun tools -p /sbin/ldconfig + +%postun -n sms-plugin -p /sbin/ldconfig + +%postun -n mms-plugin -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%dir /opt/data/msg-service +%{_libdir}/libmsg_plugin_manager.so +%{_libdir}/libmsg_mapi.so.* +%{_libdir}/libmsg_framework_handler.so +%{_libdir}/libmsg_transaction_manager.so +%{_libdir}/libmsg_utils.so +%{_libdir}/libmsg_transaction_proxy.so +%{_sysconfdir}/rc.d/init.d/msg-server +%{_sysconfdir}/rc.d/rc3.d/S70msg-server +%{_sysconfdir}/rc.d/rc5.d/S70msg-server + +%files devel +%defattr(-,root,root,-) +%{_libdir}/libmsg_mapi.so +%{_libdir}/pkgconfig/msg-service.pc +%{_includedir}/msg-service/* + + +%files tools +%defattr(-,root,root,-) +%{_bindir}/msg-helper +%{_bindir}/msg-test-app +%{_bindir}/msg-server +%{_datadir}/media/Sherbet.wav +%attr(0644,root,root)/usr/share/msg-service/plugin.cfg +%attr(0644,root,root)/opt/etc/msg-service/Temp0_2.txt +%attr(0644,root,root)/opt/etc/msg-service/Temp1_0.txt +%attr(0644,root,root)/opt/etc/msg-service/audio.amr +%attr(0644,root,root)/opt/etc/msg-service/P091120_104633.jpg +%attr(0644,root,root)/opt/etc/msg-service/A.smi +%attr(0644,root,root)/opt/etc/msg-service/V091120_104905.3gp +%attr(0644,root,root)/opt/etc/msg-service/alert_on_call.mp3 + +%files -n sms-plugin +%defattr(-,root,root,-) +%{_libdir}/libmsg_sms_plugin.so + +%files -n mms-plugin +%defattr(-,root,root,-) +%{_libdir}/libmsg_mms_plugin.so +%{_libdir}/libmsg_mms_language_pack.so diff --git a/plugin/mms_plugin/CMakeLists.txt b/plugin/mms_plugin/CMakeLists.txt new file mode 100755 index 0000000..929cbad --- /dev/null +++ b/plugin/mms_plugin/CMakeLists.txt @@ -0,0 +1,100 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(mms-plugin CXX) + +SET(CMAKE_SKIP_BUILD_RPATH TRUE) + +IF("${CMAKE_BUILD_TYPE}" STREQUAL "") + SET(CMAKE_BUILD_TYPE "Release") +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") + +########################################################## +# Define MMS Language Pack +########################################################## + +SET(MMS-LANGUAGE-PACK-SRCS + LanguagePack/MmsPluginWmLngLatinUni.cpp + LanguagePack/MmsPluginWmLngString.cpp + LanguagePack/MmsPluginWmLngUTF8Uni.cpp + LanguagePack/MmsPluginWmLngUniUTF8.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/utils + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(mms_language_pkgs REQUIRED glib-2.0 dlog) + +FOREACH(flag ${mms_language_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_CXX_FLAGS_DEBUG "-O2 -g") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_LIBRARY(${MMS-LANGUAGE-PACK-LIB} SHARED ${MMS-LANGUAGE-PACK-SRCS}) +TARGET_LINK_LIBRARIES(${MMS-LANGUAGE-PACK-LIB} ${mms_language_pkgs_LDFLAGS} ${UTILS-LIB}) + +INSTALL(TARGETS ${MMS-LANGUAGE-PACK-LIB} LIBRARY DESTINATION lib) + +########################################################## +# Define MMS Plugin +########################################################## + +SET(MMS-PLUGIN-SRCS + MmsPluginTransport.cpp + MmsPluginMain.cpp + MmsPluginEventHandler.cpp + MmsPluginStorage.cpp + MmsPluginMessage.cpp + MmsPluginMIME.cpp + MmsPluginDecode.cpp + MmsPluginAvCodec.cpp + MmsPluginDebug.cpp + MmsPluginConnManWrapper.cpp + MmsPluginUserAgent.cpp + MmsPluginHttp.cpp + MmsPluginEncode.cpp + MmsPluginCodec.cpp + MmsPluginInternal.cpp + MmsPluginContentCodec.cpp + MmsPluginSmil.cpp + MmsPluginSMILValidate.cpp + MmsPluginDrm.cpp +) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include/common + ${CMAKE_SOURCE_DIR}/include/framework + ${CMAKE_SOURCE_DIR}/include/msg_helper + ${CMAKE_SOURCE_DIR}/include/utils + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 network libxml-2.0 drm-service libcurl mm-fileinfo mmutil-jpeg vconf dlog media-thumbnail) + +FOREACH(flag ${mms_plugin_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_CXX_FLAGS_DEBUG "-O2 -g") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +#ADD_DEFINITIONS("-DWno-write-strings") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_LIBRARY(${MMS-PLUGIN-LIB} SHARED ${MMS-PLUGIN-SRCS}) +TARGET_LINK_LIBRARIES(${MMS-PLUGIN-LIB} ${mms_plugin_pkgs_LDFLAGS} ${MMS-LANGUAGE-PACK-LIB} ${UTILS-LIB}) + +INSTALL(TARGETS ${MMS-PLUGIN-LIB} LIBRARY DESTINATION lib) + diff --git a/plugin/mms_plugin/LanguagePack/MmsPluginWmLngLatinUni.cpp b/plugin/mms_plugin/LanguagePack/MmsPluginWmLngLatinUni.cpp new file mode 100755 index 0000000..90585bc --- /dev/null +++ b/plugin/mms_plugin/LanguagePack/MmsPluginWmLngLatinUni.cpp @@ -0,0 +1,1145 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MmsPluginWmLngPack.h" +#include "MmsPluginMessage.h" +#include + + +#define MAX_ASCII 256 +#define MAX_ASCII_NUM 255 + +static void __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len); +static UINT __WmLngLatin12UnicodeN(MCHAR *pOutStr, UCHAR *pInputStr, UINT len); +static int __WmLngConvertLatin12Unicode (MCHAR *des, UCHAR *str, UINT len); + +#define tabLatin2UniMax 93 +#define tabLatin3UniMax 87 +#define tabLatin4UniMax 96 +#define tabLatin8UniMax 60 +#define tabLatin15UniMax 96 +#define tabLatin5UniMax 96 +#define tabWin1251UniMax 128 +#define tabKoi8rUniMax 128 +#define tabKoi8uUniMax 128 + +#define SIM_SMSP_ALPHA_ID_MAX_LEN 30 +#define SMS_MCHAR_TO_SIM_ALPHA_MASK 0x80 +#define SMS_SIM_ALPHA_TO_MCHAR_MASK 0x7F + + +/* latin2 table */ +typedef struct { + UCHAR latin2; + MCHAR unicode; +}Latin2UniTable; + +const Latin2UniTable tabLatin2Uni[] = { + {0xA0,0x0020},{0xA1,0x0104},{0xA3,0x0141},{0xA4,0x00A4},{0xA5,0x013D}, + {0xA6,0x015A},{0xA7,0x00A7},{0xA8,0x00A8},{0xA9,0x0160},{0xAA,0x015E}, + {0xAB,0x0164},{0xAC,0x0179},{0xAD,0x00AD},{0xAE,0x017D},{0xAF,0x017B}, + {0xB0,0x00B0},{0xB1,0x0105},{0xB2,0x00B8},{0xB3,0x0142},{0xB4,0x00B4}, + {0xB5,0x012D},{0xB7,0x015B},{0xB8,0x00B8},{0xB9,0x0161},{0xBA,0x015F}, + {0xBB,0x0165},{0xBC,0x017A},{0xBE,0x017E},{0xBF,0x017C},{0xC0,0x0154}, + {0xC1,0x00C1},{0xC2,0x00C2},{0xC3,0x0102},{0xC4,0x00C4},{0xC5,0x0139}, + {0xC6,0x0106},{0xC7,0x00C7},{0xC8,0x010C},{0xC9,0x00C9},{0xCA,0x0118}, + {0xCB,0x00CB},{0xCC,0x0114},{0xCD,0x00CD},{0xCE,0x00CE},{0xCF,0x010E}, + {0xD0,0x00D0},{0xD1,0x0143},{0xD2,0x0147},{0xD3,0x00D3},{0xD4,0x00D4}, + {0xD5,0x0150},{0xD6,0x00D6},{0xD7,0x00D7},{0xD8,0x0158},{0xD9,0x016E}, + {0xDA,0x00DA},{0xDB,0x0170},{0xDC,0x00DC},{0xDD,0x00DD},{0xDE,0x0162}, + {0xDF,0x00DF},{0xE0,0x0155},{0xE1,0x00E1},{0xE2,0x00E2},{0xE3,0x0103}, + {0xE4,0x00E4},{0xE5,0x013A},{0xE6,0x0107},{0xE7,0x00E7},{0xE8,0x010D}, + {0xE9,0x00E9},{0xEA,0x0119},{0xEB,0x00EB},{0xEC,0x011B},{0xED,0x00ED}, + {0xEE,0x00EE},{0xEF,0x010F},{0xF0,0x0111},{0xF1,0x0144},{0xF2,0x0148}, + {0xF3,0x00F3},{0xF4,0x00F4},{0xF5,0x0151},{0xF6,0x00F6},{0xF7,0x00F7}, + {0xF8,0x0159},{0xF9,0x016F},{0xFA,0x00FA},{0xFB,0x0171},{0xFC,0x00FC}, + {0xFD,0x00FD},{0xFE,0x0163},{0xFF,0x00B7}, +}; + +/* latin3 table */ +typedef struct { + UCHAR latin3; + MCHAR unicode; +}Latin3UniTable; + +const Latin3UniTable tabLatin3Uni[] = { + {0xA0,0x0020},{0xA1,0x0126},{0xA2,0x02D8},{0xA3,0x00A3},{0xA4,0x00A4}, + {0xA6,0x0124},{0xA7,0x00A7},{0xA8,0x00A8},{0xA9,0x0130},{0xAA,0x015E}, + {0xAB,0x011E},{0xAC,0x0134},{0xAD,0x00AD},{0xAF,0x017B},{0xB0,0x00B0}, + {0xB1,0x0127},{0xB2,0x00B2},{0xB3,0x00B3},{0xB4,0x00B4},{0xB5,0x00B5}, + {0xB6,0x0125},{0xB7,0x00B7},{0xB8,0x00B8},{0xB9,0x0131},{0xBA,0x015F}, + {0xBB,0x011F},{0xBC,0x0135},{0xBD,0x00BD},{0xBF,0x017C},{0xC0,0x00C0}, + {0xC1,0x00C1},{0xC2,0x00C2},{0xC4,0x00C4},{0xC5,0x010A},{0xC6,0x0108}, + {0xC7,0x00C7},{0xC8,0x00C8},{0xC9,0x00C9},{0xCA,0x00CA},{0xCB,0x00CB}, + {0xCC,0x00CC},{0xCD,0x00CD},{0xCE,0x00CE},{0xCF,0x00CF},{0xD1,0x00D1}, + {0xD2,0x00D2},{0xD3,0x00D3},{0xD4,0x00D4},{0xD6,0x00D6},{0xD7,0x00D7}, + {0xD8,0x011C},{0xD9,0x00D9},{0xDA,0x00DA},{0xDB,0x00DB},{0xDC,0x00DC}, + {0xDE,0x015C},{0xDF,0x00DF},{0xE0,0x00E0},{0xE1,0x00E1},{0xE2,0x00E2}, + {0xE4,0x00E4},{0xE5,0x010B},{0xE6,0x0109},{0xE7,0x00E7},{0xE8,0x00E8}, + {0xE9,0x00E9},{0xEA,0x00EA},{0xEB,0x00EB},{0xEC,0x00EC},{0xED,0x00ED}, + {0xEE,0x00EE},{0xEF,0x00EF},{0xF1,0x00F1},{0xF2,0x00F2},{0xF3,0x00F3}, + {0xF4,0x00F4},{0xF5,0x0121},{0xF6,0x00F6},{0xF7,0x00F7},{0xF8,0x011D}, + {0xF9,0x00F9},{0xFA,0x00FA},{0xFB,0x00FB},{0xFC,0x00FC},{0xFD,0x016D}, + {0xFE,0x015D},{0xFF,0x02D9}, +}; +/* latin4 table */ +typedef struct { + UCHAR latin4; + MCHAR unicode; +}Latin4UniTable; + +const Latin4UniTable tabLatin4Uni[] = { + {0xA0,0x0020},{0xA1,0x0104},{0xA2,0x0138},{0xA3,0x0156},{0xA4,0x00A4}, + {0xA5,0x0128},{0xA6,0x013B},{0xA7,0x00A7},{0xA8,0x00A8},{0xA9,0x0160}, + {0xAA,0x0112},{0xAB,0x0122},{0xAC,0x0166},{0xAD,0x00AD},{0xAE,0x017D}, + {0xAF,0x00AF},{0xB0,0x00B0},{0xB1,0x0105},{0xB2,0x02DB},{0xB3,0x0157}, + {0xB4,0x00B4},{0xB5,0x0129},{0xB6,0x013C},{0xB7,0x02C7},{0xB8,0x00B8}, + {0xB9,0x0161},{0xBA,0x0113},{0xBB,0x0123},{0xBC,0x0167},{0xBD,0x014A}, + {0xBE,0x017E},{0xBF,0x014B},{0xC0,0x0100},{0xC1,0x00C1},{0xC2,0x00C2}, + {0xC3,0x00C3},{0xC4,0x00C4},{0xC5,0x00C5},{0xC6,0x00C6},{0xC7,0x012E}, + {0xC8,0x010C},{0xC9,0x00C9},{0xCA,0x0118},{0xCB,0x00CB},{0xCC,0x0116}, + {0xCD,0x00CD},{0xCE,0x00CE},{0xCF,0x012A},{0xD0,0x0110},{0xD1,0x0145}, + {0xD2,0x014C},{0xD3,0x0136},{0xD4,0x00D4},{0xD5,0x00D5},{0xD6,0x00D6}, + {0xD7,0x00D7},{0xD8,0x00D8},{0xD9,0x0172},{0xDA,0x00DA},{0xDB,0x00DB}, + {0xDC,0x00DC},{0xDD,0x0168},{0xDE,0x016A},{0xDF,0x00DF},{0xE0,0x0101}, + {0xE1,0x00E1},{0xE2,0x00E2},{0xE3,0x00E3},{0xE4,0x00E4},{0xE5,0x00E5}, + {0xE6,0x00E6},{0xE7,0x012F},{0xE8,0x010D},{0xE9,0x00E9},{0xEA,0x0119}, + {0xEB,0x00EB},{0xEC,0x0117},{0xED,0x00ED},{0xEE,0x00EE},{0xEF,0x012B}, + {0xF0,0x0111},{0xF1,0x0146},{0xF2,0x014D},{0xF3,0x0137},{0xF4,0x00F4}, + {0xF5,0x00F5},{0xF6,0x00F6},{0xF7,0x00F7},{0xF8,0x00F8},{0xF9,0x0173}, + {0xFA,0x00FA},{0xFB,0x00FB},{0xFC,0x00FC},{0xFD,0x0169},{0xFE,0x016B}, + {0xFF,0x02D9}, + +}; +/* latin8 table */ +typedef struct { + UCHAR latin8; + MCHAR unicode; +}Latin8UniTable; + +const Latin8UniTable tabLatin8Uni[] = { + {0xA0,0x0020},{0xA2,0x00A2},{0xA3,0x00A3},{0xA4,0x00A4},{0xA5,0x00A5}, + {0xA6,0x00A6},{0xA7,0x00A7},{0xA8,0x00A8},{0xA9,0x00A9},{0xAA,0x00D7}, + {0xAB,0x00AB},{0xAC,0x00AC},{0xAD,0x00AD},{0xAE,0x00AE},{0xAF,0x203E}, + {0xB0,0x00B0},{0xB1,0x00B1},{0xB2,0x00B2},{0xB3,0x00B3},{0xB4,0x00B4}, + {0xB5,0x00B5},{0xB6,0x00B6},{0xB7,0x00B7},{0xB8,0x00B8},{0xB9,0x00B9}, + {0xBA,0x00F7},{0xBB,0x00BB},{0xBC,0x00BC},{0xBD,0x00BD},{0xBE,0x00BE}, + {0xDF,0x2017},{0xE0,0x05D0},{0xE1,0x05D1},{0xE2,0x05D2},{0xE3,0x05D3}, + {0xE4,0x05D4},{0xE5,0x05D5},{0xE6,0x05D6},{0xE7,0x05D7},{0xE8,0x05D8}, + {0xE9,0x05D9},{0xEA,0x05DA},{0xEB,0x05DB},{0xEC,0x05DC},{0xED,0x05DD}, + {0xEE,0x05DE},{0xEF,0x05DF},{0xF0,0x05E0},{0xF1,0x05E1},{0xF2,0x05E2}, + {0xF3,0x05E3},{0xF4,0x05E4},{0xF5,0x05E5},{0xF6,0x05E6},{0xF7,0x05E7}, + {0xF8,0x05E8},{0xF9,0x05E9},{0xFA,0x05EA},{0xFD,0x200E},{0xFE,0x200F}, +}; + +/* latin15 table */ +typedef struct { + UCHAR latin15; + MCHAR unicode; +}Latin15UniTable; + +const Latin15UniTable tabLatin15Uni[] = { + {0xA0,0x0020},{0xA1,0x00A1},{0xA2,0x00A2},{0xA3,0x00A3},{0xA4,0x20AC}, + {0xA5,0x00A5},{0xA6,0x0160},{0xA7,0x00A7},{0xA8,0x0161},{0xA9,0x00A9}, + {0xAA,0x00AA},{0xAB,0x00AB},{0xAC,0x00AC},{0xAD,0x00AD},{0xAE,0x00AE}, + {0xAF,0x00AF},{0xB0,0x00B0},{0xB1,0x00B1},{0xB2,0x00B2},{0xB3,0x00B3}, + {0xB4,0x017D},{0xB5,0x00B5},{0xB6,0x00B6},{0xB7,0x00B7},{0xB8,0x017E}, + {0xB9,0x00B9},{0xBA,0x00BA},{0xBB,0x00BB},{0xBC,0x0152},{0xBD,0x0153}, + {0xBE,0x0178},{0xBF,0x00BF},{0xC0,0x00C0},{0xC1,0x00C1},{0xC2,0x00C2}, + {0xC3,0x00C3},{0xC4,0x00C4},{0xC5,0x00C5},{0xC6,0x00C6},{0xC7,0x00C7}, + {0xC8,0x00C8},{0xC9,0x00C9},{0xCA,0x00CA},{0xCB,0x00CB},{0xCC,0x00CC}, + {0xCD,0x00CD},{0xCE,0x00CE},{0xCF,0x00CF},{0xD0,0x00D0},{0xD1,0x00D1}, + {0xD2,0x00D2},{0xD3,0x00D3},{0xD4,0x00D4},{0xD5,0x00D5},{0xD6,0x00D6}, + {0xD7,0x00D7},{0xD8,0x00D8},{0xD9,0x00D9},{0xDA,0x00DA},{0xDB,0x00DB}, + {0xDC,0x00DC},{0xDD,0x00DD},{0xDE,0x00DE},{0xDF,0x00DF},{0xE0,0x00E0}, + {0xE1,0x00E1},{0xE2,0x00E2},{0xE3,0x00E3},{0xE4,0x00E4},{0xE5,0x00E5}, + {0xE6,0x00E6},{0xE7,0x00E7},{0xE8,0x00E8},{0xE9,0x00E9},{0xEA,0x00EA}, + {0xEB,0x00EB},{0xEC,0x00EC},{0xED,0x00ED},{0xEE,0x00EE},{0xEF,0x00EF}, + {0xF0,0x00F0},{0xF1,0x00F1},{0xF2,0x00F2},{0xF3,0x00F3},{0xF4,0x00F4}, + {0xF5,0x00F5},{0xF6,0x00F6},{0xF7,0x00F7},{0xF8,0x00F8},{0xF9,0x00F9}, + {0xFA,0x00FA},{0xFB,0x00FB},{0xFC,0x00FC},{0xFD,0x00FD},{0xFE,0x00FE}, + {0xFF,0x00FF}, +}; + + +/* Win1251 table */ +typedef struct { + UCHAR win1251; + MCHAR unicode; +}Win1251UniTable; +const Win1251UniTable tabWin1251Uni[] = { + {0x80,0x0402},{0x81,0x0403},{0x82,0x201A},{0x83,0x0453},{0x84,0x201E}, + {0x85,0x2026},{0x86,0x2020},{0x87,0x2021},{0x88,0x20AC},{0x89,0x2030}, + {0x8A,0x0409},{0x8B,0x2039},{0x8C,0x040A},{0x8D,0x040C},{0x8E,0x040B}, + {0x8F,0x040F},{0x90,0x0452},{0x91,0x2018},{0x92,0x2019},{0x93,0x201C}, + {0x94,0x201D},{0x95,0x2022},{0x96,0x2013},{0x97,0x2014},{0x98,0x0000}, + {0x99,0x2122},{0x9A,0x0459},{0x9B,0x203A},{0x9C,0x045A},{0x9D,0x045C}, + {0x9E,0x045B},{0x9F,0x045F},{0xA0,0x00a0},{0xA1,0x040e},{0xA2,0x045e}, + {0xA3,0x0408},{0xA4,0x00a4},{0xA5,0x0490},{0xA6,0x00a6},{0xA7,0x00a7}, + {0xA8,0x0401},{0xA9,0x00a9},{0xAA,0x0404},{0xAB,0x00ab},{0xAC,0x00ac}, + {0xAD,0x00ad},{0xAE,0x00ae},{0xAF,0x0407},{0xB0,0x00b0},{0xB1,0x00b1}, + {0xB2,0x0406},{0xB3,0x0456},{0xB4,0x0491},{0xB5,0x00b5},{0xB6,0x00b6}, + {0xB7,0x00b7},{0xB8,0x0451},{0xB9,0x2116},{0xBA,0x0454},{0xBB,0x00bb}, + {0xBC,0x0458},{0xBD,0x0405},{0xBE,0x0455},{0xBF,0x0457},{0xC0,0x0410}, + {0xC1,0x0411},{0xC2,0x0412},{0xC3,0x0413},{0xC4,0x0414},{0xC5,0x0415}, + {0xC6,0x0416},{0xC7,0x0417},{0xC8,0x0418},{0xC9,0x0419},{0xCA,0x041a}, + {0xCB,0x041b},{0xCC,0x041c},{0xCD,0x041d},{0xCE,0x041e},{0xCF,0x041f}, + {0xD0,0x0420},{0xD1,0x0421},{0xD2,0x0422},{0xD3,0x0423},{0xD4,0x0424}, + {0xD5,0x0425},{0xD6,0x0426},{0xD7,0x0427},{0xD8,0x0428},{0xD9,0x0429}, + {0xDA,0x042a},{0xDB,0x042b},{0xDC,0x042c},{0xDD,0x042d},{0xDE,0x042e}, + {0xDF,0x042f},{0xE0,0x0430},{0xE1,0x0431},{0xE2,0x0432},{0xE3,0x0433}, + {0xE4,0x0434},{0xE5,0x0435},{0xE6,0x0436},{0xE7,0x0437},{0xE8,0x0438}, + {0xE9,0x0439},{0xEA,0x043a},{0xEB,0x043b},{0xEC,0x043c},{0xED,0x043d}, + {0xEE,0x043e},{0xEF,0x043f},{0xF0,0x0440},{0xF1,0x0441},{0xF2,0x0442}, + {0xF3,0x0443},{0xF4,0x0444},{0xF5,0x0445},{0xF6,0x0446},{0xF7,0x0447}, + {0xF8,0x0448},{0xF9,0x0449},{0xFA,0x044a},{0xFB,0x044b},{0xFC,0x044c}, + {0xFD,0x044d},{0xFE,0x044e},{0xFF,0x044f} +}; + + +/* Koi8-r table */ +typedef struct { + UCHAR koi8r; + MCHAR unicode; +}Koi8rUniTable; +const Koi8rUniTable tabKoi8rUni[] = { + {0x80,0x2500},{0x81,0x2502},{0x82,0x250C},{0x83,0x2510},{0x84,0x2514}, + {0x85,0x2518},{0x86,0x251C},{0x87,0x2524},{0x88,0x252C},{0x89,0x2534}, + {0x8A,0x253C},{0x8B,0x2580},{0x8C,0x2584},{0x8D,0x2588},{0x8E,0x258C}, + {0x8F,0x2590},{0x90,0x2591},{0x91,0x2592},{0x92,0x2593},{0x93,0x2320}, + {0x94,0x25A0},{0x95,0x2219},{0x96,0x221A},{0x97,0x2248},{0x98,0x2264}, + {0x99,0x2265},{0x9A,0x00A0},{0x9B,0x2321},{0x9C,0x00B0},{0x9D,0x00B2}, + {0x9E,0x00B7},{0x9F,0x00F7},{0xA0,0x2550},{0xA1,0x2551},{0xA2,0x2552}, + {0xA3,0x0451},{0xA4,0x2553},{0xA5,0x2554},{0xA6,0x2555},{0xA7,0x2556}, + {0xA8,0x2557},{0xA9,0x2558},{0xAA,0x2559},{0xAB,0x255A},{0xAC,0x255B}, + {0xAD,0x255C},{0xAE,0x255D},{0xAF,0x255E},{0xB0,0x255F},{0xB1,0x2560}, + {0xB2,0x2561},{0xB3,0x0401},{0xB4,0x2562},{0xB5,0x2563},{0xB6,0x2564}, + {0xB7,0x2565},{0xB8,0x2566},{0xB9,0x2567},{0xBA,0x2568},{0xBB,0x2569}, + {0xBC,0x256A},{0xBD,0x256B},{0xBE,0x256C},{0xBF,0x00A9},{0xC0,0x044E}, + {0xC1,0x0430},{0xC2,0x0431},{0xC3,0x0446},{0xC4,0x0434},{0xC5,0x0435}, + {0xC6,0x0444},{0xC7,0x0433},{0xC8,0x0445},{0xC9,0x0438},{0xCA,0x0439}, + {0xCB,0x043A},{0xCC,0x043B},{0xCD,0x043C},{0xCE,0x043D},{0xCF,0x043E}, + {0xD0,0x043F},{0xD1,0x044F},{0xD2,0x0440},{0xD3,0x0441},{0xD4,0x0442}, + {0xD5,0x0443},{0xD6,0x0436},{0xD7,0x0432},{0xD8,0x044C},{0xD9,0x044B}, + {0xDA,0x0437},{0xDB,0x0448},{0xDC,0x044D},{0xDD,0x0449},{0xDE,0x0447}, + {0xDF,0x044A},{0xE0,0x042E},{0xE1,0x0410},{0xE2,0x0411},{0xE3,0x0426}, + {0xE4,0x0414},{0xE5,0x0415},{0xE6,0x0424},{0xE7,0x0413},{0xE8,0x0425}, + {0xE9,0x0418},{0xEA,0x0419},{0xEB,0x041A},{0xEC,0x041B},{0xED,0x041C}, + {0xEE,0x041D},{0xEF,0x041E},{0xF0,0x041F},{0xF1,0x042F},{0xF2,0x0420}, + {0xF3,0x0421},{0xF4,0x0422},{0xF5,0x0423},{0xF6,0x0416},{0xF7,0x0412}, + {0xF8,0x042C},{0xF9,0x042B},{0xFA,0x0417},{0xFB,0x0428},{0xFC,0x042D}, + {0xFD,0x0429},{0xFE,0x0427},{0xFF,0x042A} +}; + + + +/* Koi8-u table */ +typedef struct { + UCHAR koi8u; + MCHAR unicode; +}Koi8uUniTable; + +const Koi8uUniTable tabKoi8uUni[] = { + {0x80,0x2500},{0x81,0x2502},{0x82,0x250C},{0x83,0x2510},{0x84,0x2514}, + {0x85,0x2518},{0x86,0x251C},{0x87,0x2524},{0x88,0x252C},{0x89,0x2534}, + {0x8A,0x253C},{0x8B,0x2580},{0x8C,0x2584},{0x8D,0x2588},{0x8E,0x258C}, + {0x8F,0x2590},{0x90,0x2591},{0x91,0x2592},{0x92,0x2593},{0x93,0x2320}, + {0x94,0x25A0},{0x95,0x2219},{0x96,0x221A},{0x97,0x2248},{0x98,0x2264}, + {0x99,0x2265},{0x9A,0x00A0},{0x9B,0x2321},{0x9C,0x00B0},{0x9D,0x00B2}, + {0x9E,0x00B7},{0x9F,0x00F7},{0xA0,0x2550},{0xA1,0x2551},{0xA2,0x2552}, + {0xA3,0x0451},{0xA4,0x0454},{0xA5,0x2554},{0xA6,0x0456},{0xA7,0x0457}, + {0xA8,0x2557},{0xA9,0x2558},{0xAA,0x2559},{0xAB,0x255A},{0xAC,0x255B}, + {0xAD,0x0491},{0xAE,0x255D},{0xAF,0x255E},{0xB0,0x255F},{0xB1,0x2560}, + {0xB2,0x2561},{0xB3,0x0401},{0xB4,0x0404},{0xB5,0x2563},{0xB6,0x0406}, + {0xB7,0x0407},{0xB8,0x2566},{0xB9,0x2567},{0xBA,0x2568},{0xBB,0x2569}, + {0xBC,0x256A},{0xBD,0x0490},{0xBE,0x256C},{0xBF,0x00A9},{0xC0,0x044E}, + {0xC1,0x0430},{0xC2,0x0431},{0xC3,0x0446},{0xC4,0x0434},{0xC5,0x0435}, + {0xC6,0x0444},{0xC7,0x0433},{0xC8,0x0445},{0xC9,0x0438},{0xCA,0x0439}, + {0xCB,0x043A},{0xCC,0x043B},{0xCD,0x043C},{0xCE,0x043D},{0xCF,0x043E}, + {0xD0,0x043F},{0xD1,0x044F},{0xD2,0x0440},{0xD3,0x0441},{0xD4,0x0442}, + {0xD5,0x0443},{0xD6,0x0436},{0xD7,0x0432},{0xD8,0x044C},{0xD9,0x044B}, + {0xDA,0x0437},{0xDB,0x0448},{0xDC,0x044D},{0xDD,0x0449},{0xDE,0x0447}, + {0xDF,0x044A},{0xE0,0x042E},{0xE1,0x0410},{0xE2,0x0411},{0xE3,0x0426}, + {0xE4,0x0414},{0xE5,0x0415},{0xE6,0x0424},{0xE7,0x0413},{0xE8,0x0425}, + {0xE9,0x0418},{0xEA,0x0419},{0xEB,0x041A},{0xEC,0x041B},{0xED,0x041C}, + {0xEE,0x041D},{0xEF,0x041E},{0xF0,0x041F},{0xF1,0x042F},{0xF2,0x0420}, + {0xF3,0x0421},{0xF4,0x0422},{0xF5,0x0423},{0xF6,0x0416},{0xF7,0x0412}, + {0xF8,0x042C},{0xF9,0x042B},{0xFA,0x0417},{0xFB,0x0428},{0xFC,0x042D}, + {0xFD,0x0429},{0xFE,0x0427},{0xFF,0x042A} +}; + + +/* Latin5 table */ +typedef struct { + UCHAR Latin5; + MCHAR unicode; +}Latin5UniTable; + +const Latin5UniTable tabLatin5Uni[] = { + {0xA0,0x00A0},{0xA1,0x0401},{0xA2,0x0402},{0xA3,0x0403},{0xA4,0x0404}, + {0xA5,0x0405},{0xA6,0x0406},{0xA7,0x0407},{0xA8,0x0408},{0xA9,0x0409}, + {0xAA,0x040A},{0xAB,0x040B},{0xAC,0x040C},{0xAD,0x00AD},{0xAE,0x040E}, + {0xAF,0x040F},{0xB0,0x0410},{0xB1,0x0411},{0xB2,0x0412},{0xB3,0x0413}, + {0xB4,0x0414},{0xB5,0x0415},{0xB6,0x0416},{0xB7,0x0417},{0xB8,0x0418}, + {0xB9,0x0419},{0xBA,0x041A},{0xBB,0x041B},{0xBC,0x041C},{0xBD,0x041D}, + {0xBE,0x041E},{0xBF,0x041F},{0xC0,0x0420},{0xC1,0x0421},{0xC2,0x0422}, + {0xC3,0x0423},{0xC4,0x0424},{0xC5,0x0425},{0xC6,0x0426},{0xC7,0x0427}, + {0xC8,0x0428},{0xC9,0x0429},{0xCA,0x042A},{0xCB,0x042B},{0xCC,0x042C}, + {0xCD,0x042D},{0xCE,0x042E},{0xCF,0x042F},{0xD0,0x0430},{0xD1,0x0431}, + {0xD2,0x0432},{0xD3,0x0433},{0xD4,0x0434},{0xD5,0x0435},{0xD6,0x0436}, + {0xD7,0x0437},{0xD8,0x0438},{0xD9,0x0439},{0xDA,0x043A},{0xDB,0x043B}, + {0xDC,0x043C},{0xDD,0x043D},{0xDE,0x043E},{0xDF,0x043F},{0xE0,0x0440}, + {0xE1,0x0441},{0xE2,0x0442},{0xE3,0x0443},{0xE4,0x0444},{0xE5,0x0445}, + {0xE6,0x0446},{0xE7,0x0447},{0xE8,0x0448},{0xE9,0x0449},{0xEA,0x044A}, + {0xEB,0x044B},{0xEC,0x044C},{0xED,0x044D},{0xEE,0x044E},{0xEF,0x044F}, + {0xF0,0x2116},{0xF1,0x0451},{0xF2,0x0452},{0xF3,0x0453},{0xF4,0x0454}, + {0xF5,0x0455},{0xF6,0x0456},{0xF7,0x0457},{0xF8,0x0458},{0xF9,0x0459}, + {0xFA,0x045A},{0xFB,0x045B},{0xFC,0x045C},{0xFD,0x00A7},{0xFE,0x045E}, + {0xFF,0x045F}, + +}; + +#define __LOCALCODE_TO_UTF8 + +#ifdef __LOCALCODE_TO_UTF8 + +bool __WmConvertCodeBufferSizeCheck (char *ftnName, int outBufSize, int requiredBufSize) +{ + if (outBufSize < requiredBufSize) { + + if (outBufSize == sizeof(void*)) { // if it is not array + MSG_DEBUG("__WmConvertCodeBufferSizeCheck: Out buffer size seems to be small (%s)\n",ftnName); + } else { + MSG_DEBUG("__WmConvertCodeBufferSizeCheck: Buffer size is too small %s: OutBuffer(%d), RequiredBufSize(%d)\n",ftnName,outBufSize,requiredBufSize); + } + return false; + } + return true; +} + + + +MCHAR __WmLngSwapShort(MCHAR aShort) +{ + return ((aShort << 8) + (aShort >> 8)); +} + +/** + * converting byte ordering between Network and device + * + * @param mszOutput [out] converted[destination] MCHAR buffer + * @param mszInput [in] source MCHAR buffer + * @param length [in] source MCHAR's string length (not byte count) + * + * @return This function returns a true on success, or false on failure. + */ +MCHAR* __WmLngSwapPCode(MCHAR *mszOutput, MCHAR *mszInput, int length) +{ + int i; + + for (i = 0; i < length; i++) { + if (mszInput[i] == (MCHAR)NULL) + break; + + mszOutput[i] = __WmLngSwapShort(mszInput[i]); + } + + mszOutput[i] = NULL; + + return mszOutput; +} + + +/** + * This function convert character Processcode(Unicode) to Localcode(UTF8) + * + * @param pszOutText : Output Buffer Pointer to LocalCode(UTF8) + * @param mszInText : Input Buffer Pointer to ProcessCode(UniCode) + * @return This function returns true on success, or false on failure. + * @see WmConvert2LCodeN + */ +bool WmConvert2LCode(char *pszOutText, int outBufSize, MCHAR *mszInText) +{ + int charCount; + charCount = WmStrlen(mszInText); + if (charCount == 0) + pszOutText[0] = '\0'; + + if ((WmConvertPCode2UTF((UCHAR*)pszOutText, outBufSize, mszInText, charCount) == true)) { + return true; + } else { + MSG_DEBUG("WmConvert2LCode: Converting Unicode(%x) to utf8 code failed\n",mszInText); + return false; + } +} + +/** + * This function convert character Localcode(UTF8) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to LocalCode(UTF8) + * @return This function returns true on success, or false on failure. + * @see WmConvert2PCodeN + */ +bool WmConvert2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int byteCount; + + byteCount = strlen((char*) szInText); + + if (byteCount == 0) + pmszOutText[0] = NULL; + + if((WmConvertUTF2PCode(pmszOutText, outBufSize,(UCHAR*)szInText, byteCount) == true)) { + return true; + } else { + MSG_DEBUG("WmConvert2PCode: Converting UTF8code(%x) to Unicode failed\n",szInText); + return false; + } +} + +/** + * This function convert N'th byte Localcode(UTF8) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to LocalCode(KSC5601) + * @param byteCount : byte number for converting character + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCode + */ +bool WmConvert2PCodeN(MCHAR *pmszOutText, int outBufSize, char *szInText, int byteCount) +{ + if ((WmConvertUTF2PCode (pmszOutText, outBufSize, (UCHAR*)szInText, byteCount) == true)) { + return true; + } else { + MSG_DEBUG("WmConvert2PCodeN: Converting UTF8code(%x) to Unicode failed\n",szInText); + return false; + } +} + +/** + * This function convert N'th character Processcode(Unicode) to Localcode(UTF8) + * + * @param pszOutText : Output Buffer Pointer to LocalCode(UTF8) + * @param mszInText : Input Buffer Pointer to ProcessCode(UniCode) + * @param charCount : number for convert n'th chararcter + * @return This function returns true on success, or false on failure. + * + * @see WmConvert2LCode + */ +bool WmConvert2LCodeN(char *pszOutText, int outBufSize, MCHAR *mszInText, int charCount) +{ + if ( (WmConvertPCode2UTF((UCHAR*)pszOutText, outBufSize, mszInText, charCount) == true)) { + return true; + } else { + MSG_DEBUG("WmConvert2LCodeN: Converting Unicode(%x) to utf8 code failed\n",mszInText); + return false; + } +} + +/** + * This function return output LocalCode Buffer Size + * + * @param mszText : Input ProcessCode String Pointer + * @return This function returns BufferSize for LocalCode + * + * @see WmGetPcodeSize + */ +int WmGetLCodeSize(MCHAR *mszText) +{ + int nBuffSize = 0; + + if (mszText[0] == '\0') + return 0; + + while (*mszText != '\0') { + + if (0x0001 <= *mszText && *mszText <= 0x007F) { + nBuffSize++; + mszText++; + } else if ((*mszText == 0x0000) || (0x0080 <= *mszText && *mszText <= 0x07FF)) { + nBuffSize += 2; + mszText++; + } else { + nBuffSize += 3; + mszText++; + } + } + return nBuffSize; +} + + +/** + * This function return output LocalCode Buffer Size + * + * @param mszText : Input ProcessCode String Pointer + * @return This function returns BufferSize for LocalCode + * + * @see WmGetPcodeSize + */ +int WmGetLCodeSizeN(MCHAR *mszText, int charCount) +{ + int nBuffSize = 0; + int i = 0; + + if (mszText[0] == '\0') + return 0; + + while ((*mszText != '\0') && (i < charCount)) { + + if (0x0001 <= *mszText && *mszText <= 0x007F) { + nBuffSize++; + mszText++; + } else if ((*mszText == 0x0000) || (0x0080 <= *mszText && *mszText <= 0x07FF)) { + nBuffSize += 2; + mszText++; + } else { + nBuffSize += 3; + mszText++; + } + i++; + } + return nBuffSize; +} +#endif + + +/** + * This function convert character Localcode(Latin2) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Latin2 code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertLatin2Code2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInLatin2Table = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertLatinCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInLatin2Table = false; + for (j = 0; j < tabLatin2UniMax; j++) { + if ((UCHAR)szInText[i] == tabLatin2Uni[j].latin2) { + pmszOutText[i] = tabLatin2Uni[j].unicode; + bInLatin2Table = true; + } + } + if (bInLatin2Table == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* Latin2 -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + + +/** + * This function convert character Localcode(Latin3) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Latin2 code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertLatin3Code2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInLatin3Table = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertLatinCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInLatin3Table = false; + for (j = 0; j < tabLatin3UniMax; j++) { + if ((UCHAR)szInText[i] == tabLatin3Uni[j].latin3) { + pmszOutText[i] = tabLatin3Uni[j].unicode; + bInLatin3Table = true; + } + } + if (bInLatin3Table == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* Latin3 -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + +/** + * This function convert character Localcode(Latin4) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Latin2 code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertLatin4Code2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInLatin4Table = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertLatinCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInLatin4Table = false; + for (j = 0; j < tabLatin4UniMax; j++) { + if ((UCHAR)szInText[i] == tabLatin4Uni[j].latin4) { + pmszOutText[i] = tabLatin4Uni[j].unicode; + bInLatin4Table = true; + } + } + if (bInLatin4Table == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* Latin4 -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + +/** + * This function convert character Localcode(Latin8) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Latin2 code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertLatin8Code2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInLatin8Table = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertLatinCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInLatin8Table = false; + for (j = 0; j < tabLatin8UniMax; j++) { + if ((UCHAR)szInText[i] == tabLatin8Uni[j].latin8) { + pmszOutText[i] = tabLatin8Uni[j].unicode; + bInLatin8Table = true; + } + } + if (bInLatin8Table == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* Latin8 -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + + +/** + * This function convert character Localcode(Win1251) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Win1251 code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertWin1251Code2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInWin1251Table = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertWin1251Code2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInWin1251Table = false; + for (j = 0; j < tabWin1251UniMax; j++) { + if ((UCHAR)szInText[i] == tabWin1251Uni[j].win1251) { + pmszOutText[i] = tabWin1251Uni[j].unicode; + bInWin1251Table = true; + } + } + if (bInWin1251Table == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* Win1251 -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + + +/** + * This function convert character Localcode(Koi8-r) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Koi8-r code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertKoi8rCode2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInKoi8rTable = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertKoi8rCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInKoi8rTable = false; + for (j = 0; j < tabKoi8rUniMax; j++) { + if ((UCHAR)szInText[i] == tabKoi8rUni[j].koi8r) { + pmszOutText[i] = tabKoi8rUni[j].unicode; + bInKoi8rTable = true; + } + } + if (bInKoi8rTable == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* bInKoi8-rTable -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + + +/** + * This function convert character Localcode(Koi8-u) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Koi8-u code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertKoi8uCode2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInKoi8uTable = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertKoi8uCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInKoi8uTable = false; + for (j = 0; j < tabKoi8uUniMax; j++) { + if ((UCHAR)szInText[i] == tabKoi8uUni[j].koi8u) { + pmszOutText[i] = tabKoi8uUni[j].unicode; + bInKoi8uTable = true; + } + } + if (bInKoi8uTable == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* bInKoi8uTable -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + + +/** + * This function convert character Localcode(Latin15) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Latin2 code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertLatin15Code2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInLatin15Table = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertLatinCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInLatin15Table = false; + for (j = 0; j < tabLatin15UniMax; j++) { + if ((UCHAR)szInText[i] == tabLatin15Uni[j].latin15) { + pmszOutText[i] = tabLatin15Uni[j].unicode; + bInLatin15Table = true; + } + } + if (bInLatin15Table == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* Latin15 -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + + + + +/** + * This function convert character Localcode(Latin5) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to Latin5 code + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertLatin5Code2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + int i = 0; + int j = 0; + int strLen = 0; + bool bInLatin5Table = false; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertLatinCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + for (i = 0; i < strLen; i++) { + bInLatin5Table = false; + for (j = 0; j < tabLatin5UniMax; j++) { + if ((UCHAR)szInText[i] == tabLatin5Uni[j].Latin5) { + pmszOutText[i] = tabLatin5Uni[j].unicode; + bInLatin5Table = true; + } + } + if (bInLatin5Table == false) + pmszOutText[i] = (MCHAR)(UCHAR)szInText[i]; + } + /* Latin5 -> UNICODE */ + pmszOutText[strLen] = NULL; + + return true; +} + + +int WmGetLatin32UTFCodeSize(unsigned char *szSrc, int nChar) +{ + int bufferSize = 0; + int latin3Size = -1; + MCHAR *pmszText; + + bufferSize = nChar*3+1; + pmszText = (MCHAR *)malloc(bufferSize); + if (!pmszText) { + MSG_DEBUG("WmGetLatin32UTFCodeSize: memory allocation is failed!\n"); + return -1; + } + WmConvertLatin3Code2PCode(pmszText, bufferSize, (char*)szSrc); + latin3Size = WmGetLCodeSize(pmszText); + free(pmszText); + return latin3Size; +} + + +int WmGetLatin42UTFCodeSize(unsigned char *szSrc, int nChar) +{ + int bufferSize = 0; + int latin4Size = -1; + MCHAR *pmszText; + + bufferSize = nChar*3+1; + pmszText = (MCHAR *)malloc(bufferSize); + if (!pmszText) { + MSG_DEBUG("WmGetLatin42UTFCodeSize: memory allocation is failed!\n"); + return -1; + } + WmConvertLatin4Code2PCode(pmszText, bufferSize, (char*)szSrc); + latin4Size = WmGetLCodeSize(pmszText); + free(pmszText); + return latin4Size; +} + + +int WmGetLatin82UTFCodeSize(unsigned char *szSrc, int nChar) +{ + int bufferSize = 0; + int latin8Size = -1; + MCHAR *pmszText; + + bufferSize = nChar*3+1; + pmszText = (MCHAR *)malloc(bufferSize); + if (!pmszText) { + MSG_DEBUG("WmGetLatin82UTFCodeSize: memory allocation is failed!\n"); + return -1; + } + WmConvertLatin8Code2PCode(pmszText, bufferSize, (char*)szSrc); + latin8Size = WmGetLCodeSize(pmszText); + free(pmszText); + return latin8Size; +} + +int WmGetLatin152UTFCodeSize(unsigned char *szSrc, int nChar) +{ + int bufferSize = 0; + int latin15Size = -1; + MCHAR *pmszText; + + bufferSize = nChar*3+1; + pmszText = (MCHAR *)malloc(bufferSize); + if (!pmszText) { + MSG_DEBUG("WmGetLatin152UTFCodeSize: memory allocation is failed!\n"); + return -1; + } + WmConvertLatin15Code2PCode(pmszText, bufferSize, (char*)szSrc); + latin15Size = WmGetLCodeSize(pmszText); + free(pmszText); + return latin15Size; +} + +int WmGetLatin52UTFCodeSize(unsigned char *szSrc, int nChar) +{ + int bufferSize = 0; + int latin5Size = -1; + MCHAR *pmszText; + + bufferSize = nChar*3+1; + pmszText = (MCHAR *)malloc(bufferSize); + if (!pmszText) { + MSG_DEBUG("WmGetLatin52UTFCodeSize: memory allocation is failed!\n"); + return -1; + } + WmConvertLatin5Code2PCode(pmszText, bufferSize, (char*)szSrc); + latin5Size = WmGetLCodeSize(pmszText); + free(pmszText); + return latin5Size; +} + + +/** + * This function convert character Localcode(Latin1) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to LocalCode(KSC5601) + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCodeN + */ +bool WmConvertLatinCode2PCode(MCHAR *pmszOutText, int outBufSize, char *szInText) +{ + UINT strLen; + + strLen = strlen((char *)szInText); + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, strLen) == false) { + MSG_DEBUG("WmConvertLatinCode2PCode: Out buffer size seems to be small!\n"); + return false; + } + + /* Latin1 -> UNICODE */ + __WmLngConvertLatin12Unicode(pmszOutText,(UCHAR*)szInText,strLen); + pmszOutText[strLen] = NULL; + + return true; +} + +/** + * This function convert N'th character Localcode(Latin1) to Processcode(Unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to LocalCode(KSC5601) + * @param charCount : number for convert n'th chararcter + * @return This function returns true on success, or false + * on failure. + * @see WmConvert2PCode + */ +bool WmConvertLatinCode2PCodeN(MCHAR *pmszOutText, int outBufSize, char *szInText, int charCount) +{ + int strLen; + + if (charCount == 0) { + MSG_DEBUG("WmConvert2PCodeN: charCount is0\n"); + pmszOutText[charCount] = NULL; + } + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, charCount) == false) { + MSG_DEBUG("WmConvertLatinCode2PCodeN: Out buffer size seems to be small!\n"); + return false; + } + + /* Latin1 -> UNICODE */ + __WmLngLatin12UnicodeN (pmszOutText, (UCHAR*)szInText, charCount); + + strLen = strlen((char *)szInText); + if(strLen < charCount) { + pmszOutText[strLen] = NULL; + } else { + pmszOutText[charCount] = NULL; + } + + return true; +} + +/* + * This function convert character Processcode(Unicode) to Localcode(Latin1) + * + * @param pOutStr : Output Buffer Pointer to LocalCode(Latin1) + * @param pInputStr : Input Buffer Pointer to ProcessCode(UniCode) + * @param len : number for convert n'th chararcter + * @return void + * + * @see + */ +static void __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len) +{ + UCHAR *rear=NULL; + MCHAR *p; + UCHAR temp; + + rear = pOutStr; + + for (p = pInputStr; len > 0 && p; len--) { + if (*pInputStr < MAX_ASCII_NUM) { // ASCII String + if (*p == 0) + *rear = '\0'; + temp = (UCHAR)(*p); + *rear = temp; + rear++; + p++; + if(len == 1) + *rear = '\0'; + } else { + *rear = 0x3F; + rear++; + p++; + if(len == 1) + *rear = '\0'; + } + pInputStr = p; + } +} + + +/* + * This function convert character Localcode(Latin1) to Processcode(Unicode) + * + * @param des[in] : Output Buffer Pointer to ProcessCode(UniCode) + * @param str[in] : Input Buffer Pointer to LocalCode(Latin1) + * @param len[in] : number for convert n'th chararcter + * @return This function returns number for convert n'th chararcter on success + * + * @see + */ +static int __WmLngConvertLatin12Unicode (MCHAR *des, UCHAR *str, UINT len) +{ + MCHAR *org; + org = des; + while (len>0) { + *des++ = *str++; + len--; + } + + return (des - org) ; +} + +/* + * This function convert N'th character Localcode(Latin1) to Processcode(Unicode) + * + * @param pOutStr : Output Buffer Pointer to ProcessCode(UniCode) + * @param pInputStr : Input Buffer Pointer to LocalCode(Latin1) + * @param len : number for convert n'th chararcter + * @return This function returns true on success, or false on failure. + * + * @see + */ +static UINT __WmLngLatin12UnicodeN(MCHAR *pOutStr, UCHAR *pInputStr, UINT len) +{ + UINT n; + + n = strlen((char*)pInputStr); + + if(len > n) + len = n; + + return __WmLngConvertLatin12Unicode (pOutStr, pInputStr, len); +} + diff --git a/plugin/mms_plugin/LanguagePack/MmsPluginWmLngString.cpp b/plugin/mms_plugin/LanguagePack/MmsPluginWmLngString.cpp new file mode 100755 index 0000000..014b928 --- /dev/null +++ b/plugin/mms_plugin/LanguagePack/MmsPluginWmLngString.cpp @@ -0,0 +1,52 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MmsPluginWmLngPack.h" + + +/** + * return length of a string (character count of a string) + * @param mszInText [in] input string pointer + * @return lenght of string + * + */ +int WmStrlen(const MCHAR *mszInText) +{ + register int n; + + n=0; + + while(*(mszInText+n) != '\0') + n++; + + return n; +} + diff --git a/plugin/mms_plugin/LanguagePack/MmsPluginWmLngUTF8Uni.cpp b/plugin/mms_plugin/LanguagePack/MmsPluginWmLngUTF8Uni.cpp new file mode 100755 index 0000000..0a7a802 --- /dev/null +++ b/plugin/mms_plugin/LanguagePack/MmsPluginWmLngUTF8Uni.cpp @@ -0,0 +1,215 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MmsPluginWmLngPack.h" + + +/* Local function */ +int __WmLngUTF2Unicode (unsigned short *des,unsigned char *src, int nChar); + + +int __WmLngStrlenByByte(UCHAR *szInText, int byteCount) +{ + int nCount = 0; + while (byteCount > 0 && (*szInText != '\0')) { + if (*szInText < 0x80) { + szInText++; + byteCount--; + } else if (((0xC0 <= *szInText) && (*szInText < 0xE0)) && (*(szInText+1) >= 0x80)) { + szInText += 2; + byteCount -= 2; + } else if ((*szInText >= 0xE0) && (*(szInText+1) >= 0x80) && (*(szInText+2) >= 0x80)) { + szInText += 3; + byteCount -= 3; + } else { + szInText++; + byteCount--; + MSG_DEBUG("__WmLngStrlenByByte: utf8 incorrect range!\n"); + } + nCount++; + } + return (nCount+1)*sizeof(MCHAR); +} + +/** + * This function convert character n'th byte UTF8 character to ProcessCode(unicode) + * + * @param pmszOutText : Output Buffer Pointer to ProcessCode(UniCode) + * @param szInText : Input Buffer Pointer to UTF8 + * @param byteCount : byte number for converting the character + * @return : This function returns true on success, or false + * on failure. + * + * @see WmConvertPCode2UTF + */ +bool WmConvertUTF2PCode (MCHAR *pmszOutText, int outBufSize, UCHAR *szInText, int byteCount) +{ + int length; + if (byteCount == 0) { + pmszOutText[0] = NULL; + return true; + } + + if (__WmConvertCodeBufferSizeCheck((char*)pmszOutText, outBufSize, __WmLngStrlenByByte((UCHAR*)szInText, byteCount)) == false) { + MSG_DEBUG("WmConvertUTF2PCode: Out buffer size seems to be small!\n"); + return false; + } + + length = __WmLngUTF2Unicode (pmszOutText, szInText, byteCount); + if (length == -1) { + MSG_DEBUG("WmConvertUTF2PCode: __WmLngUTF2Unicode returns false!\n"); + return false; + } else { + return true; + } +} + + +/* + * change 1byte-encoded-UTF8 character to Unicode + * @param byte1 : 1byte character code + * @return : result of bit operation + * + * + * @see + */ +unsigned short __WmLngConvert1ByteChar (unsigned char byte1) +{ + unsigned short result; + + result = 0; + result = (byte1 & 0x7F); + + return result; +} + +/* + * change 2byte-encoded-UTF8 character to Unicode + * @param byte1 : 1'st byte character code + * @param byte2 : 2'st byte character code + * @return : result of bit operation + * + * @see + */ +unsigned short __WmLngConvert2ByteChar (unsigned char byte1, unsigned char byte2) +{ + unsigned short result; + unsigned char hi; + unsigned char lo; + + result = 0; + + hi = byte1 & 0x1F; + lo = byte2 & 0x3F; + + result = (hi << 6) | lo; + + return result; +} + +/* + * change 3byte-encoded-UTF8 character to Unicode + * @param byte1 : 1'st character code + * @param byte2 : 2'st character code + * @param byte3 : 3'st character code + * @return : result of bit operation + * + * @see + */ +unsigned short __WmLngConvert3ByteChar (unsigned char byte1, unsigned char byte2, unsigned char byte3) +{ + unsigned short result; + unsigned char hi; + unsigned char mid; + unsigned char lo; + + result = 0; + + hi = byte1 & 0x0F; + mid = byte2 & 0x3F; + lo = byte3 & 0x3F; + + result = (hi << 12) | (mid << 6) | lo; + + return result; +} + +/* + * This function convert character UTF8 to ProcessCode(unicode) + * + * @param des : Output Buffer Pointer to ProcessCode(UniCode) + * @param src : Input Buffer Pointer to UTF8 + * @param nChar : number for convert n'th chararcter + * @return : This function returns number for convert n'th chararcter on success, or -1 + * on failure. + * + * @see + */ + +int __WmLngUTF2Unicode (unsigned short *des,unsigned char *src, int nChar) +{ + unsigned short *org; + + org = des; + + while (nChar > 0 && (*src != '\0')) { + if (*src < 0x80) { + *des = __WmLngConvert1ByteChar (*src); + + des++; + src++; + nChar--; + } else if (((0xC0 <= *src) && (*src < 0xE0)) && (*(src+1) >= 0x80)) { + *des = __WmLngConvert2ByteChar (*src, *(src+1)); + + des++; + src += 2; + nChar -= 2; + } else if ((*src >= 0xE0) && (*(src+1) >= 0x80) && (*(src+2) >= 0x80)) { + *des = __WmLngConvert3ByteChar (*src, *(src+1), *(src+2)); + + des++; + + src += 3; + nChar -= 3; + } else { + *des = __WmLngConvert1ByteChar (*src); + des++; + src++; + nChar--; + MSG_DEBUG("__WmLngUTF2Unicode: utf8 incorrect range!\n"); + } + } + *des = 0; + return (des - org); +} + + diff --git a/plugin/mms_plugin/LanguagePack/MmsPluginWmLngUniUTF8.cpp b/plugin/mms_plugin/LanguagePack/MmsPluginWmLngUniUTF8.cpp new file mode 100755 index 0000000..9e626f1 --- /dev/null +++ b/plugin/mms_plugin/LanguagePack/MmsPluginWmLngUniUTF8.cpp @@ -0,0 +1,156 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MmsPluginWmLngPack.h" + + +/* Local function */ +int __WmLngUnicode2UTF (unsigned char *des, unsigned short *src, int nChar); + + +int __WmLngGetLCodeSizeN(MCHAR *mszText, int charCount) +{ + int nBuffSize = 0; + + if (mszText[0] == '\0') + return 0; + + while (charCount > 0 && *mszText != '\0') { + + if (0x0001 <= *mszText && *mszText <= 0x007F) { + nBuffSize++; + mszText++; + charCount--; + } else if((*mszText == 0x0000) || (0x0080 <= *mszText && *mszText <= 0x07FF)) { + nBuffSize += 2; + mszText++; + charCount--; + } else { + nBuffSize += 3; + mszText++; + charCount--; + } + } + return nBuffSize+1; /* include NULL */ +} + +/** + * This function convert character ProcessCode(unicode) to UTF8 + * + * @param pszOutText : Output Buffer Pointer to UTF8 + * @param mszInText : Input Buffer Pointer to ProcessCode(UniCode) + * @param charCount : number for convert n'th chararcter + * @return This function returns true on success, or false + * on failure. + * + * @see WmConvertPCode2UTF + */ +bool WmConvertPCode2UTF(UCHAR *pszOutText, int outBufSize, MCHAR *mszInText, int charCount) +{ + int length; + + if (charCount == 0) { + pszOutText[0] = '\0'; + return true; + } + + if (__WmConvertCodeBufferSizeCheck((char*)pszOutText, outBufSize, __WmLngGetLCodeSizeN(mszInText, charCount)) == false) { + MSG_DEBUG("WmConvertPCode2UTF: Out buffer size seems to be small!\n"); + return false; + } + + length = __WmLngUnicode2UTF(pszOutText, mszInText, charCount); + if(length == -1) { + MSG_DEBUG("WmConvertPCode2UTF: __WmLngUnicode2UTF returns false!\n"); + return false; + } else { + return true; + } +} + +/* + * This function convert character ProcessCode(unicode) to UTF8 + * + * @param des : Output Buffer Pointer to UTF8 + * @param src : Input Buffer Pointer to ProcessCode(UniCode) + * @param nChar : number for convert n'th chararcter + * @return This function returns number for convert n'th chararcter on success, or -1 + * on failure. + * + * @see WmConvertPCode2UTF + */ +int __WmLngUnicode2UTF (unsigned char *des, unsigned short *src, int nChar) +{ + unsigned char *org; + unsigned char t1; + unsigned char t2; + unsigned char t3; + + org = des; + + while (nChar > 0 && *src != '\0') { + if (0x0001 <= *src && *src <= 0x007F) { + *des = (unsigned char) (*src & 0x007F); + + des++; + src++; + nChar--; + } else if ((*src == 0x0000) || (0x0080 <= *src && *src <= 0x07FF)) { + t2 = (unsigned char) (*src & 0x003F); // right most 6 bit + t1 = (unsigned char) ((*src & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + src += 1; + nChar -= 1; + } else { + t3 = (unsigned char) (*src & 0x003F); // right most 6 bit + t2 = (unsigned char) ((*src & 0x0FC0) >> 6); // right most 6 bit + t1 = (unsigned char) ((*src & 0xF000) >> 12); // right most 4 bit + + *des = 0xE0 | (t1 & 0x0F); + *(des+1) = 0x80 | (t2 & 0x3F); + *(des+2) = 0x80 | (t3 & 0x3F); + + des += 3; + src += 1; + nChar -= 1; + } + } + + *des = 0; + return (des - org); +} + + + diff --git a/plugin/mms_plugin/MmsPluginAvCodec.cpp b/plugin/mms_plugin/MmsPluginAvCodec.cpp new file mode 100755 index 0000000..8887d0e --- /dev/null +++ b/plugin/mms_plugin/MmsPluginAvCodec.cpp @@ -0,0 +1,225 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MmsPluginAvCodec.h" +#include + +AvCodecType AvGetFileCodecType(const char *szFileName) +{ + char szFileExt[FILEEXT_MAX] = {0, }; + int iPos = 0; + int iStrLen = 0; + bool bMIME = false; + + iStrLen = strlen(szFileName); + + iPos = iStrLen; + + while (iPos > 0) { + iPos--; + + if (szFileName[iPos] == '.') + break; + if (szFileName[iPos] == '/') { + bMIME = true; + break; + } + } + + if (iPos == 0) { + return AV_CODEC_NONE; + } + + if (FILEEXT_MAX > (iStrLen - iPos - 1)) { + strncpy(szFileExt, szFileName + iPos + 1, (iStrLen - iPos - 1)); + szFileExt[iStrLen - iPos - 1] = '\0'; + } else + return AV_CODEC_NONE; + + if (strcasecmp(szFileExt, "mp3") == 0 || strcasecmp(szFileExt, "MP3") == 0) + return AV_DEC_AUDIO_MP3; + + if (strcasecmp(szFileExt, "pvx") == 0 || strcasecmp(szFileExt, "PVX") == 0) + return AV_DEC_VIDEO_PVX; + else if (strcasecmp(szFileExt, "wav") == 0 || strcasecmp(szFileExt, "WAV") == 0) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + if (__AvValidWAVE(szFileName) == true) + return AV_DEC_AUDIO_WAVE; + else + return AV_CODEC_NONE; + } else +#endif + return AV_DEC_AUDIO_WAVE; + } else if (strcasecmp(szFileExt, "aac") == 0 || strcasecmp(szFileExt, "AAC") == 0) + return AV_DEC_AUDIO_AAC; +#ifdef AV_DEBUG_MODE + else if (strcasecmp(szFileExt, "wma") == 0 || strcasecmp(szFileExt, "WMA") == 0) + return AvWMFFGetFileType(szFileName); + else if (strcasecmp(szFileExt, "wmv") == 0 || strcasecmp(szFileExt, "WMV") == 0) + return AvWMFFGetFileType(szFileName); + else if (strcasecmp(szFileExt, "asf") == 0 || strcasecmp(szFileExt, "ASF") == 0) + return AvWMFFGetFileType(szFileName); +#endif + else if (strcasecmp(szFileExt, "amr") == 0 || strcasecmp(szFileExt, "AMR") == 0 || + strcasecmp(szFileExt, "x-amr") == 0 || strcasecmp(szFileExt, "X-AMR") == 0) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + if (__AvValidAMR(szFileName) == true) + return AV_DEC_AUDIO_AMR; + else + return AV_CODEC_NONE; + } else +#endif + return AV_DEC_AUDIO_AMR; + } else if (strcasecmp(szFileExt, "g7231") == 0 || strcasecmp(szFileExt, "G7231") == 0) + return AV_DEC_AUDIO_G723_1; + else if ((strcasecmp(szFileExt, "mid") == 0 || strcasecmp(szFileExt, "MID") == 0) || + (strcasecmp(szFileExt, "midi") == 0 || strcasecmp(szFileExt, "MIDI") == 0)) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + if (__AvValidMIDI(szFileName) == true) + return AV_DEC_AUDIO_MIDI; + else + return AV_CODEC_NONE; + } else +#endif + return AV_DEC_AUDIO_MIDI; + } else if (strcasecmp(szFileExt, "mmf") == 0 || strcasecmp(szFileExt, "MMF") == 0 || strcasecmp(szFileExt, "x-mmf") == 0) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + if (__AvValidMMF(szFileName) == true) + return AV_DEC_AUDIO_MMF; + else + return AV_CODEC_NONE; + } else +#endif + return AV_DEC_AUDIO_MMF; + } else if (strcasecmp(szFileExt, "pmd") == 0 || strcasecmp(szFileExt, "PMD") == 0) { + return AV_DEC_AUDIO_MIDI; + } else if (strcasecmp(szFileExt, "xmf") == 0 || strcasecmp(szFileExt, "XMF") == 0 || + strcasecmp(szFileExt, "mxmf") == 0 || strcasecmp(szFileExt, "MXMF") == 0) { + return AV_DEC_AUDIO_XMF; + } else if (strcasecmp(szFileExt, "smp") == 0 || strcasecmp(szFileExt, "SMP") == 0) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + if (__AvValidSMP(szFileName) == true) + return AV_DEC_AUDIO_ADPCM; + else + return AV_CODEC_NONE; + } else +#endif + return AV_DEC_AUDIO_ADPCM; + } else if (strcasecmp(szFileExt, "spm") == 0 || strcasecmp(szFileExt, "SPM") == 0) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + if (__AvValidMIDI(szFileName) == true) + return AV_DEC_AUDIO_SPM; + else + return AV_CODEC_NONE; + } else +#endif + return AV_DEC_AUDIO_SPM; + } else if (strcasecmp(szFileExt, "spf") == 0 || strcasecmp(szFileExt, "SPF") == 0) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + if (__AvValidMMF(szFileName) == true) + return AV_DEC_AUDIO_MMF_PHRASE_L1; + else + return AV_CODEC_NONE; + } else +#endif + return AV_DEC_AUDIO_MMF_PHRASE_L1; + } else if (strcasecmp(szFileExt, "imy") == 0 || strcasecmp(szFileExt, "IMY") == 0 || + strcasecmp(szFileExt, "iMelody") == 0 || strcasecmp(szFileExt, "x-iMelody") == 0 || + strcasecmp(szFileExt, "Melody") == 0) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + if (__AvValidIMELODY(szFileName) == true) + return AV_DEC_AUDIO_IMELODY; + else + return AV_CODEC_NONE; + } else +#endif + return AV_DEC_AUDIO_IMELODY; + } else if (strcasecmp(szFileExt, "dtmf") == 0) + return AV_DEC_AUDIO_DTMF_TONE; + else if (strcasecmp(szFileExt, "h263") == 0 || strcasecmp(szFileExt, "H263") == 0) + return AV_DEC_VIDEO_H263; + else if (strcasecmp(szFileExt, "mp4") == 0 || strcasecmp(szFileExt, "MP4") == 0 || + strcasecmp(szFileExt, "mpeg4") == 0 || strcasecmp(szFileExt, "MPEG4") == 0 || + strcasecmp(szFileExt, "m4a") == 0 || strcasecmp(szFileExt, "M4A") == 0) { +#ifdef AV_DEBUG_MODE + if (!bMIME) { + AvCodecType avCodecType = AV_CODEC_NONE; + FmFileAttribute fileAttrib; + size_t strLen; + UINT32 dateTime = 0; + + if (!DrmGetFileAttributes(szFileName, &fileAttrib)) { + return AV_CODEC_NONE; + } else { + dateTime = TmDateTimeToSeconds(&fileAttrib.dt); + strLen = strlen(szFileName); + if ((strnicmp(lastAccessFileInfo.szFileName, szFileName, strLen) == 0) && + (lastAccessFileInfo.fileSize == fileAttrib.fileSize) && + (lastAccessFileInfo.dateTime == dateTime)) { + return lastAccessFileInfo.codecType; + } else { + avCodecType = AvMP4FFGetFileType(szFileName); + + if (strcasecmp(szFileExt, "3ga") == 0 || strcasecmp(szFileExt, "3GA") == 0 || + strcasecmp(szFileExt, "m4a") == 0 || strcasecmp(szFileExt, "M4A") == 0) { + if (avCodecType | AV_DEC_AUDIO_MPEG4) + avCodecType = AV_DEC_AUDIO_MPEG4; + } + + if (avCodecType != AV_CODEC_NONE) { + strncpy(lastAccessFileInfo.szFileName, szFileName, strLen); + lastAccessFileInfo.szFileName[strLen] = '\0'; + lastAccessFileInfo.fileSize = fileAttrib.fileSize; + lastAccessFileInfo.dateTime = dateTime; + lastAccessFileInfo.codecType = avCodecType; + } + return avCodecType; + } + } + } +#endif + return AV_DEC_VIDEO_MPEG4; + } else if (strcasecmp(szFileExt, "3gp") == 0 || strcasecmp(szFileExt, "3GP") == 0 || + strcasecmp(szFileExt, "3ga") == 0 || strcasecmp(szFileExt, "3GA") == 0 || + strcasecmp(szFileExt, "3gpp") == 0 || strcasecmp(szFileExt, "3GPP") == 0) { + return AV_CODEC_NONE; + } else if (strcasecmp(szFileExt, "sdp") == 0 || strcasecmp(szFileExt, "SDP") == 0) + return AV_DEC_VIDEO_MPEG4; + else + return AV_CODEC_NONE; +} diff --git a/plugin/mms_plugin/MmsPluginCodec.cpp b/plugin/mms_plugin/MmsPluginCodec.cpp new file mode 100755 index 0000000..e5006a4 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginCodec.cpp @@ -0,0 +1,639 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MmsPluginCodec.h" +#include "MsgMmsTypes.h" +#include "MmsPluginMessage.h" +#include "MmsPluginMIME.h" +#include "MsgDebug.h" + +/* Reference : MMS-209-Encapsulation & WAP-203-WSP-20000504.pdf Table 39 */ +const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = +{ + /* MMS Specific (MsgMmsMsg.h / MsgMmsUA.h) -----------------------*/ + + /* MmsCodeFieldCode */ + { + {"Bcc", 0x01}, //0 + {"Cc", 0x02}, + {"X-Mms-Content-Location", 0x03}, + {"Content-Type", 0x04}, + {"Date", 0x05}, + {"X-Mms-Delivery-Report", 0x06}, + {"X-Mms-Delivery-Time", 0x07}, + {"X-Mms-Expiry", 0x08}, + {"From", 0x09}, + {"X-Mms-Message-Class", 0x0A}, + {"Message-ID", 0x0B}, // 10 + {"X-Mms-Message-Type", 0x0C}, + {"X-Mms-MMS-Version", 0x0D}, + {"X-Mms-Message-Size", 0x0E}, + {"X-Mms-Priority", 0x0F}, + {"X-Mms-Read-Reply", 0x10}, + {"X-Mms-Report-Allowed", 0x11}, + {"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-Sender-Visibility", 0x14}, + {"X-Mms-Status", 0x15}, + {"Subject", 0x16}, + {"To", 0x17}, + {"X-Mms-Transaction-ID", 0x18}, + + /* 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-ID", 0x1E}, + {"X-Mms-Reply-Charging-Size", 0x1F}, + {"X-Mms-Previously-Sent-By", 0x20}, + {"X-Mms-Previously-Sent-Date", 0x21}, + }, + + /* 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; +#ifdef FEATURE_JAVA_MMS + {"Application-ID", 0xFF}, + {"Reply-To-Application-ID", 0xFF}, +#endif + }, + + /* 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 + }, + + /* MmsCodeMsgType */ + { + {"m-send-req", 0x00}, + {"m-send-conf", 0x01}, + {"m-notification-ind", 0x02}, + {"m-notifyresp-ind", 0x03}, + {"m-retrieve-conf", 0x04}, + {"m-acknowledge-ind", 0x05}, + {"m-delivery-ind", 0x06}, + + /* Add by MMSENC v1.1 */ + {"m-read-rec-ind", 0x07}, + {"m-read-orig-ind", 0x08}, + {"m-forward-req", 0x09}, + {"m-forward-conf", 0x0A} + }, + + /* MmsCodeDeliveryReport */ + { + { "Yes", 0x00 }, { "No", 0x01 } + }, + + /* MmsCodeTimeType */ + { + { "relative", 0x01 }, { "absolute", 0x00 } + }, + + /* MmsCodeMsgClass */ + { + {"Personal", 0x00}, + {"Advertisement", 0x01}, + {"Informational", 0x02}, + {"Auto", 0x03} + }, + + /* MmsCodePriority */ + { + { "Low", 0x00 }, { "Normal", 0x01 }, { "High", 0x02 } + }, + + /* MmsCodeResponseStatus */ + { + {"Ok", 0x00}, + {"Error-unspecified", 0x01}, + {"Error-service-denied", 0x02}, + {"Error-message-format-corrupt", 0x03}, + {"Error-sending-address-unresolved", 0x04}, + {"Error-message-not-found", 0x05}, + {"Error-network-problem", 0x06}, + {"Error-content-not-accepted", 0x07}, + {"Error-unsupported-message", 0x08}, + + {"Error-transient-failure", 0x40}, + {"Error-transient-sending-address-unresolved", 0x41}, + {"Error-transient-message-not-found", 0x42}, + {"Error-transient-network-problem", 0x43}, + + {"Error-transient-failure", 0x44}, //reserved for future + {"Error-transient-failure", 0x45}, + {"Error-transient-failure", 0x46}, + {"Error-transient-failure", 0x47}, + {"Error-transient-failure", 0x48}, + {"Error-transient-failure", 0x49}, + {"Error-transient-failure", 0x4A}, + {"Error-transient-failure", 0x4B}, + {"Error-transient-failure", 0x4C}, + {"Error-transient-failure", 0x4D}, + {"Error-transient-failure", 0x4E}, + {"Error-transient-failure", 0x4F}, + {"Error-transient-failure", 0x50}, + {"Error-transient-failure", 0x51}, + {"Error-transient-failure", 0x52}, + {"Error-transient-failure", 0x53}, + {"Error-transient-failure", 0x54}, + {"Error-transient-failure", 0x55}, + {"Error-transient-failure", 0x56}, + {"Error-transient-failure", 0x57}, + {"Error-transient-failure", 0x58}, + {"Error-transient-failure", 0x59}, + {"Error-transient-failure", 0x5A}, + {"Error-transient-failure", 0x5B}, + {"Error-transient-failure", 0x5C}, + {"Error-transient-failure", 0x5D}, + {"Error-transient-failure", 0x5E}, + {"Error-transient-failure", 0x5F}, + + {"Error-permanent-failure", 0x60}, + {"Error-permanent-service-denied", 0x61}, + {"Error-permanent-message-format-corrupt", 0x62}, + {"Error-permanent-sending-address-unresolved", 0x63}, + {"Error-permanent-message-not-found", 0x64}, + {"Error-permanent-content-not-accepted", 0x65}, + {"Error-permanent-reply-charging-limitations-not-met", 0x66}, + {"Error-permanent-reply-charging-request-not-accepted", 0x67}, + {"Error-permanent-reply-charging-forwarding-denied", 0x68}, + {"Error-permanent-reply-charging-not-supported", 0x69}, + + {"Error-permanent-failure", 0x6A}, //reserved for future + {"Error-permanent-failure", 0x6B}, + {"Error-permanent-failure", 0x6C}, + {"Error-permanent-failure", 0x6D}, + {"Error-permanent-failure", 0x6E}, + {"Error-permanent-failure", 0x6F}, + {"Error-permanent-failure", 0x70}, + {"Error-permanent-failure", 0x71}, + {"Error-permanent-failure", 0x72}, + {"Error-permanent-failure", 0x73}, + {"Error-permanent-failure", 0x74}, + {"Error-permanent-failure", 0x75}, + {"Error-permanent-failure", 0x76}, + {"Error-permanent-failure", 0x77}, + {"Error-permanent-failure", 0x78}, + {"Error-permanent-failure", 0x79}, + {"Error-permanent-failure", 0x7A}, + {"Error-permanent-failure", 0x7B}, + {"Error-permanent-failure", 0x7C}, + {"Error-permanent-failure", 0x7D}, + {"Error-permanent-failure", 0x7E}, + {"Error-permanent-failure", 0x7F} + + + }, + + /* MmsCodeRetrieveStatus */ + { + {"Ok", 0x00}, + {"Error-transient-failure", 0x40}, + {"Error-transient-message-not-found", 0x41}, + {"Error-transient-network-problem", 0x42}, + + {"Error-transient-failure", 0x43}, //reserved for future + {"Error-transient-failure", 0x44}, + {"Error-transient-failure", 0x45}, + {"Error-transient-failure", 0x46}, + {"Error-transient-failure", 0x47}, + {"Error-transient-failure", 0x48}, + {"Error-transient-failure", 0x49}, + {"Error-transient-failure", 0x4A}, + {"Error-transient-failure", 0x4B}, + {"Error-transient-failure", 0x4C}, + {"Error-transient-failure", 0x4D}, + {"Error-transient-failure", 0x4E}, + {"Error-transient-failure", 0x4F}, + {"Error-transient-failure", 0x50}, + {"Error-transient-failure", 0x51}, + {"Error-transient-failure", 0x52}, + {"Error-transient-failure", 0x53}, + {"Error-transient-failure", 0x54}, + {"Error-transient-failure", 0x55}, + {"Error-transient-failure", 0x56}, + {"Error-transient-failure", 0x57}, + {"Error-transient-failure", 0x58}, + {"Error-transient-failure", 0x59}, + {"Error-transient-failure", 0x5A}, + {"Error-transient-failure", 0x5B}, + {"Error-transient-failure", 0x5C}, + {"Error-transient-failure", 0x5D}, + {"Error-transient-failure", 0x5E}, + {"Error-transient-failure", 0x5F}, + + {"Error-permanent-failure", 0x60}, + {"Error-permanent-service-denied", 0x61}, + {"Error-permanent-message-not-found", 0x62}, + {"Error-permanent-content-unsupported", 0x63}, + + {"Error-permanent-failure", 0x64}, //reserved for future + {"Error-permanent-failure", 0x65}, + {"Error-permanent-failure", 0x66}, + {"Error-permanent-failure", 0x67}, + {"Error-permanent-failure", 0x68}, + {"Error-permanent-failure", 0x69}, + {"Error-permanent-failure", 0x6A}, + {"Error-permanent-failure", 0x6B}, + {"Error-permanent-failure", 0x6C}, + {"Error-permanent-failure", 0x6D}, + {"Error-permanent-failure", 0x6E}, + {"Error-permanent-failure", 0x6F}, + {"Error-permanent-failure", 0x70}, + {"Error-permanent-failure", 0x71}, + {"Error-permanent-failure", 0x72}, + {"Error-permanent-failure", 0x73}, + {"Error-permanent-failure", 0x74}, + {"Error-permanent-failure", 0x75}, + {"Error-permanent-failure", 0x76}, + {"Error-permanent-failure", 0x77}, + {"Error-permanent-failure", 0x78}, + {"Error-permanent-failure", 0x79}, + {"Error-permanent-failure", 0x7A}, + {"Error-permanent-failure", 0x7B}, + {"Error-permanent-failure", 0x7C}, + {"Error-permanent-failure", 0x7D}, + {"Error-permanent-failure", 0x7E}, + {"Error-permanent-failure", 0x7F} + + }, + + /* MmsCodeReadReply */ + { + { "Yes", 0x00 }, { "No", 0x01 } + }, + + /* MmsCodeReportAllowed */ + { + { "Yes", 0x00 }, { "No", 0x01 } + }, + + /* MmsCodeSenderVisibility */ + { + { "Show", 0x01 }, { "Hide", 0x00 } + }, + + /* MmsCodeMsgStatus */ + { + {"Expired", 0x00}, + {"Retrieved", 0x01}, + {"Rejected", 0x02}, + {"Deferred", 0x03}, + {"Unrecognised", 0x04}, + + /* Add by MMSENC v1.1 */ + {"Indeterminate ", 0x05}, + {"Forwarded", 0x06}, + + /* Add by MMSENC v1.2 */ + {"Unreachable", 0x07 } + + }, + + /* MmsCodeReadStatus */ + { + {"Read", 0x00}, {"Deleted", 0x01} + }, + + /* MmsCodeAddressType */ + { + {"present", 0x00}, {"insert", 0x01} + }, + + + /* MSG Specific (MsgMIMEExtern.h) -----------------------*/ + + /* MmsCodeCharSet */ + { + {"us-ascii", 0x03}, + {"UTF-16", 0x03F7}, + {"ISO-10646-UCS-2", 0x03E8}, + {"UTF-8", 0x6A}, + + {"ISO-2022-KR", 0x25}, + {"KS_C_5601-1987", 0x24}, + {"EUC-KR", 0x26}, + {"ISO-2022-JP", 0x27}, + {"ISO-2022-JP-2", 0x28}, + + {"ISO_8859-1", 0x04}, + {"ISO_8859-2", 0x05}, + {"ISO-8859-3", 0x06}, + {"ISO-8859-4", 0x07}, + {"ISO-8859-5", 0x08}, + {"ISO-8859-6", 0x09}, + {"ISO-8859-6-E", 0x51}, + {"ISO-8859-6-I", 0x52}, + {"ISO-8859-7", 0x0a}, + {"ISO-8859-8", 0x0b}, + {"ISO-8859-8-I", 0x85}, + {"ISO-8859-9", 0x0c}, + {"ISO-8859-10", 0x0d}, + {"ISO-8859-15", 0x6F}, + + {"Shift_JIS", 0x11}, + {"EUC-JP", 0x13}, + {"GB2312", 0x07E9}, + {"BIG5", 0x0d}, + {"WIN1251", 0xFF}, + {"WINDOW-1251", 0xFF}, + {"WINDOWS-1251", 0xFF}, + {"KOI8-R", 0x0824}, + {"KOI8-U", 0x0828}, + }, + + /* MmsCodeReplyCharging, */ + { + { "Requested", 0x00 }, + { "Requested text only", 0x01 }, + { "Accepted", 0x02 }, + { "Accepted text only", 0x03 } + }, + + + /* MSG Specific (MsgMIMEExtern.h) -----------------------*/ + + /* Content-Type (http://www.wapforum.org/wina/wsp-content-type.htm) */ + /* this group(Content-Type) will be replaced by utyMime */ + { + // {"Text/txt", 0x01}, + {"Text/html", 0x02}, + {"Text/plain", 0x03}, + {"Text/vnd.wap.wml", 0x08}, + {"Text/x-vCalendar", 0x06}, + {"Text/x-vCard", 0x07}, + + {"Application/vnd.wap.multipart.*", 0x22}, + {"Application/vnd.wap.multipart.mixed", 0x23}, + {"Application/vnd.wap.multipart.related", 0x33}, + {"Application/vnd.wap.multipart.alternative", 0x26}, + + {"application/vnd.oma.drm.message", 0x48}, // 10 + {"application/vnd.oma.drm.content", 0x49}, + {"application/vnd.oma.drm.rights+xml", 0x4A}, + {"application/vnd.oma.drm.rights+wbxml", 0x4B}, + + {"application/smil", 0xFFFF}, + {"Multipart/mixed", 0x0c}, + {"Multipart/related", 0x0B}, + {"Multipart/alternative", 0x0F}, + + {"multipart/report", 0xffff}, + {"Message/rfc822", 0xffff}, + + // T E X T + {"Image/gif", 0x1D}, // 20 + {"Image/jpeg", 0x1E}, + {"Image/jpg", 0xFFFF}, + {"image/tiff", 0x1f}, + {"Image/png", 0x20}, + + + {"Image/vnd.wap.wbmp", 0x21}, + + {"Image/wbmp", 0xFFFF}, + {"Image/pjpeg", 0xFFFF}, + + {"Image/bmp", 0xFFFF}, + + // A U D I O + {"Audio/basic", 0xFFFF}, + {"Audio/mpeg", 0xFFFF}, // 30 + {"Audio/x-mpeg", 0xFFFF}, + {"Audio/mp3", 0xFFFF}, + {"audio/x-mp3", 0xFFFF}, + {"audio/mpeg3", 0xFFFF}, + {"audio/x-mpeg3", 0xFFFF}, + {"audio/mpg", 0xFFFF}, + {"audio/x-mpg", 0xFFFF}, + {"audio/x-mpegaudio", 0xFFFF}, + {"Audio/aac", 0xFFFF}, // 39 + {"Audio/g72", 0xFFFF}, + {"Audio/amr", 0xFFFF}, + {"audio/x-amr", 0xFFFF}, + {"audio/x-mmf", 0xFFFF}, + {"application/vnd.smaf", 0xffff}, + {"application/x-smaf", 0xFFFF}, + {"audio/mmf", 0xFFFF}, + + {"text/x-iMelody", 0xffff}, + {"audio/x-iMelody", 0xffff}, + {"audio/iMelody", 0xffff}, // 49 + {"audio/mid",0xffff}, + {"audio/midi", 0xffff}, + {"audio/x-midi", 0xffff}, + {"audio/sp-midi", 0xffff}, + {"audio/wave", 0xffff}, + {"audio/3gpp", 0xffff}, + {"audio/vnd.rn-realaudio", 0xffff}, + {"audio/x-pn-realaudio", 0xffff}, + {"audio/mp4", 0xffff}, + + // V I D E O + {"video/mpeg4", 0xFFFF}, + {"video/mp4", 0xffff}, + {"video/x-mp4", 0xFFFF}, + {"video/x-vp-mp4", 0xffff}, + {"Video/h263", 0xFFFF}, + + {"video/3gpp", 0xffff}, + {"video/3gp", 0xffff}, + {"Video/avi", 0xFFFF}, + + {"video/sdp", 0xffff}, // 70 + {"application/vnd.rn-realmedia", 0xffff}, + {"video/vnd.rn-realvideo", 0xffff}, + + {"application/octet-stream", 0xFFFF } + }, + + /* MmsCodeMsgDisposition : Wsp Header (By Wsp 8.4.2.53) */ + { + {"form-data", 0x00}, + {"attachment", 0x01}, + {"inline", 0x02} + }, + + /* Content-transfer-encoding : HTTP Header(Binary Value is not assigned) */ + { + {"7bit", 0x00}, + {"8bit", 0x00}, + {"binary", 0x00}, + {"base64", 0x00}, + {"quoted-printable", 0x00} + } +}; + +/* global variables */ +static char gszMmsVersion[5] = {0, }; + +char *_MmsGetTextValue(MmsCode i, int j) +{ + if (i == MmsCodeContentType) { + //apply UtyMime + return MimeGetMimeStringFromMimeInt(j); + } + + return (char *)gMmsField[i][j].szText; +} + +char *_MmsGetTextValuebyField(int field, int value) +{ + char *szValue = NULL; + + switch (field) { + case MMS_CODE_MSGTYPE: + szValue = _MmsGetTextValue(MmsCodeMsgType, value); + break; + + case MMS_CODE_MSGCLASS: + szValue = _MmsGetTextValue(MmsCodeMsgClass, value); + break; + + case MMS_CODE_PRIORITY: + szValue = _MmsGetTextValue(MmsCodePriority, value); + break; + + case MMS_CODE_SENDERVISIBILLITY: + szValue = _MmsGetTextValue(MmsCodeSenderVisibility, value); + break; + + case MMS_CODE_DELIVERYREPORT: + szValue = _MmsGetTextValue(MmsCodeDeliveryReport, value); + break; + + case MMS_CODE_READREPLY: + szValue = _MmsGetTextValue(MmsCodeReadReply, value); + break; + + case MMS_CODE_MSGSTATUS: + szValue = _MmsGetTextValue(MmsCodeMsgStatus, value); + break; + + case MMS_CODE_REPORTALLOWED: + szValue = _MmsGetTextValue(MmsCodeReportAllowed, value); + break; + + case MMS_CODE_RESPONSESTATUS: + szValue = _MmsGetTextValue(MmsCodeResponseStatus, value); + break; + + /* Add by MMSENC v1.1 */ + case MMS_CODE_READSTATUS: + szValue = _MmsGetTextValue(MmsCodeReadStatus, value); + break; + + default: + szValue = NULL; + break; + } + + return szValue; +} + +UINT16 _MmsGetBinaryValue(MmsCode i, int j) +{ + if (i == MmsCodeContentType) { + return MimeGetBinaryValueFromMimeInt((MimeType)j); + } + + return gMmsField[i][j].binary; +} + +// getting mime type (int) by binary type +int _MmsGetBinaryType(MmsCode i, UINT16 value) +{ + MSG_BEGIN(); + + if (i == MmsCodeContentType) { + //apply UtyMime + return MimeGetMimeIntFromBi(value); + } + + for (int j = 0; j < MMS_MAX_FIELD_VALUE_COUNT; j++) { + if (gMmsField[i][j].binary == value) { + return j; + } + } + + MSG_END(); + + return MIME_UNKNOWN; +} + +int _MmsGetTextType(MmsCode i, char *pValue) +{ + int j = 0; + + if (i == MmsCodeContentType) { + /*apply UtyMime */ + return MimeGetMimeIntFromMimeString( pValue ); + } + + for (j = 0; j < MMS_MAX_FIELD_VALUE_COUNT; j++) { + if (gMmsField[i][j].szText != NULL) { + if (strcasecmp( gMmsField[i][j].szText, pValue ) == 0) { + return j; + } + } + } + + return -1; +} + +UINT8 _MmsGetVersion(MmsMsg *pMsg) +{ + if (pMsg == NULL) { + return MMS_VERSION; + } + + return pMsg->mmsAttrib.version; +} + +bool _MmsSetVersion(int majorVer, int minorVer) +{ + snprintf(gszMmsVersion, sizeof(gszMmsVersion), "%d.%d", majorVer, minorVer); + return true; +} + diff --git a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp new file mode 100755 index 0000000..0b13262 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp @@ -0,0 +1,461 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MmsPluginConnManWrapper.h" + +void network_print_profile(net_profile_info_t *ProfInfo) +{ + int di = 0; + + unsigned char *ipaddr; + unsigned char *netmaskaddr; + unsigned char *gwaddr; + net_dev_info_t *net_info; + + if (ProfInfo->profile_type == NET_DEVICE_CELLULAR) { + ipaddr = (unsigned char *)&ProfInfo->ProfileInfo.Pdp.net_info.IpAddr.Data.Ipv4.s_addr; + netmaskaddr = (unsigned char *)&ProfInfo->ProfileInfo.Pdp.net_info.SubnetMask.Data.Ipv4.s_addr; + gwaddr = (unsigned char *)&ProfInfo->ProfileInfo.Pdp.net_info.GatewayAddr.Data.Ipv4.s_addr; + net_info = &(ProfInfo->ProfileInfo.Pdp.net_info); + } else { + MSG_DEBUG("Error!!! Invalid profile type\n"); + return; + } + + MSG_DEBUG("**************************************************************************************************"); + + MSG_DEBUG("Profile Name = [%s]\n", ProfInfo->ProfileName); + + if (ProfInfo->ProfileState == NET_STATE_TYPE_IDLE) + MSG_DEBUG("Profile State = [idle]\n"); + else if (ProfInfo->ProfileState == NET_STATE_TYPE_FAILURE) + MSG_DEBUG("Profile State = [failure]\n"); + else if (ProfInfo->ProfileState == NET_STATE_TYPE_ASSOCIATION) + MSG_DEBUG("Profile State = [association]\n"); + else if (ProfInfo->ProfileState == NET_STATE_TYPE_CONFIGURATION) + MSG_DEBUG("Profile State = [configuration]\n"); + else if (ProfInfo->ProfileState == NET_STATE_TYPE_READY) + MSG_DEBUG("Profile State = [ready]\n"); + else if (ProfInfo->ProfileState == NET_STATE_TYPE_ONLINE) + MSG_DEBUG("Profile State = [online]\n"); + else if (ProfInfo->ProfileState == NET_STATE_TYPE_DISCONNECT) + MSG_DEBUG("Profile State = [disconnect]\n"); + else + MSG_DEBUG("Profile State = [unknown]\n"); + + MSG_DEBUG("Profile Type = [pdp]\n"); + + if (ProfInfo->ProfileInfo.Pdp.ProtocolType == NET_PDP_TYPE_GPRS) + MSG_DEBUG("Profile Protocol Type = [GPRS]\n"); + else if (ProfInfo->ProfileInfo.Pdp.ProtocolType == NET_PDP_TYPE_EDGE) + MSG_DEBUG("Profile Protocol Type = [EDGE]\n"); + else if (ProfInfo->ProfileInfo.Pdp.ProtocolType == NET_PDP_TYPE_UMTS) + MSG_DEBUG("Profile Protocol Type = [UMTS]\n"); + else + MSG_DEBUG("Profile Protocol Type = [NONE]\n"); + + MSG_DEBUG("Profile APN = [%s]\n", ProfInfo->ProfileInfo.Pdp.Apn); + + if (ProfInfo->ProfileInfo.Pdp.AuthInfo.AuthType == NET_PDP_AUTH_PAP) + MSG_DEBUG("Profile Auth Type = [PAP]\n"); + else if (ProfInfo->ProfileInfo.Pdp.AuthInfo.AuthType == NET_PDP_AUTH_CHAP) + MSG_DEBUG("Profile Auth Type = [CHAP]\n"); + else + MSG_DEBUG("Profile Auth Type = [NONE]\n"); + + MSG_DEBUG("Profile Auth UserName = [%s]\n", ProfInfo->ProfileInfo.Pdp.AuthInfo.UserName); + MSG_DEBUG("Profile Auth Password = [%s]\n", ProfInfo->ProfileInfo.Pdp.AuthInfo.Password); + MSG_DEBUG("Profile Home URL = [%s]\n", ProfInfo->ProfileInfo.Pdp.HomeURL); + MSG_DEBUG("Profile MCC = [%s]\n", ProfInfo->ProfileInfo.Pdp.Mcc); + MSG_DEBUG("Profile MNC = [%s]\n", ProfInfo->ProfileInfo.Pdp.Mnc); + MSG_DEBUG("Profile Roaming = [%d]\n", (int)ProfInfo->ProfileInfo.Pdp.Roaming); + MSG_DEBUG("Profile Setup Required = [%d]\n", (int)ProfInfo->ProfileInfo.Pdp.SetupRequired); + MSG_DEBUG("Profile Favourite = [%d]\n", (int)ProfInfo->Favourite); + MSG_DEBUG("Profile Device Name = [%s]\n", net_info->DevName); + MSG_DEBUG("Profile DNS Count = [%d]\n", net_info->DnsCount); + for (di = 0; di < net_info->DnsCount; di++) { + unsigned char *dns = (unsigned char *)&net_info->DnsAddr[di].Data.Ipv4.s_addr; + MSG_DEBUG("Profile DNS Address %d = [%d.%d.%d.%d]\n", di+1, dns[0], dns[1], dns[2], dns[3]); + } + + if (net_info->IpConfigType == NET_IP_CONFIG_TYPE_DYNAMIC) + MSG_DEBUG("Profile IPv4 Method = [NET_IP_CONFIG_TYPE_DYNAMIC]\n"); + else if (net_info->IpConfigType == NET_IP_CONFIG_TYPE_STATIC) + MSG_DEBUG("Profile IPv4 Method = [NET_IP_CONFIG_TYPE_STATIC]\n"); + else if (net_info->IpConfigType == NET_IP_CONFIG_TYPE_FIXED) + MSG_DEBUG("Profile IPv4 Method = [NET_IP_CONFIG_TYPE_FIXED]\n"); + else if (net_info->IpConfigType == NET_IP_CONFIG_TYPE_OFF) + MSG_DEBUG("Profile IPv4 Method = [NET_IP_CONFIG_TYPE_OFF]\n"); + else + MSG_DEBUG("Profile IPv4 Method = [UNKNOWN]\n"); + + MSG_DEBUG("Profile IP Address = [%d.%d.%d.%d]\n", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]); + MSG_DEBUG("Profile Netmask = [%d.%d.%d.%d]\n", netmaskaddr[0], netmaskaddr[1], netmaskaddr[2], netmaskaddr[3]); + MSG_DEBUG("Profile Gateway = [%d.%d.%d.%d]\n", gwaddr[0], gwaddr[1], gwaddr[2], gwaddr[3]); + + if (net_info->ProxyMethod == NET_PROXY_TYPE_DIRECT) + MSG_DEBUG("Proxy Method = [direct]\n"); + else if (net_info->ProxyMethod == NET_PROXY_TYPE_AUTO) + MSG_DEBUG("Proxy Method = [auto]\n"); + else if (net_info->ProxyMethod == NET_PROXY_TYPE_MANUAL) + MSG_DEBUG("Proxy Method = [manual]\n"); + else + MSG_DEBUG("Proxy Method = [unknown]\n"); + + MSG_DEBUG("Profile Proxy = [%s]\n", net_info->ProxyAddr); + + MSG_DEBUG("**************************************************************************************************"); +} + + + +void network_evt_cb (net_event_info_t *event_cb, void *user_data) +{ + MSG_BEGIN(); + + MmsPluginCmAgent::instance()->processCBdatas(event_cb, user_data); + + MSG_END(); +} + + +MmsPluginCmAgent *MmsPluginCmAgent::pInstance = NULL; + +MmsPluginCmAgent *MmsPluginCmAgent::instance() +{ + if (!pInstance) + pInstance = new MmsPluginCmAgent(); + + return pInstance; +} + +MmsPluginCmAgent::MmsPluginCmAgent() +{ + MSG_BEGIN(); + + isCmOpened = false; + bzero(&mmsProfile, sizeof (net_profile_info_t)); + + MSG_END(); +} + +MmsPluginCmAgent::~MmsPluginCmAgent() +{ + +} + +bool MmsPluginCmAgent::registration() +{ + MSG_BEGIN(); + + bool registResult = true; + + if (net_register_client((net_event_cb_t) network_evt_cb, NULL) != NET_ERR_NONE) { + MSG_DEBUG("Error!! net_register_client() failed.\n"); + registResult = false; + } + + MSG_END(); + + return registResult; +} + +bool MmsPluginCmAgent::open() +{ + MSG_BEGIN(); + + if (!isCmOpened) { + if (!registration()) + return false; + + int netOpenResult = NET_ERR_NONE; + net_service_type_t service_type = NET_SERVICE_MMS; + + netOpenResult = net_open_connection_with_preference(service_type); + if (netOpenResult != NET_ERR_NONE) { + MSG_DEBUG("Error!! net_open_connection_with_profile() failed. [%d]", netOpenResult); + deregistration(); + return false; + } + + MSG_DEBUG("WAITING UNTIL Network Connection Open."); + + lock(); + + int time_ret = 0; + time_ret = cv.timedwait(mx.pMutex(), 50); + + unlock(); + + if (time_ret == ETIMEDOUT) { + MSG_DEBUG("Network Connection Open Time Out."); + deregistration(); + return false; + } else { + if(!isCmOpened) { + MSG_DEBUG("Network connection open failed"); + deregistration(); + return false; + } + } + } else { + MSG_DEBUG("Network is already opened."); + return false; + } + + MSG_END(); + + return isCmOpened; +} + + +void MmsPluginCmAgent::close() +{ + MSG_BEGIN(); + + if (isCmOpened) { + int netOpenResult = NET_ERR_NONE; + + netOpenResult = net_close_connection(mmsProfile.ProfileName); + if (netOpenResult != NET_ERR_NONE) { + MSG_DEBUG("Error!! net_close_connection() failed.\n"); + deregistration(); + return; + } + + MSG_DEBUG("WAITING UNTIL Network Connection Close."); + + lock(); + + int time_ret = 0; + time_ret = cv.timedwait(mx.pMutex(), 50); + + unlock(); + + if (time_ret == ETIMEDOUT) { + MSG_DEBUG("Network Connection Close Timed Out."); + } + + deregistration(); + } else { + MSG_DEBUG ("Network Connection is not opened."); + return; + } +} + + +void MmsPluginCmAgent::deregistration() +{ + MSG_BEGIN(); + + int netOpenResult = NET_ERR_NONE; + + netOpenResult = net_deregister_client(); + if (netOpenResult != NET_ERR_NONE) + MSG_DEBUG("Error!! net_deregister_client() failed. [%d]", netOpenResult); + else + MSG_DEBUG ("net_deregister_client() Success."); + + MSG_END(); +} + + +void MmsPluginCmAgent::processCBdatas(net_event_info_t *event_cb, void *user_data) +{ + MSG_BEGIN(); + + net_dev_info_t *dev_info = NULL; + net_profile_info_t *prof_info = NULL; + + switch (event_cb->Event) { + case NET_EVENT_NET_CONFIGURE_RSP: + MSG_DEBUG("Received Network Configuration response: %d \n", event_cb->Error); + dev_info = (net_dev_info_t *)event_cb->Data; + + /*Successful PDP Activation*/ + if (event_cb->Error == NET_ERR_NONE) { + char *ip = (char *)&dev_info->IpAddr.Data.Ipv4; + char *netmask = (char *)&dev_info->SubnetMask.Data.Ipv4; + char *gateway = (char *)&dev_info->GatewayAddr.Data.Ipv4; + char *dns1 = (char *)&dev_info->DnsAddr[0].Data.Ipv4.s_addr; + char *dns2 = (char *)&dev_info->DnsAddr[1].Data.Ipv4.s_addr; + + MSG_DEBUG("= IP address [%d.%d.%d.%d]\n", + (int)ip[0], ip[1], ip[2], ip[3]); + MSG_DEBUG("= Netmask [%d.%d.%d.%d]\n", + (int)netmask[0], netmask[1], netmask[2], netmask[3]); + MSG_DEBUG("= Gateway [%d.%d.%d.%d]\n", + (int)gateway[0], gateway[1], gateway[2], gateway[3]); + MSG_DEBUG("= DNS address [%d.%d.%d.%d]\n", + (int)dns1[0], dns1[1], dns1[2], dns1[3]); + MSG_DEBUG("= DNS2 address [%d.%d.%d.%d]\n", + (int)dns2[0], dns2[1], dns2[2], dns2[3]); + MSG_DEBUG("= Device name [%s]\n", dev_info->DevName); + MSG_DEBUG("= Profile name [%s]\n", dev_info->ProfileName); + } else { + MSG_DEBUG("Error!!! Network Configuration Failed %d \n", event_cb->Error); + } + break; + + /*Response from Datacom for PDP Activation Request*/ + case NET_EVENT_OPEN_IND: + MSG_DEBUG("Got Open Indication\n"); + MSG_DEBUG("Received ACTIVATION response: %d \n", event_cb->Error); + break; + case NET_EVENT_OPEN_RSP: + MSG_DEBUG("Got Open RSP\n"); + MSG_DEBUG("Received ACTIVATION response: %d \n", event_cb->Error); + prof_info = (net_profile_info_t *)event_cb->Data; + + /*Successful PDP Activation*/ + if (event_cb->Error == NET_ERR_NONE || event_cb->Error == NET_ERR_ACTIVE_CONNECTION_EXISTS) { + network_print_profile(prof_info); + + lock(); + + memcpy(&mmsProfile, prof_info, sizeof(net_profile_info_t)); + isCmOpened = true; + signal(); + + unlock(); + } else { + MSG_DEBUG("Activation Failed %d \n", event_cb->Error); // open failed + lock(); + isCmOpened = false; + signal(); + unlock(); + } + break; + + case NET_EVENT_CLOSE_RSP: + MSG_DEBUG("Got Close RSP\n"); + + lock(); + + bzero(&mmsProfile, sizeof(net_profile_info_t)); + isCmOpened = false; + signal(); + + unlock(); + break; + + case NET_EVENT_CLOSE_IND: + MSG_DEBUG("Got Close IND\n"); + break; + case NET_EVENT_PROFILE_MODIFY_IND: + MSG_DEBUG("Received Profile modified Indication\n"); + MSG_DEBUG("No. of profile [%d]\n", event_cb->Datalength); + break; + case NET_EVENT_NET_STATE_IND: + MSG_DEBUG("Received NET_EVENT_NET_STATE_IND\n"); + break; + default : + MSG_DEBUG("Error! Unknown Event\n\n"); + break; + } + + MSG_END(); +} + + +bool MmsPluginCmAgent::getDeviceName(char *deviceName) +{ + if (!isCmOpened) + return false; + + int deviceNameLength = strlen(mmsProfile.ProfileInfo.Pdp.net_info.DevName); + + if (deviceNameLength > 0) { + strncpy(deviceName, mmsProfile.ProfileInfo.Pdp.net_info.DevName, deviceNameLength); + deviceName[deviceNameLength] = '\0'; + return true; + } + + return false; +} + + +bool MmsPluginCmAgent::getHomeURL(char *homeURL) +{ + if (!isCmOpened) + return false; + + int homeURLLength = strlen(mmsProfile.ProfileInfo.Pdp.HomeURL); + + if (homeURLLength > 0) { + strncpy(homeURL, mmsProfile.ProfileInfo.Pdp.HomeURL, homeURLLength); + homeURL[homeURLLength] = '\0'; + return true; + } + + return false; +} + + +bool MmsPluginCmAgent::getProxyAddr(char *proxyAddr) +{ + if (!isCmOpened) + return false; + + int proxyAddrLength = strlen(mmsProfile.ProfileInfo.Pdp.net_info.ProxyAddr); + + if (proxyAddrLength > 0) { + if (strchr(mmsProfile.ProfileInfo.Pdp.net_info.ProxyAddr, ':') == NULL) + return false; + + proxyAddrLength = proxyAddrLength - strlen(strchr(mmsProfile.ProfileInfo.Pdp.net_info.ProxyAddr, ':')); + strncpy(proxyAddr, mmsProfile.ProfileInfo.Pdp.net_info.ProxyAddr, proxyAddrLength); + proxyAddr[proxyAddrLength] = '\0'; + + return true; + } + + return false; +} + + +int MmsPluginCmAgent::getProxyPort() +{ + if (!isCmOpened) + return -1; + + int proxyAddrLength = strlen(mmsProfile.ProfileInfo.Pdp.net_info.ProxyAddr); + + if (proxyAddrLength > 0) { + char *pPort = strchr(mmsProfile.ProfileInfo.Pdp.net_info.ProxyAddr, ':') + 1; + if (pPort) + return atoi(pPort); + else + return -1; + } + + return -1; +} + diff --git a/plugin/mms_plugin/MmsPluginContentCodec.cpp b/plugin/mms_plugin/MmsPluginContentCodec.cpp new file mode 100755 index 0000000..b765182 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginContentCodec.cpp @@ -0,0 +1,1082 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include "MsgDebug.h" +#include "MmsPluginCodec.h" +#include "MmsPluginCodec.h" +#include "MmsPluginMIME.h" +#include "MmsPluginMessage.h" +#include "MmsPluginWmLngPack.h" + +const int MSG_MAX_CH_PER_LINE = 75; + +/* ================================================================== + * Decode/Encode inline base64 string + * + * base64 : 3*8bit -> 4*6bit & convert the value into A~Z, a~z, 0~9, +, or / + * pad(=) is needed when the end of the string is < 24bit. + * + * Value Encoding Value Encoding Value Encoding Value Encoding + * 0 A 17 R 34 i 51 z + * 1 B 18 S 35 j 52 '0' + * 2 C 19 T 36 k 53 1 + * 3 D 20 U 37 l 54 2 + * 4 E 21 V 38 m 55 3 + * 5 F 22 W 39 n 56 4 + * 6 G 23 X 40 o 57 5 + * 7 H 24 Y 41 p 58 6 + * 8 I 25 Z 42 q 59 7 + * 9 J 26 a 43 r 60 8 + * 10 K 27 b 44 s 61 9 + * 11 L 28 c 45 t 62 + + * 12 M 29 d 46 u 63 / + * 13 N 30 e 47 v + * 14 O 31 f 48 w (pad) = + * 15 P 32 g 49 x + * 16 Q 33 h 50 y + * + * (1) the final quantum = 24 bits : no "=" padding, + * (2) the final quantum = 8 bits : two "=" + two characters + * (3) the final quantum = 16 bits : one "=" + three characters + * ================================================================== */ + +bool _MsgEncodeBase64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret) +{ + unsigned char *d = NULL; + unsigned char *s = (unsigned char *)pSrc; + + char *v = (char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + unsigned long i = ((srcLen + 2) / 3) * 4; + + i += 2 * ((i / 60) + 1); + *len = i; + + if (ret == NULL) { + MSG_DEBUG("_MsgEncodeBase64: ret Memory Alloc Fail \n"); + return false; + } + memset(ret, 0, i); + + d = ret; + + /* Convert 3*8bit into 4*6bit */ + for (i = 0; srcLen > 0; s += 3) { + *d++ = v[s[0] >> 2]; // byte 1: high 6 bits of character-1 + *d++ = v[((s[0] << 4) + (--srcLen ? (s[1] >> 4) : 0)) & 0x3f]; // byte 2: low 2 bits of character-1 and high 4 bits of character-2 + *d++ = srcLen ? v[((s[1] << 2) + (--srcLen ? (s[2] >> 6) : 0)) & 0x3f] : '='; // byte 3: low 4 bits of charcter-2 and high 2 bits of character-3 + *d++ = srcLen ? v[s[2] & 0x3f] : '='; // byte 4: low 6 bits of character-3 + + if (srcLen) + srcLen--; + + /* Insert CRLF at every 60 characters */ + if ((++i) == 15) { + i = 0; + *d++ = '\015'; + *d++ = '\012'; + } + } + + if (i == 15) { + *d++ = '\015'; + *d++ = '\012'; + } + *d = '\0'; + + if (((unsigned long)(d - ret)) != *len) { + *len = d - ret; + MSG_DEBUG("base64 encoding length = %d \n", *len); + } + + return true; +} + + +void *_MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *len) +{ + char c; + void *ret = NULL; + char *d = NULL; + short e = 0; + + ret = malloc((size_t)(*len = 4 + ((srcLen * 3) / 4))); + d = (char *)ret; + + if (ret == NULL) { + MSG_DEBUG("_MsgDecodeBase64: ret malloc Fail \n"); + return NULL; + } + + memset(ret, 0, (size_t)*len); + *len = 0; + + while (srcLen-- > 0) { + c = *pSrc++; + + /* Convert base64 character into original value */ + + if (isupper(c)) + c -= 'A'; + else if (islower(c)) + c -= 'a' - 26; + else if (isdigit(c)) + c -= '0' - 52; + else if (c == '+') + c = 62; + else if (c == '/') + c = 63; + else if (c == '=') { + switch (e++) { + case 2: + if (*pSrc != '=') { + *len = d - (char *)ret; + return ret; + } + break; + case 3: + e = 0; + break; + default: + *len = d - (char *)ret; + return ret; + } + continue; + } else + continue; // Actually, never get here + + /* Pad 4*6bit character into 3*8bit character */ + + switch (e++) { + case 0: + *d = c << 2; // byte 1: high 6 bits + break; + + case 1: + *d++ |= c >> 4; // byte 1: low 2 bits + *d = c << 4; // byte 2: high 4 bits + break; + + case 2: + *d++ |= c >> 2; // byte 2: low 4 bits + *d = c << 6; // byte 3: high 2 bits + break; + + case 3: + *d++ |= c; // byte 3: low 6 bits + e = 0; // Calculate next unit. + break; + + default: + MSG_DEBUG("_MsgDecodeBase64: Unknown paremeter\n"); + break; + } + } + + *len = d - (char *)ret; // Calculate the size of decoded string. + + return ret; +} + + + +/* ========================================== + * Decode/Encode inline base64 string + * + * quoted-printable := ([*(ptext / SPACE / TAB) ptext] ["="] CRLF) + * ; Maximum line length of 76 characters excluding CRLF + * + * ptext := octet / 127, =, SPACE, or TAB. + * + * ==========================================*/ + +bool _MsgEncodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret) +{ + unsigned long lp = 0; + unsigned char *d = ret; + char *hex = (char *)"0123456789ABCDEF"; + unsigned char c; + + if (ret == NULL) { + MSG_DEBUG("_MsgEncodeQuotePrintable: ret malloc Fail \n"); + return false; + } + + d = ret; + + /* + * The type of srcLen is unsigned long + * The value of srcLen is decreased by 1 -> We can't check by "srcLen > 0". + */ + while (srcLen-- > 0) { + /* Just copy CRLF */ + if (((c = *pSrc++) == '\015') && (*pSrc == '\012') && srcLen) { + *d++ = '\015'; + *d++ = *pSrc++; + srcLen--; + lp = 0; + } else { + if (iscntrl(c) || (c == 0x7f) || (c & 0x80) || (c == '=') || ((c == ' ') && (*pSrc == '\015'))) { + if ((lp += 3) > (unsigned long)MSG_MAX_CH_PER_LINE) { + *d++ = '='; + *d++ = '\015'; + *d++ = '\012'; + lp = 3; + } + + *d++ = '='; /* quote character */ + *d++ = hex[c >> 4]; /* high order 4 bits */ + *d++ = hex[c & 0xf]; /* low order 4 bits */ + } else { + /* Just copy ASCII character */ + if ((++lp) > (unsigned long)MSG_MAX_CH_PER_LINE) { + *d++ = '='; + *d++ = '\015'; + *d++ = '\012'; + lp = 1; + } + *d++ = c; + } + } + } + + *d = '\0'; + *len = d - ret; + + return true; +} + + +unsigned char *_MsgDecodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len) +{ + unsigned char *ret = NULL; + unsigned char *d = NULL; + unsigned char *s = NULL; /* last non-blank */ + unsigned char c; + unsigned char e; + + d = s = ret = (unsigned char *)malloc((size_t)srcLen + 1); + if (ret == NULL) { + MSG_DEBUG("_MsgDecodeQuotePrintable: ret malloc Fail \n"); + return NULL; + } + + *len = 0; + pSrc[srcLen] = '\0'; + + while ((c = *pSrc++)!= '\0') { + switch (c) { + case '=': /* octet characters (> 127, =, SPACE, or TAB) */ + switch (c = *pSrc++) { + case '\0': /* end of string -> postpone to while */ + break; + + case '\015': /* CRLF */ + if (*pSrc == '\012') + pSrc++; + break; + + default: /* two hexes */ + if (!isxdigit(c)) { + *d = '\0'; + *len = d - ret; + return ret; + } + + if (isdigit(c)) + e = c - '0'; + else + e = c - (isupper(c) ? 'A' - 10 : 'a' - 10); + + c = *pSrc++; + if (!isxdigit(c)) { + *d = '\0'; + *len = d - ret; + return ret; + } + + if (isdigit(c)) + c -= '0'; + else + c -= (isupper(c) ? 'A' - 10 : 'a' - 10); + + *d++ = c + (e << 4); + s = d; + break; + } + break; + + case ' ': /* skip the blank */ + *d++ = c; + break; + + case '\015': /* Line Feedback : to last non-blank character */ + d = s; + break; + + default: + *d++ = c; /* ASCII character */ + s = d; + break; + } + } + + *d = '\0'; + *len = d - ret; + + return ret; +} + + +/* ======================================== + * Decode/Encode inline base64 string + * Inline base64 has no "\r\n" in it, + * and has charset and encoding sign in it + * ======================================== */ +bool _MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret) +{ + unsigned char *d = NULL; + unsigned char *s = (unsigned char *)pSrc; + char *v = (char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + unsigned long i = ((srcLen + 2) / 3) * 4; + + i += 2 * ((i / 60) + 1); + *len = i; + + if (ret == NULL) { + MSG_DEBUG("_MsgEncode2Base64: ret Memory Alloc Fail \n"); + return false; + } + memset(ret, 0, i); + + d = ret; + + /* Convert 3*8bit into 4*6bit */ + for (i = 0; srcLen > 0; s += 3) { + *d++ = v[s[0] >> 2]; // byte 1: high 6 bits of character-1 + *d++ = v[((s[0] << 4) + (--srcLen ? (s[1] >> 4) : 0)) & 0x3f]; // byte 2: low 2 bits of character-1 and high 4 bits of character-2 + *d++ = srcLen ? v[((s[1] << 2) + (--srcLen ? (s[2] >> 6) : 0)) & 0x3f] : '='; // byte 3: low 4 bits of charcter-2 and high 2 bits of character-3 + *d++ = srcLen ? v[s[2] & 0x3f] : '='; // byte 4: low 6 bits of character-3 + + if (srcLen) + srcLen--; + } + + *d = '\0'; + + if (((unsigned long)(d - ret)) != *len) { + *len = d - ret; + MSG_DEBUG("base64 encoding length = %d \n", *len); + } + + return true; +} + + +char *_MsgDecodeText(char *pOri) +{ + MSG_BEGIN(); + + int size = 0; + int cnt = 0; + char *pSrc = NULL; + char *pTemp = NULL; + char *pRe = NULL; + char *pStrEnd = NULL; + char *pDecStart = NULL; + char *pDecEnd = NULL; + char *pDecQ = NULL; + char *pDecQ2 = NULL; + bool bEncoding = false; + int nCharset = MSG_CHARSET_UTF8; + int nChar = 0; + int nByte = 0; + int nTemp = 0; + char *pReturnStr = NULL; + char *pConvertedStr = NULL; + MCHAR *mszTempStr = NULL; + + MCHAR *pmszOutTextStr = NULL; + + char szTempBuf[MSG_LOCAL_TEMP_BUF_SIZE] = {0}; + + // copy original string + if (strlen(pOri) >= MSG_LOCAL_TEMP_BUF_SIZE) { + pSrc = MsgStrCopy( pOri ); + } else { + memset(szTempBuf, 0, MSG_LOCAL_TEMP_BUF_SIZE); + strcpy(szTempBuf, pOri); + + pSrc = szTempBuf; + } + + // it can be one or more encoding methods in a line + while (1) { + cnt++; + + bEncoding = false; + + /* + (ex) "=?euc-kr?B?Y2NqMjEyMw==?=" + + pDecStart: charset (=?euc-kr?B?Y2NqMjEyMw==?=) + pDecQ : Encoding type (B?Y2NqMjEyMw==?=) + pDecQ2 : Encoded text (Y2NqMjEyMw==?=) + pDecEnd : Encoded of text (?=) + */ + if (pSrc == NULL) + goto __CATCH; + + if (((pDecStart = strstr(pSrc, MSG_STR_DEC_START)) != NULL) //"=?" + && ((pDecQ = strchr(pDecStart + 2, MSG_CH_QUESTION)) != NULL) // '?' + && ((pDecQ2 = strchr(pDecQ + 1, MSG_CH_QUESTION))!= NULL) // '?' + && ((pDecEnd = strstr(pDecQ2 + 1, MSG_STR_DEC_END))!= NULL)) { //"=?" + bEncoding = true; + + /* fixme: charset problem + * pDecStart ~ pDecQ : charSet & MSG_CHARSET_USC2 ~ MSG_CHARSET_UTF8 & LATIN + */ + + *pDecQ = '\0'; + nCharset = _MsgGetCode(MSG_CHARSET, pDecStart + 2); + *pDecQ = MSG_CH_QUESTION; + } + + // End of encoding + if (!bEncoding) + goto __RETURN; + + // find end of string + pStrEnd = pSrc + strlen(pSrc); + + // Decoding + if ((*(pDecQ2 - 1) == MSG_CH_BASE64_UPPER) || + (*(pDecQ2 - 1) == MSG_CH_BASE64_LOWER) || + (*(pDecQ + 1) == MSG_CH_BASE64_UPPER) || + (*(pDecQ + 1) == MSG_CH_BASE64_LOWER)) { + pTemp = (char *)_MsgDecodeBase64((UCHAR *)(pDecQ2 + 1), (ULONG)(pDecEnd - pDecQ2 - 1), (ULONG *)&size); + + if (pTemp != NULL) { + pTemp[size] = MSG_CH_NULL; + + if(pRe) { + free(pRe); + pRe = NULL; + } + + pRe = (char *)malloc((pDecStart-pSrc) + size + (pStrEnd - (pDecEnd + 2)) + 1); + if (pRe == NULL) { + MSG_DEBUG("_MsgDecodeText: pRemalloc fail \n"); + free(pTemp); + pTemp = NULL; + + goto __RETURN; + } + + memcpy(pRe, pSrc, pDecStart - pSrc); + memcpy(&pRe[pDecStart-pSrc], pTemp, size); + memcpy(&pRe[(pDecStart - pSrc) + size], pDecEnd + 2, pStrEnd - (pDecEnd + 2)); + pRe[(pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2))] = MSG_CH_NULL; + + free(pTemp); + pTemp = NULL; + + if (pSrc != NULL && pSrc != szTempBuf) { + free(pSrc); + pSrc = NULL; + } + } + } else if ((*(pDecQ2-1) == MSG_CH_QPRINT_UPPER) || + (*(pDecQ2-1) == MSG_CH_QPRINT_LOWER) || + (*(pDecQ+1) == MSG_CH_QPRINT_UPPER) || + (*(pDecQ+1) == MSG_CH_QPRINT_LOWER)) { + + pTemp = (char *)_MsgDecodeQuotePrintable((UCHAR *)( pDecQ2 + 1 ), (ULONG)(pDecEnd - pDecQ2 - 1), (ULONG *)&size); + + if (pTemp != NULL) { + int i; + pTemp[size] = MSG_CH_NULL; + + for (i = 0; i < size; i++) { + if (pTemp[i] == MSG_CH_UNDERLINE) { + pTemp[i] = MSG_CH_SP; // change '_' to ' ' + } + } + + if(pRe) { + free(pRe); + pRe = NULL; + } + + pRe = (char *)malloc((pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2)) + 1); + if (pRe == NULL) { + MSG_DEBUG("_MsgDecodeText: pRemalloc fail \n"); + free(pTemp); + pTemp = NULL; + + goto __RETURN; + } + + memcpy(pRe, pSrc, pDecStart - pSrc); + memcpy(&pRe[pDecStart - pSrc], pTemp, size); + memcpy(&pRe[(pDecStart - pSrc) + size], pDecEnd + 2, pStrEnd - (pDecEnd + 2)); + pRe[(pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2))] = MSG_CH_NULL; + + if (pTemp) { + free(pTemp); + pTemp = NULL; + } + + if (pSrc != NULL && pSrc != szTempBuf) { + free(pSrc); + pSrc = NULL; + } + } + } else { + goto __RETURN; + } + } + +__RETURN: + + pTemp = pSrc; + nTemp = strlen(pSrc); + + switch (nCharset) { + case MSG_CHARSET_UTF16: + case MSG_CHARSET_USC2: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_USC2 \n"); + + if (pTemp) { + // mmf file name display patch + if (((UINT8)pTemp[0] == 0xFF && (UINT8)pTemp[1] == 0xFE) || ((UINT8)pTemp[0] == 0xFE && (UINT8)pTemp[1] == 0xFF)) { + + nChar = (nTemp / 2 - 1); + + // Re check char-set + if (MsgIsUTF8String((unsigned char *)pTemp + 2, nTemp - 2)) { + strncpy(pTemp, pTemp + 2, strlen(pTemp + 2)); + nTemp = nTemp - 2; + MSG_DEBUG("_MsgDecodeText: real char-set = MSG_CHARSET_UTF8.\n"); + break; + } + + mszTempStr = (unsigned short *)malloc(nChar * sizeof(unsigned short)); + if (mszTempStr == NULL) { + MSG_DEBUG("_MsgDecodeText: 1. Memory Full !!! \n"); + goto __CATCH; + } + + memcpy(mszTempStr, ((unsigned short *)pTemp + 1), nChar * sizeof(unsigned short)); + + nByte = MsgGetUnicode2UTFCodeSize(((unsigned short *)pTemp + 1), nChar); + + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) { + MsgUnicode2UTF ((unsigned char *)pConvertedStr, nByte + 1, mszTempStr, nChar); + } + } else { + nChar = (nTemp / 2); + + if (nChar == 0) { + nChar = 2; + } + + // Re check char-set + if (MsgIsUTF8String((unsigned char *)pTemp, nTemp)) { + MSG_DEBUG("_MsgDecodeText: real char-set = MSG_CHARSET_UTF8.\n"); + break; + } + + mszTempStr = (unsigned short *)malloc(nChar * sizeof(unsigned short)); + if (mszTempStr == NULL) { + MSG_DEBUG("_MsgDecodeText: 2. Memory Full !!! \n"); + goto __CATCH; + } + + memcpy(mszTempStr, ((unsigned short *)pTemp), nChar * sizeof(unsigned short)); + + nByte = MsgGetUnicode2UTFCodeSize(((unsigned short *)pTemp), nChar); + + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) { + MsgUnicode2UTF ((unsigned char *)pConvertedStr, nByte + 1, mszTempStr, nChar); + } + } + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_US_ASCII: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_US_ASCII \n"); + break; + + case MSG_CHARSET_UTF8: + + /* UTF8 is default charset of Messenger */ + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_UTF8 \n"); + + break; + + case MSG_CHARSET_ISO_8859_1: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_1 \n"); + + nByte = nTemp * 3; + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertLatinCode2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_ISO_8859_2: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_2 \n"); + + nByte = nTemp * 3; + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertLatin2Code2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_ISO_8859_3: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_3 \n"); + + nByte = WmGetLatin32UTFCodeSize((unsigned char *)pTemp, nTemp); + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertLatin3Code2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_ISO_8859_4: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_4 \n"); + + nByte = WmGetLatin42UTFCodeSize((unsigned char *)pTemp, nTemp); + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertLatin4Code2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_ISO_8859_5: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_5 \n"); + + nByte = WmGetLatin52UTFCodeSize((unsigned char *)pTemp, nTemp); + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertLatin5Code2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_ISO_8859_7: + + /* Greek */ + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_9 \n"); + + nByte = MsgGetLatin72UTFCodeSize((unsigned char *)pTemp, nTemp); + pConvertedStr = (char *)malloc( nByte + 1); + if (pConvertedStr) { + MsgLatin7code2UTF((unsigned char *)pConvertedStr, nByte + 1 , (unsigned char *)pTemp, nTemp); + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_ISO_8859_8: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_8 \n"); + + nByte = WmGetLatin82UTFCodeSize((unsigned char *)pTemp, nTemp); + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertLatin8Code2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_ISO_8859_9: + /* Turkish */ + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_9 \n"); + + nByte = MsgGetLatin52UTFCodeSize((unsigned char *)pTemp, nTemp); + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) { + MsgLatin5code2UTF((unsigned char *)pConvertedStr, nByte + 1 , (unsigned char *)pTemp, nTemp); + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_ISO_8859_15: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_ISO_8859_15 \n"); + + nByte = WmGetLatin152UTFCodeSize((unsigned char *)pTemp, nTemp); + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertLatin15Code2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_WIN1251: + case MSG_CHARSET_WINDOW_1251: + case MSG_CHARSET_WINDOWS_1251: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_WINDOWS_1251 \n"); + + nByte = nTemp * 3; + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertWin1251Code2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_KOI8_R: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_KOI8_R \n"); + + nByte = nTemp * 3; + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertKoi8rCode2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + case MSG_CHARSET_KOI8_U: + + MSG_DEBUG("_MsgDecodeText: MSG_CHARSET_KOI8_U \n"); + + nByte = nTemp * 3; + + pmszOutTextStr = (unsigned short *)malloc(sizeof(MCHAR *) * (nByte + 1)); + if (pmszOutTextStr == NULL) { + MSG_DEBUG("_MsgDecodeText : Out Text String null !!! \n"); + goto __CATCH; + } + + pConvertedStr = (char *)malloc(sizeof(char *) * (nByte + 1)); + if (pConvertedStr) { + WmConvertKoi8uCode2PCode(pmszOutTextStr, sizeof(MCHAR *) * (nByte + 1), pTemp); + WmConvert2LCode(pConvertedStr, sizeof(char *) * (nByte + 1), pmszOutTextStr); + } + + if (pmszOutTextStr) { + free(pmszOutTextStr); + pmszOutTextStr = NULL; + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + + default: + + MSG_DEBUG("_MsgDecodeText: Other charsets \n"); + + nByte = MsgGetLatin2UTFCodeSize((unsigned char *)pTemp, nTemp); + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) { + MsgLatin2UTF((unsigned char *)pConvertedStr, nByte + 1, (unsigned char *)pTemp, nTemp); + } + + pTemp = pConvertedStr; + nTemp = nByte; + + break; + } + + pReturnStr = (char *)malloc(nTemp + 1); + if (pReturnStr == NULL) { + goto __CATCH; + } + memset(pReturnStr, 0, nTemp + 1); + + if (pTemp) + memcpy(pReturnStr, pTemp, nTemp); + + if (pConvertedStr) { + free(pConvertedStr); + pConvertedStr = NULL; + } + + if (mszTempStr) { + free(mszTempStr); + mszTempStr = NULL; + } + + if(pRe) { + free(pRe); + pRe = NULL; + } + + if (pSrc != NULL && pSrc != szTempBuf) { + free(pSrc); + pSrc = NULL; + } + + return pReturnStr; + +__CATCH: + + if (pConvertedStr) { + free(pConvertedStr); + pConvertedStr = NULL; + } + + if (mszTempStr) { + free(mszTempStr); + mszTempStr = NULL; + } + + if(pRe) { + free(pRe); + pRe = NULL; + } + + if (pSrc != NULL && pSrc != szTempBuf) { + free(pSrc); + pSrc = NULL; + } + + return NULL; +} + + +char *MsgEncodeText(char *pOri) +{ + ULONG nLen = 0; + char *szBuff = NULL; + int length = 0; + + length = (strlen(pOri) * 4) / 3 + 2 + 12 + 1 + 30; + szBuff = (char *)malloc(length + 1); + + if (szBuff == NULL) { + // error handling + MSG_DEBUG("_MsgEncodeText: szBuff alloc is failed \n"); + goto __CATCH; + } + + memset(szBuff, 0 , length + 1); + + snprintf(szBuff, length+1, "%s%s%c%c%c", MSG_STR_DEC_START, "utf-8", MSG_CH_QUESTION, MSG_CH_BASE64_LOWER, MSG_CH_QUESTION); + + if (_MsgEncode2Base64((unsigned char *)pOri, strlen(pOri), &nLen, (unsigned char *)szBuff + 10) == false) { + MSG_DEBUG("_MsgEncodeText: MsgEncodeBase64() is failed \n"); + goto __CATCH; + } + + strcat(szBuff, MSG_STR_DEC_END); + + return szBuff; + +__CATCH: + if (szBuff) { + free(szBuff); + } + + return false; +} + diff --git a/plugin/mms_plugin/MmsPluginDebug.cpp b/plugin/mms_plugin/MmsPluginDebug.cpp new file mode 100755 index 0000000..2e289b2 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginDebug.cpp @@ -0,0 +1,1379 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include "MmsPluginMIME.h" +#include "MmsPluginMessage.h" + +static char gszDebugStringBuf[50]; + +static char *MmsDebugPrintUnknownValue(int value) +{ + printf(gszDebugStringBuf, "unknown value(%d)", value); + return gszDebugStringBuf; +} + + +const char *MmsDebugGetMimeType(MimeType mimeType) +{ + switch (mimeType) { + case MIME_APPLICATION_XML: + return "MIME_APPLICATION_XML"; + case MIME_APPLICATION_WML_XML: + return "MIME_APPLICATION_WML_XML"; + case MIME_APPLICATION_XHTML_XML: + return "MIME_APPLICATION_XHTML_XML"; + case MIME_APPLICATION_JAVA_VM: + return "MIME_APPLICATION_JAVA_VM"; + case MIME_APPLICATION_SMIL: + return "MIME_APPLICATION_SMIL"; + case MIME_APPLICATION_JAVA_ARCHIVE: + return "MIME_APPLICATION_JAVA_ARCHIVE"; + case MIME_APPLICATION_JAVA: + return "MIME_APPLICATION_JAVA"; + case MIME_APPLICATION_OCTET_STREAM: + return "MIME_APPLICATION_OCTET_STREAM"; + case MIME_APPLICATION_STUDIOM: + return "MIME_APPLICATION_STUDIOM"; + case MIME_APPLICATION_FUNMEDIA: + return "MIME_APPLICATION_FUNMEDIA"; + case MIME_APPLICATION_MSWORD: + return "MIME_APPLICATION_MSWORD"; + case MIME_APPLICATION_PDF: + return "MIME_APPLICATION_PDF"; + case MIME_APPLICATION_ASTERIC: + return "MIME_APPLICATION_ASTERIC"; + case MIME_APPLICATION_VND_WAP_XHTMLXML: + return "MIME_APPLICATION_VND_WAP_XHTMLXML"; + case MIME_APPLICATION_VND_WAP_WMLC: + return "MIME_APPLICATION_VND_WAP_WMLC"; + case MIME_APPLICATION_VND_WAP_WMLSCRIPTC: + return "MIME_APPLICATION_VND_WAP_WMLSCRIPTC"; + case MIME_APPLICATION_VND_WAP_WTA_EVENTC: + return "MIME_APPLICATION_VND_WAP_WTA_EVENTC"; + case MIME_APPLICATION_VND_WAP_UAPROF: + return "MIME_APPLICATION_VND_WAP_UAPROF"; + case MIME_APPLICATION_VND_WAP_SIC: + return "MIME_APPLICATION_VND_WAP_SIC"; + case MIME_APPLICATION_VND_WAP_SLC: + return "MIME_APPLICATION_VND_WAP_SLC"; + case MIME_APPLICATION_VND_WAP_COC: + return "MIME_APPLICATION_VND_WAP_COC"; + case MIME_APPLICATION_VND_WAP_SIA: + return "MIME_APPLICATION_VND_WAP_SIA"; + case MIME_APPLICATION_VND_WAP_CONNECTIVITY_WBXML: + return "MIME_APPLICATION_VND_WAP_CONNECTIVITY_WBXML"; + case MIME_APPLICATION_VND_WAP_MULTIPART_FORM_DATA: + return "MIME_APPLICATION_VND_WAP_MULTIPART_FORM_DATA"; + case MIME_APPLICATION_VND_WAP_MULTIPART_BYTERANGES: + return "MIME_APPLICATION_VND_WAP_MULTIPART_BYTERANGES"; + case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED: + return "MIME_APPLICATION_VND_WAP_MULTIPART_MIXED"; + case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED: + return "MIME_APPLICATION_VND_WAP_MULTIPART_RELATED"; + case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE: + return "MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE"; + case MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC: + return "MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC"; + case MIME_APPLICATION_VND_OMA_DD_XML: + return "MIME_APPLICATION_VND_OMA_DD_XML"; + case MIME_APPLICATION_VND_OMA_DRM_MESSAGE: + return "MIME_APPLICATION_VND_OMA_DRM_MESSAGE"; + case MIME_APPLICATION_VND_OMA_DRM_CONTENT: + return "MIME_APPLICATION_VND_OMA_DRM_CONTENT"; + case MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML: + return "MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML"; + case MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML: + return "MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML"; + case MIME_APPLICATION_VND_SMAF: + return "MIME_APPLICATION_VND_SMAF"; + case MIME_APPLICATION_VND_RN_REALMEDIA: + return "MIME_APPLICATION_VND_RN_REALMEDIA"; + case MIME_APPLICATION_VND_SUN_J2ME_JAVA_ARCHIVE: + return "MIME_APPLICATION_VND_SUN_J2ME_JAVA_ARCHIVE"; + case MIME_APPLICATION_VND_EXCEL: + return "MIME_APPLICATION_VND_EXCEL"; + case MIME_APPLICATION_X_HDMLC: + return "MIME_APPLICATION_X_HDMLC"; + case MIME_APPLICATION_X_X968_USERCERT: + return "MIME_APPLICATION_X_X968_USERCERT"; + case MIME_APPLICATION_X_WWW_FORM_URLENCODED: + return "MIME_APPLICATION_X_WWW_FORM_URLENCODED"; + case MIME_APPLICATION_X_SMAF: + return "MIME_APPLICATION_X_SMAF"; + case MIME_APPLICATION_X_FLASH: + return "MIME_APPLICATION_X_FLASH"; + case MIME_APPLICATION_X_EXCEL: + return "MIME_APPLICATION_X_EXCEL"; + case MIME_APPLICATION_X_POWERPOINT: + return "MIME_APPLICATION_X_POWERPOINT"; + + case MIME_AUDIO_BASIC: + return "MIME_AUDIO_BASIC"; + case MIME_AUDIO_MPEG: + return "MIME_AUDIO_MPEG"; + case MIME_AUDIO_MP3: + return "MIME_AUDIO_MP3"; + case MIME_AUDIO_MPG3: + return "MIME_AUDIO_MPG3"; + case MIME_AUDIO_MPEG3: + return "MIME_AUDIO_MPEG3"; + case MIME_AUDIO_MPG: + return "MIME_AUDIO_MPG"; + case MIME_AUDIO_AAC: + return "MIME_AUDIO_AAC"; + case MIME_AUDIO_G72: + return "MIME_AUDIO_G72"; + case MIME_AUDIO_AMR: + return "MIME_AUDIO_AMR"; + case MIME_AUDIO_AMR_WB: + return "MIME_AUDIO_AMR_WB"; + case MIME_AUDIO_MMF: + return "MIME_AUDIO_MMF"; + case MIME_AUDIO_SMAF: + return "MIME_AUDIO_SMAF"; + case MIME_AUDIO_IMELODY: + return "MIME_AUDIO_IMELODY"; + case MIME_AUDIO_MELODY: + return "MIME_AUDIO_MELODY"; + case MIME_AUDIO_MID: + return "MIME_AUDIO_MID"; + case MIME_AUDIO_MIDI: + return "MIME_AUDIO_MIDI"; + case MIME_AUDIO_X_MID: + return "MIME_AUDIO_X_MID"; + case MIME_AUDIO_SP_MIDI: + return "MIME_AUDIO_SP_MIDI"; + case MIME_AUDIO_WAVE: + return "MIME_AUDIO_WAVE"; + case MIME_AUDIO_3GPP: + return "MIME_AUDIO_3GPP"; + case MIME_AUDIO_MP4: + return "MIME_AUDIO_MP4"; + case MIME_AUDIO_MP4A_LATM: + return "MIME_AUDIO_MP4A_LATM"; + case MIME_AUDIO_VND_RN_REALAUDIO: + return "MIME_AUDIO_VND_RN_REALAUDIO"; + case MIME_AUDIO_X_MPEG: + return "MIME_AUDIO_X_MPEG"; + case MIME_AUDIO_X_MP3: + return "MIME_AUDIO_X_MP3"; + case MIME_AUDIO_X_MPEG3: + return "MIME_AUDIO_X_MPEG3"; + case MIME_AUDIO_X_MPG: + return "MIME_AUDIO_X_MPG"; + case MIME_AUDIO_X_AMR: + return "MIME_AUDIO_X_AMR"; + case MIME_AUDIO_X_MMF: + return "MIME_AUDIO_X_MMF"; + case MIME_AUDIO_X_SMAF: + return "MIME_AUDIO_X_SMAF"; + case MIME_AUDIO_X_IMELODY: + return "MIME_AUDIO_X_IMELODY"; + case MIME_AUDIO_X_MIDI: + return "MIME_AUDIO_X_MIDI"; + case MIME_AUDIO_X_MPEGAUDIO: + return "MIME_AUDIO_X_MPEGAUDIO"; + case MIME_AUDIO_X_PN_REALAUDIO: + return "MIME_AUDIO_X_PN_REALAUDIO"; + case MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO: + return "MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO"; + case MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO_LIVE: + return "MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO_LIVE"; + case MIME_AUDIO_X_WAV: + return "MIME_AUDIO_X_WAV"; + + case MIME_IMAGE_GIF: + return "MIME_IMAGE_GIF"; + case MIME_IMAGE_JPEG: + return "MIME_IMAGE_JPEG"; + case MIME_IMAGE_JPG: + return "MIME_IMAGE_JPG"; + case MIME_IMAGE_TIFF: + return "MIME_IMAGE_TIFF"; + case MIME_IMAGE_TIF: + return "MIME_IMAGE_TIF"; + case MIME_IMAGE_PNG: + return "MIME_IMAGE_PNG"; + case MIME_IMAGE_WBMP: + return "MIME_IMAGE_WBMP"; + case MIME_IMAGE_PJPEG: + return "MIME_IMAGE_PJPEG"; + case MIME_IMAGE_BMP: + return "MIME_IMAGE_BMP"; + case MIME_IMAGE_SVG: + return "MIME_IMAGE_SVG"; + case MIME_IMAGE_SVG1: + return "MIME_IMAGE_SVG1"; + case MIME_IMAGE_VND_WAP_WBMP: + return "MIME_IMAGE_VND_WAP_WBMP"; + + case MIME_IMAGE_X_BMP: + return "MIME_IMAGE_X_BMP"; + + case MIME_MESSAGE_RFC822: + return "MIME_MESSAGE_RFC822"; + + case MIME_MULTIPART_MIXED: + return "MIME_MULTIPART_MIXED"; + case MIME_MULTIPART_RELATED: + return "MIME_MULTIPART_RELATED"; + case MIME_MULTIPART_ALTERNATIVE: + return "MIME_MULTIPART_ALTERNATIVE"; + case MIME_MULTIPART_FORM_DATA: + return "MIME_MULTIPART_FORM_DATA"; + case MIME_MULTIPART_BYTERANGE: + return "MIME_MULTIPART_BYTERANGE"; + case MIME_MULTIPART_REPORT: + return "MIME_MULTIPART_REPORT"; + + case MIME_TEXT_TXT: + return "MIME_TEXT_TXT"; + case MIME_TEXT_HTML: + return "MIME_TEXT_HTML"; + case MIME_TEXT_PLAIN: + return "MIME_TEXT_PLAIN"; + case MIME_TEXT_CSS: + return "MIME_TEXT_CSS"; + case MIME_TEXT_XML: + return "MIME_TEXT_XML"; + case MIME_TEXT_IMELODY: + return "MIME_TEXT_IMELODY"; + case MIME_TEXT_VND_WAP_WMLSCRIPT: + return "MIME_TEXT_VND_WAP_WMLSCRIPT"; + case MIME_TEXT_VND_WAP_WML: + return "MIME_TEXT_VND_WAP_WML"; + case MIME_TEXT_VND_WAP_WTA_EVENT: + return "MIME_TEXT_VND_WAP_WTA_EVENT"; + case MIME_TEXT_VND_WAP_CONNECTIVITY_XML: + return "MIME_TEXT_VND_WAP_CONNECTIVITY_XML"; + case MIME_TEXT_VND_WAP_SI: + return "MIME_TEXT_VND_WAP_SI"; + case MIME_TEXT_VND_WAP_SL: + return "MIME_TEXT_VND_WAP_SL"; + case MIME_TEXT_VND_WAP_CO: + return "MIME_TEXT_VND_WAP_CO"; + case MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR: + return "MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR"; + case MIME_TEXT_X_HDML: + return "MIME_TEXT_X_HDML"; + case MIME_TEXT_X_VCALENDAR: + return "MIME_TEXT_X_VCALENDAR"; + case MIME_TEXT_X_VCARD: + return "MIME_TEXT_X_VCARD"; + case MIME_TEXT_X_IMELODY: + return "MIME_TEXT_X_IMELODY"; + + case MIME_VIDEO_MPEG4: + return "MIME_VIDEO_MPEG4"; + case MIME_VIDEO_MP4: + return "MIME_VIDEO_MP4"; + case MIME_VIDEO_H263: + return "MIME_VIDEO_H263"; + case MIME_VIDEO_3GPP: + return "MIME_VIDEO_3GPP"; + case MIME_VIDEO_3GP: + return "MIME_VIDEO_3GP"; + case MIME_VIDEO_AVI: + return "MIME_VIDEO_AVI"; + case MIME_VIDEO_SDP: + return "MIME_VIDEO_SDP"; + case MIME_VIDEO_VND_RN_REALVIDEO: + return "MIME_VIDEO_VND_RN_REALVIDEO"; + case MIME_VIDEO_X_MP4: + return "MIME_VIDEO_X_MP4"; + case MIME_VIDEO_X_PV_MP4: + return "MIME_VIDEO_X_PV_MP4"; + case MIME_VIDEO_X_PN_REALVIDEO: + return "MIME_VIDEO_X_PN_REALVIDEO"; + case MIME_VIDEO_X_PN_MULTIRATE_REALVIDEO: + return "MIME_VIDEO_X_PN_MULTIRATE_REALVIDEO"; + default: + return MmsDebugPrintUnknownValue(mimeType); + } +} + + +/* MsgMmsMsg.h */ +const char *MmsDebugGetMmsReport(MmsReport report) +{ + switch (report) { + case MMS_REPORT_ERROR: + return "MMS_REPORT_ERROR"; + case MMS_REPORT_YES: + return "MMS_REPORT_YES"; + case MMS_REPORT_NO: + return "MMS_REPORT_NO"; + } + + return MmsDebugPrintUnknownValue(report); +} + + +const char *MmsDebugGetMmsReportAllowed(MmsReportAllowed reportAllowed) +{ + switch (reportAllowed) { + case MMS_REPORTALLOWED_ERROR: + return "MMS_REPORTALLOWED_ERROR"; + case MMS_REPORTALLOWED_YES: + return "MMS_REPORTALLOWED_YES"; + case MMS_REPORTALLOWED_NO: + return "MMS_REPORTALLOWED_NO"; + } + + return MmsDebugPrintUnknownValue(reportAllowed); +} + + +const char *MmsDebugGetMmsReadStatus(MSG_READ_REPORT_STATUS_T readStatus) +{ + _MSG_READ_REPORT_STATUS_E readReport = (_MSG_READ_REPORT_STATUS_E)readStatus; + + switch (readReport) { + case MSG_READ_REPORT_NONE: + return "MMS_READSTATUS_NONE"; + case MSG_READ_REPORT_IS_READ: + return "MMS_IS_READ"; + case MSG_READ_REPORT_IS_DELETED: + return "MMS_IS_DELETED"; + } + + return MmsDebugPrintUnknownValue(readStatus); +} + +const char *MmsDebugGetMsgType(MmsMsgType msgType) +{ + switch (msgType) { + case MMS_MSGTYPE_ERROR: + return "error"; + case MMS_MSGTYPE_SEND_REQ: + return "send.req"; + case MMS_MSGTYPE_SEND_CONF: + return "send.conf"; + case MMS_MSGTYPE_NOTIFICATION_IND: + return "notification.ind"; + case MMS_MSGTYPE_NOTIFYRESP_IND: + return "notifyResp.ind"; + case MMS_MSGTYPE_RETRIEVE_CONF: + return "retrieve conf"; + case MMS_MSGTYPE_ACKNOWLEDGE_IND: + return "acknowledge ind"; + case MMS_MSGTYPE_DELIVERY_IND: + return "delivery ind"; + case MMS_MSGTYPE_READREC_IND: + return "read rec ind"; + case MMS_MSGTYPE_READORG_IND: + return "read org ind"; + case MMS_MSGTYPE_FORWARD_REQ: + return "forward req"; + case MMS_MSGTYPE_FORWARD_CONF: + return "forward conf"; + case MMS_MSGTYPE_READ_REPLY: + return "read reply"; + default: + return MmsDebugPrintUnknownValue(msgType); + } +} + +const char *MmsDebugGetResponseStatus(MmsResponseStatus responseStatus) +{ + switch (responseStatus) { + case MMS_RESPSTATUS_ERROR: + return "error"; + case MMS_RESPSTATUS_OK: + return "ok"; + case MMS_RESPSTAUTS_ERROR_UNSPECIFIED: + return "unspecified"; + case MMS_RESPSTAUTS_ERROR_SERVICEDENIED: + return "service denied"; + case MMS_RESPSTAUTS_ERROR_MESSAGEFORMATCORRUPT: + return "message format corrupt"; + case MMS_RESPSTAUTS_ERROR_SENDINGADDRESSUNRESOLVED: + return "sending address unresolved"; + case MMS_RESPSTAUTS_ERROR_MESSAGENOTFOUND: + return "message not found"; + case MMS_RESPSTAUTS_ERROR_NETWORKPROBLEM: + return "network problem"; + case MMS_RESPSTAUTS_ERROR_CONTENTNOTACCEPTED: + return "content not accepted"; + case MMS_RESPSTAUTS_ERROR_UNSUPPORTEDMESSAGE: + return "unsupported message"; + case MMS_RESPSTAUTS_ERROR_TRANSIENT_FAILURE: + return "transient failure"; + case MMS_RESPSTAUTS_ERROR_TRANSIENT_SENDING_ADDRESS_UNRESOLVED: + return "transient sending address unresolved"; + case MMS_RESPSTAUTS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND: + return "transient message not found"; + case MMS_RESPSTAUTS_ERROR_TRANSIENT_NETWORK_PROBLEM: + return "transient network problem"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_FAILURE: + return "permanent failure"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_SERVICE_DENIED: + return "permanent service denied"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT: + return "permanent message format corrupt"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED: + return "permanent sending address unresolved"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_MESSAGE_NOT_FOUND: + return "permanent message not found"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED: + return "permanent content not accepted"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET: + return "permanent reply charging limitations not met"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED: + return "permanent reply charging request not accepted"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED: + return "permanent reply charging forwarding denied"; + case MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED: + return "permanent reply charging not supported"; + } + + return MmsDebugPrintUnknownValue(responseStatus); +} + + +const char *MmsDebugGetRetrieveStatus(MmsRetrieveStatus retrieveStatus) +{ + switch (retrieveStatus) { + case MMS_RETRSTATUS_ERROR: + return "error"; + case MMS_RETRSTATUS_OK: + return "ok"; + case MMS_RETRSTATUS_TRANSIENT_FAILURE: + return "transient failure"; + case MMS_RETRSTATUS_TRANSIENT_MESSAGE_NOT_FOUND: + return "transient message not found"; + case MMS_RETRSTATUS_TRANSIENT_NETWORK_PROBLEM: + return "transient network problem"; + case MMS_RETRSTATUS_PERMANENT_FAILURE: + return "permanent failure"; + case MMS_RETRSTATUS_PERMANENT_SERVICE_DENIED: + return "permanent service denied"; + case MMS_RETRSTATUS_PERMANENT_MESSAGE_NOT_FOUND: + return "permanent message not found"; + case MMS_RETRSTATUS_PERMANENT_CONTENT_UNSUPPORT: + return "permanent content unsupport"; + } + + return MmsDebugPrintUnknownValue(retrieveStatus); +} + + +const char *MmsDebugGetMsgStatus(MSG_DELIVERY_REPORT_STATUS_T msgStatus) +{ + switch (msgStatus) { + case MSG_DELIVERY_REPORT_ERROR: + return "error"; + case MSG_DELIVERY_REPORT_EXPIRED: + return "expired"; + case MSG_DELIVERY_REPORT_SUCCESS: + return "retrieved"; + case MSG_DELIVERY_REPORT_REJECTED: + return "rejected"; + case MSG_DELIVERY_REPORT_DEFERRED: + return "deferred"; + case MSG_DELIVERY_REPORT_UNRECOGNISED: + return "unrecognised"; + case MSG_DELIVERY_REPORT_INDETERMINATE: + return "indeterminate"; + case MSG_DELIVERY_REPORT_FORWARDED: + return "forwarded"; + case MSG_DELIVERY_REPORT_UNREACHABLE: + return "unreachable"; + } + + return MmsDebugPrintUnknownValue(msgStatus); +} + + +const char *MmsDebugGetMsgClass(MmsMsgClass msgClass) +{ + switch (msgClass) { + case MMS_MSGCLASS_ERROR: + return "error"; + case MMS_MSGCLASS_PERSONAL: + return "personal"; + case MMS_MSGCLASS_ADVERTISEMENT: + return "advertisement"; + case MMS_MSGCLASS_INFORMATIONAL: + return "information"; + case MMS_MSGCLASS_AUTO: + return "auto"; + } + + return MmsDebugPrintUnknownValue(msgClass); +} + + +const char *MmsDebugGetDataType(MmsDataType dataType) +{ + switch (dataType) { + case MMS_DATATYPE_NONE: + return "MMS_DATATYPE_NONE"; + case MMS_DATATYPE_READ: + return "MMS_DATATYPE_READ"; + case MMS_DATATYPE_SENT: + return "MMS_DATATYPE_SENT"; + case MMS_DATATYPE_NOTIFY: + return "MMS_DATATYPE_NOTIFY"; + case MMS_DATATYPE_UNSENT: + return "MMS_DATATYPE_UNSENT"; + case MMS_DATATYPE_DRAFT: + return "MMS_DATATYPE_DRAFT"; + case MMS_DATATYPE_SENDING: + return "MMS_DATATYPE_SENDING"; + case MMS_DATATYPE_DRM_RO_WAITING: + return "MMS_DATATYPE_DRM_RO_WAITING"; + case MMS_DATATYPE_RETRIEVING: + return "MMS_DATATYPE_RETRIEVING"; + case MMS_DATATYPE_UNRETV: + return "MMS_DATATYPE_UNRETV"; + default: + return MmsDebugPrintUnknownValue(dataType); + } +} + +#ifdef MMS_PLUGIN_DEBUG_ENABLE +bool +MmsDebugPrintMsgAttributes(char *pszFunc, MmsAttrib *pAttrib, bool bAll) +{ + SysRequireEx(pAttrib != NULL, false); + + if (pszFunc) + SysDebug((MID_MMS|DBG_MMS_COMMON,"%s ========= \n", pszFunc)); + + SysDebug((MID_MMS|DBG_MMS_COMMON, "szSubject = %s \n", pAttrib->szSubject)); + SysDebug((MID_MMS|DBG_MMS_COMMON, "contentType=%s \n", MmsDebugGetMimeType(pAttrib->contentType))); + SysDebug((MID_MMS|DBG_MMS_COMMON, "dataType=%s \n", MmsDebugGetDataType(pAttrib->dataType))); + + if (pAttrib->specialMsgType != MMS_SPECIAL_MSG_TYPE_NONE) + SysDebug((MID_MMS|DBG_MMS_COMMON, "spcialMsgType = %lu \n", pAttrib->specialMsgType)); + + SysDebug((MID_MMS|DBG_MMS_COMMON, "date=%lu, msgSize=%lu, bRead=%lu\n", pAttrib->date, pAttrib->msgSize, pAttrib->bRead)); + + if (!bAll) + return true; + + SysDebug((MID_MMS|DBG_MMS_COMMON, "msgClass=%s, priority=%lu \n", MmsDebugGetMsgClass(pAttrib->msgClass), pAttrib->priority )); + SysDebug((MID_MMS|DBG_MMS_COMMON, "deliveryTime.type = %lu, time = %lu\n", pAttrib->deliveryTime.type, pAttrib->deliveryTime.time)); + SysDebug((MID_MMS|DBG_MMS_COMMON, "expiryTime.type = %lu, time = %lu\n", pAttrib->expiryTime.type, pAttrib->expiryTime.time)); + + if (pAttrib->szTo && pAttrib->szTo[0] != 0) + SysDebug((MID_MMS|DBG_MMS_COMMON, "szTo = %s \n", pAttrib->szTo)); + if (pAttrib->szCc && pAttrib->szCc[0] != 0) + SysDebug((MID_MMS|DBG_MMS_COMMON, "szCc = %s \n", pAttrib->szCc)); + if (pAttrib->szBcc && pAttrib->szBcc[0] != 0) + SysDebug((MID_MMS|DBG_MMS_COMMON, "szBcc = %s \n", pAttrib->szBcc)); + +#if defined(_MMS_SUPPORT_RECEIVING_OPTION_PROMPT) + SysDebug((MID_MMS|DBG_MMS_COMMON, "readReportAllowedType = %lu \n", pAttrib->readReportAllowedType)); +#endif + SysDebug((MID_MMS|DBG_MMS_COMMON, "bAskDeliveryReport=%lu, bReportAllowed=%lu, bAskReadReply=%lu, bLeaveCopy=%lu \n", + pAttrib->bAskDeliveryReport, pAttrib->bReportAllowed, pAttrib->bAskReadReply, pAttrib->bLeaveCopy)); + + if (pAttrib->bHideAddress) + SysDebug((MID_MMS|DBG_MMS_COMMON, "bHideAddress=true\n")); + + SysDebug((MID_MMS|DBG_MMS_COMMON, "msgStatus = %s \n", MmsDebugGetMsgStatus(pAttrib->msgStatus))); + SysDebug((MID_MMS|DBG_MMS_COMMON, "responseStatus = %s \n", MmsDebugGetResponseStatus(pAttrib->responseStatus))); + SysDebug((MID_MMS|DBG_MMS_COMMON, "retrieveStatus = %s \n", MmsDebugGetRetrieveStatus(pAttrib->retrieveStatus))); + + if (pAttrib->szResponseText && pAttrib->szResponseText[0] != 0) + SysDebug((MID_MMS|DBG_MMS_COMMON, "szResponseText = %s \n", pAttrib->szResponseText)); + + if (pAttrib->szRetrieveText && pAttrib->szRetrieveText[0] != 0) + SysDebug((MID_MMS|DBG_MMS_COMMON, "szRetrieveText = %s \n", pAttrib->szRetrieveText)); + + return true; +} + +char *MmsDebugGetMsgDrmType(MsgDrmType drmType) +{ + switch (drmType) { + case MSG_DRM_TYPE_NONE: + return "MSG_DRM_TYPE_NONE"; + case MSG_DRM_TYPE_FL: + return "MSG_DRM_TYPE_FL"; + case MSG_DRM_TYPE_CD: + return "MSG_DRM_TYPE_CD"; + case MSG_DRM_TYPE_SD: + return "MSG_DRM_TYPE_SD"; + case MSG_DRM_TYPE_SSD: + return "MSG_DRM_TYPE_SSD"; + } + + return MmsDebugPrintUnknownValue(drmType); +} + +char *MmsDebugGetDrmDeliveryMode(DrmDeliveryMode deliveryMode) +{ + switch (deliveryMode) { + case DRM_DELIVERYMODE_FORWARD_LOCK: + return "DRM_DELIVERYMODE_FORWARD_LOCK"; + case DRM_DELIVERYMODE_COMBINED_DELIVERY: + return "DRM_DELIVERYMODE_COMBINED_DELIVERY"; + case DRM_DELIVERYMODE_SEPARATE_DELIVERY: + return "DRM_DELIVERYMODE_SEPARATE_DELIVERY"; + case DRM_DELIVERYMODE_SPECIAL_SEPARATE: + return "DRM_DELIVERYMODE_SPECIAL_SEPARATE"; + } + + return MmsDebugPrintUnknownValue(deliveryMode); +} + +char *MmsDebugGetDrmRightState(DrmRightState rightState) +{ + switch (rightState) { + case DRMRIGHT_STATE_NORIGHTS: + return "DRMRIGHT_STATE_NORIGHTS"; + case DRMRIGHT_STATE_INVALID_RIGHTS: + return "DRMRIGHT_STATE_INVALID_RIGHTS"; + case DRMRIGHT_STATE_VALID_RIGHTS: + return "DRMRIGHT_STATE_VALID_RIGHTS"; + case DRMRIGHT_STATE_EXPIRED_RIGHTS: + return "DRMRIGHT_STATE_EXPIRED_RIGHTS"; + } + + return MmsDebugPrintUnknownValue(rightState); +} + + +bool MmsDebugPrintDrmRight(DrmRight *pDrmRight) +{ + if (!pDrmRight) + return true; + + if (pDrmRight->rightStatus == DRMRIGHT_STATE_NORIGHTS) { + SysDebug((MID_MMS|DBG_MMS_COMMON, "rightStatus = %s \n", MmsDebugGetDrmRightState(pDrmRight->rightStatus))); + return true; + } + + SysDebug((MID_MMS|DBG_MMS_COMMON, "iDeliveryType = %s \n", MmsDebugGetDrmDeliveryMode(pDrmRight->iDeliveryType))); + SysDebug((MID_MMS|DBG_MMS_COMMON, "bestConstraint = %s \n", MmsDebugGetDrmConsumeMode(pDrmRight->bestConstraint))); + SysDebug((MID_MMS|DBG_MMS_COMMON, "bFirstIntervalRender = %d \n", pDrmRight->bFirstIntervalRender)); + SysDebug((MID_MMS|DBG_MMS_COMMON, "rightStatus = %s \n", MmsDebugGetDrmRightState(pDrmRight->rightStatus))); + + SysDebug((MID_MMS|DBG_MMS_COMMON, "bValidIssuer = %d \n", pDrmRight->bValidIssuer)); + + return true; +} + +char *MmsDebugPrintMsgDRMStatus(MsgDRMStatus status) +{ + switch (status) { + case MSG_DRM_STATUS_INVALID: + return "MSG_DRM_STATUS_INVALID"; + case MSG_DRM_STATUS_VALID: + return "MSG_DRM_STATUS_VALID"; + case MSG_DRM_STATUS_EXPIRED: + return "MSG_DRM_STATUS_EXPIRED"; + } + + return MmsDebugPrintUnknownValue(status); +} + + +bool MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index) +{ + SysDebug((MID_MMS|DBG_MMS_COMMON, "------------------------------\n")); + SysDebug((MID_MMS|DBG_MMS_COMMON, "%dth multipart info\n", index)); + SysDebug((MID_MMS|DBG_MMS_COMMON, "header size=%d\n", pMultipart->type.size)); + SysDebug((MID_MMS|DBG_MMS_COMMON, "body size=%d\n", pMultipart->type.contentSize)); + SysDebug((MID_MMS|DBG_MMS_COMMON, "content type=%s\n", MmsDebugGetMimeType(pMultipart->type.type))); + SysDebug((MID_MMS|DBG_MMS_COMMON, "content ID=%s\n", pMultipart->type.szContentID)); + SysDebug((MID_MMS|DBG_MMS_COMMON, "content location=%s\n", pMultipart->type.szContentLocation)); + + if (pMultipart->type.type == MIME_TEXT_PLAIN) { + SysDebug((MID_MMS|DBG_MMS_COMMON, "text info\n")); + SysDebug((MID_MMS|DBG_MMS_COMMON, "charset=%d\n", pMultipart->type.param.charset)); + SysDebug((MID_MMS|DBG_MMS_COMMON, "text file name=%s\n", pMultipart->type.param.szName)); + } + + if (pMultipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { + SysDebug((MID_MMS|DBG_MMS_COMMON, "drm info\n")); + SysDebug((MID_MMS|DBG_MMS_COMMON, "drm type=%s\n", MmsDebugGetMsgDrmType(pMultipart->type.drmInfo.drmType))); + SysDebug((MID_MMS|DBG_MMS_COMMON, "drm content type=%s\n", MmsDebugGetMimeType(pMultipart->type.drmInfo.contentType))); + SysDebug((MID_MMS|DBG_MMS_COMMON, "drm content URI=%s\n", pMultipart->type.drmInfo.szContentURI)); + } + SysDebug((MID_MMS|DBG_MMS_COMMON, "------------------------------\n")); + return true; +} + + +bool MmsDebugPrintCurrentEventHandler(char *pszFunc, MmsDebugEvType evType) +{ + HEventHandler hMmsEH; + HEventHandler hSmsEH; + HEventHandler hEmailEH; + HEventHandler hCommonEH; + HEventHandler hCurrentEH; + + hMmsEH = WmGetEventHandlerByName(EHN_MMS); + hSmsEH = WmGetEventHandlerByName(EHN_SMS); + hEmailEH = WmGetEventHandlerByName(EHN_EMAIL); + hCommonEH = WmGetEventHandlerByName(EHN_MESSENGER); + hCurrentEH = WmGetCurrentEventHandler(); + + switch (evType) { + case MMS_DEBUG_EV_MMS: + SysRequireExf(hCurrentEH == hMmsEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \ + pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH)); + break; + + case MMS_DEBUG_EV_SMS: + SysRequireExf(hCurrentEH == hSmsEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \ + pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH)); + break; + + case MMS_DEBUG_EV_COMMON: + SysRequireExf(hCurrentEH == hCommonEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \ + pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH)); + break; + + case MMS_DEBUG_EV_EMAIL: + SysRequireExf(hCurrentEH == hEmailEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \ + pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH)); + break; + + case MMS_DEBUG_EV_NONE: + default: + SysDebug((MID_MMS,"%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \ + pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH)); + break; + } + return true; +} + + +char *DebugPrintGetRmResultInd(MmsRmResultInd indType) +{ + switch (indType) { + case RM_RESULTIND_NONE: + return "RM_RESULTIND_NONE"; + + case RM_RESULTIND_MANUAL_SEND: + return "RM_RESULTIND_MANUAL_SEND"; + + case RM_RESULTIND_AUTO_SEND: + return "RM_RESULTIND_AUTO_SEND"; + + case RM_RESULTIND_MANUAL_GET: + return "RM_RESULTIND_MANUAL_GET"; + + case RM_RESULTIND_AUTO_GET: + return "RM_RESULTIND_AUTO_GET"; + + case RM_RESULTIND_MANUAL_FORWARD: + return "RM_RESULTIND_MANUAL_FORWARD"; + } + + return MmsDebugPrintUnknownValue(indType); +} + + +char *DebugPrintHttpStatusCode(int status) +{ + switch (status) { + case HTTP_STATUS_100: + return "HTTP_STATUS_100"; + case HTTP_STATUS_101: + return "HTTP_STATUS_101"; + + case HTTP_STATUS_200: + return "HTTP_STATUS_200"; + case HTTP_STATUS_201: + return "HTTP_STATUS_201"; + case HTTP_STATUS_202: + return "HTTP_STATUS_202"; + case HTTP_STATUS_203: + return "HTTP_STATUS_203"; + case HTTP_STATUS_204: + return "HTTP_STATUS_204"; + case HTTP_STATUS_205: + return "HTTP_STATUS_205"; + case HTTP_STATUS_206: + return "HTTP_STATUS_206"; + + case HTTP_STATUS_300: + return "HTTP_STATUS_300"; + case HTTP_STATUS_301: + return "HTTP_STATUS_301"; + case HTTP_STATUS_302: + return "HTTP_STATUS_302"; + case HTTP_STATUS_303: + return "HTTP_STATUS_303"; + case HTTP_STATUS_304: + return "HTTP_STATUS_304"; + case HTTP_STATUS_305: + return "HTTP_STATUS_305"; + + case HTTP_STATUS_400: + return "HTTP_STATUS_400"; + case HTTP_STATUS_401: + return "HTTP_STATUS_401"; + case HTTP_STATUS_402: + return "HTTP_STATUS_402"; + case HTTP_STATUS_403: + return "HTTP_STATUS_403"; + case HTTP_STATUS_404: + return "HTTP_STATUS_404"; + case HTTP_STATUS_405: + return "HTTP_STATUS_405"; + case HTTP_STATUS_406: + return "HTTP_STATUS_406"; + case HTTP_STATUS_407: + return "HTTP_STATUS_407"; + case HTTP_STATUS_408: + return "HTTP_STATUS_408"; + case HTTP_STATUS_409: + return "HTTP_STATUS_409"; + case HTTP_STATUS_410: + return "HTTP_STATUS_410"; + case HTTP_STATUS_411: + return "HTTP_STATUS_411"; + case HTTP_STATUS_412: + return "HTTP_STATUS_412"; + case HTTP_STATUS_413: + return "HTTP_STATUS_413"; + case HTTP_STATUS_414: + return "HTTP_STATUS_414"; + case HTTP_STATUS_415: + return "HTTP_STATUS_415"; + + case HTTP_STATUS_500: + return "HTTP_STATUS_500"; + case HTTP_STATUS_501: + return "HTTP_STATUS_501"; + case HTTP_STATUS_502: + return "HTTP_STATUS_502"; + case HTTP_STATUS_503: + return "HTTP_STATUS_503"; + case HTTP_STATUS_504: + return "HTTP_STATUS_504"; + case HTTP_STATUS_505: + return "HTTP_STATUS_505"; + + case REASON_WTP_UNKNOWN: + return "REASON_WTP_UNKNOWN"; + case REASON_WTP_PROTO_ERR: + return "REASON_WTP_PROTO_ERR"; + case REASON_WTP_INVALID_TID: + return "REASON_WTP_INVALID_TID"; + case REASON_WTP_NOT_IMPLEMENTED_CL2: + return "REASON_WTP_NOT_IMPLEMENTED_CL2"; + case REASON_WTP_NOT_IMPLEMENTED_SAR: + return "REASON_WTP_NOT_IMPLEMENTED_SAR"; + case REASON_WTP_NOT_IMPLEMENTEDU_ACK: + return "REASON_WTP_NOT_IMPLEMENTEDU_ACK"; + case REASON_WTP_VERSIONONE: + return "REASON_WTP_VERSIONONE"; + case REASON_WTP_CAPTEMP_EXCEED: + return "REASON_WTP_CAPTEMP_EXCEED"; + case REASON_WTP_NO_RESPONSE: + return "REASON_WTP_NO_RESPONSE"; + case REASON_WTP_MESSAGE_TOO_LARGE: + return "REASON_WTP_MESSAGE_TOO_LARGE"; + + case REASON_PROTOERR: + return "REASON_PROTOERR"; // = 0xE0 + case REASON_DISCONNECT: + return "REASON_DISCONNECT"; + case REASON_SUSPEND: + return "REASON_SUSPEND"; + case REASON_RESUME: + return "REASON_RESUME"; + case REASON_CONGESTION: + return "REASON_CONGESTION"; + case REASON_CONNECTERR: + return "REASON_CONNECTERR"; + case REASON_MRUEXCEEDED: + return "REASON_MRUEXCEEDED"; + case REASON_MOREXCEEDED: + return "REASON_MOREXCEEDED"; + case REASON_PEERREQ: + return "REASON_PEERREQ"; + case REASON_NETERR: + return "REASON_NETERR"; + case REASON_USERREQ: + return "REASON_USERREQ"; + /* added for ver 1.2 */ + case REASON_USERRFS: + return "REASON_USERRFS"; + case REASON_PND: + return "REASON_PND"; + case REASON_USERDCR: + return "REASON_USERDCR"; + case REASON_USERDCU: + return "REASON_USERDCU"; + } + + return MmsDebugPrintUnknownValue(status); +} + + +char *DebugPrintRmMethodType(MmsRmMethodType method) +{ + switch (method) { + case RM_METHOD_NONE: + return "RM_METHOD_NONE"; + case RM_METHOD_GET: + return "RM_METHOD_GET"; + case RM_METHOD_POST: + return "RM_METHOD_POST"; + } + + return MmsDebugPrintUnknownValue(method); +} + + +char *DebugPrintGetMmsRmNetState(MmsRmNetState state) +{ + switch (state) { + case RM_PROTO_IDLE: + return "RM_PROTO_IDLE"; + case RM_PROTO_STARTING: + return "RM_PROTO_STARTING"; + case RM_PROTO_STARTED: + return "RM_PROTO_STARTED"; + case RM_PROTO_STOPPING: + return "RM_PROTO_STOPPING"; + + case RM_PROTO_WAITING: + return "RM_PROTO_WAITING"; + case RM_PROTO_DISCONNECTING_OTHER_APP: + return "RM_PROTO_DISCONNECTING_OTHER_APP"; + case RM_PROTO_DISCONNECTED_BY_OTHER_APP: + return "RM_PROTO_DISCONNECTED_BY_OTHER_APP"; + + case RM_PROTO_FAILED: + return "RM_PROTO_FAILED"; + } + + return MmsDebugPrintUnknownValue(state); +} + + +char *DebugPrintGetMmsRmEntityState(MmsRmExEntityState stateEx) +{ + switch (stateEx) { + case RM_ENTITY_IDLE: + return "RM_ENTITY_IDLE"; + case RM_ENTITY_PROTO_STARTING: + return "RM_ENTITY_PROTO_STARTING"; + + case RM_ENTITY_CNXN_ESTABLISHING: + return "RM_ENTITY_CNXN_ESTABLISHING"; + case RM_ENTITY_CNXN_ESTABLISHED: + return "RM_ENTITY_CNXN_ESTABLISHED"; + + case RM_ENTITY_SENDING_REQUEST: + return "RM_ENTITY_SENDING_REQUEST"; + case RM_ENTITY_SENDING_REQ_N_NO_RESPONSE: + return "RM_ENTITY_SENDING_REQ_N_NO_RESPONSE"; + + case RM_ENTITY_SENDING_REQ_COMPLETED: + return "RM_ENTITY_SENDING_REQ_COMPLETED"; + + case RM_ENTITY_SENDING_REQ_FAILED: + return "RM_ENTITY_SENDING_REQ_FAILED"; + case RM_ENTITY_SENDING_REQ_CANCELLED_BY_USER_CONFIRMED: + return "RM_ENTITY_SENDING_REQ_CANCELLED_BY_USER_CONFIRMED"; + } + + return MmsDebugPrintUnknownValue(stateEx); +} + + +char *MmsDebugPrintMmsRmResult(MmsRmResult result) +{ + switch (result) { + case MMS_RM_RESULT_SUCCESSED: + return "MMS_RM_RESULT_SUCCESSED"; + case MMS_RM_RESULT_FAIL: + return "MMS_RM_RESULT_FAIL"; + case MMS_RM_RESULT_FAIL_N_RETRY: + return "MMS_RM_RESULT_FAIL_N_RETRY"; + + case MMS_RM_RESULT_PROTO_STARTING_FAILED: + return "MMS_RM_RESULT_PROTO_STARTING_FAILED"; + + case MMS_RM_RESULT_DISCONNECT_MMS: + return "MMS_RM_RESULT_DISCONNECT_MMS"; + case MMS_RM_RESULT_CLOSING_OTHER_APP_FAILED: + return "MMS_RM_RESULT_CLOSING_OTHER_APP_FAILED"; + + case MMS_RM_RESULT_SENDING_REQ_FAILED: + return "MMS_RM_RESULT_SENDING_REQ_FAILED"; + case MMS_RM_RESULT_CANCELED_BY_USER: + return "MMS_RM_RESULT_CANCELED_BY_USER"; + case MMS_RM_RESULT_CANCELED_FROM_RETRY_POPUP: + return "MMS_RM_RESULT_CANCELED_FROM_RETRY_POPUP"; + + case MMS_RM_RESULT_PROTO_FAILED: + return "MMS_RM_RESULT_PROTO_FAILED"; + case MMS_RM_RESULT_DISCONNECTED_BY_OTHER: + return "MMS_RM_RESULT_DISCONNECTED_BY_OTHER"; + + case MMS_RM_RESULT_MEMORY_FULL: + return "MMS_RM_RESULT_MEMORY_FULL"; + } + + return MmsDebugPrintUnknownValue(result); +} + +void MmsDebugPrintReqEntityInfo(MmsRmRequest *pEntity) +{ + SysDebug((MID_MMS," - proto state=%s\n", DebugPrintGetMmsRmNetState(_MmsRmNetGetState()))); + + if (_MmsRmNetGetProtoType() == MMS_RM_WAP_CONNORIENTED || _MmsRmNetGetProtoType() == MMS_RM_WTLS) { + SysDebug((MID_MMS," - wap cnxn state=%s\n", DebugPrintWspState(MmsRmWspGetCnxnState()))); + } + + if (!pEntity) { + SysDebug((MID_EXCEPTION, "MmsDebugPrintReqEntityInfo : pEntity is NULL. \n")); + return; + } + + SysDebug((MID_MMS," - entity state=%s\n", DebugPrintGetMmsRmEntityState(pEntity->stateEx))); + + if (pEntity->cb.result.bSend) { + if (pEntity->pduType == MMS_RM_READ_REPORT_V10) { + SysDebug((MID_MMS," - sending read report v10\n")); + } else if (pEntity->pduType == MMS_RM_READ_REPORT_V11) { + SysDebug((MID_MMS," - sending read report v11\n")); + } else { + SysDebug((MID_MMS," - sending msg\n")); + } + } else { // then receiving.. + if (pEntity->cb.result.bAutoRetrieving) { + SysDebug((MID_MMS," - retrieving(auto)\n")); + } else { + SysDebug((MID_MMS," - retrieving(manual)\n")); + } + } + + SysDebug((MID_MMS," - msgID=%d, trID=0x%x, pduType=%s\n", pEntity->msgID, pEntity->trId, MmsDebugPrintRmPduType(pEntity->pduType))); + + if (pEntity->protoActvCount > 1) { + SysDebug((MID_MMS," - protoActvCount=%d\n", pEntity->protoActvCount)); + } + + if (pEntity->reqCount > 1) { + SysDebug((MID_MMS," - reqCount=%d\n", pEntity->reqCount)); + } + + if (pEntity->fullRetryCount > 1) { + SysDebug((MID_MMS," - fullRetryCount=%d\n", pEntity->fullRetryCount)); + } +} + +char *MmsDebugPrintHttpErrorCode(int errCode) +{ + switch (errCode) { + case HTTPERR_INVALID_PARAM: + return "HTTPERR_INVALID_PARAM"; + case HTTPERR_UNKNOWN: + return "HTTPERR_UNKNOWN"; + case HTTPERR_INVALID_PROXY: + return "HTTPERR_INVALID_PROXY"; + case HTTPERR_OUT_OF_MEMORY: + return "HTTPERR_OUT_OF_MEMORY"; + case HTTPERR_NO_RESPONSE: + return "HTTPERR_NO_RESPONSE"; + case HTTPERR_INIT: + return "HTTPERR_INIT"; + case HTTPERR_NETDOWN: + return "HTTPERR_NETDOWN"; + case HTTPERR_TIMEOUT: + return "HTTPERR_TIMEOUT"; + case HTTPERR_HOST_UNREACH: + return "HTTPERR_HOST_UNREACH"; + case HTTPERR_CONN_RESET: + return "HTTPERR_CONN_RESET"; + case HTTPERR_INTERNAL: + return "HTTPERR_INTERNAL"; + case HTTPERR_CHUNKEDTR: + return "HTTPERR_CHUNKEDTR"; + case HTTPERR_USER: + return "HTTPERR_USER"; + case HTTPERR_TOO_BIG: + return "HTTPERR_TOO_BIG"; + case HTTPERR_NOT_SUPPORTED_SVC: + return "HTTPERR_NOT_SUPPORTED_SVC"; + case HTTPERR_NO_CONTENT: + return "HTTPERR_NO_CONTENT"; + case HTTPERR_WRITEFAIL: + return "HTTPERR_WRITEFAIL"; + case HTTPERR_AUTHFAIL: + return "HTTPERR_AUTHFAIL"; + + case HTTPERR_DNSFAIL: + return "HTTPERR_DNSFAIL"; + case HTTPERR_UAGENT_NOT_ALLOWED: + return "HTTPERR_UAGENT_NOT_ALLOWED"; + + } + return MmsDebugPrintUnknownValue(errCode); +} + +char *MmsDebugPrintProtoErrorCode(int errCode) +{ + switch (errCode) { + case PROTO_ERROR_NONE: + return "PROTO_ERROR_NONE"; + /* Wireless stack errors */ + case PROTO_ERROR_NO_SERVICE: + return "PROTO_ERROR_NO_SERVICE"; + case PROTO_ERROR_INVALID_PARAM: + return "PROTO_ERROR_INVALID_PARAM"; + case PROTO_ERROR_INVALID_APN: + return "PROTO_ERROR_INVALID_APN"; + case PROTO_ERROR_INVALID_OP_MODE: + return "PROTO_ERROR_INVALID_OP_MODE"; + case PROTO_ERROR_INVALID_PROTO_TYPE: + return "PROTO_ERROR_INVALID_PROTO_TYPE"; + case PROTO_ERROR_INVALID_SERVICE_DOMAIN: + return "PROTO_ERROR_INVALID_SERVICE_DOMAIN"; + case PROTO_ERROR_INVALID_PDP_DATA: + return "PROTO_ERROR_INVALID_PDP_DATA"; + case PROTO_ERROR_INVALID_QOS: + return "PROTO_ERROR_INVALID_QOS"; + case PROTO_ERROR_SESSION_DEACTIVATED: + return "PROTO_ERROR_SESSION_DEACTIVATED"; + case PROTO_ERROR_AUTHENTICATION_FAILED: + return "PROTO_ERROR_AUTHENTICATION_FAILED"; + case PROTO_ERROR_MOBILE_FAILURE: + return "PROTO_ERROR_MOBILE_FAILURE"; + case PROTO_ERROR_NETWORK_FAILURE: + return "PROTO_ERROR_NETWORK_FAILURE"; + case PROTO_ERROR_TIMEOUT: + return "PROTO_ERROR_TIMEOUT"; + case PROTO_ERROR_NO_RESOURCE: + return "PROTO_ERROR_NO_RESOURCE"; + case PROTO_ERROR_INVALID_CONTEXT_ID: + return "PROTO_ERROR_INVALID_CONTEXT_ID"; + case PROTO_ERROR_MODEM_IN_USE: + return "PROTO_ERROR_MODEM_IN_USE"; + case PROTO_ERROR_INVALID_SIM_STATE: + return "PROTO_ERROR_INVALID_SIM_STATE:"; + case PROTO_ERROR_SERVICE_NOT_SUBSCRIBED: + return "PROTO_ERROR_SERVICE_NOT_SUBSCRIBED"; + case PROTO_ERROR_SERVICE_NOT_IMPLEMENTED: + return "PROTO_ERROR_SERVICE_NOT_IMPLEMENTED"; + case PROTO_ERROR_FDN_NOT_ALLOWED: + return "PROTO_ERROR_FDN_NOT_ALLOWED"; + case PROTO_ERROR_CALL_INCOME: + return "PROTO_ERROR_CALL_INCOME"; + case PROTO_ERROR_NOT_SUPPORT_3GCSD: + return "PROTO_ERROR_NOT_SUPPORT_3GCSD"; + case PROTO_ERROR_UNKNOWN: + return "PROTO_ERROR_UNKNOWN"; + case PROTO_ERROR_SI_OFFLINE: + return "PROTO_ERROR_SI_OFFLINE"; + /* TCP/IP/PPP stack errors */ + case PROTO_ERROR_TCPIP_UP: + return "PROTO_ERROR_TCPIP_UP"; + case PROTO_ERROR_TCPIP_DOWN: + return "PROTO_ERROR_TCPIP_DOWN"; + case PROTO_ERROR_PPP_UP: + return "PROTO_ERROR_PPP_UP"; + case PROTO_ERROR_PPP_DOWN: + return "PROTO_ERROR_PPP_DOWN"; + case PROTO_ERROR_WDP_INIT: + return "PROTO_ERROR_WDP_INIT"; + /* ProtoMgr API call errors */ + case PROTO_ERROR_ACTIVE_CONNECTIONS: + return "PROTO_ERROR_ACTIVE_CONNECTIONS"; + case PROTO_ERROR_MAX_CONNECTIONS: + return "PROTO_ERROR_MAX_CONNECTIONS"; + case PROTO_ERROR_INVALID_HANDLE: + return "PROTO_ERROR_INVALID_HANDLE"; + case PROTO_ERROR_INVALID_CONTEXT: + return "PROTO_ERROR_INVALID_CONTEXT"; + case PROTO_ERROR_INVALID_CALLBACK: + return "PROTO_ERROR_INVALID_CALLBACK"; + case PROTO_ERROR_INVALID_EHN: + return "PROTO_ERROR_INVALID_EHN"; + case PROTO_ERROR_INVALID_EVENTCLASS: + return "PROTO_ERROR_INVALID_EVENTCLASS"; + case PROTO_ERROR_INVALID_REFTYPE: + return "PROTO_ERROR_INVALID_REFTYPE"; + case PROTO_ERROR_INVALID_TIMEOUT: + return "PROTO_ERROR_INVALID_TIMEOUT"; + case PROTO_ERROR_MAX_CLIENT: + return "PROTO_ERROR_MAX_CLIENT"; + case PROTO_ERROR_MAX_ACCOUNT: + return "PROTO_ERROR_MAX_ACCOUNT"; + case PROTO_ERROR_ACCESS_DENIED: + return "PROTO_ERROR_ACCESS_DENIED"; + case PROTO_ERROR_REGISTRY_LOAD: + return "PROTO_ERROR_REGISTRY_LOAD"; + + case PROTO_ERROR_PCBROWSING_ON: + return "PROTO_ERROR_PCBROWSING_ON"; + case PROTO_ERROR_REACTIVATION_REQ: + return "PROTO_ERROR_REACTIVATION_REQ"; + case PROTO_ERROR_NO_PDP_ACTIVATED: + return "PROTO_ERROR_NO_PDP_ACTIVATED"; + + case PROTO_ERROR_MAX: + return "PROTO_ERROR_MAX"; + + } + + return MmsDebugPrintUnknownValue(errCode); +} + + +char *DebugPrintWspResult(WspResult wspResult) +{ + switch (wspResult) { + case WSP_RESULT_NO_ERROR: + return "WSP_RESULT_NO_ERROR"; + case WSP_RESULT_NO_SESSION: + return "WSP_RESULT_NO_SESSION"; + case WSP_RESULT_NOT_SUITABLE: + return "WSP_RESULT_NOT_SUITABLE"; + + case WSP_RESULT_NOT_RESPONDING: + return "WSP_RESULT_NOT_RESPONDING"; + case WSP_RESULT_MOP_EXCEED: + return "WSP_RESULT_MOP_EXCEED"; + case WSP_RESULT_MOM_EXCEED: + return "WSP_RESULT_MOM_EXCEED"; + + case WSP_RESULT_UNABLE: + return "WSP_RESULT_UNABLE"; + case WSP_RESULT_UNKNOWN: + return "WSP_RESULT_UNKNOWN"; + case WSP_RESULT_WRONG_PARAM: + return "WSP_RESULT_WRONG_PARAM"; + + case WSP_RESULT_NO_MEMORY: + return "WSP_RESULT_NO_MEMORY"; + case WSP_RESULT_NO_HANDLE: + return "WSP_RESULT_NO_HANDLE"; + + case WSP_RESULT_CAPABILITY_UNABLE: + return "WSP_RESULT_CAPABILITY_UNABLE"; + case WSP_RESULT_UAGENT_NOT_ALLOWED: + return "WSP_RESULT_UAGENT_NOT_ALLOWED"; + } + + return MmsDebugPrintUnknownValue(wspResult); +} + + +char *DebugPrintWspState(MmsRmWapState wspState) +{ + switch (wspState) { //gMmsRmWapState + case RM_WAP_IDLE: + return "RM_WAP_IDLE"; + case RM_WAP_CONNECTING: + return "RM_WAP_CONNECTING"; + case RM_WAP_CONNECTED: + return "RM_WAP_CONNECTED"; + case RM_WAP_DISCONNECTING: + return "RM_WAP_DISCONNECTING"; + case RM_WAP_SECURE_REDIRECT: + return "RM_WAP_SECURE_REDIRECT"; + case RM_WAP_FAILED: + return "RM_WAP_FAILED"; + case RM_WAP_WTLS_HANDSHAKING: + return "RM_WAP_WTLS_HANDSHAKING"; + case RM_WAP_WTLS_HANDSHAKE_COMPLETED: + return "RM_WAP_WTLS_HANDSHAKE_COMPLETED"; + } + + return MmsDebugPrintUnknownValue(wspState); +} + + +char *MmsDebugPrintRmPduType(MmsRmPduType pduType) +{ + switch (pduType) { + case MMS_RM_PDU_TYPE: + return "MMS_RM_PDU_TYPE"; + + case MMS_RM_SEND_REQ: + return "MMS_RM_SEND_REQ"; + case MMS_RM_GET_REQ_AUTO: + return "MMS_RM_GET_REQ_AUTO"; + case MMS_RM_GET_REQ_MANUAL: + return "MMS_RM_GET_REQ_MANUAL"; + case MMS_RM_NOTIFY_RESP_IND: + return "MMS_RM_NOTIFY_RESP_IND"; + case MMS_RM_ACK_IND: + return "MMS_RM_ACK_IND"; + + case MMS_RM_NOTI_IND: + return "MMS_RM_NOTI_IND"; + case MMS_RM_RETRIEVE_CONF: + return "MMS_RM_RETRIEVE_CONF"; + + case MMS_RM_READ_REPORT_V10: + return "MMS_RM_READ_REPORT_V10"; + case MMS_RM_READ_REPORT_V11: + return "MMS_RM_READ_REPORT_V11"; + } + + return MmsDebugPrintUnknownValue(pduType); +} + + +char *MmsDebugPrintMailboxType(MsgMailboxType mailboxType) +{ + switch (mailboxType) { + case MSG_MAILBOX_WRITE: + return "MSG_MAILBOX_WRITE"; + case MSG_MAILBOX_INBOX: + return "MSG_MAILBOX_INBOX"; + case MSG_MAILBOX_DRAFT: + return "MSG_MAILBOX_DRAFT"; + case MSG_MAILBOX_SENT: + return "MSG_MAILBOX_SENT"; + case MSG_MAILBOX_MAILBOX: + return "MSG_MAILBOX_MAILBOX"; + case MSG_MAILBOX_OUTBOX: + return "MSG_MAILBOX_OUTBOX"; + case MSG_MAILBOX_TEMPLATE: + return "MSG_MAILBOX_TEMPLATE"; + case MSG_MAILBOX_MYFOLDER: + return "MSG_MAILBOX_MYFOLDER"; + case MSG_MAILBOX_MYFOLDER_LIST: + return "MSG_MAILBOX_MYFOLDER_LIST"; + case MSG_MAILBOX_PRESET: + return "MSG_MAILBOX_PRESET"; + } + + return MmsDebugPrintUnknownValue(mailboxType); +} +#endif + diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp new file mode 100755 index 0000000..565f39d --- /dev/null +++ b/plugin/mms_plugin/MmsPluginDecode.cpp @@ -0,0 +1,8592 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include + +#include "MsgDebug.h" +#include "MsgException.h" +#include "MmsPluginMessage.h" +#include "MmsPluginStorage.h" +#include "MsgUtilFile.h" +#include "MmsPluginCodec.h" +#include "MmsPluginDebug.h" +#include "MsgSettingTypes.h" +#include "MsgSettingHandler.h" +#include "MmsPluginInternal.h" +#include "MmsPluginAvCodec.h" +#include "MmsPluginStorage.h" +#include "MmsPluginSmil.h" +#ifdef __SUPPORT_DRM__ +#include "MmsPluginDrm.h" +#include "MsgDrmWrapper.h" +#include "drm-service.h" +#endif + + +static bool _MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength); /* bufLen < gMmsDecodeMaxLen */ +static bool _MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength); /* no bufLen limit */ +static bool _MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength); + +static int __MmsBinaryDecodeUintvar(FILE *pFile, UINT32 *pUintVar, int totalLength); +static int __MmsDecodeValueLength(FILE *pFile, UINT32 *pValueLength, int totalLength); +static int __MmsDecodeValueLength2(FILE *pFile, UINT32 *pValueLength, int totalLength); +static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen, int totalLength); +static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen, int totalLength); +static bool __MmsBinaryDecodeInteger(FILE *pFile, UINT32 *pInteger, int *pIntLen, int totalLength); +static bool __MmsBinaryDecodeCharset(FILE *pFile, UINT32 *nCharSet, int *pCharSetLen, int totalLength); +static char *__MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength); +static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int totalLength); +static UINT32 __MmsHeaderDecodeIntegerByLength(FILE *pFile, UINT32 length, int totalLength); +static bool __MmsDecodeLongInteger(FILE *pFile, UINT32 *pLongInteger, int totalLength); +static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int totalLength); +static MsgHeaderAddress *__MmsDecodeEncodedAddress(FILE *pFile, int totalLength); + +#ifdef __SUPPORT_DRM__ +bool __MmsParseDCFInfo(FILE *pFile, MsgDRMInfo *pDrmInfo, int totalLength); +bool __MmsParseDCFHdr(FILE *pFile, MsgDRMInfo *pDrmInfo, UINT32 headerLen, int totalLength); +bool MmsBinaryDecodeDRMMessage(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int fullBodyLength, int totalLength); +bool MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength); +#endif + +static bool MmsBinaryDecodeMovePointer(FILE *pFile, int offset, int totalLength); +bool MmsBinaryIsTextEncodedPart(FILE *pFile, int totalLength); +static bool __MmsBinaryDecodeCheckAndDecreaseLength(int *pLength, int valueLength); + +bool __MmsTextDecodeMsgHeader(FILE *pFile); +bool MmsTextDecodeMsgBody(FILE *pFile); + +char gszMmsLoadBuf1[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, }; +char gszMmsLoadBuf2[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, }; + +static char *gpCurMmsDecodeBuff = NULL; +static int gCurMmsDecodeBuffPos = 0; /* next decoding position in gpCurMmsDecodeBuff */ +static int gMmsDecodeMaxLen = 0; +static int gMmsDecodeCurOffset = 0; /* current offset in file (last read) */ +static int gMmsDecodeBufLen = 0; /* number of last read characters */ + +static char *gpMmsDecodeBuf1 = NULL; +static char *gpMmsDecodeBuf2 = NULL; + +MmsHeader mmsHeader = +{ + false, //bActive + NULL, //pszOwner + -1, //msgID + + (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; + + + /* 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; + + + /* 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; + + /* MMS v1.1 ReplyCharge */ + { + (MmsReplyChargeType)MMS_REPLY_NONE, //MmsReplyChargeType chargeType; + {MMS_TIMETYPE_RELATIVE, 0}, //MmsTimeStruct deadLine; + 0, //int chargeSize; + "" , //char szChargeID; + }, + + "", //char[] szMsgID; + 0, //UINT32 msgSize; +}; + +#ifdef __SUPPORT_DRM__ + +#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 + +#endif + + +bool _MmsDecodeInitialize(void) +{ + MmsInitMsgType(&mmsHeader.msgType); + MmsInitMsgBody(&mmsHeader.msgBody); + + return true; +} + +bool __MmsSetMmsHeaderOwner(int msgID, char* pszNewOwner) +{ + if (pszNewOwner) { + // set new owner + MSG_DEBUG("__MmsSetMmsHeaderOwner: set (%s, msgID=%d)\n", pszNewOwner, msgID); + + if ((mmsHeader.pszOwner = (char*)malloc(strlen(pszNewOwner) + 1)) == NULL) + return false; + + memset (mmsHeader.pszOwner, 0, strlen(pszNewOwner) + 1) ; + + strcpy(mmsHeader.pszOwner, pszNewOwner); + mmsHeader.bActive = true; + mmsHeader.msgID = msgID; + } else { + // delete current owner + if (mmsHeader.pszOwner) { + MSG_DEBUG("__MmsSetMmsHeaderOwner: free (%s %d)\n", mmsHeader.pszOwner, msgID); + free(mmsHeader.pszOwner); + mmsHeader.pszOwner = NULL; + } + mmsHeader.bActive = false; + mmsHeader.msgID = -1; + } + + return true; +} + + +void _MmsInitHeader() +{ + mmsHeader.type = MMS_MSGTYPE_ERROR; + + memset(mmsHeader.szTrID, 0, MMS_TR_ID_LEN + 1); + mmsHeader.version = MMS_VERSION; + mmsHeader.date = 0; + + MsgFreeHeaderAddress(mmsHeader.pFrom); + MsgFreeHeaderAddress(mmsHeader.pTo); + MsgFreeHeaderAddress(mmsHeader.pCc); + MsgFreeHeaderAddress(mmsHeader.pBcc); + + mmsHeader.pFrom = NULL; + mmsHeader.pTo = NULL; + mmsHeader.pCc = NULL; + mmsHeader.pBcc = NULL; + + memset(mmsHeader.szSubject, 0, MSG_LOCALE_SUBJ_LEN + 1); + + mmsHeader.responseStatus = (MmsResponseStatus)MMS_RESPSTATUS_OK; + mmsHeader.retrieveStatus = (MmsRetrieveStatus)MMS_RETRSTATUS_OK; + memset(mmsHeader.szResponseText, 0, MMS_LOCALE_RESP_TEXT_LEN + 1); + memset(mmsHeader.szRetrieveText, 0, MMS_LOCALE_RESP_TEXT_LEN + 1); + + + mmsHeader.msgClass = (MmsMsgClass)MMS_MSGCLASS_PERSONAL; + mmsHeader.expiryTime.type = MMS_TIMETYPE_RELATIVE; + 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.hideAddress =(MmsSenderVisible)MMS_SENDER_SHOW; + mmsHeader.deliveryReport = (MmsReport)MMS_REPORT_NO; + mmsHeader.readReply = (MmsReport)MMS_REPORT_NO; + mmsHeader.reportAllowed = (MmsReportAllowed)MMS_REPORTALLOWED_YES; + memset(mmsHeader.szContentLocation, 0, MMS_LOCATION_LEN + 1); + + + mmsHeader.msgStatus = (MSG_DELIVERY_REPORT_STATUS_T)MSG_DELIVERY_REPORT_NONE; + mmsHeader.readStatus = (MSG_READ_REPORT_STATUS_T)MSG_READ_REPORT_NONE; + + mmsHeader.replyCharge.chargeType = (MmsReplyChargeType)MMS_REPLY_NONE; + mmsHeader.replyCharge.chargeSize = 0; + mmsHeader.replyCharge.deadLine.type = MMS_TIMETYPE_RELATIVE; + mmsHeader.replyCharge.deadLine.time = 0; + memset(mmsHeader.replyCharge.szChargeID, 0, MMS_MSG_ID_LEN + 1); + + + memset(mmsHeader.szMsgID, 0, MMS_MSG_ID_LEN + 1); + mmsHeader.msgSize = 0; +#ifdef __SUPPORT_DRM__ + mmsHeader.drmType = MSG_DRM_TYPE_NONE; +#endif + + _MmsDecodeInitialize(); +} + + + +void _MmsCleanDecodeBuff(void) +{ + memset(gpMmsDecodeBuf1, 0, gMmsDecodeMaxLen + 1); + memset(gpMmsDecodeBuf2, 0, gMmsDecodeMaxLen + 1); + gpCurMmsDecodeBuff = NULL; + gCurMmsDecodeBuffPos = 0; + gMmsDecodeBufLen = 0; +} + + +void _MmsRegisterDecodeBuffer(char *pInBuff1, char *pInBuff2, int maxLen) +{ + gpMmsDecodeBuf1 = pInBuff1; + gpMmsDecodeBuf2 = pInBuff2; + gpCurMmsDecodeBuff = NULL; + gCurMmsDecodeBuffPos = 0; + gMmsDecodeMaxLen = maxLen; + gMmsDecodeCurOffset = 0; + gMmsDecodeBufLen = 0; +} + +void _MmsUnregisterDecodeBuffer(void) +{ + gpMmsDecodeBuf1 = NULL; + gpMmsDecodeBuf2 = NULL; + gpCurMmsDecodeBuff = NULL; + gCurMmsDecodeBuffPos = 0; + gMmsDecodeMaxLen = 0; + gMmsDecodeCurOffset = 0; + gMmsDecodeBufLen = 0; +} + + +int _MmsGetDecodeOffset(void) +{ + return (gMmsDecodeCurOffset - gMmsDecodeBufLen + gCurMmsDecodeBuffPos); +} + + +static bool __MmsBinaryDecodeCheckAndDecreaseLength(int *pLength, int valueLength) +{ + if (*pLength <= valueLength) { + gCurMmsDecodeBuffPos -= valueLength; + gCurMmsDecodeBuffPos += *pLength; + return false; + } + + *pLength -= valueLength; + + return true; +} + + +/* ========================================================== + + B I N A R Y D E C O D I N G + + ==========================================================*/ + +/* + * Binary Encoded Message Format + * + * < Single Part Body Message > + * ----------------------------------- + * | Header Fields | + * ----------------------------------- + * | Content Type:start=xxx;type=xxx | ->(ex) Text/Plain, Text/Html, .... + * ----------------------------------- + * | Single Part Body | + * ----------------------------------- + * + * < Multi Part Body Message > + * ----------------------------------- + * | Header Fields | + * ----------------------------------- + * | Content Type:start=xxx;type=xxx | -> (ex) Application/vnd.wap.multipart.mixed(related), multipart/mixed(related) + * ----------------------------------- + * | # of Entries (body parts) | + * ----------------------------------- < Each Entry > + * | Entry 1 | -> ----------------------------- + * ----------------------------------- | header Length | + * | Entry 2 | ----------------------------- + * ----------------------------------- | Data Length | + * | ...... | ----------------------------- - + * ----------------------------------- | Content-Type | | + * | Entry n | ----------------------------- | Header Length + * ----------------------------------- | Header | | + * ----------------------------- - + * | Data | | Data Length + * ----------------------------- - + */ +bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) +{ + UINT16 fieldCode = 0xffff; + UINT16 fieldValue = 0xffff; + UINT8 oneByte = 0xff; + + MsgHeaderAddress *pAddr = NULL; + MsgHeaderAddress *pLastTo = NULL; + MsgHeaderAddress *pLastCc = NULL; + MsgHeaderAddress *pLastBcc = NULL; + + UINT32 valueLength = 0; + UINT32 tmpInteger = 0; + int tmpIntLen = 0; + + int offset = 0; + + char szGarbageBuff[MSG_STDSTR_LONG] = {0, }; + char *pLimitData = NULL; + int nRead = 0; + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: pFile=%d, total len=%d\n", pFile, totalLength); + + _MmsCleanDecodeBuff(); + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, + &gMmsDecodeCurOffset, gpMmsDecodeBuf1, gpMmsDecodeBuf2, + gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: fail to load to buffer \n"); + goto __CATCH; + } + + while (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength)) { + fieldCode = oneByte & 0x7f; + + switch (_MmsGetBinaryType(MmsCodeFieldCode, fieldCode)) { + case MMS_CODE_RESPONSESTATUS: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: responseStatus GetOneByte fail\n"); + goto __CATCH; + } + + fieldValue = _MmsGetBinaryType(MmsCodeResponseStatus, (UINT16)(oneByte & 0x7F)); + + if (fieldValue == 0xFFFF) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: responseStatus error\n"); + goto __CATCH; + } + + if (fieldValue >= 0x0044 && fieldValue <= 0x005F) { + fieldValue = 0x0040; + } else if (fieldValue >= 0x006A && fieldValue <= 0x007F) { + fieldValue = 0x0060; + } + + mmsHeader.responseStatus = (MmsResponseStatus)fieldValue; + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: response status = %s\n", MmsDebugGetResponseStatus(mmsHeader.responseStatus)); + + break; + + case MMS_CODE_RETRIEVESTATUS: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: retrieveStatus GetOneByte fail\n"); + goto __CATCH; + } + + fieldValue = _MmsGetBinaryType(MmsCodeRetrieveStatus, (UINT16)(oneByte & 0x7F)); + + if (fieldValue == 0xFFFF) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: retrieveStatus error\n"); + goto __CATCH; + } + + if (fieldValue >= 0x0043 && fieldValue <= 0x005F) { + fieldValue = 0x0040; // 192; Error-transient-failure + } else if (fieldValue >= 0x0064 && fieldValue <= 0x007F) { + fieldValue = 0x0060; //224; Error-permanent-failure + } + + mmsHeader.retrieveStatus = (MmsRetrieveStatus)fieldValue; + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: retrieve status = %s\n", + MmsDebugGetRetrieveStatus(mmsHeader.retrieveStatus)); + + break; + + case MMS_CODE_RESPONSETEXT: + + if (__MmsBinaryDecodeEncodedString(pFile, mmsHeader.szResponseText, MMS_LOCALE_RESP_TEXT_LEN + 1, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_RESPONSETEXT \n"); + goto __CATCH; + } + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: response text = %s\n", mmsHeader.szResponseText); + break; + + case MMS_CODE_RETRIEVETEXT: + + if (__MmsBinaryDecodeEncodedString(pFile, mmsHeader.szRetrieveText, MMS_LOCALE_RESP_TEXT_LEN + 1, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_RETRIEVETEXT \n"); + goto __CATCH; + } + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: retrieve text = %s\n", mmsHeader.szResponseText); + break; + + case MMS_CODE_MSGID: + + if (__MmsBinaryDecodeText(pFile, mmsHeader.szMsgID, MMS_MSG_ID_LEN + 1, totalLength) < 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_MSGID is invalid\n"); + goto __CATCH; + } + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg id = %s\n", mmsHeader.szMsgID); + + if (MsgStrlen (mmsHeader.szMsgID) > 2) + MsgMIMERemoveQuote (mmsHeader.szMsgID); + + break; + + case MMS_CODE_SUBJECT: + + if (__MmsBinaryDecodeEncodedString(pFile, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN + 1, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_SUBJECT \n"); + goto __CATCH; + } + + pLimitData = (char *)malloc(MSG_LOCALE_SUBJ_LEN + 1); + + if (pLimitData == NULL) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : pLimitData malloc fail \n"); + goto __CATCH; + } + + nRead = MsgCutUTFString((unsigned char*)pLimitData, MSG_LOCALE_SUBJ_LEN + 1, (unsigned char*)mmsHeader.szSubject, MSG_SUBJ_LEN); + MSG_DEBUG("MmsBinaryDecodeMsgHeader : Subject edit.. \n"); + + if (nRead > MSG_LOCALE_SUBJ_LEN) { + memset(mmsHeader.szSubject, 0 , sizeof(mmsHeader.szSubject)); + strncpy(mmsHeader.szSubject, pLimitData, MSG_SUBJ_LEN); + } else { + memset(mmsHeader.szSubject, 0 , sizeof(mmsHeader.szSubject)); + strncpy(mmsHeader.szSubject, pLimitData, MSG_LOCALE_SUBJ_LEN); + } + + if (pLimitData) { + free(pLimitData); + pLimitData = NULL; + } + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: subject = %s\n", mmsHeader.szSubject); + break; + + case MMS_CODE_FROM: + + /* Value-length (Address-present-token Encoded-string-value | Insert-address-token) */ + + if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_FROM is invalid\n"); + goto __CATCH; + } + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: MMS_CODE_FROM GetOneByte fail\n"); + goto __CATCH; + } + + // DRM_TEMPLATE - start + + valueLength--; + + if (oneByte == (_MmsGetBinaryValue(MmsCodeAddressType, MMS_ADDRESS_PRESENT_TOKEN)|0x80)) { + if (valueLength > 0) { + mmsHeader.pFrom = __MmsDecodeEncodedAddress(pFile, totalLength); + if (mmsHeader.pFrom == NULL) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_FROM __MmsDecodeEncodedAddress fail\n"); + goto __CATCH; + } + } else { + mmsHeader.pFrom = (MsgHeaderAddress *)malloc(sizeof(MsgHeaderAddress)); + if (mmsHeader.pFrom == NULL) + goto __CATCH; + + mmsHeader.pFrom->szAddr = (char *)malloc(1); + if (mmsHeader.pFrom->szAddr == NULL) { + free(mmsHeader.pFrom); + mmsHeader.pFrom = NULL; + goto __CATCH; + } + + mmsHeader.pFrom->szAddr[0] = '\0'; + mmsHeader.pFrom->pNext = NULL; + } + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: from = %s\n", mmsHeader.pFrom->szAddr); + // DRM_TEMPLATE - end + } else if (oneByte == (_MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN)|0x80)) { + /* Present Token only */ + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_FROM insert token\n"); + } else { + /* from data broken */ + MSG_DEBUG("MmsBinaryDecodeMsgHeader: from addr broken\n"); + gCurMmsDecodeBuffPos--; + goto __CATCH; + } + break; + + case MMS_CODE_TO: + + pAddr = __MmsDecodeEncodedAddress(pFile, totalLength); + if (pAddr == NULL) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_TO __MmsDecodeEncodedAddress fail\n"); + goto __CATCH; + } + + if (mmsHeader.pTo == NULL) { + /* the first TO */ + pLastTo = mmsHeader.pTo = pAddr; + } else { + if (pLastTo) + pLastTo->pNext = pAddr; + pLastTo = pAddr; + } + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: to = %s\n", mmsHeader.pTo->szAddr); + break; + + case MMS_CODE_BCC: + + pAddr = __MmsDecodeEncodedAddress(pFile, totalLength); + if (pAddr == NULL) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_BCC __MmsDecodeEncodedAddress fail\n"); + goto __CATCH; + } + + if (mmsHeader.pBcc == NULL) { + /* the first Bcc */ + pLastBcc = mmsHeader.pBcc = pAddr; + } else { + if (pLastBcc) + pLastBcc->pNext = pAddr; + pLastBcc = pAddr; + } + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: bcc = %s\n", mmsHeader.pBcc->szAddr); + break; + + case MMS_CODE_CC: + + pAddr = __MmsDecodeEncodedAddress(pFile, totalLength); + if (pAddr == NULL) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_CC __MmsDecodeEncodedAddress fail\n"); + goto __CATCH; + } + + if (mmsHeader.pCc == NULL) { + /* the first Cc */ + pLastCc = mmsHeader.pCc = pAddr; + } else { + if (pLastCc) + pLastCc->pNext = pAddr; + pLastCc = pAddr; + } + MSG_DEBUG("MmsBinaryDecodeMsgHeader: cc = %s\n", mmsHeader.pCc->szAddr); + break; + + case MMS_CODE_CONTENTLOCATION: + + if (__MmsBinaryDecodeText(pFile, mmsHeader.szContentLocation, MMS_LOCATION_LEN + 1, totalLength) < 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_CONTENTLOCATION is invalid\n"); + goto __CATCH; + } + MSG_DEBUG("MmsBinaryDecodeMsgHeader: content location = %s\n", mmsHeader.szContentLocation); + break; + + case MMS_CODE_DATE: + + if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.date, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_DATE is invalid\n"); + goto __CATCH; + } + MSG_DEBUG("MmsBinaryDecodeMsgHeader: date = %d\n", mmsHeader.date); + break; + + case MMS_CODE_DELIVERYREPORT: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: deliveryReport GetOneByte fail\n"); + goto __CATCH; + } + + fieldValue = _MmsGetBinaryType(MmsCodeDeliveryReport, (UINT16)(oneByte & 0x7F)); + + if (fieldValue == 0xFFFF) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: deliveryReport error\n"); + goto __CATCH; + } + + mmsHeader.deliveryReport = (MmsReport)fieldValue; + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: delivery report=%s\n", MmsDebugGetMmsReport(mmsHeader.deliveryReport)); + break; + + case MMS_CODE_DELIVERYTIME: + + /* value_length (absolute-token Long-integer | Relative-token Long-integer) */ + + if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_DELIVERYTIME \n"); + goto __CATCH; + } + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: delivery time GetOneByte fail\n"); + goto __CATCH; + } + + //DRM_TEMPLATE - start + valueLength--; + + if (oneByte == (_MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) { + mmsHeader.deliveryTime.type = MMS_TIMETYPE_ABSOLUTE; + + if (valueLength > 0) { + if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.deliveryTime.time, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_DELIVERYTIME\n"); + goto __CATCH; + } + } + // DRM_TEMPLATE - end + } else { + mmsHeader.deliveryTime.type = MMS_TIMETYPE_RELATIVE; + + if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&mmsHeader.deliveryTime.time, &tmpIntLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : __MmsBinaryDecodeInteger fail...\n"); + goto __CATCH; + } + } + MSG_DEBUG("MmsBinaryDecodeMsgHeader: delivery type=%d, time=%d\n", mmsHeader.deliveryTime.type, mmsHeader.deliveryTime.time); + break; + + case MMS_CODE_EXPIRYTIME: + + /* value_length(absolute-token Long-integer | Relative-token Long-integer) */ + + if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_EXPIRYTIME \n"); + goto __CATCH; + } + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: expiry time GetOneByte fail\n"); + goto __CATCH; + } + + // DRM_TEMPLATE - start + valueLength--; + + if (oneByte == (_MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) { + mmsHeader.expiryTime.type = MMS_TIMETYPE_ABSOLUTE; + + if (valueLength > 0) { + if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.expiryTime.time, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_EXPIRYTIME is invalid\n"); + goto __CATCH; + } + } + // DRM_TEMPLATE - end + } else { + mmsHeader.expiryTime.type = MMS_TIMETYPE_RELATIVE; + + if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&mmsHeader.expiryTime.time, &tmpIntLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : __MmsBinaryDecodeInteger fail...\n"); + goto __CATCH; + } + } + MSG_DEBUG("MmsBinaryDecodeMsgHeader: expiry = %d\n", mmsHeader.expiryTime.time); + break; + + case MMS_CODE_MSGCLASS: + + /* Class-value = Class-identifier | Token Text */ + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgClass GetOneByte fail\n"); + goto __CATCH; + } + + if (oneByte > 0x7f) { + /* Class-identifier */ + mmsHeader.msgClass = (MmsMsgClass)_MmsGetBinaryType(MmsCodeMsgClass, (UINT16)(oneByte & 0x7F)); + } else { + if (__MmsBinaryDecodeText(pFile, szGarbageBuff, MSG_STDSTR_LONG, totalLength) < 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: 1. __MmsBinaryDecodeText fail. (class)\n"); + goto __CATCH; + } + } + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg class=%s\n", MmsDebugGetMsgClass(mmsHeader.msgClass)); + break; + + case MMS_CODE_MSGSIZE: + + if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.msgSize, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_MSGSIZE is invalid\n"); + goto __CATCH; + } + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg size = %d\n", mmsHeader.msgSize); + break; + + case MMS_CODE_MSGSTATUS: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + + mmsHeader.msgStatus = (MSG_DELIVERY_REPORT_STATUS_T)_MmsGetBinaryType(MmsCodeMsgStatus, (UINT16)(oneByte & 0x7F)); + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg status=%s \n", MmsDebugGetMsgStatus(mmsHeader.msgStatus)) ; + break; + + case MMS_CODE_MSGTYPE: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + + mmsHeader.type = (MmsMsgType)_MmsGetBinaryType(MmsCodeMsgType, (UINT16)(oneByte & 0x7F)); + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg type=%s\n", MmsDebugGetMsgType(mmsHeader.type)); + break; + + case MMS_CODE_PRIORITY: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + mmsHeader.priority = (MmsPriority)_MmsGetBinaryType(MmsCodePriority, (UINT16)(oneByte & 0x7F)); + MSG_DEBUG("MmsBinaryDecodeMsgHeader: priority=%d\n", mmsHeader.priority); + break; + + case MMS_CODE_READREPLY: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + mmsHeader.readReply = (MmsReport)_MmsGetBinaryType(MmsCodeReadReply, (UINT16)(oneByte & 0x7F)); + MSG_DEBUG("MmsBinaryDecodeMsgHeader: read reply=%s \n", MmsDebugGetMmsReport(mmsHeader.readReply)); + break; + + case MMS_CODE_REPORTALLOWED: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + mmsHeader.reportAllowed = (MmsReportAllowed)_MmsGetBinaryType(MmsCodeReportAllowed, (UINT16)(oneByte & 0x7F)); + MSG_DEBUG("MmsBinaryDecodeMsgHeader: mmsHeader.reportAllowed=%d\n", MmsDebugGetMmsReportAllowed(mmsHeader.reportAllowed)); + break; + + case MMS_CODE_SENDERVISIBILLITY: + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + mmsHeader.hideAddress= (MmsSenderVisible)!(_MmsGetBinaryType(MmsCodeSenderVisibility, (UINT16)(oneByte &0x7F))); + MSG_DEBUG("MmsBinaryDecodeMsgHeader: sender visible=%d \n", mmsHeader.hideAddress); + break; + + case MMS_CODE_TRID: + + if (__MmsBinaryDecodeText(pFile, mmsHeader.szTrID, MMS_TR_ID_LEN + 1, totalLength) < 0) { + MSG_DEBUG("Transaction ID Too Long \n"); + goto __CATCH; + } + MSG_DEBUG("MmsBinaryDecodeMsgHeader: trID = %s\n", mmsHeader.szTrID); + break; + + case MMS_CODE_VERSION: + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + mmsHeader.version = oneByte; + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: ver = 0x%x\n", mmsHeader.version); + break; + + case MMS_CODE_CONTENTTYPE: + + /* + * Content-type is the last header field of SendRequest and RetrieveConf. + * It's required to decrease pointer by one and return, + * to parse this field in MmsBinaryDecodeContentType(). + */ + goto __RETURN; + + + /* ----------- Add by MMSENC v1.1 ----------- */ + + case MMS_CODE_READSTATUS: + + /* Read-status-value = Read | Deleted without being read */ + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + + mmsHeader.readStatus = (MSG_READ_REPORT_STATUS_T)_MmsGetBinaryType(MmsCodeReadStatus, (UINT16)(oneByte & 0x7F)); + MSG_DEBUG("MmsBinaryDecodeMsgHeader: read status=%s\n", MmsDebugGetMmsReadStatus(mmsHeader.readStatus)); + break; + + case MMS_CODE_REPLYCHARGING: + + /* Reply-charging-value = Requested | Requested text only | Accepted | Accepted text only */ + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + + mmsHeader.replyCharge.chargeType = (MmsReplyChargeType)_MmsGetBinaryType(MmsCodeReplyCharging, (UINT16)(oneByte & 0x7F)); + MSG_DEBUG("MmsBinaryDecodeMsgHeader: mmsHeader.reply charge=%d\n", mmsHeader.replyCharge.chargeType); + break; + + case MMS_CODE_REPLYCHARGINGDEADLINE: + + /* Reply-charging-deadline-value = Value-length (Absolute-token Date-value | Relative-token Delta-seconds-value) */ + + if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_REPLYCHARGINGDEADLINE \n"); + goto __CATCH; + } + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n"); + goto __CATCH; + } + + if (oneByte == (_MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE) | 0x80)) { + mmsHeader.replyCharge.deadLine.type = MMS_TIMETYPE_ABSOLUTE; + } else { + mmsHeader.replyCharge.deadLine.type = MMS_TIMETYPE_RELATIVE; + } + + // DRM_TEMPLATE - start + valueLength--; + + if (valueLength > 0) { + if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.replyCharge.deadLine.time, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_REPLYCHARGINGDEADLINE is invalid\n"); + goto __CATCH; + } + } + // DRM_TEMPLATE - end + break; + + case MMS_CODE_REPLYCHARGINGID: + + /* Reply-charging-ID-value = Text-string */ + + if (__MmsBinaryDecodeText(pFile, mmsHeader.replyCharge.szChargeID, MMS_MSG_ID_LEN + 1, totalLength) < 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: 1. __MmsBinaryDecodeText fail. (szReplyChargingID)\n"); + goto __CATCH; + } + break; + + case MMS_CODE_REPLYCHARGINGSIZE: + + /* Reply-charging-size-value = Long-integer */ + + if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.replyCharge.chargeSize, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_REPLYCHARGINGSIZE is invalid\n"); + goto __CATCH; + } + break; + + case MMS_CODE_PREVIOUSLYSENTBY: + + /* + * Previously-sent-by-value = Value-length Forwarded-count-value Encoded-string-value + * Forwarded-count-value = Integer-value + * MMS_CODE_PREVIOUSLYSENTBY shall be a pair with MMS_CODE_PREVIOUSLYSENTDATE + */ + + /* + * fixme: There is no proper field to store this information. + * Just increase pointer now. + */ + + if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : 1. invalid MMS_CODE_PREVIOUSLYSENTBY \n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeInteger(pFile, &tmpInteger, &tmpIntLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : 2. invalid MMS_CODE_PREVIOUSLYSENTBY \n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeEncodedString(pFile, szGarbageBuff, MSG_STDSTR_LONG, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_RETRIEVETEXT \n"); + goto __CATCH; + } + break; + + case MMS_CODE_PREVIOUSLYSENTDATE: + + /* + * Previously-sent-date-value = Value-length Forwarded-count-value Date-value + * Forwarded-count-value = Integer-value + * MMS_CODE_PREVIOUSLYSENTDATE shall be a pair with MMS_CODE_PREVIOUSLYSENTBY + */ + + /* + * fixme: There is no proper field to store this information. + * Just increase pointer now. + */ + + if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : 1. invalid MMS_CODE_PREVIOUSLYSENTDATE \n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeInteger(pFile, &tmpInteger, &tmpIntLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : 2. invalid MS_CODE_PREVIOUSLYSENTDATE \n"); + goto __CATCH; + } + + if (__MmsDecodeLongInteger(pFile, (UINT32*)&tmpInteger, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader : 3. invalid MMS_CODE_PREVIOUSLYSENTDATE \n"); + goto __CATCH; + } + break; + + + default: + + /* + * Application-header = Token-text Application-specific-value + * Token-text = Token End-of-string + * Application-specific-value = Text -string + * + * OR unknown header field - Just ignore these fields. + * + * Read one byte and check the value >= 0x80 + * (check these value can be field code) + */ + { + int remainLength = 0; + + oneByte = 0x00; + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + remainLength = totalLength - offset; + + while ((oneByte < 0x80) && (remainLength > 0)) { + if (__MmsBinaryDecodeCheckAndDecreaseLength(&remainLength, 1) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: __MmsBinaryDecodeCheckAndDecreaseLength fail\n"); + goto __CATCH; + } + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgHeader: responseStatus GetOneByte fail\n"); + goto __CATCH; + } + } + + gCurMmsDecodeBuffPos--; + } + + break; + } /* switch */ + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + } /* while */ + + +__RETURN: + + MSG_DEBUG("MmsBinaryDecodeMsgHeader: success\n"); + return true; + + +__CATCH: + MSG_DEBUG("MmsBinaryDecodeMsgHeader: failed\n"); + + return false; +} + +#ifdef FEATURE_JAVA_MMS +// for JAVA MMS AppId - check later whether it can be handled by MmsBinaryDecodeMsgHeader +bool MmsBinaryDecodeContentType(FILE *pFile, char *szFilePath, int totalLength) +{ + int length = 0; + + MSG_DEBUG("MmsBinaryDecodeContentType:\n"); + + if (szFilePath != NULL) + strncpy(mmsHeader.msgType.szOrgFilePath, szFilePath, strlen(szFilePath)); + mmsHeader.msgType.offset = _MmsGetDecodeOffset() - 1; // + Content-Type code value + + // read data(2K) from msg file(/User/Msg/Inbox/5) to gpCurMmsDecodeBuff for decoding + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, + &gMmsDecodeCurOffset, gpMmsDecodeBuf1, gpMmsDecodeBuf2, + gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeContentType: fail to load to buffer \n"); + goto __CATCH; + } + + // msg's type [ex] related, mixed, single part (jpg, amr and etc) + length = MmsBinaryDecodeContentType(pFile, &mmsHeader.msgType, totalLength); + if (length == -1) { + MSG_DEBUG("MmsBinaryDecodeContentType: MMS_CODE_CONTENTTYPE is fail\n"); + goto __CATCH; + } + MSG_DEBUG("Content-Type: Application-ID:%s Reply-To-Application-ID:%s",mmsHeader.msgType.param.szApplicationID, mmsHeader.msgType.param.szReplyToApplicationID); + + return true; + +__CATCH: + + /* fixme: Delete multipart using MmsDeleteMsg() */ + + return false; +} +#endif + +bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength) +{ + int length = 0; + int offset = 0; + + MsgMultipart *pMultipart = NULL; + + MSG_DEBUG("MmsBinaryDecodeMsgBody:\n"); + + if (szFilePath != NULL) + strncpy(mmsHeader.msgType.szOrgFilePath, szFilePath , strlen(szFilePath)); + + mmsHeader.msgType.offset = _MmsGetDecodeOffset() - 1; // + Content-Type code value + + // read data(2K) from msg file(/User/Msg/Inbox/5) to gpCurMmsDecodeBuff for decoding + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, + &gMmsDecodeCurOffset, gpMmsDecodeBuf1, gpMmsDecodeBuf2, + gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMsgBody: fail to load to buffer \n"); + goto __CATCH; + } + + // msg's type [ex] related, mixed, single part (jpg, amr and etc) + length = MmsBinaryDecodeContentType(pFile, &mmsHeader.msgType, totalLength); + if (length == -1) { + MSG_DEBUG("MmsBinaryDecodeMsgBody: MMS_CODE_CONTENTTYPE is fail\n"); + goto __CATCH; + } + + mmsHeader.msgType.size = length + 1; // + Content-Type code value + mmsHeader.msgBody.offset = _MmsGetDecodeOffset(); + + switch (mmsHeader.msgType.type) { + case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED: + case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED: + case MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC: + case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE: + case MIME_MULTIPART_REPORT: + case MIME_MULTIPART_MIXED: + case MIME_MULTIPART_RELATED: + case MIME_MULTIPART_ALTERNATIVE: + case MIME_APPLICATION_VND_OMA_DRM_MESSAGE: + case MIME_APPLICATION_VND_OMA_DRM_CONTENT: + + MSG_DEBUG("__MmsBinaryMsgBodyDecode: Decode multipart\n"); + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + if (MmsBinaryDecodeMultipart(pFile, szFilePath, &mmsHeader.msgType, &mmsHeader.msgBody, totalLength) == false) { + MSG_DEBUG("__MmsBinaryMsgBodyDecode: MmsBinaryDecodeMultipart is fail.\n"); + goto __CATCH; + } + break; + + default: + + /* Single part message ---------------------------------------------- */ + + strcpy(mmsHeader.msgBody.szOrgFilePath, szFilePath); + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + if (MmsBinaryDecodePartBody(pFile, totalLength - mmsHeader.msgBody.offset, totalLength) == false) { + MSG_DEBUG("__MmsBinaryMsgBodyDecode: MmsBinaryDecodePartBody is fail.(Single Part)\n"); + goto __CATCH; + } + + mmsHeader.msgBody.size = totalLength - mmsHeader.msgBody.offset; + mmsHeader.msgType.contentSize = totalLength - mmsHeader.msgBody.offset; + + break; + } + +#ifdef __SUPPORT_DRM__ + mmsHeader.drmType = MsgGetDRMType(&mmsHeader.msgType, &mmsHeader.msgBody); +#endif + +__RETURN: + + return true; + +__CATCH: + + /* fixme: Delete multipart using MmsDeleteMsg() */ + + if (pMultipart) { + if (pMultipart->pBody) { + if (pMultipart->pBody->body.pText) { + free(pMultipart->pBody->body.pText); + pMultipart->pBody->body.pText = NULL; + } + + free(pMultipart->pBody); + pMultipart->pBody = NULL; + } + + free(pMultipart); + pMultipart = NULL; + } + + return false; +} + +#if MMS_ENABLE_EXTEND_CFM +// DRM (Extended)CFM +// Get Extended CFM value. +static bool __MmsConvertString2Bool(char *pszValue) +{ + if (!strcasecmp(pszValue, "no")) + return true; + + return false; +} +#endif + +bool MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int valueLength, int totalLength) +{ + UINT8 oneByte = 0; + int charSetLen = 0; + char *szTypeString = NULL; + char *szTypeValue = NULL; + UINT8 paramCode = 0xff; + UINT32 integer = 0; + int intLen = 0; + int length = 0; + int textLength = 0; + + /* + * Parameter = Typed-parameter | Untyped-parameter + * WAP-230-WSP-20010118-p, Proposed Version 18 January 2001 (pp.107) + */ + + MSG_DEBUG("MmsBinaryDecodeParameter: \n"); + + while (valueLength > 0) { + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeContentType: paramCode _MmsBinaryDecodeGetOneByte fail\n"); + goto __CATCH; + } + + paramCode = oneByte; + valueLength--; + + switch (paramCode) { + case 0x81: // charset + + if (__MmsBinaryDecodeCharset(pFile, (UINT32*)&(pMsgType->param.charset), &charSetLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeContentType : __MmsBinaryDecodeCharset fail.\n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, charSetLen) == false) + goto __RETURN; + + break; + + 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) + totalLength); + if (length < 0) { + MSG_DEBUG("MmsBinaryDecodeContentType : __MmsDecodeGetFilename fail. (name parameter)\n"); + goto __CATCH; + } + + if (MsgCheckFileNameHasInvalidChar(pMsgType->param.szName)) { + _MsgReplaceInvalidFileNameChar(pMsgType->param.szName, '_'); + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, length) == false) + goto __RETURN; + + break; + + 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) { + MSG_DEBUG("MmsBinaryDecodeContentType : __MmsDecodeGetFilename fail. (filename parameter)\n"); + goto __CATCH; + } + + if (MsgCheckFileNameHasInvalidChar(pMsgType->param.szFileName)) { + _MsgReplaceInvalidFileNameChar(pMsgType->param.szFileName, '_'); + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, length) == false) + goto __RETURN; + + break; + + case 0x89: //type = Constrained-encoding = Extension-Media | Short-integer + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeContentType: type _MmsBinaryDecodeGetOneByte fail\n"); + goto __CATCH; + } + + if (oneByte > 0x7f) { + pMsgType->param.type = _MmsGetBinaryType(MmsCodeContentType, + (UINT16)(oneByte & 0x7f)); + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, 1) == false) + goto __RETURN; + } else { + gCurMmsDecodeBuffPos--; + + textLength = 0; + szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + pMsgType->param.type = _MmsGetTextType(MmsCodeContentType, szTypeString); + + if (szTypeString) { + free(szTypeString); + szTypeString = NULL; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, textLength) == false) + goto __RETURN; + } + + break; + + case 0x8A: //start encoding version 1.2 + case 0x99: //start encoding version 1.4 + + textLength = 0; + szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + if (szTypeString) { + memset(pMsgType->param.szStart, 0, MMS_CONTENT_ID_LEN + 1); + strncpy(pMsgType->param.szStart, szTypeString, MMS_CONTENT_ID_LEN); + free(szTypeString); + szTypeString = NULL; + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, textLength) == false) + goto __RETURN; + } + + break; + + case 0x8B: //startInfo encoding version 1.2 + case 0x9A: //startInfo encoding version 1.4 + + textLength = 0; + szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + + if (szTypeString) { + memset(pMsgType->param.szStartInfo, 0, MMS_CONTENT_ID_LEN + 1); + strncpy(pMsgType->param.szStartInfo, szTypeString, MMS_CONTENT_ID_LEN); + + free(szTypeString); + szTypeString = NULL; + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, textLength) == false) + goto __RETURN; + } + + break; + + default: + + if (paramCode > 0x7F) { + MSG_DEBUG("MmsBinaryDecodeContentType: Unsupported parameter\n"); + + // 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; + } else { + /* + * Untyped Parameter = Token-text Untyped-value + * Token-text = Token End-of-string + * Untyped-value = Integer-value | Text-value + * Text-value = No-value | Token-text | Quoted-string + * + * Just increase pointer!!! + */ + + + /* Token-text */ + + gCurMmsDecodeBuffPos--; + valueLength++; + + textLength = 0; + szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, textLength) == false) + goto __RETURN; + + + /* Text-value */ + + if (__MmsBinaryDecodeInteger(pFile, &integer, &intLen, totalLength) == true) { + MSG_DEBUG("MmsBinaryDecodeContentType: Unsupported parameter(%d)\n", integer); + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, intLen) == false) + goto __RETURN; + } else { + textLength = 0; + szTypeValue = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + + if (szTypeValue) { + /* checkMe: forwardLock needs boudary string */ + if (strcasecmp(szTypeString, "boundary") == 0) { + memset(pMsgType->param.szBoundary, 0, MSG_BOUNDARY_LEN + 1); + strncpy(pMsgType->param.szBoundary, szTypeValue, MSG_BOUNDARY_LEN); +#ifdef FEATURE_JAVA_MMS + } else if (strcasecmp(szTypeString, "Application-ID") == 0) { + pMsgType->param.szApplicationID = (char*) malloc(textLength + 1); + memset(pMsgType->param.szApplicationID, 0, textLength + 1); + strncpy(pMsgType->param.szApplicationID, szTypeValue, textLength); + MSG_DEBUG("Application-ID:%s",pMsgType->param.szApplicationID); + } else if (strcasecmp(szTypeString,"Reply-To-Application-ID") == 0) { + pMsgType->param.szReplyToApplicationID= (char*) malloc(textLength + 1); + memset(pMsgType->param.szReplyToApplicationID, 0, textLength + 1); + strncpy(pMsgType->param.szReplyToApplicationID, szTypeValue, textLength); + MSG_DEBUG("ReplyToApplication-ID:%s",pMsgType->param.szReplyToApplicationID); +#endif + } + free(szTypeValue); + szTypeValue = NULL; + + MSG_DEBUG("MmsBinaryDecodeContentType: Unsupported parameter(%s)\n", szTypeValue); + if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, textLength) == false) + goto __RETURN; + } + } + + if (szTypeString) { + MSG_DEBUG("MmsBinaryDecodeContentType: Unsupported parameter(%s)\n", szTypeString); + free(szTypeString); + szTypeString = NULL; + } + } + + break; + } + } /*end of while loop*/ + + +__RETURN: + + if (szTypeString) { + free(szTypeString); + szTypeString = NULL; + } + + return true; + +__CATCH: + + if (szTypeString) { + free(szTypeString); + szTypeString = NULL; + } + return false; +} + + + +/** + * Decode Encoded Content type + * + * @param pEncodedData [in] ContentType encoded data + * @param pMsgType [out] Decoded MsgType + * @return Decoded address list + */ +int MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int totalLength) +{ + UINT8 oneByte = 0; + char *szTypeString = NULL; + int valueLength = 0; + int length = 0; + int textLength = 0; + + + /* + * Content-type-value : [WAPWSP 8.4.2.24] + * Preassigned content-types : [WAPWSP Appendix A, Table 40] + * The use of start-parameter : [RFC2387] and SHOULD be encoded according to [WAPWSP]. + * + * Content-type-value = Constrained-media | Content-general-form + * Content-general-form = Value-length Media-type + * Media-type = (Well-known-media | Extension-Media) *(Parameter) + */ + + MSG_DEBUG("MmsBinaryDecodeContentType: decoding content type..\n"); + + + length = __MmsDecodeValueLength(pFile, (UINT32*)&valueLength, totalLength); + if (length <= 0) { + /* + * Constrained-media or Single part message + * Constrained-media = Constrained-encoding = Extension-Media | Short-integer + * Extension-media = *TEXT End-of-string + * Short-integer = OCTET(1xxx xxxx) + */ + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeContentType: Constrained-media _MmsBinaryDecodeGetOneByte fail\n"); + goto __CATCH; + } + + if (oneByte > 0x7F) { + /* Short-integer */ + pMsgType->type = _MmsGetBinaryType(MmsCodeContentType, (UINT16)(oneByte & 0x7F)); + length = 1; + } else { + char *pszTemp = NULL; + + /* Extension-Media */ + gCurMmsDecodeBuffPos--; + + textLength = 0; + szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + + if (szTypeString && (strchr(szTypeString, ';')) != NULL) { + pszTemp = _MsgGetStringUntilDelimiter(szTypeString, ';'); + if (pszTemp) { + free(szTypeString); + szTypeString = pszTemp; + } + } + + pMsgType->type = _MmsGetTextType(MmsCodeContentType, szTypeString); + + length = textLength; + + if (szTypeString) { + free(szTypeString); + szTypeString = NULL; + } + } + } else { + /* + * Content-general-form = Value-length Media-type + * Media-type = (Well-known-media | Extension-Media)*(Parameter) + */ + + length += valueLength; + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeContentType: Well-known-media _MmsBinaryDecodeGetOneByte fail\n"); + goto __CATCH; + } + + if (oneByte > 0x7F) { + /* Well-known-media */ + pMsgType->type = _MmsGetBinaryType(MmsCodeContentType, (UINT16)(oneByte & 0x7F)); + valueLength--; + } else { + /* Extension-Media */ + gCurMmsDecodeBuffPos--; + + textLength = 0; + szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + pMsgType->type = _MmsGetTextType(MmsCodeContentType, szTypeString); + valueLength -= textLength; + + if (szTypeString) { + free(szTypeString); + szTypeString = NULL; + } + } + + MSG_DEBUG("MmsBinaryDecodeContentType: content type=%s\n", MmsDebugGetMimeType((MimeType)pMsgType->type)); + + + if (MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeContentType: Content-Type parameter fail\n"); + goto __CATCH; + } + } + + return length; + +__CATCH: + return -1; +} + + +bool MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int headerLen, int totalLength) +{ + UINT8 fieldCode = 0xff; + int length = 0; + UINT32 valueLength = 0; + char *pCode = NULL; + char *pValue = NULL; + char *pParam = NULL; + char ch = '\0'; + UINT8 oneByte = 0; + int textLength = 0; + int tmpInt = 0; + int tmpIntLen = 0; + char *pLatinBuff = NULL; + char *szSrc = NULL; + char *szTemp = NULL; + + + if (pFile == NULL || pMsgType == NULL) + return false; + + /* + * Message-header = Well-known-header | Application-header + * Well-known-header = Well-known-field-name Wap-value + * Application-header = Token-text Application-specific-value + * Well-known-field-name = Short-integer + * Application-specific-value = Text-string + */ + + while (headerLen > 0) { + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodePartHeader: field code GetOneByte fail\n"); + goto __CATCH; + } + + if (0x80 <= oneByte && oneByte <= 0xC7) { + /* Well-known-header = Well-known-field-name Wap-value (0x00 ~ 0x47) */ + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, 1) == false) + goto __RETURN; + + fieldCode = oneByte & 0x7f; + + switch (fieldCode) { + case 0x0E: //Content-Location + case 0x04: //Content-Location + + pLatinBuff = (char *)malloc(MMS_CONTENT_ID_LEN + 1); + if (pLatinBuff == NULL) + goto __CATCH; + + length = __MmsBinaryDecodeText(pFile, pLatinBuff, MMS_CONTENT_ID_LEN + 1, totalLength); + if (length == -1) { + MSG_DEBUG("MmsBinaryDecodePartHeader : __MmsBinaryDecodeQuotedString fail.\n"); + goto __CATCH; + } + + szSrc = MsgChangeHexString(pLatinBuff); + + if (szSrc) { + strcpy(pLatinBuff, szSrc); + free(szSrc); + szSrc = NULL; + } + + textLength = strlen(pLatinBuff); + + if (MsgLatin2UTF ((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) { + MSG_DEBUG("MmsBinaryDecodePartHeader: MsgLatin2UTF fail \n"); + goto __CATCH; + } + + free(pLatinBuff); + pLatinBuff = NULL; + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) + goto __RETURN; + + break; + + case 0x40: // Content-ID + + pLatinBuff = (char *)malloc(MMS_CONTENT_ID_LEN + 1); + if (pLatinBuff == NULL) + goto __CATCH; + + length = __MmsBinaryDecodeQuotedString(pFile, pLatinBuff, MMS_CONTENT_ID_LEN + 1, totalLength); + + if (length == -1) { + MSG_DEBUG("MmsBinaryDecodePartHeader : Content-ID __MmsBinaryDecodeQuotedString fail.\n"); + goto __CATCH; + } + + szSrc = MsgChangeHexString(pLatinBuff); + + if (szSrc) { + strcpy(pLatinBuff, szSrc); + free(szSrc); + szSrc = NULL; + } + + textLength = strlen(pLatinBuff); + if (MsgLatin2UTF ((unsigned char*)pMsgType->szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) { + MSG_DEBUG("MmsBinaryDecodePartHeader: MsgLatin2UTF fail \n"); + goto __CATCH; + } + free(pLatinBuff); + pLatinBuff = NULL; + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) + goto __RETURN; + + break; + + case 0x2E: // Content-Disposition + case 0x45: // Content-Disposition + + /* + * Content-disposition-value = Value-length Disposition *(Parameter) + * Disposition = Form-data | Attachment | Inline | Token-text + * Form-data = : 0x80 + * Attachment = : 0x81 + * Inline = : 0x82 + */ + + length = __MmsDecodeValueLength2(pFile, &valueLength, totalLength); + + if (length > 0) { + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) + goto __RETURN; + + } + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodePartHeader: Disposition value GetOneByte fail\n"); + goto __CATCH; + } + + if (length > 0) + valueLength--; + + if (oneByte >= 0x80) { + pMsgType->disposition = _MmsGetBinaryType(MmsCodeMsgDisposition, (UINT16)(oneByte & 0x7F)); + + if (pMsgType->disposition == INVALID_HOBJ) { + MSG_DEBUG("MmsBinaryDecodePartHeader : Content-Disposition _MmsGetBinaryType fail.\n"); + pMsgType->disposition = MSG_DISPOSITION_ATTACHMENT; // default + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, 1) == false) + goto __RETURN; + + if (MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodePartHeader: Disposition parameter fail\n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, valueLength) == false) + goto __RETURN; + } else { + + gCurMmsDecodeBuffPos--; + valueLength++; + + pLatinBuff = (char *)malloc(MSG_FILENAME_LEN_MAX); + memset(pLatinBuff, 0, MSG_FILENAME_LEN_MAX); + + textLength = __MmsBinaryDecodeText(pFile, pLatinBuff, MSG_FILENAME_LEN_MAX-1, totalLength); + + + if (textLength < 0) { + MSG_DEBUG("MmsBinaryDecodePartHeader : Content-Disposition decodingfail. \n"); + goto __CATCH; + } + free(pLatinBuff); + pLatinBuff = NULL; + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, textLength) == false) + goto __RETURN; + + valueLength -= textLength; + + if (MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) + { + MSG_DEBUG("MmsBinaryDecodePartHeader: Disposition parameter fail\n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, valueLength) == false) + goto __RETURN; + + } + + break; + + case 0x0B: //Content-Encoding + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodePartHeader: Disposition value GetOneByte fail\n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, 1) == false) + goto __RETURN; + + break; + + case 0x0C: //Content-Language + + if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&tmpInt, &tmpIntLen, totalLength) == true) { + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, tmpIntLen) == false) + goto __RETURN; + } else { + char* cTemp = NULL; + + cTemp = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + + if (cTemp == NULL) { + MSG_DEBUG("MmsBinaryDecodePartHeader : __MmsBinaryDecodeText2 fail...\n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, textLength) == false) { + if (cTemp) { + free(cTemp); + } + goto __RETURN; + } + + if (cTemp) + free(cTemp); + } + + break; + + case 0x0D: //Content-Length + + if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&tmpInt, &tmpIntLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodePartHeader : __MmsBinaryDecodeInteger fail...\n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, tmpIntLen) == false) + goto __RETURN; + + break; + + case 0x30: //X-Wap-Content-URI skip this value + + MSG_DEBUG("MmsBinaryDecodePartHeader : X-Wap-Content-URI header.\n"); + pLatinBuff = (char *)malloc(MMS_TEXT_LEN); + if (pLatinBuff == NULL) + goto __CATCH; + + length = __MmsBinaryDecodeText(pFile, pLatinBuff, MMS_TEXT_LEN, totalLength); + + if (length == -1) { + MSG_DEBUG("MmsBinaryDecodePartHeader : __MmsBinaryDecodeQuotedString fail.\n"); + goto __CATCH; + } + + MSG_DEBUG("MmsBinaryDecodePartHeader : X-Wap-Content-URI header decoded. Value length %d\n", length); + free(pLatinBuff); + pLatinBuff = NULL; + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) + goto __RETURN; + + MSG_DEBUG("MmsBinaryDecodePartHeader : X-Wap-Content-URI header skipped.\n"); + + break; + + 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 + The following rules are used to encode accept character set values. + Accept-charset-value = Constrained-charset | Accept-charset-general-form + Accept-charset-general-form = Value-length (Well-known-charset | Token-text) [Q-value] + Constrained-charset = Any-charset | Constrained-encoding + Well-known-charset = Any-charset | Integer-value + ; Both are encoded using values from Character Set Assignments table in Assigned Numbers + Any-charset = + ; Equivalent to the special RFC2616 charset value ¡°*¡± + */ + + int charset = 0; + int charSetLen = 0; + + MSG_DEBUG("MmsBinaryDecodePartHeader : Accept-charset. \n"); + + length = __MmsDecodeValueLength(pFile, &valueLength, totalLength); + if (length > 0) { + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) + goto __RETURN; + + } + + if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&charset, &charSetLen, totalLength) == false) { + // We only support the well-known-charset format + MSG_DEBUG("MmsBinaryDecodePartHeader : __MmsBinaryDecodeInteger fail...\n"); + goto __CATCH; + } + + if (charset > 0) + _MmsGetBinaryType(MmsCodeCharSet, (UINT16)charset); + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, charSetLen) == false) + goto __RETURN; + + break; + } + + default: + + /* Other Content-xxx headers : Have valueLength */ + + MSG_DEBUG("MmsBinaryDecodePartHeader : unknown Value = 0x%x\n", oneByte); + + length = __MmsDecodeValueLength(pFile, &valueLength, totalLength); + if (length <= 0) { + MSG_DEBUG("MmsBinaryDecodePartHeader : 1. invalid MMS_CODE_PREVIOUSLYSENTDATE \n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) + goto __RETURN; + + szTemp = (char *)malloc(valueLength); + if (szTemp == NULL) + goto __CATCH; + + if (_MmsBinaryDecodeGetBytes(pFile, szTemp, valueLength, totalLength) < 0) { + MSG_DEBUG("MmsBinaryDecodePartHeader : default _MmsBinaryDecodeGetBytes() fail\n"); + if (szTemp) { + free(szTemp); + szTemp = NULL; + } + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, valueLength) == false) + goto __RETURN; + + break; + } + } else { + /* + * Application-header = Token-text Application-specific-value + * Application-specific-value = Text-string + */ + + MSG_DEBUG(" MmsBinaryDecodePartHeader: Application-header = Token-text Application-specific-value \n"); + + gCurMmsDecodeBuffPos--; + + /* Token-text */ + + textLength = 0; + pCode = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + if (pCode == NULL) { + MSG_DEBUG("MmsBinaryDecodePartHeader: pCode is null\n"); + goto __CATCH; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, textLength) == false) + goto __RETURN; + + MSG_DEBUG(" MmsBinaryDecodePartHeader: Token-text (%s) \n", pCode); + + + /* Application-specific-value */ + + textLength = 0; + pValue = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + if (pValue == NULL) { + MSG_DEBUG("MmsBinaryDecodePartHeader: pValue is null\n"); + goto __CATCH; + } + + MSG_DEBUG(" MmsBinaryDecodePartHeader: Application-specific-value (%s) \n", pValue); + + + pParam = strchr(pValue, MSG_CH_ADDR_DELIMETER); + if (pParam) { + ch = *pParam; + *pParam = '\0'; + } + + switch (_MmsGetTextType(MmsCodeMsgBodyHeaderCode, pCode)) { + case MMS_BODYHDR_TRANSFERENCODING: // Content-Transfer-Encoding + pMsgType->encoding = _MmsGetTextType(MmsCodeContentTransferEncoding, pValue); + break; + + case MMS_BODYHDR_CONTENTID: // Content-ID + + pLatinBuff = (char *)malloc(MMS_CONTENT_ID_LEN + 1); + if (pLatinBuff == NULL) + { + goto __CATCH; + } + + MsgMIMERemoveQuote (pValue); + strncpy(pLatinBuff, pValue, MMS_MSG_ID_LEN); + + length = strlen(pLatinBuff); + if (MsgLatin2UTF ((unsigned char*)pMsgType->szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0) + { + MSG_DEBUG("MmsBinaryDecodePartHeader: MsgLatin2UTF fail \n"); + goto __CATCH; + } + + free(pLatinBuff); + pLatinBuff = NULL; + break; + + case MMS_BODYHDR_CONTENTLOCATION: // Content-Location + + pLatinBuff = (char *)malloc(MMS_CONTENT_ID_LEN + 1); + if (pLatinBuff == NULL) + goto __CATCH; + + strncpy(pLatinBuff, pValue, MMS_MSG_ID_LEN); + + length = strlen(pLatinBuff); + if (MsgLatin2UTF ((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0) { + MSG_DEBUG("MmsBinaryDecodePartHeader: MsgLatin2UTF fail \n"); + goto __CATCH; + } + + free(pLatinBuff); + pLatinBuff = NULL; + break; + + case MMS_BODYHDR_DISPOSITION: // Content-Disposition + pMsgType->disposition = _MmsGetTextType(MmsCodeMsgDisposition, pValue); + break; + + case MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY: // DRM RO WAITING + break; + + default: + MSG_DEBUG("Unknown Field : %s, Value: %s\n", pCode, pValue); + break; + } + + if (pParam) { + _MsgParseParameter(pMsgType, pParam + 1); + *pParam = ch; + } + if (pCode) { + free(pCode); + pCode = NULL; + } + if (pValue) { + free(pValue); + pValue = NULL; + } + + if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, textLength) == false) + goto __RETURN; + + } + } //while + +__RETURN: + + if (pLatinBuff) { + free(pLatinBuff); + pLatinBuff = NULL; + } + + if (szTemp) { + free(szTemp); + szTemp = NULL; + } + + if (pCode) { + free(pCode); + pCode = NULL; + } + + return true; + +__CATCH: + + if (pLatinBuff) { + free(pLatinBuff); + pLatinBuff = NULL; + } + if (pCode) { + free(pCode); + pCode = NULL; + } + if (pValue) { + free(pValue); + pValue = NULL; + } + + if (szTemp) { + free(szTemp); + szTemp = NULL; + } + + return false; +} + + +bool MmsBinaryDecodeEntries(FILE *pFile, UINT32 *npEntries, int totalLength) +{ + int length = 0; + + length = __MmsBinaryDecodeUintvar(pFile, npEntries, totalLength); + if (length <= 0) { + goto __CATCH; + } + + MSG_DEBUG("MmsBinaryDecodeEntries: Number of Entries = %d\n", *npEntries); + + return true; + +__CATCH: + return false; +} + + + +bool MmsBinaryDecodePartBody(FILE *pFile, UINT32 bodyLength, int totalLength) +{ + int offset = 0; + + /* + * Currently, offset and size is + * the only information used with msgBody. + * If you need, add here more information + */ + + MSG_DEBUG("MmsBinaryDecodePartBody: \n"); + + offset = _MmsGetDecodeOffset(); + offset += bodyLength; + + if (MsgFseek(pFile, offset, SEEK_SET) < 0) { + MSG_DEBUG("MmsBinaryDecodePartBody: fail to seek file pointer \n"); + goto __CATCH; + } + + _MmsCleanDecodeBuff(); + + gMmsDecodeCurOffset = offset; + + if (offset >= totalLength) + goto __RETURN; + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("_MmsBinaryDecodeGetOneByte: fail to load to buffer \n"); + goto __CATCH; + } + + return true; + +__RETURN: + return true; + +__CATCH: + return false; +} + + +static bool MmsBinaryDecodeMovePointer(FILE *pFile, int offset, int totalLength) +{ + if (offset > totalLength) + goto __RETURN; + + if (MsgFseek(pFile, offset, SEEK_SET) < 0) { + MSG_DEBUG("MmsBinaryDecodeMovePointer: fail to seek file pointer \n"); + goto __CATCH; + } + + _MmsCleanDecodeBuff(); + + gMmsDecodeCurOffset = offset; + + if (offset == totalLength) + goto __RETURN; + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMovePointer: fail to load to buffer \n"); + goto __CATCH; + } + +__RETURN: + return true; + +__CATCH: + return false; +} + + +bool MmsBinaryIsTextEncodedPart(FILE *pFile, int totalLength) +{ + UINT8 oneByte = 0; + int byteCount = 0; + + byteCount++; //check 0x0D + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) + goto __CATCH; + + if (oneByte != 0x0D) { + //it can be started "--" without 0x0D 0x0A + if (oneByte != 0x2D) { + goto __CATCH; + } else { + byteCount++; // check 0x2D ('-') + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) + goto __CATCH; + + if (oneByte != 0x2D) { + goto __CATCH; + } else { + goto __RETURN; + } + } + } else { + byteCount++; //check 0x0A + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) + goto __CATCH; + + if (oneByte != 0x0A) { + goto __CATCH; + } else { + byteCount++; // check 0x2D ('-') + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) + goto __CATCH; + + if (oneByte != 0x2D) { + goto __CATCH; + } else { + byteCount++; // check 0x2D ('-') + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) + goto __CATCH; + + if (oneByte != 0x2D) { + goto __CATCH; + } else { + goto __RETURN; + } + } + } + } + +__RETURN: + gCurMmsDecodeBuffPos -= byteCount; + return true; + +__CATCH: + gCurMmsDecodeBuffPos -= byteCount; + return false; +} + + +bool MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength) +{ + UINT32 nEntries = 0; + MsgMultipart *pMultipart = NULL; + MsgMultipart *pLastMultipart = NULL; + MsgMultipart *pPreMultipart = NULL; + int offset = 0; + int index = 0; + + MsgPresentationFactor factor = MSG_PRESENTATION_NONE; + MsgPresentaionInfo presentationInfo; + + MSG_DEBUG("MmsBinaryDecodeMultipart: total length=%d\n", totalLength); + + presentationInfo.factor = MSG_PRESENTATION_NONE; + presentationInfo.pCurPresentation = NULL; + presentationInfo.pPrevPart = NULL; + + if (MmsBinaryDecodeEntries(pFile, &nEntries, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMultipart: MmsBinaryDecodeEntries is fail.\n"); + goto __CATCH; + } + + while (nEntries) { + MSG_DEBUG("MmsBinaryDecodeMultipart: decoding %dth multipart\n", index); + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + if ((pMultipart = MsgAllocMultipart()) == NULL) { + MSG_DEBUG("MmsBinaryDecodeMultipart: MsgAllocMultipart Fail \n"); + goto __CATCH; + } + + if (MmsBinaryDecodeEachPart(pFile, szFilePath, &(pMultipart->type), pMultipart->pBody, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeMultipart: MmsBinaryDecodeEachPart is fail.(nEntries = %d)\n", nEntries); + goto __CATCH; + } + + if (pMsgType->param.type == MIME_APPLICATION_SMIL) { + factor = MsgIsPresentationEx(&(pMultipart->type), pMsgType->param.szStart, (MimeType)pMsgType->param.type); + } else { + factor = MSG_PRESENTATION_NONE; + } + // priority 1 : content type match, 2: content location, 3: type + if (presentationInfo.factor < factor) { + // Presentation part + presentationInfo.factor = factor; + presentationInfo.pPrevPart = pPreMultipart; + presentationInfo.pCurPresentation = pMultipart; + } + + if (pMsgBody->body.pMultipart == NULL) { + /* first multipart */ + pMsgBody->body.pMultipart = pMultipart; + pLastMultipart = pMultipart; + pPreMultipart = NULL; + } else if (pLastMultipart != NULL) { + pPreMultipart = pLastMultipart; + + pLastMultipart->pNext = pMultipart; + pLastMultipart = pMultipart; + } + + pMsgType->contentSize += pMultipart->pBody->size; + + nEntries--; + pPreMultipart = pMultipart; + MmsDebugPrintMulitpartEntry(pMultipart, index++); + + } + + pMsgBody->size = totalLength - pMsgBody->offset; + +#ifdef __SUPPORT_DRM__ + if (MmsDrm2GetConvertState() != MMS_DRM2_CONVERT_REQUIRED) +#endif + MsgConfirmPresentationPart(pMsgType, pMsgBody, &presentationInfo); + + if (MsgResolveNestedMultipart(pMsgType, pMsgBody) == false) { + MSG_DEBUG("MmsBinaryDecodeMultipart : MsgResolveNestedMultipart failed \n"); + goto __CATCH; + } + +__RETURN: + return true; + +__CATCH: + return false; +} + + +bool MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength) +{ + int length = 0; + bool bSuccess = false; + UINT32 headerLength = 0; + UINT32 bodyLength = 0; + int offset = 0; + + MSG_DEBUG("MmsBinaryDecodeEachPart: total length=%d\n", totalLength); + + /* header length */ + + if (__MmsBinaryDecodeUintvar(pFile, &headerLength, totalLength) <= 0) { + MSG_DEBUG("MmsBinaryDecodeEachPart: Get header length fail \n"); + goto __CATCH; + } + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + + /* body length */ + + if (__MmsBinaryDecodeUintvar(pFile, &bodyLength, totalLength) <= 0) { + MSG_DEBUG("MmsBinaryDecodeEachPart: Get body length fail\n"); + goto __CATCH; + } + + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + + /* Content Type */ + if (szFilePath != NULL) + strncpy(pMsgType->szOrgFilePath, szFilePath, strlen(szFilePath)); + + pMsgType->offset = _MmsGetDecodeOffset(); + pMsgType->size = headerLength; + pMsgType->contentSize = bodyLength; + + if (pMsgType->offset > totalLength) + goto __RETURN; + + length = MmsBinaryDecodeContentType(pFile, pMsgType, totalLength); + if (length <= 0) { + MSG_DEBUG("MmsBinaryDecodeEachPart: Decode contentType Fail \n"); + goto __CATCH; + } + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + + /* Part Header */ + + if (MmsBinaryDecodePartHeader(pFile, pMsgType, headerLength - length, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeEachPart: Decode contentHeader Fail \n"); + goto __CATCH; + } + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + /* Part Body */ + + if (szFilePath != NULL) + strncpy(pMsgBody->szOrgFilePath, szFilePath, strlen(szFilePath)); + + pMsgBody->offset = _MmsGetDecodeOffset(); + pMsgBody->size = bodyLength; + + if (pMsgBody->offset > totalLength) + goto __RETURN; + + switch (pMsgType->type) { + case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED: + case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED: + case MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC: + case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE: + case MIME_MULTIPART_REPORT: + case MIME_MULTIPART_MIXED: + case MIME_MULTIPART_RELATED: + case MIME_MULTIPART_ALTERNATIVE: + + MSG_DEBUG("MmsBinaryDecodeEachPart: Decode multipart\n"); + + if (MmsBinaryDecodeMultipart(pFile, szFilePath, pMsgType, pMsgBody, totalLength) == false) { + MSG_DEBUG("MmsBinaryDecodeEachPart: MmsBinaryDecodeMultipart is fail.\n"); + goto __CATCH; + } + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + break; + + +#ifdef __SUPPORT_DRM__ + + case MIME_APPLICATION_VND_OMA_DRM_MESSAGE: /* Contains forwardLock OR combined-delivery media part */ + MSG_DEBUG("MmsBinaryDecodeEachPart: MIME_APPLICATION_VND_OMA_DRM_MESSAGE Part \n"); + + if (MmsDrm2GetConvertState() != MMS_DRM2_CONVERT_NOT_FIXED && MmsDrm2GetConvertState() != MMS_DRM2_CONVERT_REQUIRED) { + + if (MmsBinaryDecodeDRMContent(pFile, szFilePath, pMsgType, pMsgBody, bodyLength, totalLength) == false) + goto __CATCH; + } else { + MmsDrm2SetConvertState(MMS_DRM2_CONVERT_REQUIRED); + + bSuccess = MmsBinaryDecodePartBody(pFile, bodyLength, totalLength); + if (bSuccess == false) { + MSG_DEBUG("MmsBinaryDecodeEachPart: Decode contentBody Fail \n"); + goto __CATCH; + } + } + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + break; + + case MIME_APPLICATION_VND_OMA_DRM_CONTENT: /* Contains seperate-delivery media part (DCF) */ + + MSG_DEBUG("MmsBinaryDecodeEachPart: MIME_APPLICATION_VND_OMA_DRM_CONTENT Part \n"); + + if (MmsBinaryDecodeDRMContent(pFile, szFilePath, pMsgType, pMsgBody, bodyLength, totalLength) == false) + goto __CATCH; + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + break; +#endif + + default: + MSG_DEBUG("MmsBinaryDecodeEachPart: Other normal Part \n"); + + bSuccess = MmsBinaryDecodePartBody(pFile, bodyLength, totalLength); + if (bSuccess == false) { + MSG_DEBUG("MmsBinaryDecodeEachPart: Decode contentBody Fail \n"); + goto __CATCH; + } + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + break; + } + + return true; + +__RETURN: + + return true; + +__CATCH: + + return false; +} + +#ifdef __SUPPORT_DRM__ +bool __MmsParseDCFInfo(FILE *pFile, MsgDRMInfo *pDrmInfo, int totalLength) +{ + UINT8 version = 0; + UINT8 contentTypeLen = 0; + UINT8 contentURILen = 0; + char *szContentType = NULL; + char *szContentURI = NULL; + + if (_MmsBinaryDecodeGetOneByte(pFile, &version, totalLength) == false) { + MSG_DEBUG("__MmsParseDCFInfo: [version] GetOneByte fail\n"); + goto __CATCH; + } + + if (_MmsBinaryDecodeGetOneByte(pFile, &contentTypeLen, totalLength) == false) { + MSG_DEBUG("__MmsParseDCFInfo: [contentTypeLen] GetOneByte fail\n"); + goto __CATCH; + } + + if (_MmsBinaryDecodeGetOneByte(pFile, &contentURILen, totalLength) == false) { + MSG_DEBUG("__MmsParseDCFInfo: [contentURILen] GetOneByte fail\n"); + goto __CATCH; + } + + //Get media content-type (mime-type) + szContentType = (char *)malloc(contentTypeLen + 1); + if (szContentType == NULL) + goto __CATCH; + + memset(szContentType, 0, contentTypeLen + 1); + + if (_MmsBinaryDecodeGetBytes(pFile, szContentType, contentTypeLen + 1, totalLength) < 0) { + MSG_DEBUG("__MmsParseDCFInfo : contentType is invalid\n"); + goto __CATCH; + } + gCurMmsDecodeBuffPos--; + pDrmInfo->contentType = (MsgContentType)_MsgGetCode(MSG_TYPE, szContentType); + + + //Get content-ID - 1.remover "cid:", 2.resolve "%hexa", 3.and copy the string + szContentURI = (char *)malloc(contentURILen + 1); + if (szContentURI == NULL) + goto __CATCH; + + memset(szContentURI, 0, contentURILen + 1); + + if (_MmsBinaryDecodeGetBytes(pFile, szContentURI, contentURILen + 1, totalLength) < 0) { + MSG_DEBUG("__MmsParseDCFInfo : contentType is invalid\n"); + goto __CATCH; + } + gCurMmsDecodeBuffPos--; + pDrmInfo->szContentURI = MsgResolveContentURI(szContentURI); + + + if (szContentType) { + free(szContentType); + szContentType = NULL; + } + + if (szContentURI) { + free(szContentURI); + szContentURI = NULL; + } + return true; + + +__CATCH: + + if (szContentType) { + free(szContentType); + szContentType = NULL; + } + + if (szContentURI) { + free(szContentURI); + szContentURI = NULL; + } + return false; + +} + + +bool __MmsParseDCFHdr(FILE *pFile, MsgDRMInfo *pDrmInfo, UINT32 headerLen, int totalLength) +{ + char *szDCFHdr = NULL; + MsgType partType; + ULONG nRead = 0; + int offset = 0; + + /* add to parse DCF header such as, + * Right-Issuer, Content-Name, and Content-Description. + */ + + szDCFHdr = (char *)malloc(headerLen + 1); + if (szDCFHdr == NULL) { + MSG_DEBUG("__MmsParseDCFHdr: szDCFHdr alloc fail\n"); + goto __CATCH; + } + memset(szDCFHdr, 0, headerLen + 1); + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + if (MsgFseek(pFile, offset, SEEK_SET) < 0) + goto __CATCH; + + if ((nRead = MsgReadFile(szDCFHdr, sizeof(char), headerLen, pFile)) == 0){ + goto __CATCH; + } + szDCFHdr[nRead] = '\0'; + + _MsgInitMsgType(&partType); + _MsgParsePartHeader(&partType, szDCFHdr, headerLen); + + pDrmInfo->szContentName = partType.drmInfo.szContentName; + pDrmInfo->szContentVendor = partType.drmInfo.szContentVendor; + pDrmInfo->szContentDescription = partType.drmInfo.szContentDescription; + pDrmInfo->szRightIssuer = partType.drmInfo.szRightIssuer; + + if (MmsBinaryDecodeMovePointer(pFile, offset + headerLen, totalLength) == false) + goto __CATCH; + +__RETURN: + + if (szDCFHdr) { + free(szDCFHdr); + szDCFHdr = NULL; + } + + return true; + +__CATCH: + + if (szDCFHdr) { + free(szDCFHdr); + szDCFHdr = NULL; + } + + return false; +} + + +bool MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength) +{ + int offset = 0; + char szTempFilePath[MSG_FILEPATH_LEN_MAX] = MSG_DATA_PATH"drm.dcf"; + char *pRawData = NULL; + bool isFileCreated = false; + + MSG_DEBUG("bodyLength: %d\n", bodyLength); + + offset = _MmsGetDecodeOffset(); + + if (offset >= totalLength) + goto __RETURN; + + if (szFilePath != NULL) + strncpy(pMsgBody->szOrgFilePath, szFilePath, strlen(szFilePath)); + if (szFilePath != NULL) + strncpy(pMsgType->szOrgFilePath, szFilePath, strlen(szFilePath)); + + pRawData = (char *)malloc(bodyLength); + if (pRawData == NULL) { + MSG_DEBUG("pRawData alloc FAIL \n"); + goto __CATCH; + } + + if (MsgFseek(pFile, offset, SEEK_SET) < 0) { + MSG_DEBUG("MsgFseek() returns -1 \n"); + goto __CATCH; + } + if (MsgReadFile(pRawData, sizeof(char), bodyLength, pFile) != (size_t)bodyLength) { + MSG_DEBUG("FmReadFile() returns false \n"); + goto __CATCH; + } + if (MsgOpenCreateAndOverwriteFile(szTempFilePath, pRawData, bodyLength) == false) { + MSG_DEBUG("MsgOpenCreateAndOverwriteFile() returns false \n"); + goto __CATCH; + } + + isFileCreated = true; + MSG_DEBUG("MmsDrm2GetConvertState() [%d]", MmsDrm2GetConvertState()); + + if (pMsgType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE && (MmsDrm2GetConvertState()!=MMS_DRM2_CONVERT_FINISH)) { + MmsDrm2SetConvertState(MMS_DRM2_CONVERT_REQUIRED); + } else { + if (MsgDRM2GetDRMInfo(szTempFilePath, pMsgType) == false) { + MSG_DEBUG("MsgDRM2GetDRMInfo() returns false \n"); + goto __CATCH; + } + } + + remove(szTempFilePath); + isFileCreated = false; + + if (MmsBinaryDecodeMovePointer(pFile, offset + bodyLength, totalLength) == false) + goto __CATCH; + +__RETURN: + + if (pRawData) { + free(pRawData); + pRawData = NULL; + } + + return true; + +__CATCH: + if (isFileCreated) + remove(szTempFilePath); + + if (pRawData) { + free(pRawData); + pRawData = NULL; + } + + return false; +} + + +bool MmsBinaryDecodeDRMMessage(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int fullBodyLength, int totalLength) +{ + int offset = 0; + char szTempFilePath[MSG_FILEPATH_LEN_MAX] = "/User/Msg/Mms/Temp/drm.dm"; + char *pRawData = NULL; + bool isFileCreated = false; + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + if (szFilePath != NULL) + strncpy(pMsgBody->szOrgFilePath, szFilePath, strlen(szFilePath)); + if (szFilePath != NULL) + strncpy(pMsgType->szOrgFilePath, szFilePath, strlen(szFilePath)); + + pRawData = (char *)malloc(fullBodyLength); + if (pRawData == NULL) { + MSG_DEBUG("pRawData alloc FAIL \n"); + goto __CATCH; + } + + if (MsgFseek(pFile, offset, SEEK_SET) < 0) { + MSG_DEBUG("MsgFseek() returns -1 \n"); + goto __CATCH; + } + + if (MsgReadFile(pRawData, sizeof(char), fullBodyLength, pFile)!= (size_t)fullBodyLength) { + MSG_DEBUG("FmReadFile() returns false \n"); + goto __CATCH; + } + + if (MsgOpenCreateAndOverwriteFile(szTempFilePath, pRawData, fullBodyLength) == false) { + MSG_DEBUG("MsgOpenCreateAndOverwriteFile() returns false \n"); + goto __CATCH; + } + isFileCreated = true; + + if (strstr(szTempFilePath, ".dm")) { + char szConvertedFilePath[MSG_FILEPATH_LEN_MAX] = {0,}; + + if (MsgDrmConvertDmtoDcfType(szTempFilePath, szConvertedFilePath)) { + remove(szTempFilePath); + memset(szTempFilePath, 0, MSG_FILEPATH_LEN_MAX); + strncpy(szTempFilePath, szConvertedFilePath, MSG_FILEPATH_LEN_MAX-1); + } + } + + if (MsgDRM2GetDRMInfo(szTempFilePath, pMsgType) == false) { + MSG_DEBUG("MsgDRM2GetDRMInfo() returns false \n"); + goto __CATCH; + } + + remove(szTempFilePath); + isFileCreated = false; + + if (MmsBinaryDecodeMovePointer(pFile, offset + fullBodyLength, totalLength) == false) + goto __CATCH; + +__RETURN: + + if (pRawData) { + free(pRawData); + pRawData = NULL; + } + return true; + +__CATCH: + if (isFileCreated) + remove(szTempFilePath); + + if (pRawData) { + free(pRawData); + pRawData = NULL; + } + return false; +} + +static int __MmsDrm2BinaryEncodeUintvarLen(UINT32 integer) +{ + UINT32 length = 0; + + /* Find encoded unitvar length */ + if (integer <= MMS_UINTVAR_LENGTH_1) { + length = 1; + } else { + if (integer <= MMS_UINTVAR_LENGTH_2) { + length = 2; + } else { + if (integer <= MMS_UINTVAR_LENGTH_3) { + length = 3; + } else { + length = 4; + } + } + } + + return length; +} + + +static bool __MmsDrm2BinaryEncodeUintvar(UINT32 integer, int length, char *pszOutput) +{ + const char ZERO = 0x00; + int i = 2; + char szReverse[MSG_STDSTR_LONG] = {0, }; + + union { + UINT32 integer; + char bytes[4]; + } source; + source.integer = integer; + memset(szReverse, 0, MSG_STDSTR_LONG); + + /* Seperate integer to 4 1 byte integer */ + szReverse[3] = source.bytes[3] & 0x0f; + szReverse[0] = source.bytes[0]; + szReverse[0] = szReverse[0] & 0x7f; + + while (length >= i) {// initially, i = 2 + /* Move integer bit to proper position */ + source.integer = source.integer << 1; + source.integer = source.integer >> 8; + source.bytes[3] = ZERO; + + /* Retrive 1 encode uintvar */ + szReverse[i-1] = source.bytes[0]; + szReverse[i-1] = szReverse[i-1] | 0x80; + i++; + } + + for (i=0; i < length; i++) + pszOutput[i] = szReverse[length - i - 1]; + + return true; +} + + +static int __MmsDrm2GetEntriesValueLength(FILE *pFile, int orgOffset) +{ + char szEntries[5] = {0, }; + UINT8 oneByte = 0; + int j = 0; //j is the length of nEntries value + + if (MsgReadFile(szEntries, sizeof(char), 4, pFile) != (size_t)4) { + MSG_DEBUG("__MmsDrm2GetEntriesValueLength: FmReadFile() returns false \n"); + return false; + } + + while (true) { + oneByte = szEntries[j++]; + + if (oneByte <= 0x7f) + break; + } + + //move file pointer to point nEntries + if (MsgFseek(pFile, orgOffset, SEEK_SET) < 0) { + MSG_DEBUG("__MmsDrm2GetEntriesValueLength: fail to seek file pointer\n"); + return false; + } + + return j; +} + + +static bool __MmsDrm2WriteDataToConvertedFile(FILE *pSrcFile, FILE *pDestinationFile, char *pszMmsLoadTempBuf, int length, int bufLen) +{ + int loadLen = 0, totalLoadLen = 0, nRead = 0; + + for (int i=0; i<(length/bufLen)+1; i++) { + loadLen = (length-totalLoadLen < bufLen) ? length-totalLoadLen : bufLen; + + memset(pszMmsLoadTempBuf, 0, MMS_DRM2_CONVERT_BUFFER_MAX + 1); + + if (MsgReadFile(pszMmsLoadTempBuf, sizeof(char), loadLen, pSrcFile) != (size_t)loadLen) { + MSG_DEBUG("__MmsDrm2WriteDataToConvertedFile: FmReadFile() returns false \n"); + return false; + } + + if (MsgWriteFile(pszMmsLoadTempBuf, sizeof(char), loadLen, pDestinationFile) != (size_t)loadLen) { + MSG_DEBUG("__MmsDrm2WriteDataToConvertedFile: File Writing is failed.\n"); + return false; + } + + totalLoadLen += nRead; + } + + return true; +} + + +/************************************************************************* + * description : make new message file converting CD & FL part of original message file to SD type + * argument : void + * return value + - bool : result of converting +**************************************************************************/ +bool MmsDrm2ConvertMsgBody(char *szOriginFilePath) +{ + FILE *pFile = NULL; + FILE *hConvertedFile = NULL; + FILE *hTempFile = NULL; + FILE *hFile = NULL; + MsgMultipart *pMultipart = NULL; + char szTempFilePath[MSG_FILEPATH_LEN_MAX] = MSG_DATA_PATH"Drm_Convert"; + char szTempFile[MSG_FILEPATH_LEN_MAX] = MSG_DATA_PATH"temp.dm"; + char *pszMmsLoadTempBuf = NULL; + char *pszOrgData = NULL; + int length = 0; + int bufLen = MMS_DRM2_CONVERT_BUFFER_MAX; + int curOffset = 0; + + MSG_DEBUG("start convert~~~~~~\n"); + + pFile = MsgOpenFile(szOriginFilePath, "rb"); + if (pFile == NULL) { + MSG_DEBUG("Open decode temporary file fail\n"); + goto __CATCH; + } + + hConvertedFile = MsgOpenFile(MMS_DECODE_DRM_CONVERTED_TEMP_FILE, "wb+"); + if (hConvertedFile == NULL) { + MSG_DEBUG("Open decode temporary file fail\n"); + goto __CATCH; + } + + pszMmsLoadTempBuf = (char*)malloc(MMS_DRM2_CONVERT_BUFFER_MAX + 1); + if (pszMmsLoadTempBuf == NULL) { + MSG_DEBUG("malloc for pszMmsLoadTempBuf failed\n"); + goto __CATCH; + } + memset(pszMmsLoadTempBuf, 0, MMS_DRM2_CONVERT_BUFFER_MAX + 1); + + // MMS Header copy + length = mmsHeader.msgBody.offset; + if (__MmsDrm2WriteDataToConvertedFile(pFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { + MSG_DEBUG("Write header data fail\n"); + goto __CATCH; + } + + curOffset += length; //change offset + + // MMS Body copy + if (MsgIsMultipart(mmsHeader.msgType.type) == true) + { + // nEntries copy + length = __MmsDrm2GetEntriesValueLength(pFile, curOffset); // getting nEntries value's length + + if (__MmsDrm2WriteDataToConvertedFile(pFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { + MSG_DEBUG("Write nEntries fail\n"); + goto __CATCH; + } + + curOffset += length; //change offset + + // each Multipart entry copy + pMultipart = mmsHeader.msgBody.body.pMultipart; + + while (pMultipart) { + if (pMultipart->type.type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE) { + int orgDataLen = pMultipart->pBody->size; + int nSize = 0; + + MSG_DEBUG("Write MIME_APPLICATION_VND_OMA_DRM_MESSAGE multipart data(orgDataLen = %d).\n", orgDataLen); + + pszOrgData = (char *)malloc(orgDataLen + 1); + if (pszOrgData == NULL) { + MSG_DEBUG("pszOrgData is NULL \n"); + goto __CATCH; + } + memset(pszOrgData, 0, orgDataLen + 1); + + // move file pointer to data + if (MsgFseek(pFile, pMultipart->pBody->offset, SEEK_SET) < 0) { + MSG_DEBUG("fail to seek file pointer 1\n"); + goto __CATCH; + } + + if (MsgReadFile(pszOrgData, sizeof(char), orgDataLen, pFile) != (size_t)orgDataLen) { + MSG_DEBUG("FmReadFile() returns false for orgData\n"); + goto __CATCH; + } + + if((hFile = MsgOpenFile(szTempFile, "wb+")) == NULL) { + MSG_DEBUG("file open failed [%s]", szTempFile); + goto __CATCH; + } + + if (MsgWriteFile(pszOrgData, sizeof(char), orgDataLen, hFile) != (size_t)orgDataLen) { + MSG_DEBUG("File write error"); + goto __CATCH; + } + + MsgFflush(hFile); + MsgCloseFile(hFile); + + hFile = NULL; + + // --> invoking drm agent api, converting data part start + MSG_DEBUG("start data part convert by callling drm agent api\n"); + + int ret = 0; + ret = MsgDrmConvertDmtoDcfType(szTempFile, szTempFilePath); + MSG_DEBUG("MsgDrmConvertDmtoDcfType returned %s", ret ? "true": "false"); + + if (MsgGetFileSize(szTempFilePath, &nSize) == false) { + MSG_DEBUG("MsgGetFileSize error"); + goto __CATCH; + } + MSG_DEBUG("MmsDrm2ConvertMsgBody: end data part convert(converted data len = %d)\n", nSize); + // <-- invoking drm agent api, converting data part end + + // move file pointer to the head of multipart + if (MsgFseek(pFile, curOffset, SEEK_SET) < 0) { + MSG_DEBUG("fail to seek file pointer 2\n"); + goto __CATCH; + } + + // read headerLen, dataLen + length = pMultipart->type.offset - curOffset; + memset(pszMmsLoadTempBuf, 0, MMS_DRM2_CONVERT_BUFFER_MAX + 1); + if (MsgReadFile(pszMmsLoadTempBuf, sizeof(char), length, pFile) != (size_t)length) { + MSG_DEBUG("FmReadFile() returns false for headerLen, dataLen\n"); + goto __CATCH; + } + + curOffset += length; + + // change dataLen based on converted data + { + UINT8 oneByte = 0; + int j = 0; + int encodeLen = 0; + char szOutput[MSG_STDSTR_LONG] = {0, }; + + while (true) { + oneByte = pszMmsLoadTempBuf[j++]; + + if (oneByte <= 0x7f) + break; + } + + encodeLen = __MmsDrm2BinaryEncodeUintvarLen((UINT32)nSize); + __MmsDrm2BinaryEncodeUintvar((UINT32)nSize, encodeLen, szOutput); + + strncpy(&(pszMmsLoadTempBuf[j]), szOutput, encodeLen); + pszMmsLoadTempBuf[j+encodeLen] = '\0'; + + if (MsgWriteFile(pszMmsLoadTempBuf, sizeof(char), length, hConvertedFile) != (size_t)length) { + MSG_DEBUG("Drm2WriteConvertData: FmWriteFile() returns false for dateLen\n"); + goto __CATCH; + } + } + + + length = pMultipart->pBody->offset - pMultipart->type.offset; + + if (__MmsDrm2WriteDataToConvertedFile(pFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { + MSG_DEBUG("Drm2WriteConvertData: Write content type, headers fail\n"); + goto __CATCH; + } + + curOffset += length; + + // write converted data + hTempFile = MsgOpenFile(szTempFilePath, "rb"); + if (hTempFile == NULL) { + MSG_DEBUG("Open decode temporary file fail\n"); + goto __CATCH; + } + + length = nSize; + + if (__MmsDrm2WriteDataToConvertedFile(hTempFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { + MSG_DEBUG("Write converted data fail\n"); + goto __CATCH; + } + + if (hTempFile != NULL) { + MsgCloseFile(hTempFile); + hTempFile = NULL; + } + + curOffset += pMultipart->pBody->size; + + // move file pointer to the head of multipart + if (MsgFseek(pFile, curOffset, SEEK_SET) < 0) { + MSG_DEBUG("fail to seek file pointer \n"); + goto __CATCH; + } + } else { // it doesn't need to convert if it is not CD or FL + MSG_DEBUG("Write normal multipart data\n"); + + length = pMultipart->pBody->offset + pMultipart->pBody->size - curOffset; + + if (__MmsDrm2WriteDataToConvertedFile(pFile, hConvertedFile, pszMmsLoadTempBuf, length, bufLen) == false) { + MSG_DEBUG("Write multipart data fail \n"); + goto __CATCH; + } + + curOffset += length; + } + + pMultipart = pMultipart->pNext; + } + } + + MSG_DEBUG("end convert~~~~~~\n"); + + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; + } + + if (hConvertedFile != NULL) { + MsgCloseFile(hConvertedFile); + hConvertedFile = NULL; + } + + if (hTempFile != NULL) { + MsgCloseFile(hTempFile); + hTempFile = NULL; + } + + if (pszMmsLoadTempBuf) { + free(pszMmsLoadTempBuf); + pszMmsLoadTempBuf = NULL; + } + + if (pszOrgData) { + free(pszOrgData); + pszOrgData = NULL; + } + + if (hFile != NULL) { + MsgCloseFile(hFile); + hFile = NULL; + } + + remove(szTempFile); + remove(szTempFilePath); + + return true; + +__CATCH: + + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; + } + + if (hConvertedFile != NULL) { + MsgCloseFile(hConvertedFile); + hConvertedFile = NULL; + } + + if (hTempFile != NULL) { + MsgCloseFile(hTempFile); + hTempFile = NULL; + } + + if (pszMmsLoadTempBuf) { + free(pszMmsLoadTempBuf); + pszMmsLoadTempBuf = NULL; + } + + if (pszOrgData) { + free(pszOrgData); + pszOrgData = NULL; + } + + if (hFile != NULL) + { + MsgCloseFile(hFile); + hFile = NULL; + } + + remove(szTempFile); + remove(szTempFilePath); + remove(MMS_DECODE_DRM_CONVERTED_TEMP_FILE); //remove convertin result if it goes to __CATCH + + return false; +} + + +/************************************************************************* + * description : Function for decoding a converted file + * argument : void + * return value + - bool : result of converting +**************************************************************************/ +bool MmsDrm2DecodeConvertedMsg(int msgID, char *pszFullPath) +{ + FILE *hConvertedFile = NULL; + int nSize = 0; + + MSG_DEBUG("MmsDrm2DecodeConvertedMsg: start re-decoding~~~~~~\n"); + + // free + _MsgFreeDRMInfo(&mmsHeader.msgType.drmInfo); + _MsgFreeBody(&mmsHeader.msgBody, mmsHeader.msgType.type); + + _MmsInitHeader(); + _MmsUnregisterDecodeBuffer(); + + // start decoding + _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX); + + // open converted file + if ((hConvertedFile = MsgOpenFile(MMS_DECODE_DRM_CONVERTED_TEMP_FILE, "rb")) == NULL) { + MSG_DEBUG("MmsDrm2ReDecodeMsg: opening temporary file failed\n"); + goto __CATCH; + } + + if (MsgGetFileSize(MMS_DECODE_DRM_CONVERTED_TEMP_FILE, &nSize) == false) { + MSG_DEBUG("MsgGetFileSize: failed\n"); + goto __CATCH; + } + + if (!MmsBinaryDecodeMsgHeader(hConvertedFile, nSize)) { + MSG_DEBUG("MmsDrm2ReDecodeMsg: decoding header(binary mode) failed\n"); + goto __CATCH; + } + + if (!MmsBinaryDecodeMsgBody(hConvertedFile, pszFullPath, nSize)) { + MSG_DEBUG("MmsDrm2ReDecodeMsg: decoding body failed\n"); + goto __CATCH; + } + + if (hConvertedFile != NULL) { + MsgCloseFile(hConvertedFile); + hConvertedFile = NULL; + } + + return true; + +__CATCH: + + if (hConvertedFile != NULL) { + MsgCloseFile(hConvertedFile); + remove(MMS_DECODE_DRM_CONVERTED_TEMP_FILE); + hConvertedFile = NULL; + } + + return false; +} + + +bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath) +{ + MmsMsg *pMmsMsg; + MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg); + _MmsUnregisterDecodeBuffer(); +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pMmsMsg->msgType.drmInfo); +#endif + _MsgFreeBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type); + + if (_MmsReadMsgBody(pMsg->msgId, bSavePartsAsTempFiles, bRetrieved, retrievedPath) == false) { + MSG_DEBUG("MmsDrm2ReadMsgConvertedBody: _MmsReadMsgBody with converted file is failed\n"); + return false; + } + + return true; +} + +#endif + +/* -------------------------------------------------------------------- + * + * B I N A R Y D E C D E U T I L I T Y + * + * --------------------------------------------------------------------*/ + +bool _MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength) +{ + int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos; + + if (pFile == NULL || pOneByte == NULL) + { + MSG_DEBUG("_MmsBinaryDecodeGetOneByte: invalid file or buffer\n"); + goto __CATCH; + } + + if (length < 1) { + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("_MmsBinaryDecodeGetOneByte: fail to load to buffer \n"); + goto __CATCH; + } + } + + *pOneByte = gpCurMmsDecodeBuff[gCurMmsDecodeBuffPos++]; + + return true; + +__CATCH: + return false; +} + + +/* + * @remark: bufLen < gMmsDecodeMaxLen + */ +bool _MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength) +{ + int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos; + int i = 0; + + + if (pFile == NULL || szBuff == NULL || bufLen == 0 || bufLen > gMmsDecodeMaxLen) + goto __CATCH; + + memset(szBuff, 0, bufLen); + + if (length < bufLen) { + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("_MmsBinaryDecodeGetBytes: fail to load to buffer \n"); + goto __CATCH; + } + } + + for (i = 0; i < bufLen - 1; i++) + szBuff[i] = gpCurMmsDecodeBuff[gCurMmsDecodeBuffPos++]; + + + gCurMmsDecodeBuffPos++; //NULL + + return true; + +__CATCH: + return false; +} + + + +bool _MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength) +{ + int iPos = 0; + + if (pFile == NULL || szBuff == NULL || bufLen == 0) + goto __CATCH; + + memset(szBuff, 0, bufLen); + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("_MmsBinaryDecodeGetLongBytes: fail to load to buffer \n"); + goto __CATCH; + } + + while ((bufLen - iPos) >= gMmsDecodeMaxLen) { + if (_MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, gMmsDecodeMaxLen, totalLength) == false) { + MSG_DEBUG("_MmsBinaryDecodeGetLongBytes: 1. _MmsBinaryDecodeGetBytes fail \n"); + goto __CATCH; + } + + iPos += gMmsDecodeMaxLen; + } + + if ((bufLen - iPos) > 0) { + if (_MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, (bufLen - iPos), totalLength) == false) { + MSG_DEBUG("_MmsBinaryDecodeGetLongBytes: 2. _MmsBinaryDecodeGetBytes fail \n"); + goto __CATCH; + } + + iPos += (bufLen - iPos); + } + + return true; + +__CATCH: + return false; +} + + +/** + * Decode uintvar to 32bit unsigned integer + * + * @param pEncodedData [in] encoded data + * @param pUintVar [out] Decode uintvar (32bit unsigned integer) + * @return The length of uintvar (-1, if cannot be converted to a uintvar) + * + * 0 XXXXXXX -> 0-bit: continue bit & 1~7bit: integer value + * - ------- + */ +static const UINT32 uintvarDecodeTable[] = { 0x00000001, 0x00000080, 0x00004000, 0x00100000, 0x08000000 }; + +static int __MmsBinaryDecodeUintvar(FILE *pFile, UINT32 *pUintVar, int totalLength) +{ + UINT8 count = 0; + UINT8 oneByte = 0; + UINT32 decodedUintvar = 0; + UINT8 iBuff[5] = {0}; + int length = MSG_MMS_DECODE_BUFFER_MAX - gCurMmsDecodeBuffPos; + + + if (pFile == NULL || pUintVar == NULL) + return -1; + + if (length < 5) { + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeUintvar: fail to load to buffer \n"); + goto __CATCH; + } + } + + while (true) { + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) + goto __CATCH; + + if (oneByte > 0x7f) { + iBuff[count++] = oneByte; + } else { + iBuff[count++] = oneByte; + break; + } + + if (count > 5) { + MSG_DEBUG("__MmsBinaryDecodeUintvar : legnth is too long\n"); + goto __CATCH; + } + } + + for (int i = 0; i < count; i++) + decodedUintvar += (uintvarDecodeTable[i] * (iBuff[count-(i+1)]&0x7f)); + + *pUintVar = decodedUintvar; + + return count; + +__CATCH: + gCurMmsDecodeBuffPos -= count; + return -1; +} + + +/** + * Decode uintvar to 32bit unsigned integer by uintvar length + * + * @param pEncodedData [in] uintvar encoded data + * @param length [in] length of integer value + * @return unsigned integer value + */ +static UINT32 __MmsHeaderDecodeIntegerByLength(FILE *pFile, UINT32 length, int totalLength) +{ + UINT32 i = 0; + UINT8 oneByte = 0; + char *pData = NULL; + union { + UINT32 integer; + UINT8 seg[4]; + } returner; + + returner.integer = 0; + + if (length > 4) + length = 4; + + if (length == 1) + { + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("__MmsHeaderDecodeIntegerByLength: _MmsBinaryDecodeGetOneByte fail\n"); + return oneByte; + } + + if (oneByte > 0x7f) { + return (oneByte & 0x7f); + } else { + return oneByte; + } + } + + if (length == 0) + return 0; + + pData = (char *)malloc(length + 1); + if (pData == NULL) { + MSG_DEBUG("__MmsHeaderDecodeIntegerByLength: pData alloc fail\n"); + goto __CATCH; + } + memset(pData, 0, length + 1); + + if (_MmsBinaryDecodeGetBytes(pFile, pData, length + 1, totalLength) == false) { + MSG_DEBUG("__MmsHeaderDecodeIntegerByLength: _MmsBinaryDecodeGetOneByte fail\n"); + goto __CATCH; + } + + gCurMmsDecodeBuffPos--; // - NULL + + for (i= 0; i < length; i++) + returner.seg[length - (i+1)] = pData[i]; + + if (pData) { + free(pData); + pData = NULL; + } + + return returner.integer; + +__CATCH: + + if (pData) { + free(pData); + pData = NULL; + } + + return returner.integer; +} + + +/** + * Decode uintvar to 32bit unsigned integer by uintvar length + * + * @param pEncodedData [in] uintvar encoded data + * @param pInteger [out] Decode integer value (long/short) + * @return unsigned integer value (-1, if cannot be converted to unsigned integer value) + */ +static bool __MmsBinaryDecodeInteger(FILE *pFile, UINT32 *pInteger, int *pIntLen, int totalLength) +{ + UINT8 oneByte = 0; + char *pData = NULL; + union { + UINT32 integer; + UINT8 seg[4]; + } returner; + + + if (pInteger == NULL) + return false; + + returner.integer = 0; + *pIntLen = 0; + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeInteger: GetOneByte fail\n"); + return false; + } + + if (oneByte < 0x1F) /* long integer : WAP-230-WSP-20010118-p, Proposed Version 18 January 2001 (pp.86) */ + { + pData = (char *)malloc(oneByte + 1); + if (pData == NULL) { + MSG_DEBUG("__MmsBinaryDecodeInteger: pData memalloc fail\n"); + goto __CATCH; + } + memset(pData, 0, oneByte + 1); + + // Even NULL is copied in the _MmsBinaryDecodeGetBytes + if (_MmsBinaryDecodeGetBytes(pFile, pData, oneByte + 1, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeInteger: GetBytes fail\n"); + goto __CATCH; + } + + gCurMmsDecodeBuffPos--; // - NULL + + int length = 0; + if (oneByte > 4) { + length = 4; + } else { + length = oneByte; + } + + int i = 0; + for (i = 0; i < length; i++) + returner.seg[length - (i+1)] = pData[i]; + + *pInteger = returner.integer; + *pIntLen = oneByte + 1; + } else if (oneByte >= 0x80) { + /* short integer : WAP-230-WSP-20010118-p, Proposed Version 18 January 2001 (pp.86) */ + *pInteger = oneByte & 0x7f; + *pIntLen = 1; + } else { + goto __CATCH; + } + + if (pData) { + free(pData); + pData = NULL; + } + + return true; + +__CATCH: + + gCurMmsDecodeBuffPos--; + + if (pData) { + free(pData); + pData = NULL; + } + + return false; +} + + +/** + * Decode uintvar to 32bit unsigned integer by uintvar length + * + * @return 1 : Success + * 0 : This is not Value Length type data + * -1 : Requires System error report + */ +static int __MmsDecodeValueLength(FILE *pFile, UINT32 *pValueLength, int totalLength) +{ + int length = 0; + UINT32 uintvar = 0; + UINT8 oneByte = 0; + + + /* + * value-length = short-length | (Length-quote Length) + * = 0~30 | 31 + Uintvar-length + */ + + if (pFile == NULL || pValueLength == NULL) + goto __CATCH; + + *pValueLength = 0; + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + gCurMmsDecodeBuffPos--; + goto __CATCH; + } + + if (0x00 < oneByte && oneByte < 0x1F) { + /* short-length */ + + *pValueLength = oneByte; + length = 1; + } else if (oneByte == 0x1F) { + /* Length-quote = 0x1F */ + + length = __MmsBinaryDecodeUintvar(pFile, &uintvar, totalLength); + if (length == -1) { + MSG_DEBUG("__MmsDecodeValueLength: __MmsBinaryDecodeUintvar fail..\n"); + goto __CATCH; + } + length ++; // + length-quote + *pValueLength = uintvar; + } else { + MSG_DEBUG("__MmsDecodeValueLength: not a value length type data\n"); + gCurMmsDecodeBuffPos--; + return 0; + } + + return length; + +__CATCH: + MSG_DEBUG("__MmsDecodeValueLength: getting data fail\n"); + return -1; +} + + + +/** + * Decode uintvar to 32bit unsigned integer by uintvar length + * + * @return 1 : Success + * 0 : This is not Value Length type data + * -1 : Requires System error report + * @ defference : if there is not length-quote, consider it as short length. + */ +static int __MmsDecodeValueLength2(FILE *pFile, UINT32 *pValueLength, int totalLength) +{ + int length = 0; + UINT32 uintvar = 0; + UINT8 oneByte = 0; + + + /* + * value-length = short-length | (Length-quote Length) + * = 0~30 | 31 + Uintvar-length + */ + + if (pFile == NULL || pValueLength == NULL) + goto __CATCH; + + *pValueLength = 0; + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { + gCurMmsDecodeBuffPos--; + goto __CATCH; + } + + if (0x00 < oneByte && oneByte < 0x1F) { + /* short-length */ + + *pValueLength = oneByte; + length = 1; + } else if (oneByte == 0x1F) { + /* Length-quote = 0x1F */ + + length = __MmsBinaryDecodeUintvar(pFile, &uintvar, totalLength); + if (length == -1) { + MSG_DEBUG("__MmsDecodeValueLength2: __MmsBinaryDecodeUintvar fail..\n"); + goto __CATCH; + } + length ++; // + length-quote + *pValueLength = uintvar; + } else { + MSG_DEBUG("__MmsDecodeValueLength2: there is not length-quote, consider it as short length.\n"); + *pValueLength = oneByte; + length = 1; + } + + return length; + +__CATCH: + MSG_DEBUG("__MmsDecodeValueLength2: getting data fail\n"); + return -1; +} + + + +/** + * Decode QuotedString + * + * @param pEncodedData [in] QuotedString encoded data + * @param szBuff [out] Decoded quoted string + * @param bufLen [out] Buffer length + * @return length of quoted string + */ +static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen, int totalLength) +{ + int iPos = 0; + int length = 0; + int readBytes = 0; + char *pData = NULL; + int returnLength = 0; + + /* + * Quoted-string = *TEXT End-of-string + * The TEXT encodes an RFC2616 Quoted-string with the enclosing quotation-marks <"> removed + */ + + if (pFile == NULL || szBuff == NULL || bufLen <= 0) + return -1; + + memset(szBuff, 0, bufLen); + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeQuotedString: 1. fail to load to buffer \n"); + goto __CATCH; + } + + length = strlen(gpCurMmsDecodeBuff) + 1; // + NULL + + if (length == 0) + goto __RETURN; + + while (length > gMmsDecodeBufLen) { + if (gMmsDecodeBufLen <= 0) { + MSG_DEBUG("__MmsBinaryDecodeQuotedString: gMmsDecodeBufLen <= 0 \n"); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", + gpCurMmsDecodeBuff[0], gpCurMmsDecodeBuff[1], gpCurMmsDecodeBuff[2], + gpCurMmsDecodeBuff[3], gpCurMmsDecodeBuff[4]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", + gpCurMmsDecodeBuff[5], gpCurMmsDecodeBuff[6], gpCurMmsDecodeBuff[7], + gpCurMmsDecodeBuff[8], gpCurMmsDecodeBuff[9]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", + gpCurMmsDecodeBuff[10], gpCurMmsDecodeBuff[11], gpCurMmsDecodeBuff[12], + gpCurMmsDecodeBuff[13], gpCurMmsDecodeBuff[14]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", + gpCurMmsDecodeBuff[15], gpCurMmsDecodeBuff[16], gpCurMmsDecodeBuff[17], + gpCurMmsDecodeBuff[18], gpCurMmsDecodeBuff[19]); + goto __CATCH; + } + + pData = (char *)malloc(gMmsDecodeBufLen + 1); + if (pData == NULL) + goto __CATCH; + + memset(pData, 0, gMmsDecodeBufLen + 1); + + if (_MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false) + goto __CATCH; + + returnLength += gMmsDecodeBufLen; + + if ((bufLen - iPos) > 0) { + readBytes = (gMmsDecodeBufLen < (bufLen - iPos)) ? gMmsDecodeBufLen : (bufLen - iPos); + if (iPos == 0 && (pData[0] == MARK)) { + /* MARK: check first time only */ + + strncpy(szBuff + iPos, (char*)pData + 1, readBytes - 1); + iPos += (readBytes - 1); + } else { + strncpy(szBuff + iPos, (char*)pData, readBytes); + iPos += readBytes; + } + } + + if (pData) { + free(pData); + pData = NULL; + } + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeText: 2. fail to load to buffer \n"); + goto __CATCH; + } + length = strlen(gpCurMmsDecodeBuff) + 1; // + NULL + } /* while */ + + if (length > 0) { + pData = (char *)malloc(length); + if (pData == NULL) + goto __CATCH; + + if (_MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false) + goto __CATCH; + + returnLength += length; + + if ((bufLen - iPos) > 0) { + /* read until NULL from raw data, and copy only string */ + readBytes = (length < (bufLen - iPos)) ? length : (bufLen - iPos); + if (iPos == 0 && (pData[0] == MARK)) { + /* MARK: check first time only */ + strncpy(szBuff + iPos, (char*)pData + 1, readBytes - 1); + iPos += (readBytes - 1); + } else { + strncpy(szBuff + iPos, (char*)pData, readBytes - 1); // + NULL + iPos += readBytes; + } + } + + if (pData) { + free(pData); + pData = NULL; + } + } + + szBuff[bufLen - 1] = '\0'; + + return returnLength; + +__RETURN: + + if (pData) { + free(pData); + pData = NULL; + } + + return length; + +__CATCH: + + if (pData) { + free(pData); + pData = NULL; + } + + return -1; +} + + +/** + * Decode Text + * + * @param pEncodedData [in] QuotedString encoded data + * @param szBuff [out] Decoded quoted string + * @param bufLen [out] Buffer length + * @return length of decode text string + */ +static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int totalLength) +{ + int length = 0; + int readBytes = 0; + int iPos = 0; + int returnLength = 0; + char *pData = NULL; + bool bQuote = false; + int offset = 0; + + /* + * Text-String = [QUOTE]*TEXT end_of_string + * [QUOTE]*(128~255)\0 + * *(32~126)\0 + */ + + if (pFile == NULL || szBuff == NULL || bufLen <= 0) + return -1; + + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + memset(szBuff, 0, bufLen); + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeText: 1. fail to load to buffer \n"); + goto __CATCH; + } + + length = strlen(gpCurMmsDecodeBuff) + 1; // + NULL + + if (length == 0) + goto __RETURN; + + while (length > gMmsDecodeBufLen) { + if (gMmsDecodeBufLen <= 0) { + MSG_DEBUG("__MmsBinaryDecodeQuotedString: gMmsDecodeBufLen <= 0 \n"); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", gpCurMmsDecodeBuff[0], gpCurMmsDecodeBuff[1], gpCurMmsDecodeBuff[2], + gpCurMmsDecodeBuff[3], gpCurMmsDecodeBuff[4]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", gpCurMmsDecodeBuff[5], gpCurMmsDecodeBuff[6], gpCurMmsDecodeBuff[7], + gpCurMmsDecodeBuff[8], gpCurMmsDecodeBuff[9]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", gpCurMmsDecodeBuff[10], gpCurMmsDecodeBuff[11], gpCurMmsDecodeBuff[12], + gpCurMmsDecodeBuff[13], gpCurMmsDecodeBuff[14]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", gpCurMmsDecodeBuff[15], gpCurMmsDecodeBuff[16], gpCurMmsDecodeBuff[17], + gpCurMmsDecodeBuff[18], gpCurMmsDecodeBuff[19]); + goto __CATCH; + } + + pData = (char *)malloc(gMmsDecodeBufLen + 1); + if (pData == NULL) + goto __CATCH; + + memset(pData, 0, gMmsDecodeBufLen + 1); + + if (_MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false) + goto __CATCH; + + if ((bufLen - iPos) > 0) { + readBytes = (gMmsDecodeBufLen < (bufLen - iPos)) ? gMmsDecodeBufLen : (bufLen - iPos); + if (iPos == 0 && (pData[0] == QUOTE) && (bQuote == false)) { + /* QUOTE: check first time only */ + + strncpy(szBuff + iPos, (char*)pData + 1, readBytes - 1); + iPos += (readBytes - 1); + bQuote = true; + } else { + strncpy(szBuff + iPos, (char*)pData, readBytes); + iPos += readBytes; + } + } + + if (pData) { + free(pData); + pData = NULL; + } + + returnLength += gMmsDecodeBufLen; + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeText: 2. fail to load to buffer \n"); + goto __CATCH; + } + length = strlen(gpCurMmsDecodeBuff) + 1; // + NULL + } /* while */ + + if (length > 0) { + pData = (char *)malloc(length); + if (pData == NULL) + goto __CATCH; + + memset(pData, 0, length); + + if (_MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false) + goto __CATCH; + + if ((bufLen - iPos) > 0) { + readBytes = (length < (bufLen - iPos)) ? length : (bufLen - iPos); + if (iPos == 0 && (pData[0] == QUOTE) && (bQuote == false)) { + /* QUOTE: check first time only */ + + strncpy(szBuff + iPos, (char*)pData + 1, readBytes - 1); + iPos += (readBytes - 1); + bQuote = true; + } else { + strncpy(szBuff + iPos, (char*)pData, readBytes - 1); // + NULL + iPos += readBytes; + } + } + + if (pData) { + free(pData); + pData = NULL; + } + + returnLength += length; // + NULL + } + + szBuff[bufLen - 1] = '\0'; + + return returnLength; + +__RETURN: + + if (pData) { + free(pData); + pData = NULL; + } + + szBuff[0] = '\0'; + length = 0; + + MmsBinaryDecodeMovePointer(pFile, offset, totalLength); + + return length; + +__CATCH: + + if (pData) { + free(pData); + pData = NULL; + } + + return -1; +} + + +static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength) +{ + int length = 0; + int curLen = 0; + char *pData = NULL; + char *szBuff = NULL; + char *szTempPtr = NULL; + bool bQuote = false; + int offset = 0; + + /* + * Text-String = [QUOTE]*TEXT end_of_string + * [QUOTE]*(128~255)\0 + * *(32~126)\0 + */ + + if (pFile == NULL || pLength == NULL) + goto __CATCH; + + *pLength = 0; + offset = _MmsGetDecodeOffset(); + if (offset >= totalLength) + goto __RETURN; + + if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeTextLen: 1. fail to load to buffer \n"); + goto __CATCH; + } + + length = strlen(gpCurMmsDecodeBuff) + 1; + + if (length == 0) + goto __CATCH; + + while (length > gMmsDecodeBufLen) { + if (gMmsDecodeBufLen <= 0) { + MSG_DEBUG("__MmsBinaryDecodeQuotedString: gMmsDecodeBufLen <= 0 \n"); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", + gpCurMmsDecodeBuff[0], gpCurMmsDecodeBuff[1], gpCurMmsDecodeBuff[2], + gpCurMmsDecodeBuff[3], gpCurMmsDecodeBuff[4]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", + gpCurMmsDecodeBuff[5], gpCurMmsDecodeBuff[6], gpCurMmsDecodeBuff[7], + gpCurMmsDecodeBuff[8], gpCurMmsDecodeBuff[9]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", + gpCurMmsDecodeBuff[10], gpCurMmsDecodeBuff[11], gpCurMmsDecodeBuff[12], + gpCurMmsDecodeBuff[13], gpCurMmsDecodeBuff[14]); + MSG_DEBUG("__MmsBinaryDecodeQuotedString: %x %x %x %x %x\n", + gpCurMmsDecodeBuff[15], gpCurMmsDecodeBuff[16], gpCurMmsDecodeBuff[17], + gpCurMmsDecodeBuff[18], gpCurMmsDecodeBuff[19]); + goto __CATCH; + } + + pData = (char *)malloc(gMmsDecodeBufLen + 1); + if (pData == NULL) + goto __CATCH; + + memset(pData, 0, gMmsDecodeBufLen + 1); + + if (_MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false) + goto __CATCH; + + if (szBuff == NULL) { + szBuff = (char *)malloc(gMmsDecodeBufLen + 1); + } else { + szTempPtr = (char *)realloc(szBuff, curLen + gMmsDecodeBufLen + 1); + + //NULL pointer check for realloc + if (szTempPtr == NULL) { + goto __CATCH; + } else { + szBuff = szTempPtr; + } + } + if (szBuff == NULL) + goto __CATCH; + + memset(szBuff + curLen, 0, gMmsDecodeBufLen + 1); + + if (curLen == 0 && (pData[0] == QUOTE) && (bQuote == false)) { + /* QUOTE: check first time only */ + + strncpy(szBuff + curLen, (char*)pData + 1, gMmsDecodeBufLen - 1); + curLen += (gMmsDecodeBufLen - 1); + bQuote = true; + } else { + strncpy(szBuff + curLen, (char*)pData, gMmsDecodeBufLen); + curLen += gMmsDecodeBufLen; + } + + if (pData) { + free(pData); + pData = NULL; + } + + *pLength += gMmsDecodeBufLen; + + if (MsgLoadDataToDecodeBuffer(pFile, + &gpCurMmsDecodeBuff, + &gCurMmsDecodeBuffPos, + &gMmsDecodeCurOffset, + gpMmsDecodeBuf1, + gpMmsDecodeBuf2, + gMmsDecodeMaxLen, + &gMmsDecodeBufLen, + totalLength) == false) + { + MSG_DEBUG("__MmsBinaryDecodeText: 2. fail to load to buffer \n"); + goto __CATCH; + } + length = strlen(gpCurMmsDecodeBuff) + 1; + } /* while */ + + if (length > 0) { + pData = (char *)malloc(length); + if (pData == NULL) { + goto __CATCH; + } + + if (_MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false) { + goto __CATCH; + } + + if (szBuff == NULL) { + szBuff = (char *)malloc(length); + } else { + szTempPtr = (char *)realloc(szBuff, curLen + length); + + //NULL pointer check for realloc + if (szTempPtr == NULL) + goto __CATCH; + else + szBuff = szTempPtr; + } + + if (szBuff == NULL) { + goto __CATCH; + } + + memset(szBuff + curLen, 0, length); + + if (curLen == 0 && (pData[0] == QUOTE) && (bQuote == false)) { + /* QUOTE: check first time only */ + + strncpy(szBuff + curLen, (char*)pData + 1, length - 2); + curLen += (length - 1); + bQuote = true; + } else { + strncpy(szBuff + curLen, (char*)pData, length - 1); + curLen += length; + } + + if (pData) { + free(pData); + pData = NULL; + } + + *pLength += length; // + NULL + } + + return szBuff; + +__RETURN: + if (pData) { + free(pData); + pData = NULL; + } + + *pLength = 1; + + MmsBinaryDecodeMovePointer(pFile, offset, totalLength); + + return szBuff; + +__CATCH: + + if (szBuff) { + free(szBuff); + szBuff = NULL; + } + + if (pData) { + free(pData); + pData = NULL; + } + + return NULL; +} + + +/** + * Decode Charset + * + * @param pEncodedData [in] QuotedString encoded data + * @param nCharSet [out] Decoded character set + * @return length of charset value + */ +static bool __MmsBinaryDecodeCharset(FILE *pFile, UINT32 *nCharSet, int *pCharSetLen, int totalLength) +{ + UINT32 integer = 0; + + /* + * Charset v1.1 0x01 Well-known-charset + * Well-known-charset = Any-charset | Integer-value + * ; Both are encoded using values from + * Character Set Assignments table in Assigned Numbers + * Any-charset = + * ; Equivalent to the special RFC2616 charset value ¡°*¡± + */ + + if (pFile == NULL || nCharSet == NULL || pCharSetLen == NULL) + return false; + + if (__MmsBinaryDecodeInteger(pFile, &integer, pCharSetLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeCharset : __MmsBinaryDecodeInteger fail...\n"); + goto __CATCH; + } + + if (integer == 0) { + /* AnyCharSet : return MSG_CHARSET_UTF8 */ + *nCharSet = MSG_CHARSET_UTF8; + return true; + } + + *nCharSet = _MmsGetBinaryType(MmsCodeCharSet, (UINT16)integer); + + if (*nCharSet == MIME_UNKNOWN) { + MSG_DEBUG("__MmsBinaryDecodeCharset : _MmsGetBinaryType fail..\n"); + *nCharSet = MSG_CHARSET_UNKNOWN; + } + + return true; + +__CATCH: + return false; +} + + + +/** + * Decode EncodedString + * + * @param pEncodedData [in] QuotedString encoded data + * @param szBuff [out] Decoded string buffer + * @param bufLen [in] Decoded buffer length + * @return length of decoded string length + */ +static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen, int totalLength) +{ + UINT32 valueLength = 0; + UINT32 charSet = 0; + int charSetLen = 0; + int nChar = 0; + int nRead2 = 0; + int nByte = 0; + int nTemp = 0; + char *pData = NULL; + char *pTempData = NULL; + unsigned short *mszTempStr = NULL; + char *pConvertedStr = NULL; + char *pNewData = NULL; + + + MSG_DEBUG("__MmsBinaryDecodeEncodedString: decode string..\n"); + + if (pFile == NULL || szBuff == NULL || bufLen <= 0) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString: invalid file or buffer\n"); + goto __CATCH; + } + + /* + * Encoded_string_value = Text-string | Value-length Char-set Text-String + * Text-string = [Quote]*TEXT End-of-string + * Value-length = 0 ~ 31 + */ + + memset(szBuff, 0, bufLen); + + switch (__MmsDecodeValueLength(pFile, &valueLength, totalLength)) { + case -1: + goto __CATCH; + + case 0: + + /* Text-string = [Quote]*TEXT End-of-string */ + + if (__MmsBinaryDecodeText(pFile, szBuff, bufLen, totalLength) < 0) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString : 1. __MmsBinaryDecodeText fail.\n"); + goto __CATCH; + } + break; + + default: + + /* Value-length Charset Text_string */ + + if (__MmsBinaryDecodeCharset(pFile, &charSet, &charSetLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString : __MmsBinaryDecodeCharset error\n"); + goto __CATCH; /* (valueLength + valueLengthLen) */ + } + + nTemp = __MmsBinaryDecodeText(pFile, szBuff, bufLen, totalLength); + if (nTemp < 0) { + /* There can be some error in data - no NULL -> try again with value length */ + + pData = (char *)malloc(valueLength - charSetLen); + if (pData == NULL) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString : pData alloc fail.\n"); + goto __CATCH; + } + + if (_MmsBinaryDecodeGetLongBytes(pFile, pData, valueLength - charSetLen, totalLength) == false) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString : _MmsBinaryDecodeGetLongBytes fail.\n"); + goto __CATCH; + } + + strncpy(szBuff, pData, bufLen - 1); + } + + + /* fixme: charset transformation */ + switch (charSet) { + case MSG_CHARSET_UTF16: + case MSG_CHARSET_USC2: + + MSG_DEBUG("__MmsBinaryDecodeEncodedString: MSG_CHARSET_USC2 \n"); + + nTemp = strlen(szBuff); + pTempData = (char *)malloc(nTemp + 1); + if (pTempData == NULL) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString: Memory Full \n"); + goto __CATCH; + } + + memset(pTempData, 0, nTemp + 1); + memcpy(pTempData, szBuff, nTemp + 1); + + if (((UINT8)pTempData[0]) == 0xFF && ((UINT8)pTempData[1]) == 0xFE) { + if ((nChar = (nTemp / 2 - 1)) <= 0) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString(%d) : nChar is invalid value (%d), charset(%d)\n", __LINE__, nChar, charSet); + goto __CATCH ; + } + + mszTempStr = (unsigned short*) malloc(nChar * sizeof(unsigned short)); + if (mszTempStr == NULL) { + MSG_DEBUG("MmsGetMediaPartData : 1. Memory Full !!! \n"); + goto __CATCH; + } + + memcpy(mszTempStr, ((unsigned short*)pTempData + 1), nChar * sizeof(unsigned short)); + + nByte = MsgGetUnicode2UTFCodeSize(((unsigned short*)pTempData + 1), nChar); + + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) + MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar); + } else { + if ((nChar = (nTemp / 2)) <= 0) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString(%d) : nChar is invalid value (%d), charset(%d)\n", __LINE__, nChar, charSet); + goto __CATCH ; + } + + mszTempStr = (unsigned short*) malloc(nChar * sizeof(unsigned short)); + if (mszTempStr == NULL) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString: 2. Memory Full !!! \n"); + goto __CATCH; + } + + memcpy(mszTempStr, ((unsigned short*)pTempData), nChar * sizeof(unsigned short)); + + nByte = MsgGetUnicode2UTFCodeSize(((unsigned short*)pTempData), nChar); + + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr != NULL) + MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar); + } + + if (pConvertedStr != NULL) { + pNewData = pConvertedStr; + nRead2 = nByte; + + strncpy(szBuff, pNewData, bufLen - 1); + } + + break; + + case MSG_CHARSET_US_ASCII: + + MSG_DEBUG("__MmsBinaryDecodeEncodedString: MSG_CHARSET_US_ASCII \n"); + + case MSG_CHARSET_UTF8: + + MSG_DEBUG("__MmsBinaryDecodeEncodedString: MSG_CHARSET_UTF8 or Others \n"); + + pNewData = pTempData; + nRead2 = nTemp; + + break; + + case MSG_CHARSET_ISO_8859_7: /* Greek */ + + MSG_DEBUG("__MmsBinaryDecodeEncodedString: MSG_CHARSET_ISO_8859_7 \n"); + + nTemp = strlen(szBuff); + pTempData = (char *)malloc(nTemp + 1); + if (pTempData == NULL) + { + MSG_DEBUG("__MmsBinaryDecodeEncodedString: Memory Full \n"); + goto __CATCH; + } + + memset(pTempData, 0 , nTemp + 1); + memcpy(pTempData, szBuff, nTemp + 1); + + nByte = MsgGetLatin72UTFCodeSize((unsigned char*)pTempData, nTemp); + pConvertedStr = (char *)malloc(nByte + 1); + + if (pConvertedStr != NULL) { + MsgLatin7code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTempData, nTemp); + + pNewData = pConvertedStr; + nRead2 = nByte; + + strncpy(szBuff, pNewData, bufLen - 1); + } + + break; + + case MSG_CHARSET_ISO_8859_9: /* Turkish */ + + MSG_DEBUG("__MmsBinaryDecodeEncodedString: MSG_CHARSET_ISO_8859_9 \n"); + + nTemp = strlen(szBuff); + pTempData = (char *)malloc(nTemp + 1); + if (pTempData == NULL) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString: Memory Full \n"); + goto __CATCH; + } + + memset(pTempData, 0 , nTemp + 1); + memcpy(pTempData, szBuff, nTemp + 1); + + nByte = MsgGetLatin52UTFCodeSize((unsigned char*)pTempData, nTemp); + pConvertedStr = (char *)malloc(nByte + 1); + + if (pConvertedStr != NULL) { + MsgLatin5code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTempData, nTemp); + + pNewData = pConvertedStr; + nRead2 = nByte; + + strncpy(szBuff, pNewData, bufLen - 1); + } + + break; + + default: + + MSG_DEBUG("__MmsBinaryDecodeEncodedString: Other charsets \n"); + + nTemp = strlen(szBuff); + pTempData = (char *)malloc(nTemp + 1); + if (pTempData == NULL) { + MSG_DEBUG("__MmsBinaryDecodeEncodedString: Memory Full \n"); + goto __CATCH; + } + + memset(pTempData, 0, nTemp + 1); + memcpy(pTempData, szBuff, nTemp + 1); + + nByte = MsgGetLatin2UTFCodeSize((unsigned char*)pTempData, nTemp); + pConvertedStr = (char *)malloc(nByte + 1); + + if (pConvertedStr != NULL) { + MsgLatin2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTempData, nTemp); + + pNewData = pConvertedStr; + nRead2 = nByte; + + strncpy(szBuff, pNewData, bufLen - 1); + } + + break; + + } //switch (charset) + + } //switch (__MmsDecodeValueLength....) + + if (pData) { + free(pData); + pData = NULL; + } + + if (pTempData) { + free(pTempData); + pTempData = NULL; + } + + if (mszTempStr) { + free(mszTempStr); + mszTempStr = NULL; + } + + if (pConvertedStr) { + free(pConvertedStr); + pConvertedStr = NULL; + } + + + return true; + +__CATCH: + + if (pData) { + free(pData); + pData = NULL; + } + + if (pTempData) { + free(pTempData); + pTempData = NULL; + } + + if (mszTempStr) { + free(mszTempStr); + mszTempStr = NULL; + } + + if (pConvertedStr) { + free(pConvertedStr); + pConvertedStr = NULL; + } + + return false; +} + + + +/** + * Decode Encoded Addresses + * + * @param pEncodedData [in] QuotedString encoded data + * @param pAddrLength [out] Decoded address length + * @return Decoded address list + */ +MsgHeaderAddress *__MmsDecodeEncodedAddress(FILE *pFile, int totalLength) +{ + UINT32 valueLength = 0; + UINT32 charSet = 0; + int charSetLen = 0; + int textLength = 0; + char *pAddrStr = NULL; + MsgHeaderAddress *pAddr = NULL; + + MSG_DEBUG("__MmsDecodeEncodedAddress: decoding address..\n"); + + if (pFile == NULL) { + MSG_DEBUG("__MmsDecodeEncodedAddress: invalid file or buffer\n"); + goto __CATCH; + } + + /* + * Encoded_string_value = Text-string | Value-length Char-set Text-String + * Text-string = [Quote]*TEXT End-of-string + * Value-length = 0 ~ 31 + */ + + switch (__MmsDecodeValueLength(pFile, &valueLength, totalLength)) { + case -1: + goto __CATCH; + + case 0: + + /* Text-string = [Quote]*TEXT End-of-string */ + + textLength = 0; + pAddrStr = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + if (pAddrStr == NULL) { + MSG_DEBUG("__MmsDecodeEncodedAddress : 1. __MmsBinaryDecodeText2 fail.\n"); + goto __CATCH; + } + break; + + default: + + /* Value-length Charset Text_string */ + + if (__MmsBinaryDecodeCharset(pFile, &charSet, &charSetLen, totalLength) == false) { + MSG_DEBUG("__MmsDecodeEncodedAddress : __MmsBinaryDecodeCharset error\n"); + goto __CATCH; + } + + textLength = 0; + pAddrStr = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + if (pAddrStr == NULL) { + /* There can be some error in data - no NULL -> try again with value length */ + + pAddrStr = (char *)malloc(valueLength - charSetLen); + if (pAddrStr == NULL) { + MSG_DEBUG("__MmsDecodeEncodedAddress : pData alloc fail.\n"); + goto __CATCH; + } + + if (_MmsBinaryDecodeGetLongBytes(pFile, pAddrStr, valueLength - charSetLen, totalLength) == false) { + MSG_DEBUG("__MmsDecodeEncodedAddress : _MmsBinaryDecodeGetLongBytes fail.\n"); + goto __CATCH; + } + } + + /* fixme: charset transformation */ + + break; + } + + pAddr = (MsgHeaderAddress *)malloc(sizeof(MsgHeaderAddress)); + if (pAddr == NULL) + goto __CATCH; + + memset(pAddr, 0, sizeof(MsgHeaderAddress)); + pAddr->szAddr = pAddrStr; + + return pAddr; + +__CATCH: + + if (pAddrStr) { + free(pAddrStr); + pAddrStr = NULL; + } + + return NULL; +} + + +/** + * Decode Encoded Pointer String + * + * @param pEncodedData [in] Long integer encoded data + * @param pLongInteger [out] Decoded long integer + * @return Decoded address list + */ +static bool __MmsDecodeLongInteger(FILE *pFile, UINT32 *pLongInteger, int totalLength) +{ + UINT8 oneByte = 0; + + /* + * Long-integer = Short-length Multi-octet-integer + * Short-length = 0~30 + * Multi-octet-integer + */ + + if (pFile == NULL || pLongInteger == NULL) + return false; + + *pLongInteger = 0; + + if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) + goto __CATCH; + + if (oneByte > 31) + goto __CATCH; + + *pLongInteger = __MmsHeaderDecodeIntegerByLength(pFile, oneByte, totalLength); + + return true; + +__CATCH: + return false; +} + + +/* + * @param pEncodedData [in] filename encoded data + * @param szBuff [out] filename output buffer + * @param fullLength [in] full filename length + * @param bufLen [in] buffer length + * CAUTION: bufLen - 1 + */ +static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int totalLength) +{ + char *pUTF8Buff = NULL; + char *pLatinBuff = NULL; + char *pExt = NULL; + char *szSrc = NULL; + char *szSrc2 = NULL; + int length = 0; + int textLength = 0; + + char *pTmpBuff = NULL; + + memset (szBuff, 0, bufLen); + + textLength = 0; + pLatinBuff = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); + + //remove "" + if (pLatinBuff) { + szSrc = MsgRemoveQuoteFromFilename(pLatinBuff); + if (szSrc) { + strcpy(pLatinBuff, szSrc); + free(szSrc); + szSrc = NULL; + } + + szSrc2 = MsgChangeHexString(pLatinBuff); + if (szSrc2) { + strcpy(pLatinBuff, szSrc2); + free(szSrc2); + szSrc2 = NULL; + } + + if (MsgIsUTF8String((unsigned char*)pLatinBuff, strlen(pLatinBuff)) == false) { + length = strlen(pLatinBuff); + + int utf8BufSize = 0; + utf8BufSize = MsgGetLatin2UTFCodeSize((unsigned char*)pLatinBuff, length); + pUTF8Buff = (char *)malloc(utf8BufSize + 1); + if (pUTF8Buff == NULL) { + MSG_DEBUG("__MmsDecodeGetFilename: pUTF8Buff alloc fail \n"); + goto __CATCH; + } + + if (MsgLatin2UTF ((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pLatinBuff, length) < 0) { + MSG_DEBUG("__MmsDecodeGetFilename: MsgLatin2UTF fail \n"); + goto __CATCH; + } + free(pLatinBuff); + pLatinBuff = NULL; + } else { + pTmpBuff = _MsgDecodeText(pLatinBuff); + pUTF8Buff = pTmpBuff; + free (pLatinBuff); + pLatinBuff = NULL; + } + } + + if (pUTF8Buff) { + /* + * keeping extension + * it should be kept extention even if the file name is shorten + */ + + length = strlen(pUTF8Buff); + if ((pExt = strrchr(pUTF8Buff, '.')) != NULL) { + int nameLength = 0; + nameLength = (length < bufLen) ? (length - strlen(pExt)) : (bufLen - strlen(pExt)); + strncpy(szBuff, pUTF8Buff, nameLength); + strcat (szBuff, pExt); + } else { + strncpy(szBuff, pUTF8Buff, bufLen - 1); + } + free(pUTF8Buff); + pUTF8Buff = NULL; + + return textLength; + } + +__CATCH: + + if (pLatinBuff) { + free(pLatinBuff); + pLatinBuff = NULL; + } + + if (pUTF8Buff) { + free(pUTF8Buff); + pUTF8Buff = NULL; + } + + return -1; +} + + +/* ========================================================== + + T E X T D E C O D I N G + + ==========================================================*/ + + +bool MmsTextDecodeMsgBody(FILE *pFile) +{ + MSG_DEBUG("MmsTextDecodeMsgBody: \n"); + return false; +} + +bool __MmsTextDecodeMsgHeader(FILE *pFile) +{ + return true; +} + + +/* ========================================================== + + M M S D E C O D I N G + + ==========================================================*/ + +// to get message body this function should be modified from message raw file. +bool _MmsReadMsgBody(MSG_MESSAGE_ID_T msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath) +{ + FILE *pFile = NULL; + MmsMsg *pMsg = NULL; + MsgMultipart *pMultipart = NULL; + int nSize = 0; + char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; + char szTempMediaDir[MSG_FILEPATH_LEN_MAX] = {0, }; + int attachmax = MSG_ATTACH_MAX; + + MSG_DEBUG("_MmsReadMsgBody: start read msg(msgID=%d)\n", msgID); + + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + memset(pMsg, 0, sizeof(MmsMsg)); + + _MmsInitHeader(); + + if (bRetrieved && (retrievedPath != NULL)) { + strncpy(szFullPath, retrievedPath, (strlen(retrievedPath) > MSG_FILEPATH_LEN_MAX ? MSG_FILEPATH_LEN_MAX:strlen(retrievedPath))); + } else { + MmsPluginStorage::instance()->getMmsRawFilePath(msgID, szFullPath); + } + + pMsg->msgID = msgID; + + /* read from MMS raw file */ + if (szFullPath != NULL) + strncpy(pMsg->szFileName, szFullPath + strlen(MSG_DATA_PATH), strlen(szFullPath + strlen(MSG_DATA_PATH))); + + MSG_DEBUG("szFullPath = (%s)", szFullPath); + + if (MsgGetFileSize(szFullPath, &nSize) == false) { + MSG_DEBUG("MsgGetFileSize: failed"); + goto __CATCH; + } + + pFile = MsgOpenFile(szFullPath, "rb"); + + if (pFile == NULL) { + MSG_DEBUG("_MmsReadMsgBody: invalid mailbox\n"); + goto __CATCH; + } + + _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX); + + if (MmsBinaryDecodeMsgHeader(pFile, nSize) == false) { + MSG_DEBUG("_MmsReadMsgBody: MmsBinaryDecodeMsgHeader fail...\n"); + goto __CATCH; + } + +#ifdef __SUPPORT_DRM__ + if (MmsDrm2GetConvertState() != MMS_DRM2_CONVERT_FINISH) + MmsDrm2SetConvertState(MMS_DRM2_CONVERT_NONE); //initialize convertState +#endif + + if (MmsBinaryDecodeMsgBody(pFile, szFullPath, nSize) == false) { + MSG_DEBUG("_MmsReadMsgBody: MmsBinaryDecodeMsgBody fail\n"); + goto __CATCH; + } + +#ifdef __SUPPORT_DRM__ + if (MmsDrm2GetConvertState() == MMS_DRM2_CONVERT_REQUIRED) { + MSG_DEBUG("_MmsReadMsgBody: MmsDrm2GetConvertState returns MMS_DRM2_CONVERT_REQUIRED.\n"); + goto RETURN; + } +#endif + + /* Set mmsHeader.msgType & msgBody to pMsg ----------- */ + + pMsg->mmsAttrib.contentType = (MsgContentType)mmsHeader.msgType.type; + + memcpy(&(pMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType)); + memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody)); + + if (pMsg->msgBody.pPresentationBody) { + if(MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0) + goto __CATCH; + + pMsg->msgBody.pPresentationBody->body.pText = (char *)malloc(pMsg->msgBody.pPresentationBody->size + 1); + if (pMsg->msgBody.pPresentationBody->body.pText == NULL) + goto __CATCH; + + memset(pMsg->msgBody.pPresentationBody->body.pText, 0, pMsg->msgBody.pPresentationBody->size + 1); + + ULONG nRead = 0; + nRead = MsgReadFile(pMsg->msgBody.pPresentationBody->body.pText, sizeof(char), pMsg->msgBody.pPresentationBody->size, pFile); + if (nRead == 0) + goto __CATCH; + + } + + MsgCloseFile(pFile); + pFile = NULL; + + /* nPartCount */ + pMsg->nPartCount = 0; + + if (MsgIsMultipart(mmsHeader.msgType.type) == true) { + pMultipart = pMsg->msgBody.body.pMultipart; + while (pMultipart) { + pMsg->nPartCount++; + + if (pMultipart->type.type == MIME_TEXT_PLAIN) + attachmax++; + + if ((mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED)||(mmsHeader.msgType.type == MIME_MULTIPART_MIXED)) { + if ((pMsg->nPartCount >= attachmax)&&(pMultipart->pNext != NULL)) { + _MsgFreeBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type); + + free(pMultipart->pNext->pBody); + pMultipart->pNext->pBody= NULL; + + free(pMultipart->pNext); + + pMultipart->pNext = NULL; + break; + } + } + pMultipart = pMultipart->pNext; + } + } else { + if (pMsg->msgBody.size > 0) + pMsg->nPartCount++; + } + + /* make temporary */ + snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, MSG_DATA_PATH"%s.dir", pMsg->szFileName); + + /////////////////////////////////////////////// + // call before processing urgent event. + //_MmsInitHeader(); + //_MmsUnregisterDecodeBuffer(); + /////////////////////////////////////////////// + + if (MsgIsMultipart(pMsg->msgType.type) == true) { + int partIndex = 0; + pMultipart = pMsg->msgBody.body.pMultipart; + + if (bSavePartsAsTempFiles) { + if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { + if (errno == EEXIST) { + MSG_DEBUG("The %s already exists", szTempMediaDir); + } else { + MSG_DEBUG("Fail to Create Dir [%s]", szTempMediaDir); + goto __CATCH; + } + } + } + + while (pMultipart) { + + if (_MmsMultipartSaveAsTempFile(&pMultipart->type, pMultipart->pBody, + (char*)MSG_DATA_PATH, pMsg->szFileName, partIndex, bSavePartsAsTempFiles) == false) + goto __CATCH; + + pMultipart = pMultipart->pNext; + partIndex ++; + } + + } 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("The %s already exists", szTempMediaDir); + } else { + MSG_DEBUG("Fail to Create Dir [%s]", szTempMediaDir); + goto __CATCH; + } + } + } + + if (_MmsMultipartSaveAsTempFile( &pMsg->msgType, &pMsg->msgBody, + (char*)MSG_DATA_PATH, pMsg->szFileName, 0, bSavePartsAsTempFiles) == false) + goto __CATCH; + } + } + MSG_DEBUG("**** _MmsReadMsgBody: E N D (Success) ***\n"); + return true; + +#ifdef __SUPPORT_DRM__ + +RETURN: + + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; + } + + return false; + +#endif + +__CATCH: + + _MmsInitHeader(); + _MmsUnregisterDecodeBuffer(); + + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; + } + +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pMsg->msgType.drmInfo); +#endif + + _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type); + MSG_DEBUG("_MmsReadMsgBody: E N D (fail) ******************** \n"); + + return false; +} + + +bool MsgFreeHeaderAddress(MsgHeaderAddress *pAddr) +{ + MsgHeaderAddress *pTempAddr = NULL; + + while (pAddr != NULL) { + pTempAddr = pAddr; + pAddr = pAddr->pNext; + + if (pTempAddr->szAddr) { + free(pTempAddr->szAddr); + pTempAddr->szAddr = NULL; + } + + free(pTempAddr); + pTempAddr = NULL; + } + + return true; +} + +bool MsgCheckFileNameHasInvalidChar(char *szName) +{ + int strLen = 0; + int i = 0; + + strLen = strlen(szName); + + for (i=0; i bcharsnospace */ + + memset (pType->param.szBoundary, 0, MSG_BOUNDARY_LEN + 1); + strncpy(pType->param.szBoundary, pDec, MSG_BOUNDARY_LEN); + MSG_DEBUG("_MsgParseParameter: szBoundary = %s \n", pType->param.szBoundary); + break; + + case MSG_PARAM_CHARSET: + pType->param.charset = _MsgGetCode(MSG_CHARSET, pDec); + + if (pType->param.charset == INVALID_HOBJ) + pType->param.charset = MSG_CHARSET_UNKNOWN; + + MSG_DEBUG("_MsgParseParameter: type = %d [charset] = %d \n", pType->type, pType->param.charset); + break; + + case MSG_PARAM_NAME: + + memset (pType->param.szName, 0, MSG_LOCALE_FILENAME_LEN_MAX + 1); + + pUTF8Buff = MsgConvertLatin2UTF8FileName(pDec); + + if (pUTF8Buff) { + if ((pExt = strrchr(pUTF8Buff, '.')) != NULL) { + if ((MSG_FILENAME_LEN_MAX-1) < strlen(pUTF8Buff)) { + nameLen = (MSG_FILENAME_LEN_MAX-1) - strlen(pExt); + } else { + nameLen = strlen(pUTF8Buff) - strlen(pExt); + } + + strncpy(pType->param.szName, pUTF8Buff, nameLen); + strcat (pType->param.szName, pExt); + } else { + strncpy(pType->param.szName, pUTF8Buff, (MSG_FILENAME_LEN_MAX-1)); + } + free(pUTF8Buff); + pUTF8Buff = NULL; + + if (_MsgChangeSpace(pType->param.szName, &szSrc) == true) { + if (szSrc) + strncpy(pType->param.szName, szSrc , strlen(szSrc)); + } + + if (szSrc) { + free(szSrc); + szSrc = NULL; + } + + // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" + _MsgRemoveFilePath(pType->param.szName); + } else { + MSG_DEBUG("_MsgParseParameter: MsgConvertLatin2UTF8FileName(%s) return NULL\n", pDec); + } + + MSG_DEBUG("_MsgParseParameter: szName = %s \n", pType->param.szName); + break; + + case MSG_PARAM_FILENAME: + + memset (pType->param.szFileName, 0, MSG_FILENAME_LEN_MAX+1); + + pUTF8Buff = MsgConvertLatin2UTF8FileName(pDec); + + if (pUTF8Buff) { + if ((pExt = strrchr(pUTF8Buff, '.')) != NULL) { + if ((MSG_FILENAME_LEN_MAX-1) < strlen(pUTF8Buff)) { + nameLen = (MSG_FILENAME_LEN_MAX-1) - strlen(pExt); + } else { + nameLen = strlen(pUTF8Buff) - strlen(pExt); + } + + strncpy(pType->param.szFileName, pUTF8Buff, nameLen); + strcat (pType->param.szFileName, pExt); + } else { + strncpy(pType->param.szFileName, pUTF8Buff, (MSG_FILENAME_LEN_MAX-1)); + } + free(pUTF8Buff); + pUTF8Buff = NULL; + + if (_MsgChangeSpace(pType->param.szFileName, &szSrc) == true) + strcpy(pType->param.szFileName, szSrc); + + if (szSrc) { + free(szSrc); + szSrc = NULL; + } + + // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" + _MsgRemoveFilePath(pType->param.szFileName); + } else { + MSG_DEBUG("_MsgParseParameter: MsgConvertLatin2UTF8FileName(%s) return NULL\n", pDec); + } + + MSG_DEBUG("_MsgParseParameter: szFileName = %s \n", pType->param.szFileName); + + break; + + case MSG_PARAM_TYPE: + + /* type/subtype of root. Only if content-type is multipart/related */ + + pType->param.type = _MsgGetCode(MSG_TYPE, pDec); + MSG_DEBUG("_MsgParseParameter: type = %d \n", pType->param.type); + + break; + + case MSG_PARAM_START: + + /* Content-id. Only if content-type is multipart/related */ + + memset (pType->param.szStart, 0, MSG_MSG_ID_LEN + 1); + strncpy(pType->param.szStart, pDec, MSG_MSG_ID_LEN); + + MSG_DEBUG("_MsgParseParameter: szStart = %s \n", pType->param.szStart); + + break; + + case MSG_PARAM_START_INFO : + + /* Only if content-type is multipart/related */ + + memset (pType->param.szStartInfo, 0, MSG_MSG_ID_LEN + 1); + strncpy(pType->param.szStartInfo, pDec, MSG_MSG_ID_LEN); + + MSG_DEBUG("_MsgParseParameter: szStartInfo = %s \n", pType->param.szStartInfo); + + break; + + case MSG_PARAM_REPORT_TYPE : + + // only used as parameter of Content-Type: multipart/report; report-type=delivery-status; + + if (pDec != NULL && strcasecmp(pDec, "delivery-status") == 0) { + pType->param.reportType = MSG_PARAM_REPORT_TYPE_DELIVERY_STATUS; + } else { + pType->param.reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; + } + + MSG_DEBUG("_MsgParseParameter: reportType = %s \n", pDec); + break; + + default: + + MSG_DEBUG("_MsgParseParameter: Unknown paremeter (%s)\n", pDec); + break; + } + + if (pDec) { + free(pDec); + pDec = NULL; + } + } + pSrc = pNextParam; + } + return true; +} + +char *_MsgSkipWS(char *s) +{ + while (true) { + if ((*s == MSG_CH_CR) || (*s == MSG_CH_LF) || (*s == MSG_CH_SP) || (*s == MSG_CH_TAB)) { + ++s; + } else if ((*s != '(') || (__MsgSkipComment(s,(long)NULL)==NULL)) { + return s; + } + } +} + +char *__MsgSkipComment (char *s,long trim) +{ + + char *ret; + char *s1 = s; + char *t = NULL; + + // ignore empty space + for (ret = ++s1; *ret == ' '; ret++) + ; + + // handle '(', ')', '\', '\0' + do { + switch (*s1) { + case '(': + if (!__MsgSkipComment (s1,(long)NULL)) + return NULL; + t = --s1; + break; + case ')': + s = ++s1; + if (trim) { + if (t) { + t[1] = '\0'; + } else { + *ret = '\0'; + } + } + return ret; + case '\\': + if (*++s1) + break; + case '\0': + *s = '\0'; + return NULL; + case ' ': + break; + default: + t = s1; + break; + } + }while (s1++); + + return NULL; +} + +char *MsgConvertLatin2UTF8FileName(char *pSrc) +{ + char *pUTF8Buff = NULL; + char *pData = NULL; + + + //convert utf8 string + if (MsgIsUTF8String((unsigned char*)pSrc, strlen(pSrc)) == false) { + int length = 0; + int utf8BufSize = 0; + + length = strlen(pSrc); + utf8BufSize = MsgGetLatin2UTFCodeSize((unsigned char*)pSrc, length); + pUTF8Buff = (char *)malloc(utf8BufSize + 1); + + if (pUTF8Buff == NULL) { + MSG_DEBUG("MsgConvertLatin2UTF8FileName: pUTF8Buff alloc fail \n"); + goto __CATCH; + } + + if (MsgLatin2UTF ((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pSrc, length) < 0) { + MSG_DEBUG("MsgConvertLatin2UTF8FileName: MsgLatin2UTF fail \n"); + goto __CATCH; + } + } else { + int length = strlen(pSrc); + pUTF8Buff = (char *)calloc(1, length+1); + + if (pUTF8Buff == NULL) { + MSG_DEBUG("MsgConvertLatin2UTF8FileName: pUTF8Buff alloc fail \n"); + goto __CATCH; + } + + memcpy(pUTF8Buff, pSrc, length); + } + + //convert hex string + if (MsgIsPercentSign(pUTF8Buff) == true) { + pData = MsgChangeHexString(pUTF8Buff); + if (pData) { + strcpy(pUTF8Buff, pData); + free(pData); + pData = NULL; + } + } + + return pUTF8Buff; + +__CATCH: + + if (pUTF8Buff) { + free(pUTF8Buff); + pUTF8Buff = NULL; + } + if (pData) { + free(pData); + pData = NULL; + } + return NULL; +} + +bool _MsgChangeSpace(char *pOrg, char **ppNew) +{ + char *pNew = NULL; + int cLen = 0; + int cIndex =0; + int index = 0; + + if (pOrg == NULL) + return false; + + cLen = strlen(pOrg); + + pNew = (char *)malloc(cLen + 1); + if (pNew == NULL) + return false; + + memset(pNew, 0, cLen + 1); + + for (cIndex=0; cIndex vf7.gif + if (pPath != NULL && *(pPath+1) != '\0') { + strncpy(szFileName, pPath+1, strlen(pPath+1)); + strncpy(pSrc, szFileName , strlen(szFileName)); + } + } + // 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) + *pTemp = '\0'; + } +} + +bool MsgIsUTF8String(unsigned char *szSrc, int nChar) +{ + MSG_DEBUG("MsgIsUTF8String: --------------- \n"); + + if (szSrc == NULL) { + MSG_DEBUG("MsgIsUTF8String: szSrc is NULL !!!! --------------- \n"); + return true; + } + + while (nChar > 0 && (*szSrc != '\0')) { + if (*szSrc < 0x80) { + szSrc++; + nChar--; + } else if ((0xC0 <= *szSrc) && (*szSrc < 0xE0)) { + if (*(szSrc + 1) >= 0x80) { + szSrc += 2; + nChar -= 2; + } else { + MSG_DEBUG("MsgIsUTF8String: 1. NOT utf8 range!\n"); + goto __CATCH; + } + } else if (*szSrc >= 0xE0) { + if (*(szSrc + 1) >= 0x80) { + if (*(szSrc + 2) >= 0x80) { + szSrc += 3; + nChar -= 3; + } else { + MSG_DEBUG("MsgIsUTF8String: 2. NOT utf8 range!\n"); + goto __CATCH; + } + } else { + MSG_DEBUG("MsgIsUTF8String: 3. NOT utf8 range!\n"); + goto __CATCH; + } + } else { + MSG_DEBUG("MsgIsUTF8String: 4. NOT utf8 range!\n"); + goto __CATCH; + } + } + + return true; + +__CATCH: + return false; +} + +bool MsgIsPercentSign(char *pSrc) +{ + char *pCh = NULL; + bool bRet = false; + + pCh = strchr(pSrc , '%'); + + if (pCh != NULL) { + bRet = true; + } else { + bRet = false; + } + + return bRet; +} + +MsgMultipart *MsgAllocMultipart(void) +{ + MsgMultipart *pMultipart = NULL; + + MSG_DEBUG("MsgAllocMultipart: --------- \n"); + + pMultipart = (MsgMultipart*)malloc(sizeof(MsgMultipart)); + if (pMultipart == NULL) { + MSG_DEBUG("MsgAllocMultipart: pMultipart malloc Fail \n"); + goto __CATCH; + } + + pMultipart->pBody = (MsgBody*)malloc(sizeof(MsgBody)); + if (pMultipart->pBody == NULL) { + MSG_DEBUG("MsgAllocMultipart: pMultipart->pBody malloc Fail \n"); + goto __CATCH; + } + + _MsgInitMsgType(&pMultipart->type); + _MsgInitMsgBody(pMultipart->pBody); + + pMultipart->pNext = NULL; + + return pMultipart; + +__CATCH: + + if (pMultipart) { + if (pMultipart->pBody) { + free(pMultipart->pBody); + pMultipart->pBody = NULL; + } + + free(pMultipart); + pMultipart = NULL; + } + + return NULL; +} + +bool _MsgInitMsgType(MsgType *pMsgType) +{ + pMsgType->offset = 0; + pMsgType->size = 0; + pMsgType->contentSize = 0; + pMsgType->disposition = 0; + pMsgType->encoding = 0; + pMsgType->type = MIME_UNKNOWN; +#ifdef FEATURE_JAVA_MMS_MIME + pMsgType->szMimeString[0] ='\0'; +#endif + pMsgType->section = 0; + + pMsgType->szOrgFilePath[0] = '\0'; + pMsgType->szContentID[0] = '\0'; + pMsgType->szContentLocation[0] = '\0'; + + pMsgType->szContentRepPos[0] = '\0'; + pMsgType->szContentRepSize[0] = '\0'; + pMsgType->szContentRepIndex[0] = '\0'; + + __MsgInitMsgContentParam(&pMsgType->param); +#ifdef __SUPPORT_DRM__ + __MsgInitMsgDRMInfo(&pMsgType->drmInfo); +#endif + + return true; +} + + +bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam) +{ + pMsgContentParam->charset = MSG_CHARSET_UNKNOWN; + pMsgContentParam->type = MIME_UNKNOWN; + pMsgContentParam->szBoundary[0] = '\0'; + pMsgContentParam->szFileName[0] = '\0'; + pMsgContentParam->szName[0] = '\0'; +#ifdef FEATURE_JAVA_MMS + pMsgContentParam->szApplicationID = NULL; + pMsgContentParam->szReplyToApplicationID = NULL; +#endif + pMsgContentParam->szStart[0] = '\0'; + pMsgContentParam->szStartInfo[0] = '\0'; + pMsgContentParam->pPresentation = NULL; + + pMsgContentParam->reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; // add only used as parameter of Content-Type: multipart/report; report-type + + return true; +} + + +bool _MsgInitMsgBody(MsgBody *pMsgBody) +{ + pMsgBody->offset = 0; + pMsgBody->size = 0; + pMsgBody->body.pText = NULL; + pMsgBody->szOrgFilePath[0] = '\0'; + + _MsgInitMsgType(&pMsgBody->presentationType); + pMsgBody->pPresentationBody = NULL; + + memset(pMsgBody->szOrgFilePath, 0, MSG_FILEPATH_LEN_MAX); + + return true; +} + + +MsgPresentationFactor MsgIsPresentationEx(MsgType *multipartType, char* szStart, MsgContentType typeParam) +{ + char szTmpStart[MSG_MSG_ID_LEN + 3] = { 0, }; + char szTmpContentID[MSG_MSG_ID_LEN + 3] = { 0, }; + char szTmpContentLO[MSG_MSG_ID_LEN + 3] = { 0, }; + int strLen = 0; + + // remove '<' and '>' in Start Param : contentID ex] <0_1.jpg> or <1233445> + if (szStart && szStart[0]) { + int startLen = 0; + startLen = strlen(szStart); + if (szStart[0] == '<' && szStart[startLen - 1] == '>') { + strncpy(szTmpStart, &szStart[1], startLen - 2); + } else { + strncpy(szTmpStart, szStart, startLen); + } + } + + // 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] == '>') { + strncpy(szTmpContentID, &(multipartType->szContentID[1]), strLen - 2); + } else { + strncpy(szTmpContentID, multipartType->szContentID, strLen); + } + } + + // 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] == '>') { + strncpy(szTmpContentLO, &multipartType->szContentLocation[1], strLen - 2); + } else { + strncpy(szTmpContentLO, multipartType->szContentLocation, strLen); + } + } + + if ((szTmpContentID[0] == '\0') && (szTmpContentLO[0] == '\0') && (multipartType->type == MIME_UNKNOWN)) + return MSG_PRESENTATION_NONE; + + // exception handling + if (szTmpStart[0] != '\0') { + // 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) { + return MSG_PRESENTATION_LOCATION; + } else if (multipartType->type == typeParam) { + return MSG_PRESENTATION_TYPE_BASE; + } else { + return MSG_PRESENTATION_NONE; + } + } else { + if (multipartType->type == typeParam && typeParam != MIME_UNKNOWN) { + return MSG_PRESENTATION_TYPE_BASE; + } else { + return MSG_PRESENTATION_NONE; + } + } +} + +void MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, MsgPresentaionInfo *pPresentationInfo) +{ + MSG_BEGIN(); + MsgMultipart *pNextPart = NULL; + 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. + if (pPresentationInfo->pCurPresentation == NULL) { + pPresentationInfo->pCurPresentation = pMsgBody->body.pMultipart; + pPresentationInfo->pPrevPart = NULL; + pPresentationInfo->factor = MSG_PRESENTATION_NONE; + } + + if (pPresentationInfo->pCurPresentation != NULL && MsgIsPresentablePart(pPresentationInfo->pCurPresentation->type.type)) { + /* Presentable Part is some MARK-UP page, such as SMIL, HTML, WML, XHTML. + * In this case, COPY the Presentation part and leave other multiparts. + */ + memcpy(&pMsgBody->presentationType, &pPresentationInfo->pCurPresentation->type, sizeof(MsgType)); + pMsgBody->pPresentationBody = pPresentationInfo->pCurPresentation->pBody; + + // remove pCurPresentation from multipart linked list + if ((pPresentationInfo->factor == MSG_PRESENTATION_NONE)||(pPresentationInfo->pPrevPart == NULL)) { + // first part + pMsgBody->body.pMultipart = pPresentationInfo->pCurPresentation->pNext; + pMsgType->contentSize -= pPresentationInfo->pCurPresentation->pBody->size; + pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size; + if (pPresentationInfo->pCurPresentation) { +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pPresentationInfo->pCurPresentation->type.drmInfo); +#endif + free(pPresentationInfo->pCurPresentation); + pPresentationInfo->pCurPresentation = NULL; + } + } else { + // not a first part + pPresentationInfo->pPrevPart->pNext = pPresentationInfo->pCurPresentation->pNext; + pMsgType->contentSize -= pPresentationInfo->pCurPresentation->pBody->size; + pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size; + if (pPresentationInfo->pCurPresentation) { + free(pPresentationInfo->pCurPresentation); + pPresentationInfo->pCurPresentation = NULL; + } + } + } else if (pPresentationInfo->pCurPresentation != NULL && MsgIsText(pPresentationInfo->pCurPresentation->type.type)) { + /* NON-Presentable Part is some PLAIN part such as, text/plain, multipart/alternative. + * In this case, leave the Presentation part as a multipart and remove other multiparts. + */ + + // Backup the multipart link information + pNextPart = pMsgBody->body.pMultipart; + + // 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 + while (pNextPart) { + pRemovePart = pNextPart; + pNextPart = pNextPart->pNext; + + if (pRemovePart->pBody) { + _MsgFreeBody(pRemovePart->pBody, pRemovePart->type.type); + free(pRemovePart->pBody); + pRemovePart->pBody = NULL; + } + + free(pRemovePart); + pRemovePart = NULL; + } + } else { +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pMsgBody->presentationType.drmInfo); +#endif + _MsgInitMsgType(&pMsgBody->presentationType); + pMsgBody->pPresentationBody = NULL; + } + } + MSG_END(); +} + +bool MsgIsMultipartRelated(int type) +{ + if (type == MIME_MULTIPART_RELATED || type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { + return true; + } else { + return false; + } +} + +bool MsgIsPresentablePart(int type) +{ + if (type == MIME_TEXT_HTML || type == MIME_TEXT_VND_WAP_WML || type == MIME_APPLICATION_SMIL) { + return true; + } else { + return false; + } +} + +#ifdef __SUPPORT_DRM__ +void _MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo) +{ + MSG_DEBUG("_MsgFreeDRMInfo: S T A R T !!! \n"); + + if (pDrmInfo == NULL) { + MSG_DEBUG("pDrmInfo is NULL"); + return; + } + + if (pDrmInfo->szContentDescription) { + free(pDrmInfo->szContentDescription); + pDrmInfo->szContentDescription = NULL; + } + + if (pDrmInfo->szContentVendor) { + free(pDrmInfo->szContentVendor); + pDrmInfo->szContentVendor = NULL; + } + + if (pDrmInfo->szContentName) { + free(pDrmInfo->szContentName); + pDrmInfo->szContentName = NULL; + } + + if (pDrmInfo->szContentURI) { + free(pDrmInfo->szContentURI); + pDrmInfo->szContentURI = NULL; + } + + if (pDrmInfo->szRightIssuer) { + free(pDrmInfo->szRightIssuer); + pDrmInfo->szRightIssuer = NULL; + } + + if (pDrmInfo->szDrm2FullPath) { + free(pDrmInfo->szDrm2FullPath); + pDrmInfo->szDrm2FullPath = NULL; + } + +#if MMS_ENABLE_EXTEND_CFM + // DRM (Extended)CFM + if (pDrmInfo->pszContentType) { + free(pDrmInfo->pszContentType); + pDrmInfo->pszContentType = NULL; + } +#endif + + pDrmInfo->contentType = MIME_UNKNOWN; + pDrmInfo->drmType = MSG_DRM_TYPE_NONE; +} + +bool MsgCopyDrmInfo(MsgType *pPartType) +{ + char *pExt = NULL; + char *pTmpBuf = NULL; + + //convert application/vnd.oma.drm.content to media type + pPartType->type = pPartType->drmInfo.contentType; + + // fix wrong file name presentation on save media screen. + if (pPartType->szContentID[0] == '\0' && pPartType->drmInfo.szContentURI) + strncpy(pPartType->szContentID, pPartType->drmInfo.szContentURI, MSG_MSG_ID_LEN); + + /* set title name (content name) */ + if (pPartType->param.szName[0] == '\0') { + /* szName is vitual name, real filename is *.dcf or *.dm */ + if (pPartType->drmInfo.szContentName && pPartType->drmInfo.szContentName[0] != '\0') { + /* In case of szContentName retrieved from DRM agent is exist. */ + pTmpBuf = pPartType->drmInfo.szContentName; + } else if (pPartType->szContentLocation[0] != '\0') { + /* In case of szContentLocation parsed from MMS header */ + pTmpBuf = strrchr(pPartType->szContentLocation, '/'); + if (pTmpBuf == NULL) + pTmpBuf = pPartType->szContentLocation; + } else { + /* use another name */ + /* possible NULL pointer assignment*/ + pTmpBuf = strdup("untitled"); + } + + if ((pExt = strrchr(pTmpBuf, '.')) != NULL) { + int extLen = 0; + int fileNameLen = 0; + int tmpLen = 0; + + extLen = strlen(pExt); + tmpLen = strlen(pTmpBuf); + fileNameLen = (tmpLen - extLen < MSG_LOCALE_FILENAME_LEN_MAX - extLen)?(tmpLen - extLen):(MSG_LOCALE_FILENAME_LEN_MAX - extLen); + strncpy(pPartType->param.szName, pTmpBuf, fileNameLen); + strcpy (pPartType->param.szName + fileNameLen, pExt); + } else { + strncpy(pPartType->param.szName, pTmpBuf, MSG_LOCALE_FILENAME_LEN_MAX); + MsgMakeFileName(pPartType->type, pPartType->param.szName, MSG_DRM_TYPE_NONE, 0); + } + } + + return true; +} + +#endif + +bool MsgIsText(int type) +{ + if (type == MIME_TEXT_PLAIN || type == MIME_TEXT_HTML || type == MIME_TEXT_VND_WAP_WML || + type == MIME_TEXT_X_VNOTE || type == MIME_APPLICATION_SMIL || type == MIME_TEXT_X_IMELODY) { + return true; + } else { + return false; + } +} + +bool MsgFreeAttrib(MmsAttrib *pAttrib) +{ + MSG_BEGIN(); + + if (pAttrib == NULL) { + MSG_DEBUG("pAttrib is NULL"); + return false; + } + + if (pAttrib->szTo) { + free(pAttrib->szTo); + pAttrib->szTo = NULL; + } + + if (pAttrib->szCc) { + free(pAttrib->szCc); + pAttrib->szCc = NULL; + } + + if (pAttrib->szBcc) { + free(pAttrib->szBcc); + pAttrib->szBcc = NULL; + } + + //check if pMultiStatus should be freed or not, because pMultiStatus is not allocated + if (pAttrib->pMultiStatus) { + MmsMsgMultiStatus *pMultiStatus = pAttrib->pMultiStatus; + MmsMsgMultiStatus *pCurStatus = NULL; + + while (pMultiStatus != NULL ) { + pCurStatus = pMultiStatus; + pMultiStatus = pMultiStatus->pNext; + + if (pCurStatus) { + free(pCurStatus); + pCurStatus = NULL; + } + } + + pAttrib->pMultiStatus = NULL; + } + + + MSG_END(); + + return true; +} + +bool _MsgFreeBody(MsgBody *pBody, int type) +{ + MSG_DEBUG("_MsgFreeBody: S T A R T !!! \n") ; + + if (pBody == NULL) { + MSG_DEBUG("_MsgFreeBody: pBody == NULL \n" ); + MSG_DEBUG("_MsgFreeBody: E N D (End)!!! \n") ; + + return false; + } + + switch (type) { + case MIME_MULTIPART_REPORT: + case MIME_APPLICATION_VND_OMA_DRM_MESSAGE: + case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED: + case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED: + case MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC: + 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) { +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pCurrPart->type.drmInfo); +#endif + + if (pCurrPart->pBody) { + if (pCurrPart->pBody->body.pBinary) { + free(pCurrPart->pBody->body.pBinary); + pCurrPart->pBody->body.pBinary = NULL; + } + free(pCurrPart->pBody); + pCurrPart->pBody = NULL; + } + free(pCurrPart); + pCurrPart = NULL; + } + } + + pBody->body.pMultipart = NULL; + + if (pPresentation) { + if (pPresentation->body.pText) { + free(pPresentation->body.pText); + pPresentation->body.pText = NULL; + } + free(pPresentation); + pBody->pPresentationBody = NULL; + } + + _MsgInitMsgType(&pBody->presentationType); + + break; + } + + default: + /* Any single part */ + + if (pBody->body.pBinary) { + free(pBody->body.pBinary); + pBody->body.pBinary = NULL; + } + + break; + } + + MSG_DEBUG("_MsgFreeBody: E N D (Successfully) !!! \n") ; + + return true; + +} + +bool MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) +{ + MSG_BEGIN(); + MsgMultipart *pTmpMultipart = NULL; + MsgMultipart *pSelectedPart = NULL; + MsgMultipart *pPrevPart = NULL; + MsgMultipart *pFirstPart = NULL; + MsgMultipart *pLastPart = NULL; + MsgMultipart *pRemoveList = NULL; + MsgMultipart *pNextRemovePart = NULL; + + switch (pPartType->type) { + case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE: + case MIME_MULTIPART_ALTERNATIVE: + + /* fixme: + * Policy: multipart/alternative + * multipart/alternative message has only several parts of media. + * You should choose one of them and make the alternative part + * to the selected media part. + */ + + MSG_DEBUG("MsgResolveNestedMultipart : MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE\n"); + + pSelectedPart = pPartBody->body.pMultipart; + + // NULL Pointer check!! + if (pSelectedPart == NULL) { + MSG_DEBUG("MsgResolveNestedMultipart : multipart(ALTERNATIVE) does not exist\n"); + break; + } + + pTmpMultipart = pPartBody->body.pMultipart->pNext; + + while (pTmpMultipart) { + if (pSelectedPart->type.type <= pTmpMultipart->type.type) + pSelectedPart = pTmpMultipart; + + pTmpMultipart = pTmpMultipart->pNext; + } + + pTmpMultipart = pPartBody->body.pMultipart; + pPrevPart = NULL; + + while (pTmpMultipart) { + if (pSelectedPart == pTmpMultipart) + break; + + pPrevPart = pTmpMultipart; + pTmpMultipart = pTmpMultipart->pNext; + } + + if (pPrevPart == NULL) { + /* selected part is the first part */ + pRemoveList = pSelectedPart->pNext; + } else { + pPrevPart->pNext = pSelectedPart->pNext; + pRemoveList = pPartBody->body.pMultipart; + pPartBody->body.pMultipart = pSelectedPart; + } + + pSelectedPart->pNext = NULL; + + if (pRemoveList) { +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pRemoveList->type.drmInfo); +#endif + _MsgFreeBody(pRemoveList->pBody, pRemoveList->type.type); + + free(pRemoveList->pBody); + free(pRemoveList); + } + + if (MsgCopyNestedMsgType(pPartType, &(pSelectedPart->type)) == false) { + MSG_DEBUG("MsgResolveNestedMultipart : MsgPriorityCopyMsgType failed \n"); + goto __CATCH; + } + + if (pSelectedPart->pBody != NULL) + memcpy(pPartBody, pSelectedPart->pBody, sizeof(MsgBody)); + + if (pSelectedPart != NULL) { +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pSelectedPart->type.drmInfo); +#endif + + if (pSelectedPart->pBody != NULL) { + free(pSelectedPart->pBody); + pSelectedPart->pBody = NULL; + } + free(pSelectedPart); + pSelectedPart = NULL; + } + + break; + + case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED: + case MIME_MULTIPART_RELATED: + + MSG_DEBUG("MsgResolveNestedMultipart : MIME_APPLICATION_VND_WAP_MULTIPART_RELATED\n"); + + pSelectedPart = pPartBody->body.pMultipart; + + while (pSelectedPart) { + if (MsgIsMultipartMixed(pSelectedPart->type.type)) { + + if (pSelectedPart->pBody == NULL) { + MSG_DEBUG("MsgResolveNestedMultipart :pSelectedPart->pBody(1) is NULL\n"); + break; + } + + pFirstPart = pSelectedPart->pBody->body.pMultipart; + + if (pFirstPart == NULL) { + MSG_DEBUG("MsgResolveNestedMultipart : multipart(RELATED) does not exist\n"); + break; + } + + if (pFirstPart->pNext) { + pLastPart = pFirstPart->pNext; + while (pLastPart->pNext) + pLastPart = pLastPart->pNext; + } else { + pLastPart = pFirstPart; + } + + if (pPrevPart == NULL) { + /* the first part */ + pTmpMultipart = pPartBody->body.pMultipart->pNext; + pPartBody->body.pMultipart = pFirstPart; + pLastPart->pNext = pTmpMultipart; + } else { + pTmpMultipart = pSelectedPart->pNext; + pPrevPart->pNext = pFirstPart; + pLastPart->pNext = pTmpMultipart; + } + + if (pSelectedPart) { +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pSelectedPart->type.drmInfo); +#endif + free(pSelectedPart->pBody); + free(pSelectedPart); + } + pSelectedPart = pTmpMultipart; + } else if (MsgIsMultipartRelated(pSelectedPart->type.type) && pPrevPart != NULL) { + pPrevPart->pNext = pTmpMultipart = pSelectedPart->pNext; + _MsgFreeBody(pSelectedPart->pBody, pSelectedPart->type.type); + + free(pSelectedPart->pBody); + free(pSelectedPart); + pSelectedPart = pTmpMultipart; + } else { + pPrevPart = pSelectedPart; + pSelectedPart = pSelectedPart->pNext; + } + } + + break; + + + case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED: + case MIME_MULTIPART_MIXED: + + MSG_DEBUG("MsgResolveNestedMultipart : MIME_APPLICATION_VND_WAP_MULTIPART_MIXED\n"); + + pPrevPart = NULL; + pSelectedPart = pPartBody->body.pMultipart; + + while (pSelectedPart) { + if (MsgIsMultipart(pSelectedPart->type.type)) { + if (pSelectedPart->pBody == NULL) { + MSG_DEBUG("MsgResolveNestedMultipart :pSelectedPart->pBody(2) is NULL\n"); + break; + } + + pFirstPart = pSelectedPart->pBody->body.pMultipart; + + // NULL Pointer check!! + if (pFirstPart == NULL) { + MSG_DEBUG("MsgResolveNestedMultipart : multipart does not exist\n"); + break; + } + + if (pFirstPart->pNext) { + pLastPart = pFirstPart->pNext; + while (pLastPart->pNext) + pLastPart = pLastPart->pNext; + } else { + pLastPart = pFirstPart; + } + + if (pPrevPart == NULL) { + /* the first part */ + pTmpMultipart = pPartBody->body.pMultipart->pNext; + pPartBody->body.pMultipart = pFirstPart; + pLastPart->pNext = pTmpMultipart; + } else { + pTmpMultipart = pSelectedPart->pNext; + pPrevPart->pNext = pFirstPart; + pLastPart->pNext = pTmpMultipart; + } + + if (pSelectedPart->pBody->pPresentationBody) + pPartBody->pPresentationBody = pSelectedPart->pBody->pPresentationBody; + + memcpy(&pPartBody->presentationType, + &pSelectedPart->pBody->presentationType, sizeof(MsgType)); + + pPartType->type = pSelectedPart->type.type; + +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pSelectedPart->type.drmInfo); +#endif + free(pSelectedPart->pBody); + free(pSelectedPart); + + pSelectedPart = pTmpMultipart; + } else { + pPrevPart = pSelectedPart; + pSelectedPart = pSelectedPart->pNext; + } + } + + break; + + case MIME_MULTIPART_REPORT: + + MSG_DEBUG("MsgResolveNestedMultipart : MIME_MULTIPART_REPORT \n"); + + pTmpMultipart = pPartBody->body.pMultipart; + pPrevPart = NULL; + + if (pTmpMultipart == NULL) { + MSG_DEBUG("MsgResolveNestedMultipart : pTmpMultipart == NULL \n"); + return false; + } + + while (pTmpMultipart) { + if (pTmpMultipart->type.type == MIME_TEXT_PLAIN) { + pSelectedPart = pTmpMultipart; + break; + } + + pPrevPart = pTmpMultipart; + pTmpMultipart = pTmpMultipart->pNext; + } + + if (pSelectedPart == NULL) { + MSG_DEBUG("MsgResolveNestedMultipart : MIME_MULTIPART_REPORT [no selected part]\n"); + MSG_DEBUG("MsgResolveNestedMultipart : MIME_MULTIPART_REPORT [no selected part]\n"); + + pRemoveList = pPartBody->body.pMultipart->pNext; + pSelectedPart = pPartBody->body.pMultipart; + pSelectedPart->pNext = NULL; + } else { + if (pPrevPart == NULL) { + // first part is selected + pRemoveList = pPartBody->body.pMultipart->pNext; + } else { + pRemoveList = pPartBody->body.pMultipart->pNext; + pPrevPart->pNext = pSelectedPart->pNext; + } + + pSelectedPart->pNext = NULL; + pPartBody->body.pMultipart = pSelectedPart; + } + + pTmpMultipart = pRemoveList; + + while (pTmpMultipart) { +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pTmpMultipart->type.drmInfo); +#endif + _MsgFreeBody(pTmpMultipart->pBody, pTmpMultipart->type.type); + pNextRemovePart = pTmpMultipart->pNext; + + free(pTmpMultipart->pBody); + free(pTmpMultipart); + pTmpMultipart = pNextRemovePart; + } + + if (MsgCopyNestedMsgType(pPartType, &(pSelectedPart->type)) == false) { + MSG_DEBUG("MsgResolveNestedMultipart : MsgPriorityCopyMsgType failed \n"); + goto __CATCH; + } + + if (pSelectedPart->pBody != NULL) + memcpy(pPartBody, pSelectedPart->pBody, sizeof(MsgBody)); + + if (pSelectedPart != NULL) { +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pSelectedPart->type.drmInfo); +#endif + if (pSelectedPart->pBody != NULL) { + free(pSelectedPart->pBody); + pSelectedPart->pBody = NULL; + } + free(pSelectedPart); + pSelectedPart = NULL; + } + + break; + + default: + break; + } + MSG_END(); + + return true; + +__CATCH: + return false; + +} + +char *MsgResolveContentURI(char *szSrc) +{ + char *szTemp = NULL; + char *szReturn = NULL; + int length = 0; + + if (szSrc == NULL) { + goto __CATCH; + } + + if (szSrc[0] == '\0') + goto __CATCH; + + + if (!strncasecmp(szSrc, "cid:", 4)) { + length = strlen(szSrc) - 3; + szSrc += 4; + } else { + length = strlen(szSrc) + 1; + } + + szTemp = (char *)malloc(length); + if (szTemp == NULL) { + MSG_DEBUG("MsgResolveContentURI: memory full\n"); + goto __CATCH; + } + + memset(szTemp, 0, length); + strcpy(szTemp, szSrc); + + szReturn = MsgChangeHexString(szTemp); + + if (szTemp) { + free(szTemp); + szTemp = NULL; + } + + return szReturn; + +__CATCH: + if (szTemp) { + free(szTemp); + szTemp = NULL; + } + + return NULL; +} + +bool _MsgParsePartHeader(MsgType *pType, const char *pRawData, int nRawData) +{ + char ch = '\0'; + int cRaw = nRawData; + char *pFieldLine = NULL; + char *pFieldValue = NULL; + char *szFieldValue = NULL; + char *szSrc = NULL; + int nLen = 0; + char fieldLine[MSG_LINE_LEN] = {0, }; //temporary line buffer + int length = 0; + + char szTempBuf[MSG_LOCAL_TEMP_BUF_SIZE]; + + while ((cRaw > 0) && *pRawData != MSG_CH_LF) { + memset(fieldLine, 0, MSG_LINE_LEN); + pFieldLine = fieldLine; + + ch = MSG_CH_SP; //remember previous character. + + while (ch) { + switch (ch = *pRawData++) { + case MSG_CH_CR: //'\r' + if (*pRawData == MSG_CH_LF) + break; + + case MSG_CH_LF: //'\n' + if (*pRawData != MSG_CH_SP && *pRawData != MSG_CH_TAB) { + ch = MSG_CH_NULL; + *pFieldLine = ch; + pFieldLine++; + } + break; + + case MSG_CH_TAB: //'\t' + *pFieldLine = MSG_CH_SP; + pFieldLine++; + break; + + default: + *pFieldLine = ch; + pFieldLine++; + break; + } + + if (--cRaw <= 0) { //If is the last character of header + *pFieldLine = MSG_CH_NULL; + pFieldLine++; + } + } + + + if ((pFieldValue = strchr(fieldLine, MSG_CH_COLON)) != NULL) { + char* pTemp = pFieldValue; + char* pValue = NULL; + + *pFieldValue++ = MSG_CH_NULL; //remove ':' + + while (*pFieldValue == MSG_CH_SP) //remove space ' ' + pFieldValue++; + + while ((fieldLine < pTemp--) && (*pTemp == MSG_CH_SP)) + *pTemp = MSG_CH_NULL; + + nLen = strlen(pFieldValue); + + if (nLen >= MSG_LOCAL_TEMP_BUF_SIZE) { + szFieldValue = (char *)malloc(nLen + 1); + memset(szFieldValue, 0 , nLen + 1); + memcpy(szFieldValue, pFieldValue, nLen + 1); + } else { + memset(szTempBuf, 0, MSG_LOCAL_TEMP_BUF_SIZE); + strcpy(szTempBuf, pFieldValue); + szFieldValue = szTempBuf; + } + + if (MsgStrcpyWithoutCRLF(szFieldValue, &szSrc) == true) { + if (szSrc != NULL) + strncpy(szFieldValue, szSrc, strlen(szSrc)); + } + if (szSrc) { + free(szSrc); + szSrc = NULL; + } + + switch (_MsgGetCode(MSG_FIELD, fieldLine)) { + case MSG_FIELD_CONTENT_ID: + if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) != NULL) + *pTemp++ = MSG_CH_NULL; + + pValue = _MsgDecodeText(szFieldValue); + memset (pType->szContentID, 0, MSG_MSG_ID_LEN + 1); + + if (pValue) { + // support CD & SD + length = MsgStrlen(pValue); + if (pValue[0] == '<' && pValue[length-1] == '>') { + strncpy(pType->szContentID, pValue + 1, length - 2); + } else { + strncpy(pType->szContentID, pValue, MSG_MSG_ID_LEN); + } + + MSG_DEBUG("_MsgParsePartHeader: Content-ID = %s %s\n", pFieldValue, pType->szContentID); + + if (pTemp != NULL) + _MsgParseParameter(pType, pTemp); + + free(pValue); + pValue = NULL; + } + + break; + + case MSG_FIELD_CONTENT_LOCATION: + if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) != NULL) + *pTemp++ = MSG_CH_NULL; + + pValue = _MsgDecodeText(szFieldValue); + memset (pType->szContentLocation, 0, MSG_MSG_ID_LEN + 1); + + if (pValue) { + strncpy(pType->szContentLocation, pValue, MSG_MSG_ID_LEN); + + MSG_DEBUG("_MsgParsePartHeader: Content-Location = %s %s\n", pFieldValue, pType->szContentLocation); + + if (pTemp != NULL) + _MsgParseParameter(pType, pTemp); + + free(pValue); + pValue = NULL; + } + + break; + + case MSG_FIELD_CONTENT_TYPE: + if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) == NULL) { + if ((pTemp = strchr(szFieldValue, MSG_CH_SP)) != NULL) + *pTemp++ = MSG_CH_NULL; + } else { + *pTemp++ = MSG_CH_NULL; + } + + pType->type = _MsgGetCode(MSG_TYPE, szFieldValue); + + MSG_DEBUG("_MsgParsePartHeader: Content-Type = %s %d\n", pFieldValue, pType->type); + + if (pType->type == INVALID_HOBJ) + pType->type = MIME_UNKNOWN; + + if (pTemp != NULL) + _MsgParseParameter(pType, pTemp); + + break; + + case MSG_FIELD_CONTENT_TRANSFER_ENCODING: + if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) == NULL) { + if ((pTemp = strchr(szFieldValue, MSG_CH_SP)) != NULL) + *pTemp++ = MSG_CH_NULL; + } else { + *pTemp++ = MSG_CH_NULL; + } + + pType->encoding = _MsgGetCode(MSG_ENCODING, szFieldValue); + + MSG_DEBUG("_MsgParsePartHeader: Content-Encoding = %s %d\n", pFieldValue, pType->encoding); + + if (pTemp != NULL) + _MsgParseParameter(pType, pTemp); + + break; + + case MSG_FIELD_CONTENT_DISPOSITION: + if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) == NULL) { + if ((pTemp = strchr(szFieldValue, MSG_CH_SP)) != NULL) + *pTemp++ = MSG_CH_NULL; + } else { + *pTemp++ = MSG_CH_NULL; + } + + pType->disposition = _MsgGetCode(MSG_DISPOSITION, szFieldValue); + + MSG_DEBUG("_MsgParsePartHeader: Content-Disposition = %s %d\n", pFieldValue, pType->disposition); + + if (pTemp != NULL) + _MsgParseParameter(pType, pTemp); + + break; + +#ifdef __SUPPORT_DRM__ + + case MSG_FIELD_CONTENT_NAME: + /* add to parse DCF header such as, + * Right-Issuer, Content-Name, and Content-Description. + */ + MsgMIMERemoveQuote(szFieldValue); + pType->drmInfo.szContentName = MsgStrCopy(szFieldValue); + break; + + case MSG_FIELD_CONTENT_DESCRIPTION: + MsgMIMERemoveQuote(szFieldValue); + pType->drmInfo.szContentDescription = MsgStrCopy(szFieldValue); + break; + + case MSG_FIELD_CONTENT_VENDOR: + MsgMIMERemoveQuote(szFieldValue); + pType->drmInfo.szContentVendor = MsgStrCopy(szFieldValue); + break; + + case MSG_FIELD_RIGHT_ISSUER: + MsgMIMERemoveQuote(szFieldValue); + pType->drmInfo.szRightIssuer = MsgStrCopy(szFieldValue); + break; + + + case MSG_FIELD_DRM_CONVERTED: + MsgMIMERemoveQuote(szFieldValue); + pType->nDrmConvertedStatus = atoi(szFieldValue); + break; + +#endif + case MSG_FILED_CONTENT_REPLACE_POS: + MsgMIMERemoveQuote(szFieldValue); + strncpy(pType->szContentRepPos, szFieldValue, sizeof(pType->szContentRepPos)); + break; + + case MSG_FILED_CONTENT_REPLACE_SIZE: + MsgMIMERemoveQuote(szFieldValue); + strncpy(pType->szContentRepSize, szFieldValue, sizeof(pType->szContentRepSize)); + break; + + case MSG_FILED_CONTENT_REPLACE_INDEX: + MsgMIMERemoveQuote(szFieldValue); + strncpy(pType->szContentRepIndex, szFieldValue, sizeof(pType->szContentRepIndex)); + break; + + default: + MSG_DEBUG("_MsgParsePartHeader: Unhandled field \n"); + break; + } + } + + if (szFieldValue != NULL && szFieldValue != szTempBuf) { + free(szFieldValue); + szFieldValue = NULL; + } + + } + + return true; +} + +char *MsgRemoveQuoteFromFilename(char *pSrc) +{ + int cLen = 0; // length of pBuff + char *pBuff = NULL; + + if (pSrc == NULL) { + MSG_DEBUG("MsgRemoveQuoteFromFilename: pSrc is Null\n"); + return NULL; + } + + cLen = strlen(pSrc); + + pBuff = (char *)malloc(cLen + 1); + + if (pBuff == NULL) { + MSG_DEBUG("MsgRemoveQuoteFromFilename: pBuff mem alloc fail!\n"); + return NULL; + } + memset(pBuff, 0 , sizeof(char)*(cLen + 1)); + + // remove front quote + if (pSrc[0] == MSG_CH_QUOT) { + cLen--; + strncpy(pBuff, &pSrc[1], cLen); + pBuff[cLen] = '\0'; + } + + if (pSrc[0] == MSG_CH_LF) { + cLen--; + strncpy(pBuff, &pSrc[1], cLen); + } else { + strcpy(pBuff, pSrc); + } + + // remove last qoute + if (pBuff[cLen-1] == MSG_CH_QUOT) { + pBuff[cLen-1] = '\0'; + } + + return pBuff; +} + +bool MsgIsMultipart(int type) +{ + if (type == MIME_MULTIPART_RELATED || type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || + type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED || type == MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC || + type == MIME_MULTIPART_MIXED || type == MIME_MULTIPART_REPORT) { + return true; + } else { + return false; + } +} + + +bool MsgIsHexChar(char *pSrc) +{ + int cIndex = 0; + int cLen = 0; + bool bRet = false; + + cLen = strlen(pSrc); + + for (cIndex = 0; cIndex < cLen ; cIndex++) { + if ((pSrc[cIndex] >= '0' && pSrc[cIndex] <= '9') || (pSrc[cIndex] >= 'A'&& pSrc[cIndex] <= 'F') || + (pSrc[cIndex] >= 'a' && pSrc[cIndex] <= 'f')) { + bRet = true; + } else { + return false; + } + } + + return bRet; +} + +char _MsgConvertHexValue(char *pSrc) +{ + int ch = 0; + int cIndex = 0; + int cLen = 0; + char ResultChar; + unsigned char uCh[2] = {0,}; + + cLen = strlen(pSrc); + + for (cIndex = 0; cIndex < cLen ; cIndex += 2) { + uCh[0] = __MsgConvertCharToInt(pSrc[cIndex]); + uCh[1] = __MsgConvertCharToInt(pSrc[cIndex+1]); + ch = (int)uCh[0]<<4|uCh[1]; + } + + ResultChar = (char)ch; + + return ResultChar; +} + +int __MsgConvertCharToInt(char ch) +{ + if (ch>='0' && ch<='9') { + return ch - '0'; + } else if (ch>='a'&& ch <='f') { + return ch -'a'+10; + } else if (ch>='A'&& ch <='F') { + return ch -'A'+10; + } else { + return 0; + } +} + +bool MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2) +{ + if (pMsgType1->section == INVALID_HOBJ) + pMsgType1->section = pMsgType2->section; + +#ifdef __SUPPORT_DRM__ + int length = 0; + + if (pMsgType1->drmInfo.drmType == MSG_DRM_TYPE_NONE) + pMsgType1->drmInfo.drmType = pMsgType2->drmInfo.drmType; + + + if (pMsgType1->szContentID[0] == '\0') { + strcpy(pMsgType1->szContentID, pMsgType2->szContentID); + + if (pMsgType2->szContentID[0]) { + length = MsgStrlen(pMsgType2->szContentID); + if (pMsgType2->szContentID[0] == '<' && pMsgType2->szContentID[length - 1] == '>') { + pMsgType1->drmInfo.szContentURI = MsgStrNCopy(pMsgType2->szContentID + 1, length - 2); + } else { + pMsgType1->drmInfo.szContentURI = MsgStrCopy(pMsgType2->szContentID); + } + } + } else { + length = MsgStrlen(pMsgType1->szContentID); + if (pMsgType1->szContentID[0] == '<' && pMsgType1->szContentID[length - 1] == '>') { + pMsgType1->drmInfo.szContentURI = MsgStrNCopy(pMsgType1->szContentID + 1, length - 2); + } else { + pMsgType1->drmInfo.szContentURI = MsgStrCopy(pMsgType1->szContentID); + } + } +#endif + + if (pMsgType1->szContentLocation[0] == '\0') + strcpy(pMsgType1->szContentLocation, pMsgType2->szContentLocation); + + /* Copy informations - we shoud open the pMsgType2's orgFile + * concerning its offset and size. + */ + if (pMsgType2->szOrgFilePath[0] != '\0') + strcpy(pMsgType1->szOrgFilePath, pMsgType2->szOrgFilePath); + + if (pMsgType2->disposition != INVALID_HOBJ) + pMsgType1->disposition = pMsgType2->disposition; + + if ((pMsgType1->type != MIME_APPLICATION_VND_OMA_DRM_MESSAGE && pMsgType1->type != MIME_APPLICATION_VND_OMA_DRM_CONTENT) && + pMsgType2->encoding != INVALID_HOBJ) + pMsgType1->encoding = pMsgType2->encoding; + + pMsgType1->contentSize = pMsgType2->contentSize; + pMsgType1->offset = pMsgType2->offset; + pMsgType1->size = pMsgType2->size; + pMsgType1->type = pMsgType2->type; + + MsgCopyNestedMsgParam(&(pMsgType1->param), &(pMsgType2->param)); + + if (pMsgType1->param.szName[0]) { +#ifdef __SUPPORT_DRM__ + pMsgType1->drmInfo.szContentName = MsgStrCopy(pMsgType2->param.szName); +#endif + } + + return true; +} + + +bool MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2) +{ + if (pParam1->charset == MSG_CHARSET_UNKNOWN) + pParam1->charset = pParam2->charset; + + if (pParam1->type == MIME_UNKNOWN) + pParam1->type = pParam2->type; + + /* Don't copy pParam2->pPresentation */ + + /* For alternative: copy the boundary string */ + if (pParam2->szBoundary[0] !='\0') + strcpy(pParam1->szBoundary, pParam2->szBoundary); + + if (pParam1->szFileName[0] =='\0') + strcpy(pParam1->szFileName, pParam2->szFileName); + + if (pParam1->szName[0] =='\0') + strcpy(pParam1->szName, pParam2->szName); + + if (pParam1->szStart[0] =='\0') + strcpy(pParam1->szStart, pParam2->szStart); + + if (pParam1->szStartInfo[0] =='\0') + strcpy(pParam1->szStartInfo, pParam2->szStartInfo); + + return true; +} + +bool MsgIsMultipartMixed(int type) +{ + if (type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || type == MIME_MULTIPART_MIXED) { + return true; + } else { + return false; + } +} + +bool MsgStrcpyWithoutCRLF(char *pOrg, char **ppNew) +{ + int nLen = 0; + int i = 0; + int index = 0; + char* pDest = NULL; + + + nLen = strlen(pOrg); + + pDest = (char *)malloc(nLen + 1); + + if (pDest == NULL) { + MSG_DEBUG("MsgStrcpyWithoutCRLF: malloc is failed\n"); + return false; + } + + memset(pDest, 0 , (nLen + 1)); + + for (i = 0; i < nLen ; i++) { + if (i < nLen - 2) { + if ((pOrg[i] == MSG_CH_CR && pOrg[i+1] == MSG_CH_LF && pOrg[i+2] == MSG_CH_TAB) || + (pOrg[i] == MSG_CH_CR && pOrg[i+1] == MSG_CH_LF && pOrg[i+2] == MSG_CH_SP)) { + i+=2; + continue; + } + } + pDest[index++] = pOrg[i]; + } + *ppNew = pDest; + + return true; +} + +bool MmsGetMsgAttrib(MmsMsgID msgID, MmsAttrib* pAttrib) +{ + MmsMsg *pMsg = NULL; + + memset(pAttrib, 0, sizeof(MmsAttrib)); + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + memcpy(pAttrib, &(pMsg->mmsAttrib), sizeof(MmsAttrib)); + + MSG_DEBUG("MmsGetMsgAttrib: msgID = %lu ---------------------\n", msgID); + + if ('\0' != pMsg->szTrID[0]) + MSG_DEBUG("szTrID = %s \n", pMsg->szTrID); + + MSG_END(); + return true; +} + +bool __MsgIsInvalidFileNameChar(char ch) +{ + if ((ch == 0x5C /* \ */) || + (ch == 0x2F /* / */) || + (ch == 0x3A /* : */) || + (ch == 0x2A /* * */) || + (ch == 0x3F /* ? */) || + (ch == 0x22 /* " */) || + (ch == 0x3C /* < */) || + (ch == 0x3E /* > */) || + (ch == 0x7C /* | */)) + return true; + + return false; +} + +bool _MmsDataUpdateLastStatus(MmsMsg *pMsg) +{ + MmsMsgMultiStatus* pStatus = NULL; + + pStatus = pMsg->mmsAttrib.pMultiStatus; + + while (pStatus != NULL) { + pStatus->bDeliveyrReportIsLast = false; + pStatus->bReadReplyIsLast = false; + pStatus = pStatus->pNext; + } + + return true; +} + + +bool MmsAddrUtilCompareAddr(char *pszAddr1, char *pszAddr2) +{ + int len1; + int len2; + char *p; + + MmsAddrUtilRemovePlmnString(pszAddr1); + MmsAddrUtilRemovePlmnString(pszAddr2); + + MSG_DEBUG("##### pszAddr1 = %s #####", pszAddr1); + MSG_DEBUG("##### pszAddr2 = %s #####", pszAddr2); + if (!strcmp(pszAddr1, pszAddr2)) + return true; + + len1 = strlen(pszAddr1); + len2 = strlen(pszAddr2); + + if (len1 > len2) { + p = strstr(pszAddr1, pszAddr2); + } else { + p = strstr(pszAddr2, pszAddr1); + } + + if (p) + return true; + + return false; +} + +int MsgGetLatin2UTFCodeSize(unsigned char *szSrc, int nChar) +{ + int nCount = 0; + + MSG_DEBUG("MsgGetLatin2UTFCodeSize: --------------- \n"); + + if ((szSrc == NULL) || (nChar <= 0)) { + MSG_DEBUG("MsgGetLatin2UTFCodeSize: szSrc is NULL !!!! --------------- \n"); + return 0; + } + + while ((nChar > 0) && (*szSrc != '\0')) { + if (0x01 <= *szSrc && *szSrc <= 0x7F) { + nCount += 1; + szSrc++; + nChar--; + } else { + nCount += 2; + szSrc++; + nChar--; + } + } + + return nCount; +} + +int MsgLatin5code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar) +{ + unsigned char *org; + unsigned char t1; + unsigned char t2; + unsigned short temp = 0; + + org = des; + outBufSize--; //Null Character + + while ((nChar > 0) && (*szSrc != '\0')) { + + if (*szSrc >= 0x01 && *szSrc <= 0x7F) { //basic common + temp = (unsigned short)(*szSrc); + + outBufSize --; + if (outBufSize < 0) + goto __RETURN; + + *des = (unsigned char) ((*szSrc) & 0x007F); + + des++; + szSrc++; + nChar--; + } else if ((*szSrc == 0x00) || (*szSrc >= 0x80 && *szSrc <= 0x9F) || + (*szSrc >= 0xA0 && *szSrc <= 0xCF) || (*szSrc >= 0xD1 && *szSrc <= 0xDC) || + (*szSrc >= 0xDF && *szSrc <= 0xEF) || (*szSrc >= 0xF1 && *szSrc <= 0xFC) || + (*szSrc == 0xFF)) {//uni 0x00A0 ~ 0x00CF + + temp = (unsigned short)(*szSrc); + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else if (*szSrc == 0xD0) {//empty section OR vendor specific codes. + + temp = 0x011E; + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else if (*szSrc == 0xDD) { + temp = 0x0130; + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else if (*szSrc == 0xDE) { + temp = 0x015E; + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else if (*szSrc == 0xF0) { + temp = 0x011F; + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else if (*szSrc == 0xFD) { + temp = 0x0131; + + outBufSize -= 2; + + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else if (*szSrc == 0xFE) { + temp = 0x015F; + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else { + return -1; + } + } +__RETURN: + *des = 0; + return(des-org); +} + +int MsgGetLatin52UTFCodeSize(unsigned char *szSrc, int nChar) +{ + int nCount = 0; + + MSG_DEBUG("MsgGetLatin52UTFCodeSize: --------------- \n"); + + if ((szSrc == NULL) || (nChar <= 0)) + return 0; + + while ((nChar > 0) && (*szSrc != '\0')) { + if (*szSrc >= 0x01 && *szSrc <= 0x7F) { + nCount += 1; + szSrc++; + nChar--; + } else if (*szSrc == 0x00 || (*szSrc >= 0x80 && *szSrc <= 0x9F) || + (*szSrc >= 0xA0 && *szSrc <= 0xCF) || (*szSrc >= 0xD1 && *szSrc <= 0xDC) | + (*szSrc >= 0xDF && *szSrc <= 0xEF) || (*szSrc >= 0xF1 && *szSrc <= 0xFC) || + *szSrc == 0xD0 || *szSrc == 0xDD || *szSrc == 0xDE || *szSrc == 0xF0 || + *szSrc == 0xFD || *szSrc == 0xFE || *szSrc == 0xFF) { //uni 0x00A0 ~ 0x00CF + nCount += 2; + szSrc++; + nChar--; + } else { + return -1; + } + } + return nCount; +} + +int MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar) +{ + unsigned char* org; + unsigned char t1, t2; + + MSG_DEBUG("MsgLatin2UTF: --------------- \n"); + + org = des; + outBufSize--; // NULL character + + while ((nChar > 0) && (*szSrc != '\0')) { + if (0x01 <= *szSrc && *szSrc <= 0x7F) { + /* check outbuffer's room for this UTF8 character */ + + outBufSize --; + if (outBufSize < 0) + goto __RETURN; + + *des = (unsigned char) (*szSrc & 0x007F); + + des++; + szSrc++; + nChar--; + } else { + /* check outbuffer's room for this UTF8 character */ + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + 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); + + des += 2; + szSrc += 1; + nChar -= 1; + } + } + +__RETURN: + + *des = 0; + return (des - org); +} + + +int MsgLatin7code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar) +{ + unsigned char *org; + unsigned char t1; + unsigned char t2; + unsigned char t3; + unsigned short temp = 0; + + MSG_DEBUG("MsgUnicode2UTF: --------------- \n"); + + org = des; + outBufSize--; //Null Character + + while ((nChar > 0) && (*szSrc != '\0')) { + if (*szSrc >= 0x01 && *szSrc <= 0x7F) { + temp = (unsigned short)(*szSrc); + + outBufSize --; + if (outBufSize < 0) + goto __RETURN; + + *des = (unsigned char) (temp & 0x007F); + + des++; + szSrc++; + nChar--; + + } else if ((*szSrc == 0x00) || (*szSrc >= 0x80 && *szSrc <= 0x9F) || + (*szSrc >= 0xA3 && *szSrc <= 0xAD) || (*szSrc == 0xBB)) { // consider 0xA4, 0xA5 + + temp = (unsigned short)(*szSrc); + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0xC0) >> 6); // right most 2 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des + 1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else if (*szSrc == 0xA0) { + temp = 0x0020; + //*des = temp to utf-8 + outBufSize--; + if (outBufSize < 0) + goto __RETURN; + + *des = (unsigned char) (temp & 0x007F); + + des++; + szSrc++; + nChar--; + + } else if (*szSrc == 0xA1) { + temp = 0x2018; + + outBufSize -= 3; + if (outBufSize < 0) + goto __RETURN; + + t3 = (unsigned char) (temp & 0x003F); // right most 6 bit + t2 = (unsigned char) ((temp & 0x0FC0) >> 6); // right most 6 bit + t1 = (unsigned char) ((temp & 0xF000) >> 12); // right most 4 bit + + *des = 0xE0 | (t1 & 0x0F); + *(des+1) = 0x80 | (t2 & 0x3F); + *(des+2) = 0x80 | (t3 & 0x3F); + + des += 3; + szSrc += 1; + nChar -= 1; + + } else if (*szSrc == 0xA2) { + temp = 0x2019; + + outBufSize -= 3; + if (outBufSize < 0) + goto __RETURN; + + t3 = (unsigned char) (temp & 0x003F); // right most 6 bit + t2 = (unsigned char) ((temp & 0x0FC0) >> 6); // right most 6 bit + t1 = (unsigned char) ((temp & 0xF000) >> 12); // right most 4 bit + + *des = 0xE0 | (t1 & 0x0F); + *(des+1) = 0x80 | (t2 & 0x3F); + *(des+2) = 0x80 | (t3 & 0x3F); + + des += 3; + szSrc += 1; + nChar -= 1; + + } else if (*szSrc == 0xAF) { + temp = 0x2015; + + outBufSize -= 3; + if (outBufSize < 0) + goto __RETURN; + + t3 = (unsigned char) (temp & 0x003F); // right most 6 bit + t2 = (unsigned char) ((temp & 0x0FC0) >> 6); // right most 6 bit + t1 = (unsigned char) ((temp & 0xF000) >> 12); // right most 4 bit + + *des = 0xE0 | (t1 & 0x0F); + *(des+1) = 0x80 | (t2 & 0x3F); + *(des+2) = 0x80 | (t3 & 0x3F); + + des += 3; + szSrc += 1; + nChar -= 1; + + } else if (0xB0 <= *szSrc && *szSrc <= 0xB4) { //0x00B0 ~ 0x00B4 + + temp = (unsigned short)(*szSrc); + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + + } else if ((0xB5 <= *szSrc && *szSrc <= 0xBA) || + (0xBC <= *szSrc && *szSrc <= 0xD1) || + (0xD3 <= *szSrc && *szSrc <= 0xFE)) { + temp= (unsigned short)(*szSrc + 0x02D0); + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (temp & 0x003F); // right most 6 bit + t1 = (unsigned char) ((temp & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + + } else { + return -1; + } + + } + +__RETURN: + *des = 0; + return(des - org); +} + +int MsgGetLatin72UTFCodeSize(unsigned char *szSrc, int nChar) +{ + int nCount = 0; + + MSG_DEBUG("MsgGetLatin72UTFCodeSize: --------------- \n"); + + if ((szSrc == NULL) || (nChar <= 0)) + return 0; + + while ((nChar > 0) && (*szSrc != '\0')) { + + if ((*szSrc >= 0x01 && *szSrc <= 0x7F) || (*szSrc == 0xA0)) { + nCount += 1; + szSrc++; + nChar--; + } else if (*szSrc == 0x00 || (0x80 <= *szSrc && *szSrc <= 0x9F) || (0xA3 <= *szSrc && *szSrc <= 0xAD) || + (0xB0 <= *szSrc && *szSrc <= 0xB4) || (0xB5 <= *szSrc && *szSrc <= 0xFE)) { + nCount += 2; + szSrc++; + nChar--; + } else if (*szSrc == 0xA1 ||*szSrc == 0xA2 || *szSrc == 0xAF) { + nCount += 3; + szSrc += 1; + nChar -= 1; + + } else { + return -1; + } + } + return nCount; +} + +int MsgUnicode2UTF(unsigned char *des, int outBufSize, unsigned short *szSrc, int nChar) +{ + unsigned char *org; + unsigned char t1; + unsigned char t2; + unsigned char t3; + + MSG_DEBUG("MsgUnicode2UTF: --------------- \n"); + + org = des; + outBufSize--; // NULL character + + while ((nChar > 0) && (*szSrc != '\0')) { + if (0x0001 <= *szSrc && *szSrc <= 0x007F) { + /* check outbuffer's room for this UTF8 character */ + + outBufSize --; + if (outBufSize < 0) + goto __RETURN; + + *des = (unsigned char) (*szSrc & 0x007F); + + des++; + szSrc++; + nChar--; + } else if ((*szSrc == 0x0000) || (0x0080 <= *szSrc && *szSrc <= 0x07FF)) { + /* check outbuffer's room for this UTF8 character */ + + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + t2 = (unsigned char) (*szSrc & 0x003F); // right most 6 bit + t1 = (unsigned char) ((*szSrc & 0x07C0) >> 6); // right most 5 bit + + *des = 0xC0 | (t1 & 0x1F); + *(des+1) = 0x80 | (t2 & 0x3F); + + des += 2; + szSrc += 1; + nChar -= 1; + } else { + /* check outbuffer's room for this UTF8 character */ + + outBufSize -= 3; + if (outBufSize < 0) + goto __RETURN; + + t3 = (unsigned char) (*szSrc & 0x003F); // right most 6 bit + t2 = (unsigned char) ((*szSrc & 0x0FC0) >> 6); // right most 6 bit + t1 = (unsigned char) ((*szSrc & 0xF000) >> 12); // right most 4 bit + + *des = 0xE0 | (t1 & 0x0F); + *(des+1) = 0x80 | (t2 & 0x3F); + *(des+2) = 0x80 | (t3 & 0x3F); + + des += 3; + szSrc += 1; + nChar -= 1; + } + } + +__RETURN: + + *des = 0; + return (des - org); +} + +int MsgGetUnicode2UTFCodeSize(unsigned short *szSrc, int nChar) +{ + int nCount = 0; + + MSG_DEBUG("MsgGetUnicode2UTFCodeSize: --------------- \n"); + + if ((szSrc == NULL) || (nChar <= 0)) { + MSG_DEBUG("MsgGetUnicode2UTFCodeSize: szSrc is NULL !!!! --------------- \n"); + return 0; + } + + while ((nChar > 0) && (*szSrc != '\0')) { + if (0x0001 <= *szSrc && *szSrc <= 0x007F) { + nCount += 1; + szSrc++; + nChar--; + } else if ((*szSrc == 0x0000) || (0x0080 <= *szSrc && *szSrc <= 0x07FF)) { + nCount += 2; + szSrc++; + nChar--; + } else { + nCount += 3; + szSrc++; + nChar--; + } + } + + return nCount; +} + +bool MmsAddrUtilCheckEmailAddress(char *pszAddr) +{ + if (!pszAddr || pszAddr[0] == 0) + return false; + + if (!strchr (pszAddr, MSG_MMS_CH_EMAIL_AT)) + return false; + + return true; +} + +bool MmsAddrUtilRemovePlmnString(char *pszAddr) +{ + char *pszAddrCopy = NULL; + char *pszStrStart = NULL; + char *pszStrTemp = NULL; + int strLen = 0; + + if ((!pszAddr) || (pszAddr[0] == 0)) { + MSG_DEBUG("MmsAddrUtilRemovePlmnString: pszAddr is null or zero\n"); + return false; + } + + strLen = strlen(pszAddr); + + pszAddrCopy = (char*)malloc(strLen + 1); + if (!pszAddrCopy) { + MSG_DEBUG("MmsAddrUtilRemovePlmnString: pszAddrCopy is NULL, mem alloc failed\n"); + return false; + } + + strcpy(pszAddrCopy, pszAddr); + + + pszAddr[0] = 0; + pszStrStart = pszAddrCopy; + + while (true) { + char* pszStrEnd = NULL; + int addressLen = 0; + + if (MmsAddrUtilCheckEmailAddress(pszAddrCopy)) + pszStrEnd = strstr(pszStrStart, "/TYPE=PLMN"); + else + pszStrEnd = strstr(pszStrStart, "/"); + + if (!pszStrEnd) { + // "/TYPE=PLMN" not found + + int remainedLen = strlen(pszStrStart); + + if (remainedLen <= 0) + break; + + strcat(pszAddr, pszStrStart); + + break; + } + + // Get one address length + addressLen = pszStrEnd - pszStrStart; + + strncat(pszAddr, pszStrStart, addressLen); + + // Find next address + pszStrStart = pszStrEnd; + + pszStrTemp = strstr(pszStrStart, MSG_MMS_STR_ADDR_DELIMETER); + + if (pszStrTemp) { + addressLen = pszStrTemp - pszStrEnd; + pszStrStart += addressLen; + } else { + pszStrStart += strlen(pszStrEnd); + } + + if (pszStrStart[0] == 0) // end of string + break; + + + strcat(pszAddr, MSG_MMS_STR_ADDR_DELIMETER); // add ';' + pszStrStart++; // remove ';' + } + + if (pszAddr[0] == 0) + strcpy(pszAddr, pszAddrCopy); + + free(pszAddrCopy); + + return true; +} + +int MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar) +{ + unsigned char *org; + + MSG_DEBUG("MsgCutUTFString: --------------- \n"); + + org = des; + outBufSize--; // NULL character + + while ((nChar > 0) && (*szSrc != '\0')) { + if (*szSrc < 0x80) { + outBufSize --; + if (outBufSize < 0) + goto __RETURN; + + *des = *szSrc; + des++; + szSrc++; + } else if (((0xC0 <= *szSrc) && (*szSrc < 0xE0)) && (*(szSrc+1) >= 0x80)) { + outBufSize -= 2; + if (outBufSize < 0) + goto __RETURN; + + *des = *szSrc; + *(des + 1) = *(szSrc + 1); + + des += 2; + szSrc += 2; + } else if ((*szSrc >= 0xE0) && (*(szSrc+1) >= 0x80) && (*(szSrc+2) >= 0x80)) { + outBufSize -= 3; + if (outBufSize < 0) + goto __RETURN; + + *des = *szSrc; + *(des + 1) = *(szSrc + 1); + *(des + 2) = *(szSrc + 2); + + des += 3; + szSrc += 3; + } else { + outBufSize --; + if (outBufSize < 0) + goto __RETURN; + + *des = *szSrc; + des++; + szSrc++; + MSG_DEBUG("MsgCutUTFString: utf8 incorrect range!\n"); + } + + nChar--; + } + +__RETURN: + + *des = 0; + return (des - org); +} + +void MsgMIMERemoveQuote(char *szSrc) +{ + int length = 0; + + length = MsgStrlen(szSrc); + if (szSrc[0] == MSG_CH_QUOT && szSrc[length-1] == MSG_CH_QUOT) { + int index = 0; + + for (index = 0; index < length-2; index++) + szSrc[index] = szSrc[index+1]; + szSrc[index] = '\0'; + } +} + +bool MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, int *pOffset, char *pInBuf1, char *pInBuf2, int maxLen, int *pBufLen, int endOfFile) +{ + MSG_BEGIN(); + int nRead = 0; + int length= 0; + + MSG_DEBUG("MsgLoadDataToDecodeBuffer: \n"); + + if (pFile == NULL) { + MSG_DEBUG("Error"); + + *pBufLen = 0; + return false; + } + + if (pPtr == NULL || pInBuf1 == NULL || pInBuf2 == NULL) { + MSG_DEBUG("Error"); + + *pBufLen = 0; + return false; + } + + if (*pBufLen == 0) { + length = maxLen - (*pPtr); + } else { + length = (*pBufLen) - (*pPtr); + } + + if (length < 0) + length = 0; + + if ((*ppBuf) == NULL) { + memset(pInBuf1, 0, maxLen); + (*ppBuf) = pInBuf1; + } else if ((*ppBuf) == pInBuf1) { + memset(pInBuf2, 0, maxLen); + if (length) + memcpy(pInBuf2, pInBuf1 + (*pPtr), length); + (*ppBuf) = pInBuf2; + } else { + memset(pInBuf1, 0, maxLen); + if (length) + memcpy(pInBuf1, pInBuf2 + (*pPtr), length); + (*ppBuf) = pInBuf1; + } + + (*pPtr) = 0; + + if (*pOffset == endOfFile) { + *pBufLen = length; + return true; + } + + if (maxLen == length) { + /* (*pPtr) was 0 */ + if (MsgReadFileForDecode(pFile, (*ppBuf), maxLen, &nRead) == false) + return false; + + *pBufLen = nRead; + } else { + if (MsgReadFileForDecode(pFile, (*ppBuf) + length, maxLen - length, &nRead) == false) + return false; + + *pBufLen = length + nRead; + } + + if ((*pOffset = MsgFtell(pFile)) == -1L) { + MSG_DEBUG("MsgFtell Error"); + return false; + } + + MSG_END(); + + return true; +} + + +bool MsgGetTypeByFileName(int *type, char *szFileName) +{ + char *pExt = NULL; + AvCodecType AvType = AV_CODEC_NONE; + + pExt = strrchr(szFileName, '.'); + if (pExt == NULL || pExt[0] == '\0') + goto __CATCH; + + pExt++; + + if (strcasecmp(pExt, "mp4") == 0 ||strcasecmp(pExt, "mpeg4") == 0 ||strcasecmp(pExt, "3gp") == 0 ||strcasecmp(pExt, "3gpp") == 0) { + + if (szFileName[0] != '/') + goto __CATCH; + + AvType = AvGetFileCodecType(szFileName); + MSG_DEBUG("MsgGetTypeByFileName:AvType(0x%x)\n", AvType); + + switch (AvType) { + case AV_DEC_AUDIO_MPEG4: + *type = MIME_AUDIO_MP4; + break; + + case AV_DEC_VIDEO_MPEG4: + *type = MIME_VIDEO_MP4; + break; + + default: + *type = MIME_VIDEO_3GPP; + break; + } + return true; + } + + if (strcasecmp(pExt, "amr") == 0) { + *type = MIME_AUDIO_AMR; + return true; + } else if ((strcasecmp(pExt, "mid") == 0) || (strcasecmp(pExt, "midi") == 0)) { + *type = MIME_AUDIO_MIDI; + return true; + } else if (strcasecmp(pExt, "imy") == 0) { + *type = MIME_TEXT_X_IMELODY; + return true; + } + + *type = MimeGetMimeFromExtInt((const char*)pExt); + MSG_DEBUG("MsgGetTypeByFileName: szFileName = %s type = %d \n", szFileName, type); + return true; + + +__CATCH: + + *type = MIME_UNKNOWN; + MSG_DEBUG("MsgGetTypeByFileName: szFileName = %s type = %d \n", szFileName, type); + + return false; + +} + + +/* + * This function write media data from raw data to file. + * @param pMsg + * @param pPartBody + * @param pszMailboxPath : path of mailbox + * @param pszMsgFilename : name of msg file + * @param index : used for file naming + * @param bSave : if true, file will be save otherwise just filename will be stored. + */ +bool _MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave) +{ + FILE *pFile = NULL; + char *pExt = 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. + + MSG_DEBUG("**** _MmsSaveMediaData: [Multi part] START ***\n"); + + if (!pPartType) { + MSG_DEBUG("pPartType is NULL\n"); + return true; // why true value is retured ??? ; false; + } + + if (pPartType->param.szName[0] == '\0' && pPartType->param.szFileName[0] == '\0') + strcpy(pPartType->param.szName, pPartType->param.szFileName); + + if (pPartType->param.szName) { + strcpy(szFileName, pPartType->param.szName); + } else { + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%lu", (unsigned long)index); + } + + +#ifndef __SUPPORT_DRM__ + MsgMakeFileName(pPartType->type, szFileName, 0); //FL & CD -> extension(.dm) SD -> extension(.dcf) +#else + MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0); //FL & CD -> extension(.dm) SD -> extension(.dcf) + if (MsgDRMIsForwardLockType(pPartType->drmInfo.drmType)) + MsgChangeDrm2FileName(szFileName); +#endif + + + snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName); // get absolute path of each temp file of each part + 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. + + if (pPartType->type == MIME_APPLICATION_OCTET_STREAM) + MsgGetTypeByFileName(&pPartType->type, szFullPath); + + // save file + if (bSave) { + if ((pFile = MsgOpenFile(szFullPath, "wb+")) == NULL) { + MSG_DEBUG("MsgOpenFile failed"); + goto __CATCH; + } + + if (MmsGetMediaPartData(pPartType, pPartBody, pFile) == false) { + MSG_DEBUG("MmsGetMediaPartData fail [index:%d]\n", index); + goto __CATCH; + } + + MsgCloseFile(pFile); + pFile = NULL; + if (pPartType->drmInfo.drmType != MSG_DRM_TYPE_NONE) { + MsgDrmRegisterFile(MSG_MODE_FILE, szFullPath, strlen(szFullPath)); + + /* change szDrm2FullPath as current content path*/ + if (pPartType->drmInfo.szDrm2FullPath) { + free(pPartType->drmInfo.szDrm2FullPath); + pPartType->drmInfo.szDrm2FullPath = MsgStrCopy(szFullPath); + } + } + + } + MSG_DEBUG("**** MmsGetMediaPartData: [Multi part] E N D (Successfully) ***\n"); + + return true; + +__CATCH: + + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; + } + + return false; +} + + + +bool MmsGetMediaPartData(MsgType *pPartType, MsgBody *pPartBody, FILE* pFile) +{ + int nRead = 0; + int nRead2 = 0; + char *pData = NULL; + char *pNewData = NULL; + char *pTempData = NULL; + int msgEncodingValue = 0; + int msgTypeValue = 0; + int msgCharsetValue = 0; + int cidLen = 0; + char *szCid = NULL; + int offset = 0; + int size = 0; + + msgEncodingValue = pPartType->encoding; + msgTypeValue = pPartType->type; + msgCharsetValue = pPartType->param.charset; + + cidLen = MsgStrlen(szCid); + + offset = pPartBody->offset; + size = pPartBody->size; + + if (pPartBody->szOrgFilePath[0]) { + pTempData = MsgOpenAndReadMmsFile(pPartBody->szOrgFilePath, offset, size, &nRead); + + if (pTempData == NULL) { + MSG_DEBUG("MmsGetMediaPartData : pTempData read fail\n"); + goto __CATCH; + } + + pData = pTempData; + } else if (pPartBody->body.pText) { + pData = pPartBody->body.pText; + nRead = pPartBody->size; + } + + if (pData == NULL) { + MSG_DEBUG("MmsGetMediaPartData : there is no data \n"); + goto __RETURN; + } + + pNewData = MmsGetBinaryUTF8Data(pData, nRead, msgEncodingValue, msgTypeValue, msgCharsetValue, &nRead2); + pPartType->encoding = MSG_ENCODING_BINARY; + + if (MsgIsText(msgTypeValue)) + pPartType->param.charset = MSG_CHARSET_UTF8; + + if (MsgWriteFile(pNewData, sizeof(char), nRead2, pFile) != (size_t)nRead2) { + MSG_DEBUG("MmsGetMediaPartData: file writing fail \n"); + + goto __CATCH; + } + +__RETURN: + + if (pNewData) { + free(pNewData); + pNewData = NULL; + } + + if (pTempData) { + free(pTempData); + pTempData = NULL; + } + + return true; + +__CATCH: + + if (pNewData) { + free(pNewData); + pNewData = NULL; + } + + if (pTempData) { + free(pTempData); + pTempData = NULL; + } + + return false; +} + +char *MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int msgTypeValue, int msgCharsetValue, int *npRead) +{ + int nChar = 0; + int nByte = 0; + int nTemp = 0; + char *pTemp = NULL; + unsigned short *mszTempStr = NULL; + char *pConvertedStr = NULL; + char *pConvertedData = NULL; + char *pNewData = NULL; + char *pReturnData = NULL; + + + switch (msgEncodingValue) { + case MSG_ENCODING_BASE64: + + pConvertedData = (char*)_MsgDecodeBase64((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte); + MSG_DEBUG("MmsGetBinaryUTF8Data : MSG_ENCODING_BASE64 bodyLength = %d \n", nByte); + + pTemp = pConvertedData; + nTemp = nByte; + + break; + + case MSG_ENCODING_QUOTE_PRINTABLE: + + pConvertedData = (char*)_MsgDecodeQuotePrintable((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte); + MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_ENCODING_QUOTE_PRINTABLE bodyLength = %d \n", nByte); + + pTemp = pConvertedData; + nTemp = nByte; + + break; + + default: + + MSG_DEBUG("MmsGetBinaryUTF8Data: 8bit OR Binary bodyLength = %d \n", nRead); + + pTemp = pData; + nTemp = nRead; + + break; + } + + if (MsgIsText(msgTypeValue)) { + /* charset converting */ + + switch (msgCharsetValue) { + case MSG_CHARSET_UTF16: + case MSG_CHARSET_USC2: + + MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_CHARSET_USC2 \n"); + + if (((UINT8)pTemp[0]) == 0xFF && ((UINT8)pTemp[1]) == 0xFE) { + nChar = (nTemp / 2 - 1); + + mszTempStr = (unsigned short*) malloc(nChar * sizeof(unsigned short)); + if (mszTempStr == NULL) { + MSG_DEBUG("MmsGetBinaryUTF8Data : 1. Memory Full !!! \n"); + goto __CATCH; + } + + memcpy(mszTempStr, ((unsigned short*)pTemp + 1), nChar * sizeof(unsigned short)); + + nByte = MsgGetUnicode2UTFCodeSize(((unsigned short*)pTemp + 1), nChar); + + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr != NULL) + MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar); + } else { + nChar = (nTemp / 2); + + mszTempStr = (unsigned short*) malloc(nChar * sizeof(unsigned short)); + if (mszTempStr == NULL) { + MSG_DEBUG("MmsGetBinaryUTF8Data: 2. Memory Full !!! \n"); + goto __CATCH; + } + + memcpy(mszTempStr, ((unsigned short*)pTemp), nChar * sizeof(unsigned short)); + + nByte = MsgGetUnicode2UTFCodeSize(((unsigned short*)pTemp), nChar); + + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) + MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar); + } + + if (pConvertedStr != NULL) + pNewData = pConvertedStr; + + *npRead = nByte + 1; + + break; + + case MSG_CHARSET_US_ASCII: + + MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_CHARSET_US_ASCII \n"); + + /* fall through */ + + case MSG_CHARSET_UTF8: + + MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_CHARSET_UTF8 or Others \n"); + + // 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; + nTemp -= 3; + } + } + pNewData = pTemp; + *npRead = nTemp; + + break; + + case MSG_CHARSET_ISO_8859_7: + + /* Greek */ + + MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_CHARSET_ISO_8859_7 \n"); + + nByte = MsgGetLatin72UTFCodeSize((unsigned char*)pTemp, nTemp); + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) + MsgLatin7code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp); + + pNewData = pConvertedStr; + *npRead = nByte + 1; + + break; + + case MSG_CHARSET_ISO_8859_9: + + /* Turkish */ + MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_CHARSET_ISO_8859_9 \n"); + + nByte = MsgGetLatin52UTFCodeSize((unsigned char*)pTemp, nTemp); + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) + MsgLatin5code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp); + + pNewData = pConvertedStr; + *npRead = nByte + 1; + + break; + + default: + + MSG_DEBUG("MmsGetBinaryUTF8Data: Other charsets \n"); + + nByte = MsgGetLatin2UTFCodeSize((unsigned char*)pTemp, nTemp); + pConvertedStr = (char *)malloc(nByte + 1); + if (pConvertedStr) + MsgLatin2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp); + + pNewData = pConvertedStr; + *npRead = nByte + 1; + + break; + } + } else { + pNewData = pTemp; + *npRead = nTemp; + } + + pReturnData = (char *)malloc(*npRead); + if (pReturnData == NULL) { + MSG_DEBUG("MmsGetBinaryUTF8Data : pReturnData alloc fail. \n"); + + goto __CATCH; + } + + if (pNewData != NULL) { + memset(pReturnData, 0, *npRead); + memcpy(pReturnData, pNewData, *npRead); + } + + if (pConvertedData) { + free(pConvertedData); + pConvertedData = NULL; + } + + if (pConvertedStr) { + free(pConvertedStr); + pConvertedStr = NULL; + } + + if (mszTempStr) { + free(mszTempStr); + mszTempStr = NULL; + } + + return pReturnData; + +__CATCH: + + if (pConvertedData) { + free(pConvertedData); + pConvertedData = NULL; + } + + if (pConvertedStr) { + free(pConvertedStr); + pConvertedStr = NULL; + } + + if (mszTempStr) { + free(mszTempStr); + mszTempStr = NULL; + } + + return NULL; +} + +#ifndef __SUPPORT_DRM__ +bool MsgMakeFileName(int iMsgType, char *szFileName, int nUntitleIndex) +{ + char szText[MSG_FILENAME_LEN_MAX+1]={0,}; + char szTemp[MSG_FILENAME_LEN_MAX+1]={0,}; + char szTempFileName[MSG_FILENAME_LEN_MAX+1]={0,}; + char *pExt = NULL; + + + MSG_DEBUG("MsgMakeFileName: iMsgType = %d szFileName = %s \n", iMsgType, szFileName); + + if (szFileName == NULL) + return false; + + if (szFileName && (szFileName[0] != '\0')) { + MsgGetFileNameWithoutExtension (szTempFileName, szFileName); + + pExt = strrchr(szTempFileName, '.'); + if (pExt == NULL) { + memset (szText, 0, MSG_FILENAME_LEN_MAX+1); + strncpy(szText, szTempFileName, MSG_FILEPATH_LEN_MAX - 1); + strcat(szText, "."); // add '.' + } else { + memset (szText, 0, MSG_FILENAME_LEN_MAX+1); + strncpy(szText, szTempFileName, pExt+1 - szFileName); // add '.' + } + } else { + if (nUntitleIndex >= 1) { + snprintf(szText, MSG_FILENAME_LEN_MAX+1, "%s_%d.", "Untitled", nUntitleIndex); + } else { + snprintf(szText, MSG_FILENAME_LEN_MAX+1, "%s.", "Untitled"); + } + } + + if (iMsgType == MIME_APPLICATION_OCTET_STREAM) { + MSG_DEBUG("MsgMakeFileName: unsupported MsgType\n"); + goto __CATCH; + } else { + int nLen = 0; + strncpy(szTemp, szText, MSG_FILENAME_LEN_MAX - 5); + if (iMsgType == MIME_UNKNOWN || (pExt = MimeGetExtFromMimeInt((MimeType)iMsgType)) == NULL) { + MSG_DEBUG("MsgMakeFileName: Failed to get extension of that mime data file. \n"); + goto __CATCH; + } + nLen = MSG_FILENAME_LEN_MAX - strlen(szTemp); + strncat(szTemp, pExt, nLen); + } + + + strcpy(szFileName, szTemp); + + MSG_DEBUG("MsgMakeFileName: made szFileName = %s \n", szFileName); + + return true; + +__CATCH: + { + char *p = NULL; + p = strrchr(szText, '.'); + if (p != NULL) + *p = 0; + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", szText); + + return false; + } +} +#else +bool MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex) +{ + char szText[MSG_FILENAME_LEN_MAX+1]={0,}; + char szTemp[MSG_FILENAME_LEN_MAX+1]={0,}; + char szTempFileName[MSG_FILENAME_LEN_MAX+1]={0,}; + char *pExt = NULL; + + MSG_DEBUG("MsgMakeFileName: iMsgType = 0x%x, drmType = %d, szFileName = %s \n", iMsgType, drmType, szFileName); + + if (szFileName == NULL) + return false; + + if (szFileName && (szFileName[0] != '\0')) { + MsgGetFileNameWithoutExtension (szTempFileName, szFileName); + + if (drmType != MSG_DRM_TYPE_NONE) { + pExt = strrchr(szTempFileName, '.'); + if (pExt == NULL) { + memset(szText, 0, MSG_FILENAME_LEN_MAX+1); + strncpy(szText, szTempFileName, MSG_FILENAME_LEN_MAX - 1); + strcat(szText, "."); // add '.' + } else { + memset(szText, 0, MSG_FILENAME_LEN_MAX+1); + strncpy(szText, szTempFileName, pExt+1 - szFileName); + } + } else { + if (strrchr(szTempFileName, '.')) + return true; + + memset(szText, 0, MSG_FILENAME_LEN_MAX+1); + strncpy(szText, szTempFileName, MSG_FILENAME_LEN_MAX - 1); + //temporary commented to save file as original name. + pExt = strrchr(szFileName, '.'); + } + } else { + if (nUntitleIndex >= 1) { + snprintf(szText, MSG_FILENAME_LEN_MAX+1, "%s_%d.", "untitled", nUntitleIndex); + } else { + snprintf(szText, MSG_FILENAME_LEN_MAX+1, "%s.", "untitled"); + } + } + + if (drmType == MSG_DRM_TYPE_SD) { + strncpy(szTemp, szText, MSG_FILENAME_LEN_MAX - 5); + strcat(szTemp, "dcf"); + } else if (MsgDRMIsForwardLockType(drmType)) { + strncpy(szTemp, szText, MSG_FILENAME_LEN_MAX - 4); + strcat(szTemp, "dm"); + } else { + if (iMsgType == MIME_APPLICATION_OCTET_STREAM) { + MSG_DEBUG("MsgMakeFileName: unsupported MsgType\n"); + goto __CATCH; + } else { + int nLen = 0; + strncpy(szTemp, szText, MSG_FILENAME_LEN_MAX - 5); + //temporary commented to save file as original name. + if (pExt == NULL) { + + if (iMsgType == MIME_UNKNOWN || (pExt = MimeGetExtFromMimeInt((MimeType)iMsgType)) == NULL) { + MSG_DEBUG("MsgMakeFileName: Failed to get extension of that mime data file. \n"); + goto __CATCH; + } + } + + nLen = MSG_FILENAME_LEN_MAX - strlen(szTemp); + strncat(szTemp, pExt, nLen); + } + } + + strcpy(szFileName, szTemp); + + MSG_DEBUG("MsgMakeFileName: made szFileName = %s \n", szFileName); + + return true; + +__CATCH: + { + char *p = NULL; + p = strrchr(szText, '.'); + if (p != NULL) + *p = 0; + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", szText); + + return false; + } +} +#endif + +bool MsgGetFileNameWithoutExtension (char *szOutputName, char *szName) +{ + char *pszExt = NULL; + + if (szOutputName == NULL) { + MSG_DEBUG("szOutputName is NULL"); + return false; + } + + strncpy(szOutputName, szName, strlen(szName)); + + if ((pszExt = strrchr(szOutputName, '.'))) { + if (pszExt[0] == '.') + pszExt[0] = '\0'; + } + + return true; +} + +int MmsGetMediaPartCount(MSG_MESSAGE_ID_T msgId) +{ + MmsMsg *pMsg; + + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + + if (msgId != pMsg->msgID) { + MSG_DEBUG("Invalid Message Id"); + return -1; + } + + return pMsg->nPartCount; +} + +bool MmsGetMediaPartHeader(int index, MsgType *pHeader) +{ + MmsMsg *pMsg = NULL; + MsgMultipart *pPart = NULL; + + if (pHeader == NULL) { + MSG_DEBUG("MmsGetMediaPartHeader: Invalid pHeader input. It's null \n"); + return false; + } + + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + + _MsgInitMsgType(pHeader); + + + /* Requires header of non-presentation */ + if (MsgIsMultipart(pMsg->msgType.type)) { + MSG_DEBUG("MmsGetMediaPartHeader: Multipart header [index = %d] \n", index); + + pPart = pMsg->msgBody.body.pMultipart; + + while (pPart && index--) + pPart = pPart->pNext; + + if (pPart == NULL) { + MSG_DEBUG("MmsGetMediaPartHeader: There is no such msg part.\n"); + return false; + } + + memcpy(pHeader, &pPart->type, sizeof(MsgType)); + } else { + MSG_DEBUG("MmsGetMediaPartHeader: Requires singlepart header \n"); + memcpy(pHeader, &pMsg->msgType, sizeof(MsgType)); + } + + return true; +} + +bool MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index) +{ + MSG_DEBUG("------------------------------\n"); + MSG_DEBUG("%dth multipart info\n", index); + MSG_DEBUG("header size=%d\n", pMultipart->type.size); + MSG_DEBUG("body size=%d\n", pMultipart->type.contentSize); + MSG_DEBUG("content type=%s\n", MmsDebugGetMimeType((MimeType)pMultipart->type.type)); + MSG_DEBUG("content ID=%s\n", pMultipart->type.szContentID); + MSG_DEBUG("content location=%s\n", pMultipart->type.szContentLocation); + + if (pMultipart->type.type == MIME_TEXT_PLAIN) { + MSG_DEBUG("text info\n"); + MSG_DEBUG("charset=%d\n", pMultipart->type.param.charset); + MSG_DEBUG("text file name=%s\n", pMultipart->type.param.szName); + } +#ifdef __SUPPORT_DRM__ + if (pMultipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { + MSG_DEBUG("drm info\n"); + MSG_DEBUG("drm type=%d (0: NONE 1: Fowward Lock, 2:Combined Delivery, 3: Separated Delivery)\n", pMultipart->type.drmInfo.drmType); + MSG_DEBUG("drm content type=%s\n", MmsDebugGetMimeType((MimeType)pMultipart->type.drmInfo.contentType)); + MSG_DEBUG("drm content URI=%s\n", pMultipart->type.drmInfo.szContentURI); + MSG_DEBUG("drm2FullPath=%s\n", pMultipart->type.drmInfo.szDrm2FullPath); + } +#endif + MSG_DEBUG("------------------------------\n"); + return true; +} + diff --git a/plugin/mms_plugin/MmsPluginDrm.cpp b/plugin/mms_plugin/MmsPluginDrm.cpp new file mode 100755 index 0000000..31f4b90 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginDrm.cpp @@ -0,0 +1,180 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include "MmsPluginDrm.h" +#include "MmsPluginCodec.h" +#include "MsgMmsTypes.h" +#include "MsgDrmWrapper.h" +#include "MsgDebug.h" +#include "drm-service.h" + +#ifdef __SUPPORT_DRM__ + +MmsDrm2ConvertState mmsDrm2ConvertState; + +MsgDrmType MsgGetDRMType(MsgType *pMsgType, MsgBody *pMsgBody) +{ + MsgDrmType drmType = MSG_DRM_TYPE_NONE; + MsgMultipart *pMultipart = NULL; + + if (MsgIsMultipart(pMsgType->type)) { + pMultipart = pMsgBody->body.pMultipart; + while (pMultipart) { + if (drmType < pMultipart->type.drmInfo.drmType) + drmType = pMultipart->type.drmInfo.drmType; + + pMultipart = pMultipart->pNext; + } + } else { + drmType = pMsgType->drmInfo.drmType; + } + + return drmType; +} + +void MmsDrm2SetConvertState(MmsDrm2ConvertState newConvertState) +{ + mmsDrm2ConvertState = newConvertState; + MSG_DEBUG("MmsDrm2SetConvertState: mmsDrm2ConvertState = %d\n", mmsDrm2ConvertState); +} + +MmsDrm2ConvertState MmsDrm2GetConvertState(void) +{ + return mmsDrm2ConvertState; +} + +bool MsgDRM2GetDRMInfo(char *szFilePath, MsgType *pMsgType) +{ + if (szFilePath == NULL || pMsgType == NULL) { + MSG_DEBUG("Param is NULL szFilePath = %d, pMsgType = %d", szFilePath, pMsgType); + return false; + } + + char szMimeType[DRM_MAX_TYPE_LEN + 1]; + char szContentID[DRM_MAX_CID_LEN + 1]; + MSG_DRM_TYPE drmType = MSG_DRM_NONE; + + MsgDrmGetDrmType(szFilePath, &drmType); + MsgDrmGetMimeTypeEx(szFilePath, szMimeType, DRM_MAX_TYPE_LEN + 1); + MsgDrmGetContentID(szFilePath, szContentID, DRM_MAX_CID_LEN + 1); + MSG_DEBUG("drmType: %d", drmType); + + switch (drmType) { + case MSG_DRM_FORWARD_LOCK: + pMsgType->drmInfo.drmType = MSG_DRM_TYPE_FL; + pMsgType->drmInfo.contentType = (MsgContentType)_MsgGetCode(MSG_TYPE, szMimeType); + if (MsgCopyDrmInfo(pMsgType) == false) { + MSG_DEBUG("MsgDRM2GetDRMInfo : MsgCopyDrmInfo failed"); + return false; + } + break; + + case MSG_DRM_COMBINED_DELIVERY: + pMsgType->drmInfo.drmType = MSG_DRM_TYPE_CD; + pMsgType->drmInfo.szContentURI = MsgResolveContentURI(szContentID); + break; + + case MSG_DRM_SEPARATE_DELIVERY: + pMsgType->drmInfo.drmType = MSG_DRM_TYPE_SD; + + pMsgType->drmInfo.contentType = (MsgContentType)_MsgGetCode(MSG_TYPE, szMimeType); + + drm_dcf_header_t dcfHdrInfo; + drm_svc_get_dcf_header_info(szFilePath, &dcfHdrInfo); + + if (dcfHdrInfo.version == DRM_OMA_DRMV1_RIGHTS) { + pMsgType->drmInfo.szContentName = MsgRemoveQuoteFromFilename(dcfHdrInfo.headerUnion.headerV1.contentName); + pMsgType->drmInfo.szContentDescription = MsgStrCopy(dcfHdrInfo.headerUnion.headerV1.contentDescription); + } + break; + + default: + pMsgType->drmInfo.drmType = MSG_DRM_TYPE_NONE; + break; + } + + pMsgType->drmInfo.szDrm2FullPath = MsgStrCopy(szFilePath); + MSG_DEBUG("pMsgType->drmInfo.szDrm2FullPath: %s", pMsgType->drmInfo.szDrm2FullPath); + + return true; +} + +bool MsgDRMIsForwardLockType(MsgDrmType drmType) +{ + switch (drmType) { + case MSG_DRM_TYPE_FL: + case MSG_DRM_TYPE_CD: + return true; + + case MSG_DRM_TYPE_NONE: //SD & plain can be forwarded + case MSG_DRM_TYPE_SD: + default: + return false; + } +} + +bool MsgChangeDrm2FileName(char *szFileName) +{ + char szTempFileName[MSG_FILENAME_LEN_MAX] = {0,}; + + if (szFileName == NULL || szFileName[0] == '\0') + return false; + + MsgGetFileNameWithoutExtension(szTempFileName, szFileName); + + if (strrchr(szTempFileName, '.')) + return true; + + strcat(szTempFileName, ".dcf"); + strcpy(szFileName, szTempFileName); + + MSG_DEBUG("MsgChangeDrm2FileName: made szFileName = %s \n", szFileName); + + return true; +} + +bool MsgIsDCFFile(char *szFilePath) +{ + int length = 0; + + MSG_DEBUG("MsgIsDCFFile: szFilePath = %s \n", szFilePath); + + length = MsgStrlen(szFilePath); + if (szFilePath[length - 4] == '.' && + (szFilePath[length - 3] == 'd' || szFilePath[length - 3] == 'D') && + (szFilePath[length - 2] == 'c' || szFilePath[length - 2] == 'C') && + (szFilePath[length - 1] == 'f' || szFilePath[length - 1] == 'F')) + return true; + + return false; +} + +#endif diff --git a/plugin/mms_plugin/MmsPluginEncode.cpp b/plugin/mms_plugin/MmsPluginEncode.cpp new file mode 100755 index 0000000..922eab2 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginEncode.cpp @@ -0,0 +1,3322 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include + +#include "MmsPluginMessage.h" +#include "MmsPluginCodec.h" +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MmsPluginMIME.h" + +gint _g_time_rev_set = 0; +gint _g_time_rev = 0; + +/** Sending message related variables ------------------------ */ + +static char gszMmsEncodeBuf[MSG_MMS_ENCODE_BUFFER_MAX] = {0, }; +static int gCurMmsEncodeBuffPos = 0; /* number of characters on gpMmsEncodeBuf */ +static int gMmsEncodeMaxLen = 0; +static int gMmsEncodeCurOffset = 0; /* offset in file */ +static char *gpMmsEncodeBuf = NULL; + + +/* Acknowledge.ind & NotifyResp.ind related variables ------------------------ */ + +static char gszMmsEncodeBuf2[MSG_MMS_ENCODE_BUFFER_MAX] = {0, }; +static int gCurMmsEncodeBuffPos2 = 0; /* number of characters on gpMmsEncodeBuf */ +static int gMmsEncodeMaxLen2 = 0; +static int gMmsEncodeCurOffset2 = 0; /* offset in file */ +static char *gpMmsEncodeBuf2 = NULL; + + +bool _MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg); +bool _MmsBinaryEncodeAckIndHdr(FILE *pFile, char *pTrID, bool bReportAllowed); +bool _MmsBinaryEncodeNotiRespIndHdr(FILE* pFile, char *pTrID, MSG_DELIVERY_REPORT_STATUS_T iStatus, bool bReportAllowed); +bool _MmsBinaryEncodeForwardReqHdr(FILE *pFile, char *szContentLocation, char *szForwardTo, char *szForwardCc, char *szForwardBcc); +bool _MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, MSG_READ_REPORT_STATUS_T mmsReadStatus); +bool _MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, MSG_READ_REPORT_STATUS_T mmsReadStatus); + +static bool __MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg, bool bIncludeSendReqHeader); +static int MmsBinaryEncodeUintvarLen(UINT32 integer); +static bool MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length); +static int MmsBinaryEncodeValueLengthLen(UINT32 integer); +static bool MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length); +static int MmsBinaryEncodeIntegerLen(UINT32 integer); +static bool MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length); +static int MmsBinaryEncodeLongIntegerLen(UINT32 integer); +static bool MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length); +static int MmsBinaryEncodeTextStringLen(UINT8 *source); +static bool MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length); +static int MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc); +static bool MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length); +static int MmsBinaryEncodeEncodedStringLen(UINT8 *source); +static bool MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length); +bool MmsBinaryEncodeSendReqHdrwithinBufRegi(FILE *pFile, MmsMsg *pMsg); +bool MmsBinaryEncodeSendReqHdrContTypeFildCode(FILE *pFile, int msgID); + +static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue); + +static 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); +static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char *szAddrStr); +static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *szAddr); + + +/* Functions for Acknowledge.ind & NotifyResp.ind ------------------------ */ + +static bool MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length); +static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile); +static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue); +extern int MsgProcessUrgentEvent(int iMode); + + +/** ----------------------------------------------------------------- + * M M S E N C O D E + * * -----------------------------------------------------------------*/ + + +static void __MmsCleanEncodeBuff(void) +{ + memset(gpMmsEncodeBuf, 0, MSG_MMS_ENCODE_BUFFER_MAX); + gCurMmsEncodeBuffPos = 0; +} + + +void _MmsRegisterEncodeBuffer(char *pInBuff, int maxLen) +{ + gpMmsEncodeBuf = pInBuff; + gCurMmsEncodeBuffPos = 0; + gMmsEncodeMaxLen = maxLen; + gMmsEncodeCurOffset = 0; +} + +void _MmsUnregisterEncodeBuffer(void) +{ + gpMmsEncodeBuf = NULL; + gCurMmsEncodeBuffPos = 0; + gMmsEncodeMaxLen = 0; + gMmsEncodeCurOffset = 0; +} + +int _MmsGetEncodeOffset(void) +{ + return (gMmsEncodeCurOffset + gCurMmsEncodeBuffPos); +} + + +bool _MmsEncodeMsg(void) +{ + MSG_DEBUG("_MmsEncodeMsg: Start Binary Encoding now ============= \n"); + return true; +} + + +bool _MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg) +{ + return __MmsEncodeSendReq(pFile, pMsg, true); +} + + +bool _MmsEncodeTemplate(FILE *pFile, MmsMsg *pMsg) +{ + return __MmsEncodeSendReq(pFile, pMsg, false); +} + + +static bool __MmsEncodeSendReq(FILE* pFile, MmsMsg* pMsg, bool bIncludeSendReqHeader) +{ + _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX); + + if (bIncludeSendReqHeader) { + if (_MmsBinaryEncodeSendReqHdr(pFile, pMsg) == false) { + _MmsUnregisterEncodeBuffer(); + return false; + } + } + + if (MmsBinaryEncodeMsgBody(pFile, &pMsg->msgType, &pMsg->msgBody, pMsg->nPartCount, !bIncludeSendReqHeader) == false) { + _MmsUnregisterEncodeBuffer(); + return false; + } + + _MmsUnregisterEncodeBuffer(); + + return true; +} + + +/* Functions for Acknowledge.ind & NotifyResp.ind ------------------------ */ + +static void __MmsCleanEncodeBuff2(void) +{ + memset(gpMmsEncodeBuf2, 0, MSG_MMS_ENCODE_BUFFER_MAX); + gCurMmsEncodeBuffPos2 = 0; +} + + +void _MmsRegisterEncodeBuffer2(char *pInBuff, int maxLen) +{ + gpMmsEncodeBuf2 = pInBuff; + gCurMmsEncodeBuffPos2 = 0; + gMmsEncodeMaxLen2 = maxLen; + gMmsEncodeCurOffset2 = 0; +} + +void _MmsUnregisterEncodeBuffer2(void) +{ + gpMmsEncodeBuf2 = NULL; + gCurMmsEncodeBuffPos2 = 0; + gMmsEncodeMaxLen2 = 0; + gMmsEncodeCurOffset2 = 0; +} + + +/** + * @param source [in] originam string + * @param length [in] gotten from MmsBinaryEncodeTextStringLen() + * @param dest [in] buffer to store quted string + * @return changed string length +*/ +static bool MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length) +{ + MSG_DEBUG("MmsBinaryEncodeTextString2: \n"); + + /** + * make text string + * Text-string = [Quote] *TEXT End-of-string + * If the 1st char in the TEXT is in the range of 128-255, a Quote char must precede it. + * Otherwise the Quote char must be omitted. + * The Quote is not part of the contents. + * Quote = + */ + + if (pFile == NULL || source == NULL) { + MSG_DEBUG("MmsBinaryEncodeTextString2: source == NULL \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < length) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, + gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { + MSG_DEBUG("MmsBinaryEncodeTextString2: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + if (source[0] > 0x7F) { + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = QUOTE; + length--; + } + + strncpy(gpMmsEncodeBuf2 + gCurMmsEncodeBuffPos2, (char*)source, (length - 1)); /** except NULL */ + gCurMmsEncodeBuffPos2 += (length - 1); /** except NULL */ + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = (UINT8)NULL; + + return true; + +__CATCH: + return false; +} + + +static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue) +{ + if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < 2) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, + gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { + MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + if (fieldCode == 0xff) { + MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: invalid fieldCode \n"); + goto __CATCH; + } + + if (fieldValue == 0xff) { + MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: invalid fieldValue \n"); + return true; + } + + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = fieldCode; + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = fieldValue; + + return true; + +__CATCH: + return false; +} + + +static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile) +{ + UINT8 majorVer = MMS_MAJOR_VERSION; + UINT8 minorVer = MMS_MINOR_VERSION; + + MSG_DEBUG("__MmsBinaryEncodeMmsVersion2: \n"); + + if (pFile == NULL) { + MSG_DEBUG("__MmsBinaryEncodeMmsVersion2: invalid input file \n"); + goto __CATCH; + } + + if (majorVer < 1) { + MSG_DEBUG("__MmsBinaryEncodeMmsVersion2: invalid major version (%d)\n", majorVer); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < 2) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, + gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { + MSG_DEBUG("__MmsBinaryEncodeMmsVersion2: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_VERSION) | 0x80; + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2] = (majorVer << 4) | (minorVer & 0x0f) | MSB; + + if (gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2] < 0x80) { + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] |= 0x80; + } else { + gCurMmsEncodeBuffPos2++; + } + + return true; + +__CATCH: + return false; +} + + +bool _MmsBinaryEncodeAckIndHdr(FILE *pFile, char *szTrID, bool bReportAllowed) +{ + int length = 0; + UINT8 fieldCode = 0xff; + UINT8 fieldValue = 0xff; + + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: szTrID = %s\n", szTrID); + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: bReportAllowed = %d\n", bReportAllowed); + + __MmsCleanEncodeBuff2(); + + /* msgType */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_ACKNOWLEDGE_IND) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: msgType error\n"); + goto __CATCH; + } + + /* trID (other type of message) */ + length = MmsBinaryEncodeTextStringLen((UINT8*)szTrID); + if (length == -1) { + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < (length + 1)) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, + gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80; + + if (MmsBinaryEncodeTextString2(pFile, (UINT8*)szTrID, length) == false) { + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: MmsBinaryEncodeTextString fail\n"); + goto __CATCH; + } + + + if (__MmsBinaryEncodeMmsVersion2(pFile) == false) { + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: __MmsBinaryEncodeMmsVersion error\n"); + goto __CATCH; + } + + + /* Report Allowed */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPORTALLOWED) | 0x80; + + if (bReportAllowed) { + fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_YES) | 0x80; + } else { + fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_NO) | 0x80; + } + + if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: Report Allowed error\n"); + goto __CATCH; + } + + /* flush remained data on encoding file */ + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, + gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { + MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + + return true; + +__CATCH: + + return false; +} + + + +bool _MmsBinaryEncodeNotiRespIndHdr(FILE *pFile, char *szTrID, MSG_DELIVERY_REPORT_STATUS_T iStatus, bool bReportAllowed) +{ + int length = 0; + UINT8 fieldCode = 0xff; + UINT8 fieldValue = 0xff; + + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: szTrID = %s\n", szTrID); + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: iStatus = %d\n", iStatus); + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: bReportAllowed = %d\n", bReportAllowed); + + __MmsCleanEncodeBuff2(); + + /* msgType */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_NOTIFYRESP_IND) | 0x80; + + if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: msgType error\n"); + goto __CATCH; + } + + + /* trID (other type of message) */ + length = MmsBinaryEncodeTextStringLen((UINT8*)szTrID); + if (length == -1) { + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < (length + 1)) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, + gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80; + if (MmsBinaryEncodeTextString2(pFile, (UINT8*)szTrID, length) == false) { + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MmsBinaryEncodeTextString fail\n"); + goto __CATCH; + } + + + if (__MmsBinaryEncodeMmsVersion2(pFile) == false) { + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: __MmsBinaryEncodeMmsVersion error\n"); + goto __CATCH; + } + + + /* MsgStatus */ + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MsgStatus = %d\n", iStatus); + + if (iStatus != MSG_DELIVERY_REPORT_NONE) { + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGSTATUS) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeMsgStatus, iStatus) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MsgStatus error\n"); + goto __CATCH; + } + } + + + /* Report Allowed */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPORTALLOWED) | 0x80; + + if (bReportAllowed) { + fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_YES) | 0x80; + } else { + fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_NO) | 0x80; + } + + if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: Report Allowed error\n"); + goto __CATCH; + } + + /* flush remained data on encoding file */ + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2, + gMmsEncodeMaxLen2, &gMmsEncodeCurOffset2) == false) { + MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + + return true; + +__CATCH: + + return false; +} + + +bool _MmsEncodeAckInd(FILE *pFile, char *pTrID, bool bReportAllowed) +{ + _MmsRegisterEncodeBuffer2(gszMmsEncodeBuf2, MSG_MMS_ENCODE_BUFFER_MAX); + + MSG_DEBUG("_MmsEncodeAckInd: Start Binary Encoding now ============= \n"); + + if (_MmsBinaryEncodeAckIndHdr(pFile, pTrID, bReportAllowed) == false) { + MSG_DEBUG("_MmsEncodeAckInd: SendReq Binary encoding fail \n"); + goto __CATCH; + } + + _MmsUnregisterEncodeBuffer2(); + + return true; + +__CATCH: + + MSG_DEBUG("## _MmsEncodeAckInd: failed"); + _MmsUnregisterEncodeBuffer2(); + + return false; +} + + + +bool _MmsEncodeNotiRespInd(FILE *pFile, char *pTrID, MSG_DELIVERY_REPORT_STATUS_T iStatus, bool bReportAllowed) +{ + _MmsRegisterEncodeBuffer2(gszMmsEncodeBuf2, MSG_MMS_ENCODE_BUFFER_MAX); + + MSG_DEBUG("_MmsEncodeNotiRespInd: Start Binary Encoding now ============= \n"); + + if (_MmsBinaryEncodeNotiRespIndHdr(pFile, pTrID, iStatus, bReportAllowed) == false) { + MSG_DEBUG("_MmsEncodeNotiRespInd: SendReq Binary encoding fail \n"); + goto __CATCH; + } + + _MmsUnregisterEncodeBuffer2(); + + return true; + +__CATCH: + + return false; +} + + +/* Functions for Acknowledge.ind & NotifyResp.ind (END) ------------------------ */ +bool _MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, MSG_READ_REPORT_STATUS_T mmsReadStatus) +{ + char *pText = NULL; + MsgMultipart *pPart = NULL; + MsgType msgType; + MsgBody msgBody; + + char *pszReportMsg = NULL; + int maxLen = 0; + + struct tm *dateTime = NULL; + time_t RawTime = 0; + time_t dateSec = 0; + + _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX); + + MSG_DEBUG("_MmsEncodeMsg: Start Binary Encoding now V1.0============= \n"); + + if (_MmsBinaryEncodeReadReport10Hdr(pFile, pMsg, mmsReadStatus) == false) { + MSG_DEBUG("_MmsEncodeReadReport10: SendReq Binary encoding fail \n"); + goto __CATCH; + } + + memset(&msgType, 0, sizeof(MsgType)); + memset(&msgBody, 0, sizeof(MsgBody)); + + pText = (char *)malloc(MSG_STDSTR_LONG); + if (pText == NULL) { + MSG_DEBUG("__MmsSendReadReportV10: text body malloc fail \n"); + goto __CATCH; + } + + memset(pText, 0, MSG_STDSTR_LONG); + + time(&RawTime); + dateTime = localtime(&RawTime); + dateSec = mktime(dateTime); + + // 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 .. + maxLen = strlen (pszReportMsg) +16 /* date string */ + 8 /* enter chars */ ; + + if (maxLen > MSG_STDSTR_LONG) { + snprintf (pText, MSG_STDSTR_LONG, "%s\n", pszReportMsg); + } else { + snprintf(pText, MSG_STDSTR_LONG, "%s\r\n\r\n%.4d/%.2d/%.2d %.2d:%.2d\r\n", + pszReportMsg, dateTime->tm_year+1900, dateTime->tm_mon+1, dateTime->tm_mday, dateTime->tm_hour, dateTime->tm_min); + } + + // make header + msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; + msgType.contentSize = strlen(pText); + msgType.param.charset = MSG_CHARSET_UNKNOWN; + + // make body + if ((pPart = MmsAllocMultipart()) == NULL) { + MSG_DEBUG("__MmsSendReadReportV10: MsgAllocMultipart Fail \n"); + goto __CATCH; + } + + + pPart->type.type = MIME_TEXT_PLAIN; + pPart->type.contentSize = strlen(pText); + pPart->type.param.charset = MSG_CHARSET_UTF8; + + if (pPart->pBody == NULL) { + MSG_DEBUG("__MmsSendReadReportV10: pPart->pBody is NULL \n"); + goto __CATCH; + } + + pPart->pBody->size = strlen(pText); + pPart->pBody->body.pText = pText; + + msgBody.body.pMultipart = pPart; + + if (MmsBinaryEncodeMsgBody(pFile, &msgType, &msgBody, 1, false) == false) { + MSG_DEBUG("__MmsSendReadReportV10: MmsBinaryEncodeMsgBody fail \n"); + goto __CATCH; + } + + MSG_DEBUG("__MmsSendReadReportV10: Send To RM ReadReport Msg \n"); + + if (pText) { + free(pText); + pText = NULL; + } + + if (pPart) { + if (pPart->pBody) { + free(pPart->pBody); + pPart->pBody = NULL; + } + free(pPart); + pPart = NULL; + } + + _MmsUnregisterEncodeBuffer(); + + return true; + +__CATCH: + + if (pText) { + free(pText); + pText = NULL; + } + + if (pPart) { + if (pPart->pBody) { + free(pPart->pBody); + pPart->pBody = NULL; + } + free(pPart); + pPart = NULL; + } + + _MmsUnregisterEncodeBuffer(); + + return false; +} + + +bool _MmsEncodeReadReport11(FILE *pFile, MmsMsg *pMsg, MSG_READ_REPORT_STATUS_T mmsReadStatus) +{ + _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX); + + MSG_DEBUG("_MmsEncodeMsg: Start Binary Encoding now V1.1============= \n"); + + if (_MmsBinaryEncodeReadReport11Hdr(pFile, pMsg, mmsReadStatus) == false) { + MSG_DEBUG("_MmsEncodeMsg: SendReq Binary encoding fail \n"); + goto __CATCH; + } + + _MmsUnregisterEncodeBuffer(); + + return true; + +__CATCH: + _MmsUnregisterEncodeBuffer(); + + return false; +} + + + +/* ========================================================== + + B I N A R Y E N C O D I N G + + ==========================================================*/ + +/* + * Binary Encoded Message Format + * + * < Single Part Body Message > + * ----------------------------------- + * | Header Fields | + * ----------------------------------- + * | Content Type:start=xxx;type=xxx | ->(ex) Text/Plain, Text/Html, .... + * ----------------------------------- + * | Single Part Body | + * ----------------------------------- + * + * < Multi Part Body Message > + * ----------------------------------- + * | Header Fields | + * ----------------------------------- + * | Content Type:start=xxx;type=xxx | -> (ex) Application/vnd.wap.multipart.mixed(related), multipart/mixed(related) + * ----------------------------------- + * | # of Entries (body parts) | + * ----------------------------------- < Each Entry > + * | Entry 1 | -> ----------------------------- + * ----------------------------------- | header Length | + * | Entry 2 | ----------------------------- + * ----------------------------------- | Data Length | + * | ...... | ----------------------------- - + * ----------------------------------- | Content-Type | | + * | Entry n | ----------------------------- | Header Length + * ----------------------------------- | Header | | + * ----------------------------- - + * | Data | | Data Length + * ----------------------------- - + */ + +bool _MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) +{ + UINT8 fieldCode = 0xff; + UINT8 fieldValue = 0xff; + int length = 0; + + __MmsCleanEncodeBuff(); + + /* msgType */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_SEND_REQ) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: msgType error\n"); + goto __CATCH; + } + + /* trID (other type of message) */ + if (__MmsBinaryEncodeTrID(pFile, pMsg->szTrID, MMS_TR_ID_LEN + 1) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: trID error\n"); + goto __CATCH; + } + + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: pMsg->szTrID = %s\n", pMsg->szTrID); + + if (__MmsBinaryEncodeMmsVersion(pFile) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: __MmsBinaryEncodeMmsVersion error\n"); + goto __CATCH; + } + + /* From : Insert Token mode */ + if (__MmsBinaryEncodeFrom(pFile) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: __MmsBinaryEncodeFrom fail\n"); + goto __CATCH; + } + + + /* To = Encoded-string-value */ + if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, pMsg->mmsAttrib.szTo) == false) + { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: To __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + + + /* Cc = Encoded-string-value */ + if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_CC, pMsg->mmsAttrib.szCc) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: Cc __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + + + /* Bcc = Encoded-string-value */ + + if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_BCC, pMsg->mmsAttrib.szBcc) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: Bcc __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + + + MSG_DEBUG("_MmsBinaryEnocdeSendReqHdr() pMsg->mmsAttrib.szSubject =%s\n",pMsg->mmsAttrib.szSubject); + + /* Subject = Encoded-string-value */ + if (pMsg->mmsAttrib.szSubject[0]) { + length = MmsBinaryEncodeEncodedStringLen((UINT8*)pMsg->mmsAttrib.szSubject); + if (length == -1) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: subject MmsBinaryEncodeEncodedStringLen fail \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length + 1) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: subject MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SUBJECT) | 0x80; + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; + if (MmsBinaryEncodeEncodedString(pFile, (UINT8*)pMsg->mmsAttrib.szSubject, length) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: subject MmsBinaryEncodeEncodedString fail \n"); + goto __CATCH; + } + } + + /* MMS-1.3-con-739 */ + /* Msg class */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGCLASS) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeMsgClass, (int)pMsg->mmsAttrib.msgClass) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: msgClass error\n"); + goto __CATCH; + } + /* MMS-1.3-con-739 */ + /* MMS-1.3-con-733 */ + /* Date = Long-integer */ + if (!__MmsBinaryEncodeDate(pFile)) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: __MmsBinaryEncodeDate error\n"); + goto __CATCH; + } + /* MMS-1.3-con-733 */ + + /* Expiry Time : Value-length Absolute-token Date-value */ + if (pMsg->mmsAttrib.bUseExpiryCustomTime == true) { + if (__MmsBinaryEncodeTime(pFile, MMS_CODE_EXPIRYTIME, pMsg->mmsAttrib.expiryCustomTime) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: expiryTime __MmsBinaryEncodeTime fail\n"); + goto __CATCH; + } + } else 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("_MmsBinaryEncodeSendReqHdr: expiryTime __MmsBinaryEncodeTime fail\n"); + goto __CATCH; + } + } + + /* Use Custom time for Delivery Time */ + if (pMsg->mmsAttrib.bUseDeliveryCustomTime == true) { + if (__MmsBinaryEncodeTime(pFile, MMS_CODE_DELIVERYTIME, pMsg->mmsAttrib.deliveryCustomTime) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: deliveryTime __MmsBinaryEncodeTime fail\n"); + goto __CATCH; + } + } else { + if (__MmsBinaryEncodeTime(pFile, MMS_CODE_DELIVERYTIME, pMsg->mmsAttrib.deliveryTime) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: deliveryTime __MmsBinaryEncodeTime fail\n"); + goto __CATCH; + } + } + + /* Priority */ + if (pMsg->mmsAttrib.priority!= MMS_PRIORITY_ERROR && pMsg->mmsAttrib.priority!= MMS_PRIORITY_NORMAL) { + /* MMS_PRIORITY_NORMAL is default : don't send optional field */ + + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_PRIORITY)|0x80; + fieldValue = _MmsGetBinaryValue(MmsCodePriority, pMsg->mmsAttrib.priority)|0x80; + + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: priority error\n"); + goto __CATCH; + } + } + + /* Sender Visible (hide | show) */ + if (pMsg->mmsAttrib.bHideAddress == true) { + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SENDERVISIBILLITY) | MSB; + fieldValue = _MmsGetBinaryValue(MmsCodeSenderVisibility, MMS_SENDER_HIDE) | 0x80; + + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: sender visibility error\n"); + goto __CATCH; + } + } + + /* Delivery Report (yes | no) */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT)|0x80; + + if (pMsg->mmsAttrib.bAskDeliveryReport) { + fieldValue = _MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_YES) | 0x80; + } else { + fieldValue = _MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_NO) | 0x80; + } + + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: sender visibility error\n"); + goto __CATCH; + } + + /* Read Reply (Yes | no) */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READREPLY)|0x80; + if (pMsg->mmsAttrib.bAskReadReply) { + fieldValue = _MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_YES)|0x80; + } else { + fieldValue = _MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_NO)|0x80; + } + + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: read reply error\n"); + goto __CATCH; + } + + if ((pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED) || + (pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED_TEXT_ONLY)) { + + // reply charging + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGING)|0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeReadReply, pMsg->mmsAttrib.replyCharge.chargeType)|0x80; + + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: replyCharging error\n"); + goto __CATCH; + } + + /** fixme: Reply-charging-deadline */ + if (pMsg->mmsAttrib.replyCharge.deadLine.time > 0) { + if (__MmsBinaryEncodeTime(pFile, MMS_CODE_REPLYCHARGINGDEADLINE, pMsg->mmsAttrib.replyCharge.deadLine) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: replyCharging __MmsBinaryEncodeTime fail\n"); + goto __CATCH; + } + } + + /** fixme: Reply-charging-size */ + if (pMsg->mmsAttrib.replyCharge.chargeSize > 0) { + length = MmsBinaryEncodeIntegerLen(pMsg->mmsAttrib.replyCharge.chargeSize); + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGSIZE) | 0x80; + + if (MmsBinaryEncodeInteger(pFile, pMsg->mmsAttrib.replyCharge.chargeSize, length) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: replyChargingSize MmsBinaryEncodeInteger error\n"); + goto __CATCH; + } + } + + /** fixme: Reply-charging-ID ----> used only when reply message */ + if (pMsg->mmsAttrib.replyCharge.szChargeID[0]) { + length = MmsBinaryEncodeTextStringLen((UINT8*)pMsg->mmsAttrib.replyCharge.szChargeID); + if (length == -1) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: szReplyChargingID MmsBinaryEncodeTextStringLen fail\n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGID) | 0x80; + + if (MmsBinaryEncodeTextString(pFile, (UINT8*)pMsg->mmsAttrib.replyCharge.szChargeID, length) == false) { + MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: szContentLocation MmsBinaryEncodeTextString fail\n"); + goto __CATCH; + } + } + } + + /* flush remained data on encoding file */ + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + + return true; + +__CATCH: + + MSG_DEBUG("## _MmsBinaryEncodeSendReqHdr: failed"); + return false; +} + +bool MmsBinaryEncodeSendReqHdrwithinBufRegi(FILE *pFile, MmsMsg *pMsg) +{ + bool ret = false; + + _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX); + ret = _MmsBinaryEncodeSendReqHdr(pFile, pMsg); + _MmsUnregisterEncodeBuffer(); + + return ret; +} + +bool _MmsBinaryEncodeContentTypeFieldCode(FILE *pFile, int msgID) +{ + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("__MmsBinaryEncodeMmsVersion: MsgWriteDataFromEncodeBuffer fail \n"); + return false; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_CONTENTTYPE) | 0x80; + + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + return false; + } + + return true; +} + +bool MmsBinaryEncodeSendReqHdrContTypeFildCode(FILE *pFile, int msgID) +{ + bool ret = false; + + _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX); + + ret = _MmsBinaryEncodeContentTypeFieldCode(pFile, msgID); + + _MmsUnregisterEncodeBuffer(); + + + return ret; +} + + +bool _MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, MSG_READ_REPORT_STATUS_T mmsReadStatus) +{ + int length = 0; + char *szTo = NULL; + UINT8 fieldCode = 0xff; + UINT8 fieldValue = 0xff; + char szSubject[MSG_LOCALE_SUBJ_LEN + 8] = {0, }; + + if (pMsg == NULL) { + MSG_DEBUG("pMsg is NULL"); + goto __CATCH; + } + + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: mmsReadStatus = %d\n", mmsReadStatus); + + __MmsCleanEncodeBuff(); + + /* msgType */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_SEND_REQ) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: msgType error\n"); + goto __CATCH; + } + + /* trID (other type of message) */ + if (__MmsBinaryEncodeTrID(pFile, NULL, 0) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: __MmsBinaryEncodeTrID error\n"); + goto __CATCH; + } + + if (__MmsBinaryEncodeMmsVersion(pFile) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: __MmsBinaryEncodeMmsVersion error\n"); + goto __CATCH; + } + + /* Date = Long-integer */ + if (!__MmsBinaryEncodeDate(pFile)) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: date __MmsBinaryEncodeDate error\n"); + goto __CATCH; + } + + /* From : Insert Token mode */ + if (__MmsBinaryEncodeFrom(pFile) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: __MmsBinaryEncodeFrom fail\n"); + goto __CATCH; + } + + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To = %s\n", pMsg->mmsAttrib.szFrom); + + /* To = Encoded-string */ + if (pMsg && (strchr(pMsg->mmsAttrib.szFrom, '/') == NULL)) { + length = strlen(pMsg->mmsAttrib.szFrom); + szTo = (char *)malloc(length + 11); + if (szTo == NULL) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: szTo alloc fail\n"); + goto __CATCH; + } + + snprintf(szTo, length + 11, "%s/TYPE=PLMN", pMsg->mmsAttrib.szFrom); + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To = %s\n", szTo); + + if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, szTo) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + + if (szTo) { + free(szTo); + szTo = NULL; + } + } else { + if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, pMsg->mmsAttrib.szFrom) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + } + + /* Subject = Encoded-string-value */ + if (pMsg && pMsg->mmsAttrib.szSubject[0]) { + if (mmsReadStatus == MSG_READ_REPORT_IS_READ) { + snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s%s", MMS_READ_REPORT_STRING_READ, pMsg->mmsAttrib.szSubject); + } else { + snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s%s", MMS_READ_REPORT_STRING_DELETED, pMsg->mmsAttrib.szSubject); + } + } else { + if (mmsReadStatus == MSG_READ_REPORT_IS_READ) { + snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_READ); + + } else { + snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_DELETED ); + } + } + + length = MmsBinaryEncodeEncodedStringLen((UINT8*)szSubject); + if (length == -1) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: subject MmsBinaryEncodeEncodedStringLen fail \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length + 1) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: subject MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SUBJECT) | 0x80; + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; + if (MmsBinaryEncodeEncodedString(pFile, (UINT8*)szSubject, length) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: subject MmsBinaryEncodeEncodedString fail \n"); + goto __CATCH; + } + + /* Msg class */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGCLASS) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeMsgClass, MMS_MSGCLASS_AUTO) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: msgClass error\n"); + goto __CATCH; + } + + + /* Delivery Report (yes | no) */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_NO) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Delivery Report error\n"); + goto __CATCH; + } + + + /* Read Reply (Yes | no) */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READREPLY) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_NO) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Read Reply error\n"); + goto __CATCH; + } + + + /* Sender Visible (hide | show) */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SENDERVISIBILLITY) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeSenderVisibility, MMS_SENDER_SHOW) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Sender Visible error\n"); + goto __CATCH; + } + + /* fixme: msgContentType */ + /* fixme: msgHeader */ + /* fixme: msgBody */ + + /* flush remained data on encoding file */ + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + + return true; + +__CATCH: + if (szTo) { + free(szTo); + szTo = NULL; + } + + return false; +} + + + +bool _MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, MSG_READ_REPORT_STATUS_T mmsReadStatus) +{ + UINT8 fieldCode = 0xff; + UINT8 fieldValue = 0xff; + char *szTo = NULL; + + __MmsCleanEncodeBuff(); + + /* msgType */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_READREC_IND) | 0x80; + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: msgType error\n"); + goto __CATCH; + } + + /* MMS version */ + if (__MmsBinaryEncodeMmsVersion(pFile) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: __MmsBinaryEncodeMmsVersion error\n"); + goto __CATCH; + } + + if (__MmsBinaryEncodeMsgID(pFile, pMsg->szMsgID) == false) + goto __CATCH; + + /* To = Encoded-string */ + if (strchr(pMsg->mmsAttrib.szFrom, '/') == NULL) { + int length = 0; + length = strlen(pMsg->mmsAttrib.szFrom); + szTo = (char *)malloc(length + 11); + + if (szTo == NULL) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: szTo alloc fail\n"); + goto __CATCH; + } + + snprintf(szTo, length + 11,"%s/TYPE=PLMN", pMsg->mmsAttrib.szFrom); + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To = %s\n", szTo); + + if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, szTo) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: To __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + + if (szTo) { + free(szTo); + szTo = NULL; + } + } else { + if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, pMsg->mmsAttrib.szFrom) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: To __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + } + + /* From : Insert Token mode */ + if (__MmsBinaryEncodeFrom(pFile) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: __MmsBinaryEncodeFrom fail\n"); + goto __CATCH; + } + + /* Date = Long-integer */ + if (!__MmsBinaryEncodeDate(pFile)) { + MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: __MmsBinaryEncodeDate error\n"); + goto __CATCH; + } + + /* Read Status (Yes | no) */ + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READSTATUS) | 0x80; + fieldValue = _MmsGetBinaryValue(MmsCodeReadStatus, mmsReadStatus) | 0x80; + + if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: Read Status error\n"); + goto __CATCH; + }; + + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: remained data MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + + return true; + +__CATCH: + if (szTo) { + free(szTo); + szTo = NULL; + } + + return false; +} + +bool MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate) +{ + int length = 0; + MsgMultipart *pMultipart = NULL; + + MSG_DEBUG("MmsBinaryEncodeMsgBody: nPartCount = %d\n", nPartCount); + + if (pFile == NULL || pType == NULL) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: invalid file handle\n"); + goto __CATCH; + } + + if (MmsIsMultipart(pType->type)) { + + int nEntries = 0; + /* --------------------------- + * Multipart message + * ---------------------------*/ + + pType->offset = _MmsGetEncodeOffset(); + + /* Content type */ + length = MmsBinaryEncodeContentTypeLen(pType); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: MmsBinaryEncodeContentTypeLen fail \n"); + goto __CATCH; + } + if (bTemplate == false) + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_CONTENTTYPE) | 0x80; + + if (MmsBinaryEncodeContentType(pFile, pType, length) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: MmsBinaryEncodeContentType fail \n"); + goto __CATCH; + } + + pBody->offset = _MmsGetEncodeOffset(); + + /* nEntries */ + if (pBody->pPresentationBody) { + nEntries = nPartCount + 1; + } else { + nEntries = nPartCount; + } + + if (nEntries >= 0) { + length = MmsBinaryEncodeUintvarLen(nEntries); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: nEntries MmsBinaryEncodeUintvarLen fail \n"); + goto __CATCH; + } + if (MmsBinaryEncodeUintvar(pFile, nEntries, length) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: nEntries MmsBinaryEncodeUintvar fail \n"); + goto __CATCH; + } + + pType->size = _MmsGetEncodeOffset() - pType->offset; + } + + if (nEntries > 0) { + if (nEntries && pBody->pPresentationBody) { + if (MmsBinaryEncodeMsgPart(pFile, pType->type, &pBody->presentationType, pBody->pPresentationBody) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: __MmsBinaryEncodeMsgPart fail \n"); + goto __CATCH; + } + + nEntries--; + } + + pMultipart = pBody->body.pMultipart; + while (nEntries && pMultipart) { + if (MmsBinaryEncodeMsgPart(pFile, pType->type, &pMultipart->type, pMultipart->pBody) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: __MmsBinaryEncodeMsgPart fail \n"); + goto __CATCH; + } + pMultipart = pMultipart->pNext; + nEntries--; + } + } else { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: Empty message body MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + pBody->size = _MmsGetEncodeOffset() - pBody->offset; + } else { + /* --------------------------- + * Singlepart message + * ---------------------------*/ + pType->offset = _MmsGetEncodeOffset(); + + if (MmsBinaryEncodeContentHeader(pFile, (MimeType)pType->type, pType, false) == false) + goto __CATCH; + + length = MmsBinaryEncodeContentTypeLen(pType); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeMsgBody: Singlepart MmsBinaryEncodeContentTypeLen fail \n"); + goto __CATCH; + } + + if (MmsBinaryEncodeContentType(pFile, pType, length) == false) + goto __CATCH; + + pType->size = _MmsGetEncodeOffset() - pType->offset; + + if (MmsBinaryEncodeContentBody(pFile, pBody) == false) + goto __CATCH; + } + + return true; + +__CATCH: + MSG_DEBUG("## MmsBinaryEncodeMsgBody: failed\n"); + + return false; +} + + +int MmsBinaryEncodeContentTypeLen(MsgType *pType) +{ + int length = 0; + int totalLength = 0; + UINT16 fieldValue = 0xffff; + char *szTextType = NULL; + int contentType = MIME_UNKNOWN; + + MSG_DEBUG("MSmsBinaryEncodeContentTypeLen: type\n"); + + /* + * Content-type-value = Constrained-media | Content-general-form + * Constrained-media = Constrained-encoding + * Constrained-encoding = Extension-Media | Short-integer + * Extension-media = *TEXT End-of-string + * Content-general-form = Value-length Media-type + * Media-type = (Well-known-media | Extension-Media) *(Parameter) + */ + + /* Content-type-value = Content-general-form ------------------------------- */ + /* Content-Type */ + + contentType = pType->type; + + fieldValue = _MmsGetBinaryValue(MmsCodeContentType, contentType); + if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) { + /* Extension-media type */ + szTextType = _MmsGetTextValue(MmsCodeContentType, contentType); + if (szTextType != NULL) { + length = MmsBinaryEncodeTextStringLen((UINT8*)szTextType); + if (length == -1) { + MSG_DEBUG("MSmsBinaryEncodeContentTypeLen: szTextType MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + totalLength += length; + } else { + totalLength++; + } + } else { + totalLength++; + } + + /* Parameters -------------------------------------------------------------- */ + + MSG_DEBUG("MSmsBinaryEncodeContentTypeLen: parameters \n\n"); + + /* Well-known-charset = Any-charset | Integer-value ----------------------- */ + + if (pType->param.charset != MSG_CHARSET_UNKNOWN) { + fieldValue = _MmsGetBinaryValue(MmsCodeCharSet, pType->param.charset); + length = MmsBinaryEncodeIntegerLen(fieldValue); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: charSet MmsBinaryEncodeIntegerLen fail \n"); + goto __CATCH; + } + totalLength += (length + 1); + } else { + if (MmsIsText(contentType)) { // Any-charset + if (!MmsIsVitemContent (contentType, pType->param.szName)) + totalLength += 2; + } + } + + + /* Name = Text-string ------------------------------------------------------ */ + + if (pType->param.szName[0]) { + char* pszName = NULL; + + if (_MsgIsASCII (pType->param.szName)) { + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName is consisted of ascii char-set chars. \n"); + + pszName = (char *)malloc(strlen(pType->param.szName) +1); + memset(pszName, 0, (strlen(pType->param.szName)+1)); + strcpy(pszName, pType->param.szName); + } else { + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName is not consisted of ascii char-set chars. \n"); + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: pType->param.szName : %s\n", pType->param.szName); + + /* if msg-server can't support non ascii, then convert non-ascii to '_' by using _MsgReplaceNonAscii*/ + int filelen = strlen(pType->param.szName); + + pszName = (char *)malloc(filelen + 1); + memset(pszName, 0, (filelen + 1)); + strncpy(pszName, pType->param.szName, filelen); + + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: pszName : %s\n", pszName); + } + + //change empty space to '_' in the file name + if (_MsgIsSpace(pszName)) { + char *pszTempName = NULL; + + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName has space(' '). \n"); + + _MsgReplaceSpecialChar(pszName, &pszTempName, ' '); + + if (pszTempName) { + free(pszName); + pszName = pszTempName; + } + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: pszName : %s\n", pszName); + } + + length = MmsBinaryEncodeTextStringLen((UINT8*)pszName); + free(pszName); + + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName MmsBinaryEncodeIntegerLen fail \n"); + goto __CATCH; + } + + totalLength += (length + 1); + } + +#ifdef FEATURE_JAVA_MMS + if (pType->param.szApplicationID) { + length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szApplicationID); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szApplicationID MmsBinaryEncodeTextStrinLen fail \n"); + goto __CATCH; + } + + totalLength += (length); + if (_MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID) == UNDEFINED_BINARY) { + totalLength += strlen(_MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID)) + 1; /* NULL */ + } else { + totalLength++; + } + } + + if (pType->param.szReplyToApplicationID) { + length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szReplyToApplicationID); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szApplicationID MmsBinaryEncodeTextStrinLen fail \n"); + goto __CATCH; + } + + totalLength += (length); + if (_MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID) == UNDEFINED_BINARY) { + totalLength += strlen(_MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID)) + 1; /* NULL */ + } else { + totalLength++; + } + } +#endif + + /* type, start, & startInfo : multipart/related only parameters -------------- */ + if (contentType == MIME_MULTIPART_RELATED || contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { + /* type ------------------------------------- */ + fieldValue = _MmsGetBinaryValue(MmsCodeContentType, pType->param.type); + if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) { + /* Extension-media type */ + szTextType = _MmsGetTextValue(MmsCodeContentType, pType->param.type); + if (szTextType != NULL) { + length = MmsBinaryEncodeTextStringLen((UINT8*)szTextType); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: type param MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + totalLength += (length + 1); + } else { + totalLength += 2; + } + } else { + totalLength += 2; + } + + /* start = Text-string ----------------------- */ + if (pType->param.szStart[0]) { + /* start = Text-string */ + length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStart); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + totalLength += (length + 1); + } + + + /* startInfo = Text-string -------------------- */ + if (pType->param.szStartInfo[0]) { + /* StartInfo (with multipart/related) = Text-string */ + length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStartInfo); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + totalLength += (length + 1); + } + } + + return totalLength; + +__CATCH: + + MSG_DEBUG("## MmsBinaryEncodeContentTypeLen: failed"); + return -1; +} + + + +bool MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLength) +{ + int length = 0; + UINT16 fieldValue = 0xffff; + char *szTextType = NULL; + int contentType = MIME_UNKNOWN; + +#ifdef FEATURE_JAVA_MMS + char *szParameter = NULL; +#endif + + MSG_DEBUG("************************************************************************************\n"); + MSG_DEBUG("MmsBinaryEncodeContentType: C O N T E N T T Y P E \n\n"); + + /* + * Content-type-value = Constrained-media | Content-general-form + * Constrained-media = Constrained-encoding + * Constrained-encoding = Extension-Media | Short-integer + * Extension-media = *TEXT End-of-string + * Content-general-form = Value-length Media-type + * Media-type = (Well-known-media | Extension-Media) *(Parameter) + */ + + if (pFile == NULL) { + MSG_DEBUG("MmsBinaryEncodeContentType: invalid file handle\n"); + goto __CATCH; + } + + + /* Content-Type = Content-general-form ------------------------------- */ + + length = MmsBinaryEncodeValueLengthLen(typeLength); + if (length == -1) { + MSG_DEBUG("MSmsBinaryEncodeContentType : MmsBinaryEncodeValueLengthLen fail.\n"); + goto __CATCH; + } + + if (MmsBinaryEncodeValueLength(pFile, typeLength, length) == false) { + MSG_DEBUG("MSmsBinaryEncodeContentType : MmsBinaryEncodeValueLength fail.\n"); + goto __CATCH; + } + + contentType = pType->type; + + fieldValue = _MmsGetBinaryValue(MmsCodeContentType, (int)contentType); + if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) { + /* Extension-media type */ + szTextType = _MmsGetTextValue(MmsCodeContentType, (int)contentType); + if (szTextType == NULL) + fieldValue = 0x00; + } + + if (szTextType == NULL) { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80; + } else { + length = MmsBinaryEncodeTextStringLen((UINT8*)szTextType); + if (length == -1) { + MSG_DEBUG("MSmsBinaryEncodeContentType: szTextType MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + if (MmsBinaryEncodeTextString(pFile, (UINT8*)szTextType, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentType: szTextType MmsBinaryEncodeTextString fail \n"); + goto __CATCH; + } + } + + /* Parameters -------------------------------------------------------------- */ + + MSG_DEBUG("MmsBinaryEncodeContentType: P A R M E T E R S \n\n"); + + /* Name = Text-string ------------------------------------------------------ */ + + if (pType->param.szName[0]) { + char* pszName = NULL; + + if (_MsgIsASCII (pType->param.szName)) { + + MSG_DEBUG("MmsBinaryEncodeContentType: szName is consisted of ascii char-set chars. \n"); + + pszName = (char *)malloc(strlen(pType->param.szName) +1); + memset(pszName, 0, (strlen(pType->param.szName)+1)); + strcpy(pszName, pType->param.szName); + } else { + MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName is not consisted of ascii char-set chars. \n"); + + /* if msg-server can't support non ascii, then convert non-ascii to '_' by using _MsgReplaceNonAscii*/ + int filelen = strlen(pType->param.szName); + + pszName = (char *)malloc(filelen + 1); + memset(pszName, 0, (filelen + 1)); + strncpy(pszName, pType->param.szName, filelen); + + MSG_DEBUG("MmsBinaryEncodeContentType: pszName : %s\n", pszName); + } + + //change empty space to '_' in the file name + if (_MsgIsSpace(pszName)) { + char* pszTempName = NULL; + + MSG_DEBUG("MmsBinaryEncodeContentType: szName has space(' '). \n"); + + _MsgReplaceSpecialChar(pszName, &pszTempName, ' '); + + if (pszTempName) { + free(pszName); + pszName = pszTempName; + } + MSG_DEBUG("MmsBinaryEncodeContentType: pszName : %s\n", pszName); + } + + length = MmsBinaryEncodeTextStringLen((UINT8*)pszName); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: szName MmsBinaryEncodeIntegerLen fail \n"); + free(pszName); + goto __CATCH; + } + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_NAME) | 0x80; + + if (MmsBinaryEncodeTextString(pFile, (UINT8*)pszName, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentType: szName MmsBinaryEncodeTextString fail\n"); + free(pszName); + goto __CATCH; + } + free(pszName); + } +#ifdef FEATURE_JAVA_MMS + MSG_DEBUG(" MmsBinaryEncodeContentType: Application-ID \n"); + + /* Application-ID: Text-string */ + if (pType->param.szApplicationID) { + length = MmsBinaryEncodeTextStringLen((UINT8*) pType->param.szApplicationID); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeIntegerLen Fail \n"); + goto __CATCH; + } + + fieldValue = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID); + + if (fieldValue == UNDEFINED_BINARY) + szParameter = _MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID); + + if (szParameter == NULL) { + MSG_DEBUG("MmsBinaryEncodeContentType: szParameter is NULL \n"); + goto __CATCH; + } + + strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)szParameter, strlen(szParameter)); + gCurMmsEncodeBuffPos += strlen(szParameter); + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] =(UINT8)NULL; + + if (MmsBinaryEncodeTextString(pFile, (UINT8*) pType->param.szApplicationID, length) == false) { + MSG_DEBUG(" MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeTextString fail\n"); + goto __CATCH; + } + + } + + /* ReplyToApplicationID: Text-string */ + if (pType->param.szReplyToApplicationID) { + length = MmsBinaryEncodeTextStringLen((UINT8*) pType->param.szReplyToApplicationID); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: szReplyToApplicationID MmsBinaryEncodeIntegerLen Fail \n"); + goto __CATCH; + } + + fieldValue = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID); + + if (fieldValue == UNDEFINED_BINARY) + szParameter = _MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID); + + if (szParameter == NULL) { + MSG_DEBUG("MmsBinaryEncodeContentType: szParameter is NULL \n"); + goto __CATCH; + } + + strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)szParameter, strlen(szParameter)); + gCurMmsEncodeBuffPos += strlen(szParameter); + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] =(UINT8)NULL; + + if (MmsBinaryEncodeTextString(pFile, (UINT8*) pType->param.szReplyToApplicationID, length) == false) { + MSG_DEBUG(" MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeTextString fail\n"); + goto __CATCH; + } + } +#endif + + /* Well-known-charset = Any-charset | Integer-value ----------------------- */ + + if (pType->param.charset != MSG_CHARSET_UNKNOWN) { + fieldValue = _MmsGetBinaryValue(MmsCodeCharSet, pType->param.charset); + length = MmsBinaryEncodeIntegerLen(fieldValue); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: charSet MmsBinaryEncodeIntegerLen fail \n"); + goto __CATCH; + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80; + if (MmsBinaryEncodeInteger(pFile, fieldValue, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentType: charSet MmsBinaryEncodeInteger fail\n"); + goto __CATCH; + } + } else { + /* Any-charset */ + if (MmsIsText(contentType)) { + if (!MmsIsVitemContent (contentType, pType->param.szName)) { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80; + fieldValue = 0x0000; //laconic_warning, just to remove warning message + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80; + } + } + } + + /* type, start, & startInfo : multipart/related only parameters -------------- */ + if (contentType == MIME_MULTIPART_RELATED || contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { + /* type ------------------------------------- */ + fieldValue = _MmsGetBinaryValue(MmsCodeContentType, pType->param.type); + if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) { + /* Extension-media type */ + szTextType = _MmsGetTextValue(MmsCodeContentType, pType->param.type); + if (szTextType == NULL) + fieldValue = 0x00; + } + + if (szTextType == NULL) { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80; + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_TYPE) | 0x80; + } else { + length = MmsBinaryEncodeTextStringLen((UINT8*)szTextType); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: type param MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_TYPE) | 0x80; + if (MmsBinaryEncodeTextString(pFile, (UINT8*)szTextType, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentType: type param MmsBinaryEncodeTextString fail \n"); + goto __CATCH; + } + } + + /* start = Text-string ----------------------- */ + if (pType->param.szStart && pType->param.szStart[0]) { + /* start = Text-string */ + length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStart); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, + MSG_PARAM_START) | 0x80; + if (MmsBinaryEncodeTextString(pFile, (UINT8*)pType->param.szStart, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextString fail \n"); + goto __CATCH; + } + } + + /* startInfo = Text-string -------------------- */ + if (pType->param.szStartInfo[0]) { + /* StartInfo (with multipart/related) = Text-string */ + length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStartInfo); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_START_INFO) | 0x80; + if (MmsBinaryEncodeTextString(pFile, (UINT8*)pType->param.szStartInfo, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextString fail \n"); + goto __CATCH; + } + } + } + + return true; + +__CATCH: + MSG_DEBUG("## MmsBinaryEncodeContentType: failed"); + return false; +} + + + +bool MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pType, MsgBody *pBody) +{ + FILE *pFile2 = NULL; + char *pData = NULL; + int length = 0; + + + if (pType->offset && pType->size) { + /* header length & body length --------------------------- */ + + length = MmsBinaryEncodeUintvarLen(pType->size); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. headerLeng MmsBinaryEncodeUintvarLen fail \n"); + goto __CATCH; + } + + if (MmsBinaryEncodeUintvar(pFile, pType->size, length) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. eaderLeng fail \n"); + goto __CATCH; + } + + length = MmsBinaryEncodeUintvarLen(pBody->size); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. bodyLeng MmsBinaryEncodeUintvarLen fail \n"); + goto __CATCH; + } + + if (MmsBinaryEncodeUintvar(pFile, pBody->size, length) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. bodyLeng fail \n"); + goto __CATCH; + } + + pFile2 = MsgOpenFile(pType->szOrgFilePath, "rb"); + if (pFile != NULL) { + pData = (char *)malloc(pType->size); + if (pData == NULL) + goto __CATCH; + + if (MsgFseek(pFile2, pType->offset, SEEK_SET) < 0) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: MsgFseek fail \n"); + goto __CATCH; + } + + ULONG nRead = 0; + + if ((nRead = MsgReadFile(pData, sizeof(char), pType->size, pFile2)) == 0) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. header MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + pType->offset = _MmsGetEncodeOffset(); + if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) { + MSG_DEBUG("MsgWriteFile failed"); + goto __CATCH; + } + gMmsEncodeCurOffset = MsgFtell(pFile); + if(gMmsEncodeCurOffset < 0) { + MSG_DEBUG("MsgFtell returns negative value [%ld]", gMmsEncodeCurOffset); + goto __CATCH; + } + } + + MsgCloseFile(pFile2); + pFile2 = NULL; + } + } else { + int headerLeng = 0; + int contentTypeLen = 0; + int contentHdrLen = 0; + + /* header length & body length --------------------------- */ + contentTypeLen = MmsBinaryEncodeContentTypeLen(pType); + length = MmsBinaryEncodeValueLengthLen(contentTypeLen); + contentHdrLen = MmsBinaryEncodeContentHeaderLen((MimeType)contentType, pType, true); + + if (contentTypeLen == -1 || length == -1 || contentHdrLen == -1) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng calculation fail \n"); + goto __CATCH; + } + + headerLeng = contentTypeLen + contentHdrLen + length; + length = MmsBinaryEncodeUintvarLen(headerLeng); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng MmsBinaryEncodeUintvarLen fail \n"); + goto __CATCH; + } + + if (MmsBinaryEncodeUintvar(pFile, headerLeng, length) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng fail \n"); + goto __CATCH; + } + + length = MmsBinaryEncodeUintvarLen(pBody->size); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: bodyLeng MmsBinaryEncodeUintvarLen fail \n"); + goto __CATCH; + } + + if (MmsBinaryEncodeUintvar(pFile, pBody->size, length) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: bodyLeng fail \n"); + goto __CATCH; + } + + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: 2. header MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + + /* content-type & header --------------------------- */ + pType->offset = _MmsGetEncodeOffset(); + + if (MmsBinaryEncodeContentType(pFile, pType, contentTypeLen) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: MmsBinaryEncodeContentType fail \n"); + goto __CATCH; + } + + if (MmsBinaryEncodeContentHeader(pFile, (MsgContentType)contentType, pType, true) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: MmsBinaryEncodeContentHeader fail \n"); + goto __CATCH; + } + + pType->size = _MmsGetEncodeOffset() - pType->offset; + } + + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: contentBody MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + + /* content-body --------------------------- */ + if (MmsBinaryEncodeContentBody(pFile, pBody) == false) { + MSG_DEBUG("MmsBinaryEncodeMsgPart: MmsBinaryEncodeContentBody fail \n"); + goto __CATCH; + } + + if (pData) { + free(pData); + pData = NULL; + } + + return true; + +__CATCH: + + if (pData) { + free(pData); + pData = NULL; + } + + MSG_DEBUG("## MmsBinaryEncodeMsgPart: failed\n"); + if (pFile2) { + MsgCloseFile(pFile2); + pFile2 = NULL; + } + + return false; +} + + +int MmsBinaryEncodeContentHeaderLen(MsgContentType contentType, MsgType *pType, bool bMultipart) +{ + int length = 0; + int totalLength = 0; + char *szTextValue = NULL; + + + MSG_DEBUG("MmsBinaryEncodeContentHeaderLen: S T A R T \n\n"); + + /* content-id ------------------------------------------------- */ + if (pType->szContentID[0]) { + if (bMultipart) { //Binary Encoding + totalLength++; + } else { + /* content-id = Quoted-string */ + length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-ID"); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeaderLen: Content-ID MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + totalLength += length; + } + + length = MmsBinaryEncodeQuotedStringLen((UINT8*)pType->szContentID); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedStringLen fail.\n"); + goto __CATCH; + } + totalLength += length; + } + + + if (pType->szContentLocation[0]) { + if (bMultipart) { //Binary Encoding + totalLength++; + } else { + /* content-location = Quoted-string */ + length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-Location"); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + totalLength += length; + } + + length = MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + totalLength += length; + } + + + /* MIME_APPLICATION_VND_WAP_MULTIPART_RELATEDrequires always "inline" */ + + if (contentType != MIME_APPLICATION_VND_WAP_MULTIPART_RELATED && + contentType != MIME_MULTIPART_RELATED && + pType->disposition != INVALID_VALUE) { + + /* + * Content-disposition-value = Value-length Disposition *(Parameter) + * Disposition = Form-data | Attachment | Inline | Token-text + * Form-data = : 0x80 + * Attachment = : 0x81 + * Inline = : 0x82 + */ + + if (bMultipart) { //Binary Encoding + totalLength += 3; + } else { + /* content-disposition = Quoted-string */ + szTextValue = _MmsGetTextValue(MmsCodeMsgDisposition, pType->disposition); + + if (szTextValue) { + length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-Disposition"); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + totalLength += length; + + length = MmsBinaryEncodeTextStringLen((UINT8*)szTextValue); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + totalLength += length; + } + } + } + + return totalLength; + +__CATCH: + MSG_DEBUG("## MmsBinaryEncodeContentHeadeLen: failed"); + + return -1; +} + + + +bool MmsBinaryEncodeContentHeader(FILE *pFile, MsgContentType contentType, MsgType *pType, bool bMultipart) +{ + int length = 0; + char *szTextValue = NULL; + + MSG_DEBUG("MmsBinaryEncodeContentHeader: S T A R T \n\n"); + + /* content-id ------------------------------------------------- */ + if (pType->szContentID[0]) { + if (bMultipart) { //Binary Encoding + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTID) | 0x80; + } else { + /* content-id = Quoted-string */ + length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-ID"); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-ID MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + if (MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-ID", length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-ID MmsBinaryEncodeTextString fail.\n"); + goto __CATCH; + } + } + + length = MmsBinaryEncodeQuotedStringLen((UINT8*)pType->szContentID); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedStringLen fail.\n"); + goto __CATCH; + } + + if (MmsBinaryEncodeQuotedString(pFile, (UINT8*)pType->szContentID, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedString fail.\n"); + goto __CATCH; + } + } + + if (pType->szContentLocation[0]) { + if (bMultipart) { //Binary Encoding + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTLOCATION) | 0x80; + } else { + /* content-location = Quoted-string */ + length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-Location"); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + if (MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-Location", length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextString fail.\n"); + goto __CATCH; + } + } + + length = MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + if (MmsBinaryEncodeTextString(pFile, (UINT8*)pType->szContentLocation, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextString fail.\n"); + goto __CATCH; + } + } + + /* MIME_APPLICATION_VND_WAP_MULTIPART_RELATEDrequires always "inline" */ + + if (contentType != MIME_APPLICATION_VND_WAP_MULTIPART_RELATED && + contentType != MIME_MULTIPART_RELATED && + pType->disposition != INVALID_VALUE) { + + /* + * Content-disposition-value = Value-length Disposition *(Parameter) + * Disposition = Form-data | Attachment | Inline | Token-text + * Form-data = : 0x80 + * Attachment = : 0x81 + * Inline = : 0x82 + */ + + if (bMultipart) {//Binary Encoding + + UINT8 fieldValue = 0xff; + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_DISPOSITION) | 0x80; + + fieldValue = _MmsGetBinaryValue(MmsCodeMsgDisposition, pType->disposition) | 0x80; + + if (fieldValue == 0xff) + fieldValue = 0x81; + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = 0x01; + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldValue; + } else { + /* content-disposition = Disposition (no support parameter) */ + + szTextValue = _MmsGetTextValue(MmsCodeMsgDisposition, pType->disposition); + + if (szTextValue) { + length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-Disposition"); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + if (MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-Disposition", length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextString fail.\n"); + goto __CATCH; + } + + length = MmsBinaryEncodeTextStringLen((UINT8*)szTextValue); + if (length == -1) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + if (MmsBinaryEncodeTextString(pFile, (UINT8*)szTextValue, length) == false) { + MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextString fail.\n"); + goto __CATCH; + } + } + } + } + + return true; + +__CATCH: + MSG_DEBUG("## MmsBinaryEncodeContentHeader: failed"); + return false; +} + + + +bool MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody) +{ + int nRead = 0; + char *pData = NULL; + + + if (pFile == NULL) + goto __CATCH; + + if (pBody == NULL) + return true; + + if (pBody->szOrgFilePath[0]) { + pData = MsgOpenAndReadMmsFile(pBody->szOrgFilePath, pBody->offset, pBody->size, &nRead); + if (pData == NULL) + goto __CATCH; + + pBody->offset = _MmsGetEncodeOffset(); + if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != nRead) { + MSG_DEBUG("MsgWriteFile failed"); + goto __CATCH; + } + gMmsEncodeCurOffset = MsgFtell(pFile); + + if (gMmsEncodeCurOffset < 0) { + MSG_DEBUG("MsgFtell returns negative value [%ld]", gMmsEncodeCurOffset); + goto __CATCH; + } + + if (pData) { + free(pData); + pData = NULL; + } + } else if (pBody->body.pText && pBody->size) { + pBody->offset = _MmsGetEncodeOffset(); + if (MsgWriteFile(pBody->body.pText, sizeof(char),pBody->size, pFile) != pBody->size) { + MSG_DEBUG("MsgWriteFile failed"); + goto __CATCH; + } + gMmsEncodeCurOffset = MsgFtell(pFile); + + if(gMmsEncodeCurOffset < 0) { + MSG_DEBUG("MsgFtell returns negative value [%ld]", gMmsEncodeCurOffset); + goto __CATCH; + } + } + + return true; + +__CATCH: + MSG_DEBUG("## MmsBinaryEncodeContentBody: failed\n"); + if (pData) { + free(pData); + pData = NULL; + } + + return false; +} + + + +/* ========================================================================= + + B I N A R Y E N C O D I N G U T I L I T Y + + =========================================================================*/ + +static int MmsBinaryEncodeIntegerLen(UINT32 integer) +{ + if (integer < 0x80) { + /* short-integer */ + return 1; + } else { + + int length = 0; + /* + * Long-integer = Short-length Multi-octet-integer + * The Short-length indicates the length of the Multi-octet-integer + */ + + while (integer) { + length++; + integer = (integer >> 8); + } + + length++; // + Short-length + + return length; + } +} + + +/* + * This makes value-length by specified integer value + * + * @param length [in] gotten from MmsBinaryEncodeIntegerLen() + */ +static bool MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length) +{ + union { + UINT32 integer; + UINT8 seg[4]; + } changer; + + + if (pFile == NULL) { + MSG_DEBUG("MmsBinaryEncodeInteger: source == NULL \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeInteger: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + if (integer < 0x80) { + /* short-integer */ + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)integer | 0x80; + } else { + /* + * Long-integer = Short-length Multi-octet-integer + * The Short-length indicates the length of the Multi-octet-integer + */ + changer.integer = integer; + length--; // - "Short-length" + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)length; + + int i; + for(i = 0; i < length; i++) + gpMmsEncodeBuf[gCurMmsEncodeBuffPos + i] = changer.seg[length - (i + 1)]; + + gCurMmsEncodeBuffPos += length; + } + + return true; + +__CATCH: + return false; +} + + +static int MmsBinaryEncodeLongIntegerLen(UINT32 integer) +{ + int length = 0; + + /* + * Long-integer = Short-length Multi-octet-integer + * The Short-length indicates the length of the Multi-octet-integer + */ + + if (integer == 0) + return 2; + + while (integer) { + length++; + integer = (integer >> 8); + } + + length++; // + Short-length + + return length; +} + + +/* + * This makes value-length by specified integer value + * + * @param length [in] gotten from MmsBinaryEncodeIntegerLen() + */ +static bool MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length) +{ + int i = 0; + union { + UINT32 integer; + UINT8 seg[4]; + }changer; + + + /* + * Long-integer = Short-length Multi-octet-integer + * The Short-length indicates the length of the Multi-octet-integer + */ + + if (pFile == NULL) { + MSG_DEBUG("MmsBinaryEncodeLongInteger: source == NULL \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeLongInteger: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + changer.integer = integer; + length--; // - "Short-length" + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)length; + + for(i = 0; i < length; i++) + gpMmsEncodeBuf[gCurMmsEncodeBuffPos + i] = changer.seg[length - (i + 1)]; + + gCurMmsEncodeBuffPos += length; + + return true; + +__CATCH: + return false; +} + + + +static int MmsBinaryEncodeTextStringLen(UINT8 *source) +{ + int length = 0; + + MSG_DEBUG("MmsBinaryEncodeTextStringLen: \n"); + + if (source == NULL) { + MSG_DEBUG("MmsBinaryEncodeTextStringLen: source == NULL \n"); + return -1; + } + + length = (int)strlen((char*)source); + if (source[0] > 0x7F) { + length += 2; // + NULL + } else { + length++; // + NULL + } + + return length; +} + + +/* + * @param source [in] originam string + * @param length [in] gotten from MmsBinaryEncodeTextStringLen() + * @param dest [in] buffer to store quted string + * @return changed string length +*/ +static bool MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length) +{ + + MSG_DEBUG("MmsBinaryEncodeTextString: \n"); + + /* + * make text string + * Text-string = [Quote] *TEXT End-of-string + * If the 1st char in the TEXT is in the range of 128-255, a Quote char must precede it. + * Otherwise the Quote char must be omitted. + * The Quote is not part of the contents. + * Quote = + */ + + if (pFile == NULL || source == NULL) { + MSG_DEBUG("MmsBinaryEncodeTextString: source == NULL \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeTextString: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + if (source[0] > 0x7F) { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = QUOTE; + length--; + } + + strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, (length - 1)); // except NULL + gCurMmsEncodeBuffPos += (length - 1); // except NULL + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)NULL; + + return true; + +__CATCH: + return false; +} + + + +/* + * Encode 28bit unsigned integer(Maximum) to uintvar + * + * @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 + + +static int MmsBinaryEncodeUintvarLen(UINT32 integer) +{ + UINT32 length = 0; + + /* Find encoded unitvar length */ + if (integer <= UINTVAR_LENGTH_1) { + length = 1; + } else { + if (integer <= UINTVAR_LENGTH_2) { + length = 2; + } else { + if (integer <= UINTVAR_LENGTH_3) { + length = 3; + } else { + length = 4; + } + } + } + + return length; +} + + +static bool MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length) +{ + const char ZERO = 0x00; + int i = 2; + char szReverse[MSG_STDSTR_LONG] = {0, }; + + union { + UINT32 integer; + char bytes[4]; + } source; + + if (pFile == NULL) { + MSG_DEBUG("MmsBinaryEncodeUintvar: pFile == INVALID_HBOJ \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeUintvar: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + source.integer = integer; + memset(szReverse, 0, MSG_STDSTR_LONG); + + /* Seperate integer to 4 1 byte integer */ + szReverse[3] = source.bytes[3] & 0x0f; + szReverse[0] = source.bytes[0]; + szReverse[0] = szReverse[0] & 0x7f; + + while (length >= i) { // initially, i = 2 + /* Move integer bit to proper position */ + source.integer = source.integer << 1; + source.integer = source.integer >> 8; + source.bytes[3] = ZERO; + + /* Retrive 1 encode uintvar */ + szReverse[i-1] = source.bytes[0]; + szReverse[i-1] = szReverse[i-1] | 0x80; + i++; + } + + for(i=0; i < length; i++) + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = szReverse[length - i - 1]; + + return true; + +__CATCH: + return false; +} + + + +static int MmsBinaryEncodeValueLengthLen(UINT32 integer) +{ + int length = 0; + + if (integer < 0x1f) { + length = 1; + } else { + length = MmsBinaryEncodeUintvarLen(integer) + 1; //LENGTH_QUOTE + } + + return length; +} + + +/* + * This makes value-length by specified integer value + * + * @param length [in] from MmsBinaryEncodeValueLengthLen() + * @return encoded value-length + */ +static bool MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length) +{ + /* + * Value-length = Short-length | (Length-quote Length) + * ; Value length is used to indicate the length of the value to follow + * Short-length = + * Length-quote = + * Length = Uintvar-integer + */ + + if (pFile == NULL) { + MSG_DEBUG("MmsBinaryEncodeValueLength: pFile == INVALID_HBOJ \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeValueLength: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + if (integer < 0x1F) { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)integer; + } else { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)LENGTH_QUOTE; + if (MmsBinaryEncodeUintvar(pFile, integer, length - 1) == false) { // LENGTH_QUOTE + MSG_DEBUG("MmsBinaryEncodeValueLength: MmsBinaryEncodeUintvar fail\n"); + goto __CATCH; + } + } + + return true; + +__CATCH: + return false; +} + + +static int MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc) +{ + if (pSrc == NULL) { + MSG_DEBUG("MmsBinaryEncodeQuotedStringLen: invalid file\n"); + goto __CATCH; + } + + return (strlen((char*)pSrc) + 2); // QUOTE + NULL + +__CATCH: + return -1; +} + + +/* + * make quoted string + * Quoted-string = *TEXT End-of-string + * + * @param source [in] original string + * @param length [in] length (in bytes) of data + * @param dest [out] buffer to store quted string + * @return changed string length +*/ +static bool MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length) +{ + if (source == NULL || pFile == NULL) { + MSG_DEBUG("MmsBinaryEncodeQuotedString: invalid file\n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeQuotedString: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = '\"'; + strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, length - 2); // except '\"' & NULL + gCurMmsEncodeBuffPos += (length - 2); + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)NULL; + + return true; + +__CATCH: + return false; +} + + + +static int MmsBinaryEncodeEncodedStringLen(UINT8 *source) +{ + UINT32 charset = 0x6A; // default = utf-8 + int charLeng = 0; + int textLeng = 0; + int valueLengthLen = 0; + + + MSG_DEBUG("MmsBinaryEncodeEncodedStringLen: \n"); + + /* value-length charSet text-string */ + /* Estimate charset value length and text string length */ + charLeng = MmsBinaryEncodeIntegerLen(charset); + if (charLeng == -1) { + MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : charLeng MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH;; + } + + textLeng = MmsBinaryEncodeTextStringLen((UINT8*)source); + if (textLeng == -1) { + MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : textLeng MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH;; + } + + valueLengthLen = MmsBinaryEncodeValueLengthLen(charLeng + textLeng); + if (valueLengthLen == -1) { + MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : valLengthLen MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH; + } + + return (charLeng + textLeng + valueLengthLen); + +__CATCH: + return -1; +} + + +/* + * This makes value-length by specified integer value + * + * @param length [in] from MmsBinaryEncodeEncodedStringLen() + * @return encoded encoded-string + */ +static bool MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length) +{ + UINT32 charset = 0x6A; // default = utf-8 + int charLeng = 0; + int textLeng = 0; + int valLengthLen = 0; + + + MSG_DEBUG("MmsBinaryEncodeEncodedString: \n"); + + /* value-length charSet text-string */ + + if (pFile == NULL || source == NULL) { + MSG_DEBUG("MmsBinaryEncodeEncodedString: invalid input parameter\n"); + goto __CATCH; + } + + /* Estimate charset value length and text string length */ + charLeng = MmsBinaryEncodeIntegerLen(charset); + if (charLeng == -1) { + MSG_DEBUG("MmsBinaryEncodeEncodedString : charLeng MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH;; + } + + textLeng = MmsBinaryEncodeTextStringLen((UINT8*)source); + if (textLeng == -1) { + MSG_DEBUG("MmsBinaryEncodeEncodedString : textLeng MmsBinaryEncodeTextStringLen fail.\n"); + goto __CATCH;; + } + + valLengthLen = MmsBinaryEncodeValueLengthLen(charLeng + textLeng); + if (valLengthLen == -1) { + MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeValueLengthLen fail.\n"); + goto __CATCH; + } + + if (length != (charLeng + textLeng + valLengthLen)) + { + MSG_DEBUG("MmsBinaryEncodeEncodedString: invalid length\n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("MmsBinaryEncodeEncodedString: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + /* Value length of charset value and text string */ + if (MmsBinaryEncodeValueLength(pFile, charLeng + textLeng, valLengthLen) == false) { + MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeValueLength fail.\n"); + goto __CATCH; + } + + /* fixme: Write charset on buffer -> integer value not long-integer */ + if (MmsBinaryEncodeInteger(pFile, charset, charLeng) == false) { + MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeInteger fail.\n"); + goto __CATCH; + } + + + /* Write text string on buffer */ + if (MmsBinaryEncodeTextString(pFile, (UINT8*)source, textLeng) == false) { + MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeTextString fail.\n"); + goto __CATCH; + } + + return true; + +__CATCH: + return false; +} + + +static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue) +{ + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + if (fieldCode == 0xff) { + MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: invalid fieldCode \n"); + goto __CATCH; + } + + if (fieldValue == 0xff) { + MSG_DEBUG("__MmsBinaryEncodeFieldCodeAndValue: invalid fieldValue \n"); + return true; + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldValue; + + return true; + +__CATCH: + return false; +} + + + +static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen) +{ + int length = 0; + UINT8 fieldCode = 0xff; + char szBuff[MMS_TR_ID_LEN + 1] = {0, }; + struct tm *dateTime = NULL; + time_t RawTime = 0; + time_t dateSec = 0; + + time(&RawTime); + dateTime = localtime(&RawTime); + dateSec = mktime(dateTime); + + + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80; + if (fieldCode == 0xff) { + MSG_DEBUG("__MmsBinaryEncodeTrID: invalid fieldCode \n"); + goto __CATCH; + } + + snprintf(szBuff, MMS_TR_ID_LEN + 1, "%lu.%lu", dateSec, (unsigned long)random()); + MSG_DEBUG("__MmsBinaryEncodeTrID: 2. szBuff = %s\n", szBuff); + + length = MmsBinaryEncodeTextStringLen((UINT8*)szBuff); + if (length == -1) { + MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("__MmsBinaryEncodeTrID: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; + if (MmsBinaryEncodeTextString(pFile, (UINT8*)szBuff, length) == false) { + MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextString fail\n"); + goto __CATCH; + } + + if (szTrID) { + memset(szTrID, 0, bufLen); + strncpy(szTrID, szBuff, bufLen - 1); + } + + return true; + +__CATCH: + + return false; +} + +static bool __MmsBinaryEncodeMsgID(FILE *pFile, const char *szMsgID) +{ + int length = 0; + UINT8 fieldCode = 0xff; + + fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGID) | 0x80; + if (fieldCode == 0xff) { + MSG_DEBUG("__MmsBinaryEncodeTrID: invalid fieldCode \n"); + goto __CATCH; + } + + MSG_DEBUG("__MmsBinaryEncodeMsgID: 2. szBuff = %s\n", szMsgID); + + length = MmsBinaryEncodeTextStringLen((UINT8*)szMsgID); + if (length == -1) { + MSG_DEBUG("__MmsBinaryEncodeMsgID: MmsBinaryEncodeTextStringLen fail \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("__MmsBinaryEncodeTrID: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; + if (MmsBinaryEncodeTextString(pFile, (UINT8*)szMsgID, length) == false) { + MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextString fail\n"); + goto __CATCH; + } + + return true; + +__CATCH: + + return false; +} + + + +static bool __MmsBinaryEncodeMmsVersion(FILE *pFile) +{ + UINT8 majorVer = MMS_MAJOR_VERSION; + UINT8 minorVer = MMS_MINOR_VERSION; + + MSG_DEBUG("__MmsBinaryEncodeMmsVersion: \n"); + + if (pFile == NULL) { + MSG_DEBUG("__MmsBinaryEncodeMmsVersion: invalid input file \n"); + goto __CATCH; + } + + if (majorVer < 1) { + MSG_DEBUG("__MmsBinaryEncodeMmsVersion: invalid major version (%d)\n", majorVer); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("__MmsBinaryEncodeMmsVersion: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_VERSION) | 0x80; + + MSG_DEBUG("__MmsBinaryEncodeMmsVersion: major version (%d)\n", majorVer); + MSG_DEBUG("__MmsBinaryEncodeMmsVersion: minor version (%d)\n", minorVer); + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos] = (majorVer << 4) | (minorVer & 0x0f) | MSB; + + if (gpMmsEncodeBuf[gCurMmsEncodeBuffPos] < 0x80) { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] |= 0x80; + } else { + gCurMmsEncodeBuffPos++; + } + + return true; + +__CATCH: + return false; +} + + + +static bool __MmsBinaryEncodeDate(FILE *pFile) +{ + struct tm *dateTime = NULL; + time_t dateSec = 0; + + dateSec = time(NULL); + dateTime = localtime(&dateSec); + + MSG_DEBUG("%d - %d - %d, %d : %d (SYSTEM)", dateTime->tm_year + 1900, dateTime->tm_mon + 1, dateTime->tm_mday + , dateTime->tm_hour, dateTime->tm_min); + + if (dateSec > 0) { + int length = 0; + length = MmsBinaryEncodeLongIntegerLen(dateSec); + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { // + fieldCode + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("__MmsBinaryEncodeDate: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DATE) | 0x80; + + if (MmsBinaryEncodeLongInteger(pFile, dateSec, length) == false) { + MSG_DEBUG("__MmsBinaryEncodeDate: date MmsBinaryEncodeLongInteger error\n"); + goto __CATCH; + } + } else { + MSG_DEBUG("__MmsBinaryEncodeDate: date has a negative value (%d) \n", dateSec); + goto __CATCH; + } + return true; + +__CATCH: + return false; +} + + + +static bool __MmsBinaryEncodeFrom(FILE *pFile) +{ + if (pFile == NULL) { + MSG_DEBUG("__MmsBinaryEncodeFrom: invalid input file \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 3) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("__MmsBinaryEncodeFrom: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_FROM) | 0x80; + /* length of MMS_INSERT_ADDRESS_TOKEN value */ + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = 0x01; + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN) | 0x80; + return true; + +__CATCH: + return false; +} + + +static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char *szAddrStr) +{ + int length = 0; + + if (pFile == NULL) { + MSG_DEBUG("__MmsBinaryEncodeOneAddress: invalid input file \n"); + goto __CATCH; + } + + /* EncodedString */ + length = MmsBinaryEncodeEncodedStringLen((UINT8*)szAddrStr); + + if (length == -1) { + MSG_DEBUG("__MmsBinaryEncodeOneAddress: MmsBinaryEncodeEncodedStringLen fail \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < length + 1) { + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("__MmsBinaryEncodeOneAddress: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, addrType) | 0x80; + + + if (MmsBinaryEncodeEncodedString(pFile, (UINT8*)szAddrStr, length) == false) { + MSG_DEBUG("__MmsBinaryEncodeOneAddress: MmsBinaryEncodeEncodedString fail \n"); + goto __CATCH; + } + + return true; + +__CATCH: + return false; +} + + +static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *szAddr) +{ + char *pSingleAddr = NULL; + + + if (pFile == NULL) { + MSG_DEBUG("__MmsBinaryEncodeAddress: invalid input file \n"); + goto __CATCH; + } + + while (szAddr && szAddr[0]) { + szAddr = _MsgSkipWS3(szAddr); + if (szAddr == NULL) + break; + + pSingleAddr = strchr(szAddr, MSG_CH_SEMICOLON); + if (pSingleAddr) { + + *pSingleAddr = MSG_CH_NULL; + if (__MmsBinaryEncodeOneAddress(pFile, addrType, szAddr) == false) { + MSG_DEBUG("__MmsBinaryEncodeAddress: __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + *pSingleAddr = MSG_CH_SEMICOLON; + + szAddr = pSingleAddr + 1; + pSingleAddr = NULL; + } else { + if (__MmsBinaryEncodeOneAddress(pFile, addrType, szAddr) == false) { + MSG_DEBUG("__MmsBinaryEncodeAddress: __MmsBinaryEncodeAddress fail\n"); + goto __CATCH; + } + + szAddr = NULL; + } + } + + return true; + +__CATCH: + return false; +} + + + +static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeStruct time) +{ + int timeLen = 0; + int length = 0; + + if (pFile == NULL) { + MSG_DEBUG("__MmsBinaryEncodeTime: invalid input file \n"); + goto __CATCH; + } + + if (time.time == 0 || + (fieldCode != MMS_CODE_EXPIRYTIME && fieldCode != MMS_CODE_DELIVERYTIME && fieldCode != MMS_CODE_REPLYCHARGINGDEADLINE) || + (time.type != MMS_TIMETYPE_ABSOLUTE && time.type != MMS_TIMETYPE_RELATIVE)) { + MSG_DEBUG("__MmsBinaryEncodeTime: time.type = %d \n", time.type); + return true; + } + + /* + * use temporary buffer to estimate value length + * and copy it to pData buffer later. + */ + + if (time.type == MMS_TIMETYPE_RELATIVE) { + timeLen = MmsBinaryEncodeIntegerLen(time.time); + } else { + timeLen = MmsBinaryEncodeLongIntegerLen(time.time); + } + + if (timeLen <= 0) { + MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeLongIntegerLen fail \n"); + goto __CATCH; + } + + length = MmsBinaryEncodeValueLengthLen(timeLen + 1); //time length + time type token + if (length == -1) { + MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeValueLengthLen fail \n"); + goto __CATCH; + } + + if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + timeLen + 2)) { // + fieldCode + timeType + + if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, + gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { + MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: MsgWriteDataFromEncodeBuffer fail \n"); + goto __CATCH; + } + } + + /* fieldCode */ + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, fieldCode) | 0x80; + + /* value length */ + if (MmsBinaryEncodeValueLength(pFile, timeLen + 1, length) == false) { + MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeValueLength fail \n"); + goto __CATCH; + } + + /* time type & value */ + if (time.type == MMS_TIMETYPE_RELATIVE) { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_RELATIVE) | 0x80; + if (MmsBinaryEncodeInteger(pFile, time.time, timeLen) == false) { + MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeLongInteger fail \n"); + goto __CATCH; + } + } else { + gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE) | 0x80; + if (MmsBinaryEncodeLongInteger(pFile, time.time, timeLen) == false) { + MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeLongInteger fail \n"); + goto __CATCH; + } + } + + return true; + +__CATCH: + return false; +} + diff --git a/plugin/mms_plugin/MmsPluginEventHandler.cpp b/plugin/mms_plugin/MmsPluginEventHandler.cpp new file mode 100755 index 0000000..39bfc40 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginEventHandler.cpp @@ -0,0 +1,179 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgMmsTypes.h" +#include "MsgSoundPlayer.h" +#include "MsgStorageHandler.h" +#include "MmsPluginTransport.h" +#include "MmsPluginEventHandler.h" +#include "MmsPluginCodec.h" +#include "MmsPluginInternal.h" +#include "MmsPluginSmil.h" +#include "MsgMmsMessage.h" + + +/*================================================================================================== + IMPLEMENTATION OF SmsPluginEventHandler - Member Functions +==================================================================================================*/ +MmsPluginEventHandler *MmsPluginEventHandler::pInstance = NULL; + + +MmsPluginEventHandler::MmsPluginEventHandler() +{ + memset(&listener, 0x00, sizeof(MSG_PLUGIN_LISTENER_S)); +} + + +MmsPluginEventHandler::~MmsPluginEventHandler() +{ + +} + + +MmsPluginEventHandler *MmsPluginEventHandler::instance() +{ + if (!pInstance) + pInstance = new MmsPluginEventHandler(); + + return pInstance; +} + + +void MmsPluginEventHandler::registerListener(MSG_PLUGIN_LISTENER_S *pListener) +{ + listener = *pListener; +} + + +void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char *pRetrievedFilePath) +{ + MSG_MESSAGE_INFO_S msgInfo = {0,}; + + switch (pRequest->eMmsPduType) { + // received data is send-conf + case eMMS_SEND_CONF: + MmsPluginInternal::instance()->processSendConf(&msgInfo, pRequest); + + // callback to MSG FW + listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID); + + //MsgDeleteFile(pRetrievedFilePath + strlen(MSG_DATA_PATH)); // not ipc + remove(pRetrievedFilePath); // not ipc + break; + + // received data is retrieve-conf + case eMMS_RETRIEVE_AUTO_CONF: + case eMMS_RETRIEVE_MANUAL_CONF: + MmsPluginInternal::instance()->processRetrieveConf(&msgInfo, pRequest, pRetrievedFilePath); + + // callback to MSG FW + listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID); + break; + + case eMMS_FORWARD_CONF: + MmsPluginInternal::instance()->processForwardConf(&msgInfo, pRequest); + break; + + default: + break; + } +} + + +void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_MESSAGE_INFO_S msgInfo = {}; + MMS_RECV_DATA_S recvData = {{0}, }; + + MSG_DEBUG("pRequest->msgId [%d]", pRequest->msgId); + + switch (pRequest->eMmsPduType) { + case eMMS_SEND_REQ: + case eMMS_SEND_CONF: + msgInfo.msgId = pRequest->msgId; + //Set only changed members + msgInfo.msgType.mainType = MSG_MMS_TYPE; + + if (pRequest->eMmsPduType == eMMS_SEND_REQ) + msgInfo.msgType.subType = MSG_SENDREQ_MMS; + else + msgInfo.msgType.subType = MSG_SENDCONF_MMS; + + msgInfo.networkStatus = MSG_NETWORK_SEND_FAIL; + + 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 + 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 + 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_END(); +} + diff --git a/plugin/mms_plugin/MmsPluginHttp.cpp b/plugin/mms_plugin/MmsPluginHttp.cpp new file mode 100755 index 0000000..d76b7b4 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginHttp.cpp @@ -0,0 +1,645 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MmsPluginHttp.h" +#include "MmsPluginUserAgent.h" +#include "stdlib.h" +#include +#include "MmsPluginConnManWrapper.h" + + + +void httpGetHostFromUrl(char *pUrl, char *pHost) +{ + int hostLen = 0; + int tailLen = 0; + char *tail = NULL; + + if (strstr(pUrl, "HTTP://") == NULL) { + tail = strstr(pUrl, "/"); + if (NULL == tail) + tailLen = 0; + else + tailLen = strlen(tail); + + hostLen = strlen(pUrl) - tailLen; + memcpy(pHost, pUrl, hostLen); + pHost[hostLen] = '\0'; + } else { + tail = strstr(&pUrl[7], "/"); + if (NULL == tail) + tailLen = 0; + else + tailLen = strlen(tail); + + hostLen = strlen(pUrl) - tailLen - 7; + memcpy(pHost, &pUrl[7], hostLen); + pHost[hostLen] = '\0'; + } +} + +void HttpHeaderInfo(curl_slist **responseHeaders, char *szUrl, int ulContentLen) +{ + char szBuffer[1025] = {0, }; + char pcheader[HTTP_REQUEST_LEN] = {0, }; + + bool nResult = MsgMmsGetCustomHTTPHeader(MMS_HH_CONTENT_TYPE, szBuffer); + if (nResult) { + strcat(pcheader,"Content-Type: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } + + memset(szBuffer, 0, 1025); + memset(pcheader, 0, HTTP_REQUEST_LEN); + snprintf(szBuffer, 1024, "%d", ulContentLen); + if (nResult) { + strcat(pcheader, "Content-Length: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } + + memset(szBuffer, 0, 1025); + memset(pcheader, 0, HTTP_REQUEST_LEN); + nResult = MsgMmsGetCustomHTTPHeader(MMS_HH_HOST, szBuffer); + if (nResult) { + strcat(pcheader, "HOST: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } + + memset(szBuffer, 0, 1025); + memset(pcheader, 0, HTTP_REQUEST_LEN); + nResult = MsgMmsGetCustomHTTPHeader(MMS_HH_ACCEPT, szBuffer); + if (nResult) { + strcat(pcheader, "Accept: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } + + memset(szBuffer, 0, 1025); + memset(pcheader, 0, HTTP_REQUEST_LEN); + nResult = MsgMmsGetCustomHTTPHeader(MMS_HH_ACCEPT_CHARSET, szBuffer); + if (nResult) { + strcat(pcheader, "Accept-Charset: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } + + memset(szBuffer, 0, 1025); + memset(pcheader, 0, HTTP_REQUEST_LEN); + nResult = MsgMmsGetCustomHTTPHeader(MMS_HH_ACCEPT_LANGUAGE, szBuffer); + if (nResult) { + strcat(pcheader, "Accept-Language: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } + + memset(szBuffer, 0, 1025); + memset(pcheader, 0, HTTP_REQUEST_LEN); + nResult = MsgMmsGetCustomHTTPHeader(MMS_HH_ACCEPT_ENCODING, szBuffer); + if (nResult) { + strcat(pcheader, "Accept-Encoding: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } + + memset(szBuffer, 0, 1025); + memset(pcheader, 0, HTTP_REQUEST_LEN); + nResult = MsgMmsGetCustomHTTPHeader(MMS_HH_USER_AGENT, szBuffer); + if (nResult) { + strcat(pcheader, "User-Agent: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } + + memset(szBuffer, 0, 1025); + memset(pcheader, 0, HTTP_REQUEST_LEN); + nResult = MsgMmsGetCustomHTTPHeader(MMS_HH_WAP_PROFILE, szBuffer); + if (nResult) { + strcat(pcheader, "X-wap-profile: "); + strcat(pcheader, szBuffer); + MSG_DEBUG("%s", pcheader); + *responseHeaders = curl_slist_append(*responseHeaders, pcheader); + } +} + +bool MsgMmsGetCustomHTTPHeader(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *szHeaderBuffer) +{ + bool result; + + result = false; + if (szHeaderBuffer != NULL) { + switch (httpHeaderItem) { + case MMS_HH_CONTENT_TYPE: + snprintf((char *)szHeaderBuffer, 1024, "%s", MSG_MMS_HH_CONTENT_TYPE); + result = true; + break; + + case MMS_HH_HOST: + MsgMmsGetHost(szHeaderBuffer, 1024); + if (strlen(szHeaderBuffer) > 0) + result = true; + else + result = false; + break; + + case MMS_HH_ACCEPT: + snprintf((char *)szHeaderBuffer, 1024, "%s", MSG_MMS_HH_ACCEPT); + result = true; + break; + + case MMS_HH_ACCEPT_CHARSET: + snprintf((char *)szHeaderBuffer, 1024, "%s", MSG_MMS_HH_CHARSET); + result = true; + break; + + case MMS_HH_ACCEPT_LANGUAGE: + snprintf((char *)szHeaderBuffer, 1024, "%s", MSG_MMS_HH_LANGUAGE); + result = true; + break; + + case MMS_HH_ACCEPT_ENCODING: + snprintf((char *)szHeaderBuffer, 1024, "%s", MSG_MMS_HH_ENCODING); + result = true; + break; + + case MMS_HH_USER_AGENT: + { + char szUserAgent[1024 + 1] = {0,}; + + memset(szUserAgent, 0x00, (sizeof(char) * (1024 + 1) )); + snprintf(szUserAgent, 1024, "%s", MSG_MMS_HH_USER_AGENT); + + snprintf((char *)szHeaderBuffer, 1024, "%s", szUserAgent); + result = true; + } + break; + + case MMS_HH_WAP_PROFILE: + { + char szUAProfile[1024 + 1] = {0,}; + + memset(szUAProfile, 0x00, (sizeof(char)*(1024+1) )); + snprintf(szUAProfile, 1024, "%s", MSG_MMS_WAP_PROFILE); + + snprintf((char *)szHeaderBuffer, 1024, "%s", szUAProfile); + result = true; + } + break; + + default: + MSG_DEBUG("invalid param"); + break; + } + } + + return result; +} + +void MsgMmsGetHost(char *szHost, int nBufferLen) +{ + MmsPluginHttpAgent *pHttpAgent = MmsPluginHttpAgent::instance(); + MMS_PLUGIN_HTTP_DATA_S *httpConfigData = pHttpAgent->getHttpConfigData(); + + const char *prefixString = "http://"; + const char *delim = ":/\\=@"; + + int prefixLength = strlen(prefixString); + + char *startPtr = &httpConfigData->mmscConfig.mmscUrl[0]; + char *movePtr = NULL; + + MSG_DEBUG("startPtr(%s)", startPtr); + + if (strncasecmp(startPtr, prefixString, prefixLength) == 0) { + MSG_DEBUG("(%s) exist", prefixString); + startPtr += prefixLength; + movePtr = startPtr; + movePtr = strpbrk(movePtr, delim); + MSG_DEBUG("strpbrk --> movePtr(%s)", movePtr); + if (movePtr == NULL) { + strncpy(szHost, startPtr, nBufferLen); + MSG_DEBUG("szHost(%s)", szHost); + } else { + int nCopyLen = movePtr - startPtr; + strncpy(szHost, startPtr, nCopyLen); + MSG_DEBUG("szHost(%s)", szHost); + } + } else { + MSG_DEBUG("(%s) not exist", prefixString); + movePtr = startPtr; + movePtr = strpbrk(movePtr, delim); + MSG_DEBUG("strpbrk --> movePtr(%s)", movePtr); + if (movePtr == NULL) { + strncpy(szHost, startPtr, nBufferLen); + MSG_DEBUG("szHost(%s)", szHost); + } else { + int nCopyLen = movePtr - startPtr; + strncpy(szHost, startPtr, nCopyLen); + MSG_DEBUG("szHost(%s)", szHost); + } + } +} + + +MMS_NET_ERROR_T MmsHttpReadData(void *ptr, size_t size, size_t nmemb, void *userdata) +{ + MMS_NET_ERROR_T httpRet = eMMS_UNKNOWN; + + MmsPluginHttpAgent *pHttpAgent = MmsPluginHttpAgent::instance(); + MMS_PLUGIN_HTTP_CONTEXT_S *pMmsPlgCd = pHttpAgent->getMmsPldCd(); + long length_received = size * nmemb; + + if (length_received) { + //Save the received buffer in a safe place. + if (pMmsPlgCd->final_content_buf == NULL) { + MSG_DEBUG("Body Lenghth Read = %d", length_received); + pMmsPlgCd->final_content_buf = (unsigned char *)malloc((length_received + 1) * sizeof(unsigned char)); + memset(pMmsPlgCd->final_content_buf,0x0,((length_received + 1) * sizeof(unsigned char))); + MSG_DEBUG(" Global g_final_content_buf=%0x", pMmsPlgCd->final_content_buf); + } else { + //realloc pHttpEvent->bodyLen extra and memset + pMmsPlgCd->final_content_buf = (unsigned char *)realloc(pMmsPlgCd->final_content_buf, + (pMmsPlgCd->bufOffset + length_received + 1) * sizeof(unsigned char)); + MSG_DEBUG("Body Lenghth Read = %d Content Length = %d", length_received, pMmsPlgCd->bufOffset); + memset((pMmsPlgCd->final_content_buf +pMmsPlgCd->bufOffset), 0x0, + ((length_received + 1) * sizeof(unsigned char))); + MSG_DEBUG(" Global g_final_content_buf=%0x", pMmsPlgCd->final_content_buf); + } + + //copy body + if (pMmsPlgCd->final_content_buf != NULL) { + memcpy( pMmsPlgCd->final_content_buf + pMmsPlgCd->bufOffset, ptr, length_received); + MSG_DEBUG("Current g_bufOffset =%d", pMmsPlgCd->bufOffset); + /* Content Received */ + MSG_DEBUG("Total Content received PTR =%0X, Content Size =%d", pMmsPlgCd->final_content_buf, + pMmsPlgCd->bufOffset); + pMmsPlgCd->bufOffset = pMmsPlgCd->bufOffset + length_received; + httpRet = eMMS_UNKNOWN; + } + } else { + MSG_DEBUG("End of Data transfer"); + MSG_DEBUG("MmsHttpReadData Buffer Size = %d", pMmsPlgCd->bufOffset); + MSG_DEBUG("MmsHttpReadData Buffer = %s", pMmsPlgCd->final_content_buf); + + if (pMmsPlgCd->bufOffset == 0) { + /* This is applicable when - M-ReadRec.inf,M-Ack.ind, M-NotifyResp.ind posted */ + MSG_DEBUG(" Content Size is Zero"); + + if (pMmsPlgCd->final_content_buf != NULL) { + free(pMmsPlgCd->final_content_buf ); + pMmsPlgCd->final_content_buf = NULL; + } + + httpRet = eMMS_HTTP_EVENT_SENT_ACK_COMPLETED; + } else if (pMmsPlgCd->final_content_buf != NULL && pMmsPlgCd->bufOffset != 0) { + // Process Http Data + MSG_DEBUG(" Send Received Data to UA"); + httpRet = eMMS_HTTP_RECV_DATA; // eMMS_HTTP_RECV_DATA; + } else { + httpRet = eMMS_UNKNOWN; // check later + } + + return httpRet; + } + + return httpRet; +} + + +size_t MmsHttpPostTransactionCB(void *ptr, size_t size, size_t nmemb, void *userdata) +{ + MSG_DEBUG(" ====== HTTP_EVENT_SENT ========"); + long length_received = size * nmemb; + MmsHttpReadData(ptr, size, nmemb, userdata); + + return length_received; +} + +size_t MmsHttpGetTransactionCB(void *ptr, size_t size, size_t nmemb, void *userdata) +{ + MSG_DEBUG(" ====== HTTP_EVENT_RECEIVED ========"); + long length_received = size * nmemb; + MmsHttpReadData(ptr, size, nmemb, userdata); + + return length_received; +} + +int httpCmdInitSession(MMS_PLUGIN_HTTP_DATA_S *httpConfig) +{ + MSG_DEBUG("HttpCmd Init Session"); + + char proxyAddr[MAX_IPV4_LENGTH + 1] = {0}; + + snprintf(proxyAddr, MAX_IPV4_LENGTH + 1, "%s:%d", httpConfig->mmscConfig.httpProxyIpAddr, httpConfig->mmscConfig.proxyPortNo); + MSG_DEBUG("profileId [%d], proxyAddr [%s]", httpConfig->currentProfileId, proxyAddr); + + CURL *curl_session = curl_easy_init(); + if (NULL == curl_session) { + MSG_DEBUG("curl_easy_init() failed"); + return eMMS_HTTP_SESSION_OPEN_FAILED; + } + + int curl_status = curl_easy_setopt(curl_session, CURLOPT_PROXY, proxyAddr); + if (curl_status != CURLM_OK) { + MSG_DEBUG("curl_easy_setopt(): CURLOPT_PROXY failed"); + curl_easy_cleanup(curl_session); + return eMMS_HTTP_SESSION_OPEN_FAILED; + } + + httpConfig->session = curl_session; + + return eMMS_HTTP_SESSION_INIT; +} + + +int httpCmdPostTransaction(MMS_PLUGIN_HTTP_DATA_S *httpConfig) +{ + int trId; + + MSG_DEBUG("HttpCmd Post Transaction"); + MSG_DEBUG(" === HTTP Agent Thread : Signal ==> eMMS_HTTP_SIGNAL_POST_TRANSACTION"); + + char deviceName[1024] = {0,}; + + MmsPluginCmAgent::instance()->getDeviceName(deviceName); + + MSG_DEBUG("deviceName: [%s]", deviceName); + int curl_status = curl_easy_setopt(httpConfig->session, CURLOPT_INTERFACE, deviceName); + + if (curl_status != CURLM_OK) { + MSG_DEBUG("curl_easy_setopt(): CURLOPT_INTERFACE failed"); + + return eMMS_EXCEPTIONAL_ERROR; + } + + MSG_PROFILE_BEGIN(libcurl); + + CURLcode rc = curl_easy_perform(httpConfig->session); + + MSG_PROFILE_END(libcurl); + + MmsPluginHttpAgent* httpAgent = MmsPluginHttpAgent::instance(); + MMS_PLUGIN_HTTP_DATA_S *httpConfigData = httpAgent->getHttpConfigData(); + if (httpConfigData->sessionHeader) { + curl_slist_free_all((curl_slist *)httpConfigData->sessionHeader); + httpConfigData->sessionHeader = NULL; + } + + if (CURLE_OK != rc) { + MSG_DEBUG("curl_easy_perform return error rc[%d]", rc); + + return eMMS_HTTP_ERROR_NETWORK; + } + + MSG_DEBUG("## End Transaction ##"); + MSG_DEBUG("############ trID = %d ###########", trId); + + srandom((unsigned int) time(NULL)); + trId = random() % 1000000000 + 1; + + httpConfig->transactionId = trId; + + return eMMS_HTTP_SENT_SUCCESS; +} + +int httpCmdGetTransaction(MMS_PLUGIN_HTTP_DATA_S *httpConfig) +{ + int trId; + + MSG_DEBUG("HttpCmd Get Transaction"); + MSG_DEBUG(" === HTTP Agent Thread : Signal ==> eMMS_HTTP_SIGNAL_GET_TRANSACTION"); + + char deviceName[1024] = {0,}; + MmsPluginCmAgent::instance()->getDeviceName(deviceName); + MSG_DEBUG("deviceName: [%s]", deviceName); + + int curl_status = curl_easy_setopt(httpConfig->session, CURLOPT_INTERFACE, deviceName); + if (curl_status != CURLM_OK) { + MSG_DEBUG("curl_easy_setopt(): CURLOPT_INTERFACE failed"); + + return eMMS_EXCEPTIONAL_ERROR; + } + + CURLcode rc = curl_easy_perform(httpConfig->session); + + MmsPluginHttpAgent* httpAgent = MmsPluginHttpAgent::instance(); + MMS_PLUGIN_HTTP_DATA_S *httpConfigData = httpAgent->getHttpConfigData(); + if (httpConfigData->sessionHeader) { + curl_slist_free_all((curl_slist *)httpConfigData->sessionHeader); + httpConfigData->sessionHeader = NULL; + } + + if (CURLE_OK != rc) { + MSG_DEBUG("curl_easy_perform return error = %d", rc); + + return eMMS_HTTP_ERROR_NETWORK; + } + + MSG_DEBUG("## End Transaction ##"); + MSG_DEBUG("############ trID = %d ###########", trId); + srandom((unsigned int) time(NULL)); + trId = random() % 1000000000 + 1; + httpConfig->transactionId = trId; + + return eMMS_HTTP_SENT_SUCCESS; +} + +MmsPluginHttpAgent *MmsPluginHttpAgent::pInstance = NULL; +MmsPluginHttpAgent *MmsPluginHttpAgent::instance() +{ + if (!pInstance) + pInstance = new MmsPluginHttpAgent(); + + return pInstance; +} + + +MmsPluginHttpAgent::MmsPluginHttpAgent() +{ + MSG_DEBUG("MmsPluginHttpAgent()"); + + bzero(&httpConfigData, sizeof(httpConfigData)); + bzero(&mmsPlgCd, sizeof(mmsPlgCd)); + + httpCmdHandler.clear(); + + waiting = false; + + httpCmdHandler[eHTTP_CMD_INIT_SESSION] = &httpCmdInitSession; + httpCmdHandler[eHTTP_CMD_POST_TRANSACTION] = &httpCmdPostTransaction; + httpCmdHandler[eHTTP_CMD_GET_TRANSACTION] = &httpCmdGetTransaction; +} + +MmsPluginHttpAgent::~MmsPluginHttpAgent() +{ + +} + +void MmsPluginHttpAgent::SetMMSProfile() +{ + MSG_BEGIN(); + + MMSC_CONFIG_DATA_S *mmscConfig = &(httpConfigData.mmscConfig); + + MmsPluginCmAgent::instance()->getHomeURL(mmscConfig->mmscUrl); + if (strlen(mmscConfig->mmscUrl) < 1) { + strcpy(mmscConfig->mmscUrl, DEFAULT_MMSC_URL); + } + + MmsPluginCmAgent::instance()->getProxyAddr(mmscConfig->httpProxyIpAddr); + mmscConfig->proxyPortNo = MmsPluginCmAgent::instance()->getProxyPort(); + + MSG_END(); +} + +int MmsPluginHttpAgent::cmdRequest(MMS_HTTP_CMD_TYPE_T cmdType) +{ + MSG_DEBUG("cmdRequest:%x", cmdType); + + int ret = 0; + + ret = httpCmdHandler[cmdType](&httpConfigData); + + return ret; +} + +MMS_PLUGIN_HTTP_CONTEXT_S* MmsPluginHttpAgent::getMmsPldCd() +{ + return &mmsPlgCd; +} + +MMS_PLUGIN_HTTP_DATA_S *MmsPluginHttpAgent::getHttpConfigData() +{ + return &httpConfigData; +} + +void MmsPluginHttpAgent::setHttpWaitingFlag(bool val) +{ + waiting = val; +} + +bool MmsPluginHttpAgent::getHttpWaitingFlag() +{ + return waiting; +} + + +int MmsPluginHttpAgent::setSession(mmsTranQEntity *qEntity) +{ + MSG_DEBUG("%s %d", qEntity->pPostData, qEntity->postDataLen); + + if (qEntity->eHttpCmdType == eHTTP_CMD_POST_TRANSACTION) { + MSG_DEBUG("HttpCmd Post Transaction"); + MSG_DEBUG(" === HTTP Agent Thread : Signal ==> eMMS_HTTP_SIGNAL_POST_TRANSACTION"); + + curl_slist *responseHeaders = NULL; + + HttpHeaderInfo(&responseHeaders, NULL, qEntity->postDataLen); + responseHeaders = curl_slist_append(responseHeaders, "Pragma: "); + responseHeaders = curl_slist_append(responseHeaders, "Proxy-Connection: "); + responseHeaders = curl_slist_append(responseHeaders, "Expect: "); + MSG_DEBUG(" === MMSCURI = %s === ", httpConfigData.mmscConfig.mmscUrl); + + httpConfigData.sessionHeader = (void *)responseHeaders; + + MSG_DEBUG("## Start Transaction : Post ##"); + curl_easy_setopt(httpConfigData.session, CURLOPT_VERBOSE, true); + curl_easy_setopt(httpConfigData.session, CURLOPT_POST, true); + curl_easy_setopt(httpConfigData.session, CURLOPT_URL, httpConfigData.mmscConfig.mmscUrl); + curl_easy_setopt(httpConfigData.session, CURLOPT_NOPROGRESS, true); + curl_easy_setopt(httpConfigData.session, CURLOPT_HTTPHEADER, responseHeaders); + curl_easy_setopt(httpConfigData.session, CURLOPT_POSTFIELDS, qEntity->pPostData); + curl_easy_setopt(httpConfigData.session, CURLOPT_POSTFIELDSIZE, qEntity->postDataLen); + curl_easy_setopt(httpConfigData.session, CURLOPT_WRITEFUNCTION, MmsHttpPostTransactionCB); + + curl_easy_setopt(httpConfigData.session, CURLOPT_TCP_NODELAY, 1); + } else if (qEntity->eHttpCmdType == eHTTP_CMD_GET_TRANSACTION) { + MSG_DEBUG("MmsHttpInitTransactionGet %d pGetData (%s)", qEntity->getDataLen, qEntity->pGetData); + MSG_DEBUG("MmsHttpInitTransactionGet mmscURL (%s) ", httpConfigData.mmscConfig.mmscUrl); + + char szUrl[MAX_MMSC_URL_LEN] = {0, }; + + memcpy(szUrl, qEntity->pGetData, qEntity->getDataLen); + + MSG_DEBUG("MmsHttpInitTransactionGet szURL (%s)", szUrl); + + curl_slist *responseHeaders = NULL; + + HttpHeaderInfo(&responseHeaders, szUrl, 0); + responseHeaders = curl_slist_append(responseHeaders, "Pragma: "); + responseHeaders = curl_slist_append(responseHeaders, "Proxy-Connection: "); + + httpConfigData.sessionHeader = (void *)responseHeaders; + + MSG_DEBUG("## Start Transaction : Get ##"); + curl_easy_setopt(httpConfigData.session, CURLOPT_VERBOSE, true); + curl_easy_setopt(httpConfigData.session, CURLOPT_URL, szUrl); + curl_easy_setopt(httpConfigData.session, CURLOPT_NOPROGRESS, true); + curl_easy_setopt(httpConfigData.session, CURLOPT_HTTPHEADER, responseHeaders); + curl_easy_setopt(httpConfigData.session, CURLOPT_WRITEFUNCTION, MmsHttpGetTransactionCB); + } else { + MSG_DEBUG("Unknown eHttpCmdType [%d]", qEntity->eHttpCmdType); + return -1; + } + + return 0; +} + + +void MmsPluginHttpAgent::clearSession() +{ + MSG_BEGIN(); + + if (httpConfigData.sessionHeader) { + curl_slist_free_all((curl_slist *)httpConfigData.sessionHeader); + httpConfigData.sessionHeader = NULL; + } + + if (httpConfigData.session == NULL) { + MSG_DEBUG("[Error]httpConfigData.session is NULL"); + return; + } + + curl_easy_cleanup(httpConfigData.session); + + httpConfigData.session = NULL; + + MSG_END(); +} diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp new file mode 100755 index 0000000..4dd981e --- /dev/null +++ b/plugin/mms_plugin/MmsPluginInternal.cpp @@ -0,0 +1,912 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgException.h" +#include "MsgMmsMessage.h" +#include "MsgTransportTypes.h" +#include "MsgGconfWrapper.h" +#include "MsgSoundPlayer.h" +#include "MsgStorageHandler.h" +#include "MmsPluginTypes.h" +#include "MmsPluginCodec.h" +#include "MmsPluginSetup.h" +#include "MmsPluginInternal.h" +#include "MmsPluginStorage.h" +#include "MmsPluginHttp.h" +#include "MmsPluginCodec.h" + +#include "MsgNotificationWrapper.h" +#include "MmsPluginSmil.h" + +MmsSetup gMmsSetup; + +/*================================================================================================== + IMPLEMENTATION OF MmsPluginInternal - Member Functions +==================================================================================================*/ +MmsPluginInternal *MmsPluginInternal::pInstance = NULL; + + +MmsPluginInternal::MmsPluginInternal() +{ + +} + +MmsPluginInternal::~MmsPluginInternal() +{ + +} + +MmsPluginInternal *MmsPluginInternal::instance() +{ + if (!pInstance) + pInstance = new MmsPluginInternal(); + + return pInstance; +} + +void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject) +{ + MSG_DEBUG("processReceivedInd \r\n"); + + FILE *pFile = NULL; + char fileName[MSG_FILENAME_LEN_MAX] = {0,}; + + if (pMsgInfo->bTextSms == true) { + char fullPath[MAX_FULL_PATH_SIZE+1] = {0,}; + + if(MsgCreateFileName(fileName) == false) + THROW(MsgException::FILE_ERROR, "MsgCreateFileName error"); + + MSG_DEBUG(" File name = %s", fileName); + + if(MsgWriteIpcFile(fileName, pMsgInfo->msgText, pMsgInfo->dataSize) == false) + THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error"); + + snprintf(fullPath, MAX_FULL_PATH_SIZE+1, MSG_IPC_DATA_PATH"%s", fileName); + + memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData)); + memcpy(pMsgInfo->msgData, fullPath, strlen(fullPath)); + pMsgInfo->bTextSms = false; + } + + MSG_DEBUG("MMS File Path = %s", pMsgInfo->msgData); + + _MmsInitHeader(); + _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX); + + if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) { + MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData); + } else { + //Decode Header + if (!MmsBinaryDecodeMsgHeader(pFile, pMsgInfo->dataSize)) + MSG_DEBUG("Decoding Header Failed \r\n"); + + MsgDeleteFile(pMsgInfo->msgData + strlen(MSG_IPC_DATA_PATH)); + + switch (mmsHeader.type) { + case MMS_MSGTYPE_NOTIFICATION_IND: + MSG_DEBUG("MmsProcessNewMsgInd: process noti.ind\n"); + // For Set Value pMsgInfo + if (processNotiInd(pMsgInfo, pRequest) == false) + *bReject = true; + else + *bReject = false; + break; + + case MMS_MSGTYPE_DELIVERY_IND: + MSG_DEBUG("MmsProcessNewMsgInd: process delivery.ind\n"); + // For Set Value pMsgInfo + processDeliveryInd(pMsgInfo); + break; + + case MMS_MSGTYPE_READORG_IND: + MSG_DEBUG("MmsProcessNewMsgInd: process readorig.ind\n"); + processReadOrgInd(pMsgInfo); + break; + default: + break; + } + + MsgCloseFile(pFile); + } + //Check Msg Type & Process(Save ...) +} + +bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest) +{ + MSG_DEBUG("MmsProcessNotiInd"); + MSG_ERROR_T err = MSG_SUCCESS; + + MSG_MMS_HOME_RETRIEVE_TYPE_T retrieveType; + bool bReportAllowed; + + MmsAttrib attrib; + + MmsInitMsgAttrib(&attrib); + + pMsgInfo->msgType.mainType = MSG_MMS_TYPE; + pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; + pMsgInfo->priority = mmsHeader.priority; + strncpy(pMsgInfo->subject, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN); + + MSG_DEBUG("pMsgInfo->subject [%s]", pMsgInfo->subject); + + if (strlen(pMsgInfo->subject) < 1) + snprintf(pMsgInfo->subject, MAX_SUBJECT_LEN, "MMS Notification Message."); + + attrib.expiryTime = mmsHeader.expiryTime; + + MmsPluginStorage *pStorage = MmsPluginStorage::instance(); + err = pStorage->updateMmsAttrib(pMsgInfo->msgId, &attrib, pMsgInfo->msgType.subType); + + if (mmsHeader.pFrom) { + MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr); + // From + strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pFrom->szAddr, MAX_ADDRESS_VAL_LEN); + } + + int roamState = 0; + + roamState = MsgSettingGetInt(VCONFKEY_TELEPHONY_SVC_ROAM); + MsgSettingGetBool(MMS_SEND_REPORT_ALLOWED, &bReportAllowed); + + if (checkRejectNotiInd(roamState, bReportAllowed, pMsgInfo->msgData)) { + MSG_DEBUG("MMS Message Rejected......"); + + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + pMsgInfo->bTextSms = true; + memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS; + + return false; + } + + if (roamState == VCONFKEY_TELEPHONY_SVC_ROAM_OFF) { + retrieveType = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_HOME_NETWORK); + MSG_DEBUG("$$$$$$$$$$ MMS_RECV_HOME_NETWORK = %d $$$$$$$$$$$$$", retrieveType); + } else { + retrieveType = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK); + MSG_DEBUG("$$$$$$$$$$ MMS_RECV_ABROAD_NETWORK = %d $$$$$$$$$$$$$", retrieveType); + + if (retrieveType == MSG_ABROAD_RESTRICTED) { + MSG_DEBUG("MMS Receiving Setting Restricted was selected."); + // m-notify-resp-ind encoding process + memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); + + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pMsgInfo->msgData); + + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + pMsgInfo->bTextSms = true; + memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS; + + return true; + } + } + + // should send http 'GET' + if (retrieveType == MSG_HOME_AUTO_DOWNLOAD || retrieveType == MSG_ABROAD_AUTO_DOWNLOAD) { + MSG_DEBUG("=========== START AUTO RETRIEVE MODE ============"); + memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); + + memcpy(pMsgInfo->msgData, mmsHeader.szContentLocation, strlen(mmsHeader.szContentLocation)) ; + + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + + pMsgInfo->bTextSms = true; + + memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + pRequest->msgInfo.msgType.subType = MSG_GET_MMS; + + MSG_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 + memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); + + if (retrieveType == MSG_HOME_MANUAL || retrieveType == MSG_ABROAD_MANUAL) { + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pMsgInfo->msgData); + } + + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + pMsgInfo->bTextSms = true; + memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS; + } + + return true; +} + + +void MmsPluginInternal::processDeliveryInd(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + MSG_BEGIN(); + + MmsMsg *pMsg = NULL; + bool bFound = false; + MmsMsgMultiStatus *pStatus = NULL; + MmsMsgMultiStatus *pLastStatus = NULL; + + pMsg = (MmsMsg *)malloc(sizeof(MmsMsg)); + + if (pMsg == NULL) { + MSG_DEBUG("fail to allocation memory."); + return; + } + + MmsInitMsgAttrib(&pMsg->mmsAttrib); + + pMsgInfo->msgType.mainType = MSG_MMS_TYPE; + pMsgInfo->msgType.subType = MSG_DELIVERYIND_MMS; + pMsgInfo->bTextSms = true; + + MSG_DEBUG("#### mmsHeader.szMsgID = %s : when received delivery ind####", mmsHeader.szMsgID); + + int tmpId = (MSG_MESSAGE_ID_T)MmsSearchMsgId(mmsHeader.pTo->szAddr, mmsHeader.szMsgID); + + + MSG_DEBUG("tmpId [%d]", tmpId); + MSG_DEBUG("mmsHeader.pTo->szAddr [%s]", mmsHeader.pTo->szAddr); + + if (tmpId > 0) { + pMsgInfo->msgId = (MSG_MESSAGE_ID_T)tmpId; + + pMsg->mmsAttrib.pMultiStatus = MmsGetMultiStatus(pMsgInfo->msgId); + + pStatus = pMsg->mmsAttrib.pMultiStatus; + + MSG_DEBUG("### pStatus->szTo = %s ###", pStatus->szTo); + + while (pStatus && !bFound) { + MSG_DEBUG("### MmsAddrUtilCompareAddr ###"); + MSG_DEBUG("### mmsHeader.pTo->szAddr = %s ###", mmsHeader.pTo->szAddr); + if (MmsAddrUtilCompareAddr( pStatus->szTo, mmsHeader.pTo->szAddr)) { + bFound = true; + break; + } + + pStatus = pStatus->pNext; + } + + if (bFound == false) { + MSG_DEBUG("### bFound == false ###"); + /* Queue the delivery report --------------------------- */ + + pStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus)); + memset(pStatus, 0, sizeof(MmsMsgMultiStatus)); + + pStatus->readStatus = MMS_READSTATUS_NONE; + memset(pStatus->szTo, 0, MSG_ADDR_LEN + 1); + strncpy(pStatus->szTo, mmsHeader.pTo->szAddr, MSG_ADDR_LEN); + + if (pMsg->mmsAttrib.pMultiStatus == NULL) { + /* first delivery report */ + pMsg->mmsAttrib.pMultiStatus = pStatus; + } else { + pLastStatus = pMsg->mmsAttrib.pMultiStatus; + + while (pLastStatus->pNext) { + pLastStatus = pLastStatus->pNext; + } + + pLastStatus->pNext = pStatus; + pLastStatus = pStatus; + } + } + + pStatus->handledTime = mmsHeader.date; + pStatus->msgStatus = mmsHeader.msgStatus; + + memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1); + pMsgInfo->dataSize = 0; + strncpy(pMsgInfo->msgData, getMmsDeliveryStatus(pStatus->msgStatus), MAX_MSG_DATA_LEN); + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + pMsgInfo->bTextSms = true; + MSG_DEBUG("Delivery Status = %s", pMsgInfo->msgData); + + strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN); + + pStatus->bDeliveryReportIsRead = false; + + _MmsDataUpdateLastStatus(pMsg); + + pStatus->bDeliveyrReportIsLast= true; + + MmsUpdateDeliveryReport(pMsgInfo->msgId, pStatus); + + MmsPluginStorage::instance()->addMmsNoti(pMsgInfo); + } else { + MSG_DEBUG("Can't not find Message!"); + memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1); + pMsgInfo->dataSize = 0; + strncpy(pMsgInfo->msgData, getMmsDeliveryStatus(mmsHeader.msgStatus), MAX_MSG_DATA_LEN); + + MSG_DEBUG("Delivery Status = %s", pMsgInfo->msgData); + + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + + MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr); + + strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN); + } + + MsgFreeAttrib(&pMsg->mmsAttrib); + + free(pMsg); + + MSG_END(); +} + +void MmsPluginInternal::processReadOrgInd(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + MSG_BEGIN(); + + MmsMsg *pMsg = NULL; + bool bFound = false; + MmsMsgMultiStatus *pStatus = NULL; + MmsMsgMultiStatus *pLastStatus = NULL; + + pMsg = (MmsMsg *)malloc(sizeof(MmsMsg)); + + if (pMsg == NULL) { + MSG_DEBUG("fail to allocation memory."); + return; + } + + MmsInitMsgAttrib(&pMsg->mmsAttrib); + + pMsgInfo->msgType.mainType = MSG_MMS_TYPE; + pMsgInfo->msgType.subType = MSG_READORGIND_MMS; + pMsgInfo->bTextSms = true; + + MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr); + MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr); + + if (mmsHeader.readStatus != MSG_READ_REPORT_IS_DELETED || (strcmp(mmsHeader.pFrom->szAddr, mmsHeader.pTo->szAddr))) { + MSG_DEBUG("#### mmsHeader.szMsgID = %s : when received read orig ind####", mmsHeader.szMsgID); + + int tmpId = MmsSearchMsgId(mmsHeader.pFrom->szAddr, mmsHeader.szMsgID); + + if (tmpId > 0) { + pMsgInfo->msgId = (MSG_MESSAGE_ID_T)tmpId; + + pMsg->mmsAttrib.pMultiStatus = MmsGetMultiStatus(pMsgInfo->msgId); + + pStatus = pMsg->mmsAttrib.pMultiStatus; + + MSG_DEBUG("### pStatus->szTo = %s ###", pStatus->szTo); + + while (pStatus && !bFound) { + MSG_DEBUG("### MmsAddrUtilCompareAddr ###"); + MSG_DEBUG("### mmsHeader.pFrom->szAddr = %s ###", mmsHeader.pFrom->szAddr); + if (MmsAddrUtilCompareAddr(pStatus->szTo, mmsHeader.pFrom->szAddr)) { + bFound = true; + break; + } + + pStatus = pStatus->pNext; + } + + if (bFound == false) { + MSG_DEBUG("### bFound == false ###"); + /* Queue the delivery report --------------------------- */ + + pStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus)); + memset(pStatus, 0, sizeof(MmsMsgMultiStatus)); + + pStatus->msgStatus = MMS_MSGSTATUS_NONE; + + memset(pStatus->szTo, 0, MSG_ADDR_LEN + 1); + strncpy(pStatus->szTo, mmsHeader.pFrom->szAddr, MSG_ADDR_LEN); + + if (pMsg->mmsAttrib.pMultiStatus == NULL) { + /* first readOrg report */ + pMsg->mmsAttrib.pMultiStatus = pStatus; + } else { + pLastStatus = pMsg->mmsAttrib.pMultiStatus; + + while (pLastStatus->pNext) { + pLastStatus = pLastStatus->pNext; + } + + pLastStatus->pNext = pStatus; + pLastStatus = pStatus; + } + } + + pStatus->readTime = mmsHeader.date; + pStatus->readStatus = mmsHeader.readStatus; + + memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1); + pMsgInfo->dataSize = 0; + strncpy(pMsgInfo->msgData, getMmsReadStatus(pStatus->readStatus), MAX_MSG_DATA_LEN); + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + pMsgInfo->bTextSms = true; + MSG_DEBUG("read Status = %s", pMsgInfo->msgData); + + strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN); + + pStatus->bReadReplyIsRead = false; + + _MmsDataUpdateLastStatus(pMsg); + + pStatus->bReadReplyIsLast= true; + + MmsUpdateReadReport(pMsgInfo->msgId, pStatus); + + MmsPluginStorage::instance()->addMmsNoti(pMsgInfo); + } else { + MSG_DEBUG("Can't not find Message!"); + memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1); + pMsgInfo->dataSize = 0; + strncpy(pMsgInfo->msgData, getMmsReadStatus(mmsHeader.readStatus), MAX_MSG_DATA_LEN); + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + MSG_DEBUG("read Status = %s", pMsgInfo->msgData); + + MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr); + + strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN); + } + } + + MsgFreeAttrib(&pMsg->mmsAttrib); + + free(pMsg); + + MSG_END(); +} + +void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEntity *pRequest) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + MMS_RECV_DATA_S recvData = {{0}, }; + + pMsgInfo->msgId = pRequest->msgId; + + //Set only changed members + pMsgInfo->msgType.mainType = MSG_MMS_TYPE; + pMsgInfo->msgType.subType = MSG_SENDCONF_MMS; + + pMsgInfo->folderId = MSG_OUTBOX_ID; + + strncpy(pMsgInfo->subject, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN); + + if (mmsHeader.responseStatus == MMS_RESPSTATUS_OK) { + pMsgInfo->networkStatus = MSG_NETWORK_SEND_SUCCESS; + } else { + pMsgInfo->networkStatus = MSG_NETWORK_SEND_FAIL; + + char responseText[MMS_LOCALE_RESP_TEXT_LEN]; + + memset(responseText, 0x00, MMS_LOCALE_RESP_TEXT_LEN); + snprintf(responseText, MMS_LOCALE_RESP_TEXT_LEN, " %s [%d]", mmsHeader.szResponseText, mmsHeader.responseStatus); + + memset(pMsgInfo->msgText, 0x00, MAX_MSG_TEXT_LEN + 1); + strncpy(pMsgInfo->msgText, responseText, MMS_LOCALE_RESP_TEXT_LEN); + } + + // set message-id from mmsc + strncpy(recvData.szMsgID, mmsHeader.szMsgID, MMS_MSG_ID_LEN); + strncpy(recvData.szTrID, mmsHeader.szTrID, MMS_TR_ID_LEN); + + memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1); + memcpy(pMsgInfo->msgData, &recvData, sizeof(MMS_RECV_DATA_S)); + + time_t curTime; + curTime = time(NULL); + + pMsgInfo->displayTime = curTime; + + MmsMsg *pMsg = NULL; + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + _MmsInitHeader(); +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pMsg->msgType.drmInfo); +#endif + _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type); + + + MSG_END(); +} + + +void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEntity *pRequest, char *pRetrievedFilePath) +{ + MSG_BEGIN(); + + int partCnt = 0; + int attachCount = 0; + MsgType partHeader; + bool bMultipartRelated = false; + + MSG_ERROR_T err = MSG_SUCCESS; + MMS_RECV_DATA_S recvData = {{0}, }; + + MmsAttrib attrib; + + MmsInitMsgAttrib(&attrib); + + attrib.priority = mmsHeader.priority; + attrib.bAskDeliveryReport = getMmsReport(mmsHeader.deliveryReport); + attrib.bAskReadReply = getMmsReport(mmsHeader.readReply); + + //Set only changed members + pMsgInfo->msgId = pRequest->msgId; + MSG_DEBUG("@@@@@ msgId = %d @@@@@", pMsgInfo->msgId); + pMsgInfo->msgType.mainType = MSG_MMS_TYPE; + + if (pRequest->eMmsPduType == eMMS_RETRIEVE_AUTO_CONF) + pMsgInfo->msgType.subType = MSG_RETRIEVE_AUTOCONF_MMS; + else + pMsgInfo->msgType.subType = MSG_RETRIEVE_MANUALCONF_MMS; + + strncpy(pMsgInfo->subject, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN); + + strncpy(pRequest->transactionId, mmsHeader.szTrID, MMS_TR_ID_LEN); + + time_t curTime; + curTime = time(NULL); + + pMsgInfo->displayTime = curTime; + + if (mmsHeader.retrieveStatus == MMS_RETRSTATUS_OK) { + pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_SUCCESS; + pMsgInfo->folderId = MSG_INBOX_ID; + } else { + pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_FAIL; + pMsgInfo->folderId = MSG_INBOX_ID; + // If failed MMS Retrieve, then saved as MMS Noti Ind Message. + pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; + } + + pMsgInfo->dataSize = pRequest->getDataLen; + + // set message-id & MMS TPDU file path + strcpy(recvData.szMsgID, mmsHeader.szMsgID); + if (pRetrievedFilePath) + strncpy(recvData.retrievedFilePath, pRetrievedFilePath, sizeof(recvData.retrievedFilePath)); + +#ifdef FEATURE_JAVA_MMS + if (mmsHeader.msgType.param.szApplicationID || mmsHeader.msgType.param.szReplyToApplicationID) { + recvData.msgAppId.valid = true; + if (mmsHeader.msgType.param.szApplicationID) + strncpy(recvData.msgAppId.appId, mmsHeader.msgType.param.szApplicationID, sizeof(recvData.msgAppId.appId)); + if (mmsHeader.msgType.param.szReplyToApplicationID) + strncpy(recvData.msgAppId.replyToAppId, mmsHeader.msgType.param.szReplyToApplicationID, sizeof(recvData.msgAppId.replyToAppId)); + + char fullPath[MAX_FULL_PATH_SIZE+1] = {0, }; + + char *filename = NULL; + filename = strrchr(pRetrievedFilePath, '/'); + + snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, filename + 1); + + rename(pRetrievedFilePath, fullPath); + + if (chmod(fullPath, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) != 0) { + MSG_DEBUG("File Write Error: %s", strerror(errno)); + } + + if (chown(fullPath, 0, 6502 ) != 0) { + MSG_DEBUG("File Write Error: %s", strerror(errno)); + } + } +#endif + memcpy(pMsgInfo->msgData, &recvData, sizeof(MMS_RECV_DATA_S)); + + MSG_DEBUG("@@@@@ MsgData = %s @@@@@", pMsgInfo->msgData); + MSG_DEBUG("@@@@@ retrievedFilePath = %s @@@@@", recvData.retrievedFilePath); + MSG_DEBUG("@@@@@ szMsgID = %s @@@@@", recvData.szMsgID); + //update delivery report, read reply + + MmsPluginStorage *pStorage = MmsPluginStorage::instance(); + + MMS_MESSAGE_DATA_S msgData; + memset(&msgData, 0, sizeof(MMS_MESSAGE_DATA_S)); + + // Conversation is supported only Multipart Related message, Presentation info should be provided + if (mmsHeader.msgType.type == MIME_MULTIPART_RELATED || mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { + char *pSmilDoc = NULL; + MmsMsg *pMsg = NULL; + char szFileName[MSG_FILENAME_LEN_MAX] = {0, }; + + msgData.regionCnt = 0; + msgData.pageCnt = 0; + msgData.attachCnt = 0; + msgData.transitionCnt = 0; + msgData.metaCnt = 0; + memset(msgData.szSmilFilePath, 0, MSG_FILEPATH_LEN_MAX); + + pSmilDoc = MmsSmilGetPresentationData(pMsgInfo->msgId); + MmsSmilParseSmilDoc(&msgData, pSmilDoc); + + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + strcpy(szFileName, pMsg->szFileName); + + err = pStorage->getMsgText(&msgData, pMsgInfo->msgText); + err = pStorage->makeThumbnail(&msgData, pMsgInfo->thumbPath, szFileName); + + bMultipartRelated = true; + } else { + MSG_DEBUG("Multipart mixed message doesn't support mms conversation"); + } + + err = pStorage->updateMmsAttrib(pMsgInfo->msgId, &attrib, pMsgInfo->msgType.subType); + + partCnt = MmsGetMediaPartCount(pMsgInfo->msgId); + MSG_DEBUG("MmsUiGetMediaAttachInfo: partCnt=%d\n", partCnt ); + + if (partCnt < 0) { + MSG_DEBUG("MmsUiGetMediaAttachInfo: partCnt=%d\n", partCnt ); + } else { + for (int i = 0; i < partCnt; ++i) { + if (!MmsGetMediaPartHeader(i, &partHeader)) { + MSG_DEBUG("MmsUiGetMediaAttachInfo: MmsGetMediaPartHeader failed\n" ); + break; + } + + if (partHeader.contentSize > 0) { + char szBuf[MSG_FILEPATH_LEN_MAX]; + + strcpy((char *)szBuf, partHeader.param.szFileName); + sprintf(partHeader.param.szFileName, MSG_DATA_PATH"%s", szBuf); + if (!bMultipartRelated || MmsCheckAdditionalMedia(&msgData, &partHeader)) + attachCount++; + } + } + } + MSG_DEBUG("attachCount [%d]", attachCount); + err = pStorage->updateMmsAttachCount(pMsgInfo->msgId, attachCount); + + if (bMultipartRelated) { + _MsgMmsReleasePageList(&msgData); + _MsgMmsReleaseRegionList(&msgData); + _MsgMmsReleaseAttachList(&msgData); + _MsgMmsReleaseTransitionList(&msgData); + _MsgMmsReleaseMetaList(&msgData); + } + + MmsMsg *pMsg = NULL; + pStorage->getMmsMessage(&pMsg); + _MmsInitHeader(); +#ifdef __SUPPORT_DRM__ + _MsgFreeDRMInfo(&pMsg->msgType.drmInfo); +#endif + _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type); + + MSG_END(); +} + +void MmsPluginInternal::processForwardConf(MSG_MESSAGE_INFO_S *msgInfo, mmsTranQEntity *pRequest) +{ + +} + +/* This function Send NotifyRespInd Msg + * + * @param pTrID [in] Specifies Transaction ID + * @param iStatus [in] Specifies Msg Status + * @param iReportAllowed [in] Specifies whether to send deliveryReport to sender or not + * @return This function returns true on success, or false on failure. + */ +bool MmsPluginInternal::encodeNotifyRespInd(char *szTrID, MSG_DELIVERY_REPORT_STATUS_T iStatus, bool bReportAllowed, char *pSendFilePath) +{ + MSG_BEGIN(); + + FILE *pFile = NULL; + char pTempFileName[MSG_FILENAME_LEN_MAX+1] = {0}; + char pTempFilePath[MAX_FULL_PATH_SIZE] = {0}; + + if (MsgCreateFileName(pTempFileName) == false) + return false; + + snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, MSG_DATA_PATH"%s.noti.ind", pTempFileName); + + pFile = MsgOpenMMSFile(pTempFilePath); + + if (!pFile) { + MSG_DEBUG("[ERROR] MsgOpenMMSFile fail"); + return false; + } + + if (_MmsEncodeNotiRespInd(pFile, szTrID, iStatus, bReportAllowed) == false) { + MSG_DEBUG("MmsEncodeNotifyRespInd: _MmsEncodeNotiRespInd fail"); + MsgCloseFile(pFile); + return false; + } + + MsgCloseFile(pFile); + + if (pSendFilePath) { + snprintf(pSendFilePath, MAX_MSG_DATA_LEN+1, "%s.mms", pTempFilePath); + } else { + MSG_DEBUG("[ERROR] pSendFilePath is NULL"); + return false; + } + + MSG_END(); + + return true; +} + +/* This function Send AcknowledgeInd Msg + * + * @param pTrID [in] Specifies Transaction ID + * @param iReportAllowed [in] Specifies whether to send deliveryReport to sender or not + * @return This function returns true on success, or false on failure. + */ +bool MmsPluginInternal::encodeAckInd(char *szTrID, bool bReportAllowed, char *pSendFilePath) +{ + MSG_BEGIN(); + FILE *pFile = NULL; + char pTempFileName[MSG_FILENAME_LEN_MAX+1] = {0}; + char pTempFilePath[MAX_FULL_PATH_SIZE] = {0}; + + if (MsgCreateFileName(pTempFileName) == false) + return false; + + snprintf(pTempFilePath, MAX_FULL_PATH_SIZE, MSG_DATA_PATH"%s.ack.ind", pTempFileName); + + pFile = MsgOpenMMSFile(pTempFilePath); + if (!pFile) { + MSG_DEBUG("[ERROR] MsgOpenMMSFile fail \n" ); + return false; + } + + if (_MmsEncodeAckInd(pFile, szTrID, bReportAllowed) == false) { + MSG_DEBUG("MmsEncodeAckInd: _MmsEncodeAckInd fail \n" ); + MsgCloseFile(pFile); + return false; + } + + MsgCloseFile(pFile); + + if (pSendFilePath) { + snprintf(pSendFilePath, MAX_MSG_DATA_LEN+1, "%s.mms", pTempFilePath); + } else { + MSG_DEBUG("[ERROR] pSendFilePath is NULL"); + return false; + } + + MSG_END(); + + return true; +} + +bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, char *pSendFilePath) +{ + MSG_BEGIN(); + MSG_MMS_HOME_RETRIEVE_TYPE_T retrieveType; + bool bRejectAnonymous; + bool bRejectAdvertisement; + + MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bRejectAnonymous); + MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bRejectAdvertisement); + + // Anonymous Reject + if (bRejectAnonymous && + (mmsHeader.pFrom == NULL || mmsHeader.pFrom->szAddr[0] == '\0')) { + MSG_DEBUG("Anonymous Reject... "); + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pSendFilePath); + + return true; + } + + // Advertisement Reject + if (bRejectAdvertisement && mmsHeader.msgClass == MMS_MSGCLASS_ADVERTISEMENT) { + MSG_DEBUG("Advertisement Reject... "); + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pSendFilePath); + + return true; + } + + // 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) { + MSG_DEBUG("Abroad_Network : Notification Reject... "); + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pSendFilePath); + + return true; + } + } else { + retrieveType = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_HOME_NETWORK); + if (retrieveType == MSG_HOME_REJECT) { + MSG_DEBUG("Home_Network : Notification Reject... "); + encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pSendFilePath); + + return true; + } + } + + // Not Rejected + MSG_END(); + return false; + +} + +bool MmsPluginInternal::getMmsReport(MmsReport mmsReport) +{ + bool result = false; + + if (mmsReport == MMS_REPORT_YES) + result = true; + else if (mmsReport == MMS_REPORT_NO) + result = false; + + return result; +} + +const char *MmsPluginInternal::getMmsDeliveryStatus(MSG_DELIVERY_REPORT_STATUS_T deliveryStatus) +{ + MSG_DEBUG("msgStatus= %d", deliveryStatus); + + switch (deliveryStatus) { + case MSG_DELIVERY_REPORT_EXPIRED: + return "expired."; + case MSG_DELIVERY_REPORT_REJECTED: + return "rejected."; + case MSG_DELIVERY_REPORT_UNREACHABLE: + return "unreachable."; + case MSG_DELIVERY_REPORT_UNRECOGNISED: + return "unrecognised."; + case MSG_DELIVERY_REPORT_SUCCESS: + return "delivered."; + default: + return "delivery failed."; + } +} + +const char *MmsPluginInternal::getMmsReadStatus(MSG_READ_REPORT_STATUS_T readStatus) +{ + switch (readStatus) { + case MSG_READ_REPORT_IS_READ: + return "message is read."; + case MSG_READ_REPORT_IS_DELETED: + return "message is deleted."; + default: + return "read status is none."; + } +} + diff --git a/plugin/mms_plugin/MmsPluginMIME.cpp b/plugin/mms_plugin/MmsPluginMIME.cpp new file mode 100755 index 0000000..646af3d --- /dev/null +++ b/plugin/mms_plugin/MmsPluginMIME.cpp @@ -0,0 +1,1329 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include "MmsPluginMIME.h" +#include "MsgDebug.h" + +#include "MmsPluginSmil.h" +#ifndef NULL +#define NULL 0 +#endif + + +/* Header field */ +static const char *szMsgField[MSG_FIELD_NUM] = +{ + "Return-Path", + "Message-ID", + "From" , + "To" , + "Cc" , + "Subject", + "Date", + "Mime-Version", + "Content-Type", + "Content-Transfer-Encoding", + "Content-Disposition", //If start param is given in multipart/related, this field will be ignored + "Content-ID", //for start part of multipart/related body + "Content-Location", + "Content-Name", + "Content-Description", + "Content-Vendor", + "Rights-Issuer", + "Return-Receipt-To", /* Delivery confirm */ + "Disposition-Notification-To", /* Read confirm */ + "Content-Rep-Pos", + "Content-Rep-Size", + "Content-Rep-Index" +}; + +/* MIME header field parameter */ +static const char *szMsgParam[MSG_PARAM_NUM] = +{ + "charset", + "name", + "filename", + "type", //Only if content-type is multipart/related, + "start", //Only if content-type is multipart/related + "start-info", //Only if content-type is multipart/related + "boundary", + "report-type", // only used as parameter of Content-Type: multipart/report; report-type=delivery-status; +#ifdef FEATURE_JAVA_MMS + "Application-ID", //laconic_javaParamFix + "Reply-To-Application-ID", //laconic_javaParamFix +#endif +}; + +/* Content-Transfer-Encoding header value */ +static const char *szMsgEncoding[MSG_ENCODING_NUM] = +{ + "7bit", + "8bit", + "binary", + "base64", + "quoted-printable" +}; + +/* Content-Disposition header value */ +static const char *szMsgDisposition[MSG_DISPOSITION_NUM] = +{ + "form-data", + "attachment", + "inline" +}; + +static const char *szMsgAddrType[MSG_ADDR_TYPE_NUM] = +{ + "/TYPE=PLMN", + "", + "/TYPE=IPV4", + "/TYPE=IPV6", + "" +}; + +/* character-set value */ +static const char *szMsgCharset [MSG_CHARSET_NUM] = +{ + "us-ascii", + "utf-16", + "usc-2", + "utf-8", + /* MIME character-set value */ + + "iso-2022-kr", + "ks_c_5601-1987", + "euc_kr", + "iso-2022-jp", + "iso-2022-jp-2", + "iso-8859-1", + "iso-8859-2", + "iso-8859-3", + "iso-8859-4", + "iso-8859-5", + "iso-8859-6", + "iso-8859-6-e", + "iso-8859-6-i", + "iso-8859-7", + "iso-8859-8", + "iso-8859-8-i", + "iso-8859-9", + "iso-8859-10", + "iso-8859-15", + "Shift_jis", + "euc-jp", + "gb2312", + "big5", + "win1251", + "window-1251", + "windows-1251", + "koi8-r", + "koi8-u" +}; + + +/************************************************** 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.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/x-bmp", "bmp", false, MIME_IMAGE_X_BMP, MIME_IMAGE_BMP, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY }, + + {"message/rfc822", "elm", false, MIME_MESSAGE_RFC822, MIME_MESSAGE_RFC822, MIME_APPLICATION_NONE, MIME_MAINTYPE_MESSAGE, UNDEFINED_BINARY }, + + {"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", "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 }, + + //134 + {"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 }, + + + //142 + {"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_TEXT, 0x06 }, + {"text/x-vCard", "vcf", true, MIME_TEXT_X_VCARD, MIME_TEXT_X_VCARD, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 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 }, + + //148 + {"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", "3gp"/*,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 }, + + // 157 + {"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 }, + + //159 + {"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, 134, 142, + 148, 157, 159 +}; + + +/***************** Extension definition *****************/ +static const ExtTable extTable[] = { + + {"txt", MIME_TEXT_PLAIN}, + {"html", MIME_TEXT_HTML}, + {"htm", MIME_TEXT_HTML}, + {"xhtml", MIME_APPLICATION_XHTML_XML}, + {"wml", MIME_TEXT_VND_WAP_WML}, + {"vcs", MIME_TEXT_X_VCALENDAR}, + {"vcf", MIME_TEXT_X_VCARD}, + {"vnt", MIME_TEXT_X_VNOTE}, + {"smil", MIME_APPLICATION_SMIL}, + {"eml", MIME_MESSAGE_RFC822}, + {"gif", MIME_IMAGE_GIF}, + {"jpeg", MIME_IMAGE_JPEG}, + {"jpg", MIME_IMAGE_JPEG}, + {"jpe", MIME_IMAGE_JPEG}, + {"jpz", MIME_IMAGE_JPEG}, + {"tiff", MIME_IMAGE_TIFF}, + {"tif", MIME_IMAGE_TIFF}, + {"png", MIME_IMAGE_PNG}, + {"pnz", MIME_IMAGE_PNG}, + {"wbmp", MIME_IMAGE_VND_WAP_WBMP}, + {"bmp", MIME_IMAGE_BMP}, + {"au", MIME_AUDIO_BASIC}, + {"snd", MIME_AUDIO_BASIC}, + {"mp3", MIME_AUDIO_MP3}, + {"aac", MIME_AUDIO_AAC}, + {"mp4", MIME_AUDIO_MP4}, + {"m4a", MIME_AUDIO_M4A}, + {"amr", MIME_AUDIO_X_AMR}, + {"mmf", MIME_APPLICATION_VND_SMAF}, + {"imy", MIME_AUDIO_X_IMELODY}, + {"mid", MIME_AUDIO_MID}, + {"midi", MIME_AUDIO_MID}, + {"spm", MIME_AUDIO_SP_MIDI}, + {"wav", MIME_AUDIO_WAVE}, + {"3gp", MIME_AUDIO_3GPP}, + {"3gpp", MIME_VIDEO_3GPP}, + {"rm", MIME_VIDEO_VND_RN_REALVIDEO}, + {"ra", MIME_AUDIO_VND_RN_REALAUDIO}, + {"ram", MIME_AUDIO_VND_RN_REALAUDIO}, + {"wma", MIME_AUDIO_X_MS_WMA}, + {"smp", MIME_APPLICATION_STUDIOM}, + {"avi", MIME_VIDEO_AVI}, + {"sdp", MIME_APPLICATION_SDP}, + {"vbm", MIME_TEXT_PLAIN}, + {"url", MIME_TEXT_PLAIN}, + {"jad", MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR}, + {"jar", MIME_APPLICATION_VND_SUN_J2ME_JAVA_ARCHIVE}, + {"dd", MIME_APPLICATION_VND_OMA_DD_XML}, + {"dm", MIME_APPLICATION_VND_OMA_DRM_MESSAGE}, + {"dcf", MIME_APPLICATION_VND_OMA_DRM_CONTENT}, + {"rv", MIME_VIDEO_X_PN_REALVIDEO}, + {"ro", MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML}, + {"xls", MIME_APPLICATION_X_EXCEL}, + {"pdf", MIME_APPLICATION_PDF}, + {"ppt", MIME_APPLICATION_X_POWERPOINT}, + {"swf", MIME_APPLICATION_X_FLASH}, + {"svg", MIME_IMAGE_SVG}, + {"doc", MIME_APPLICATION_MSWORD}, + {"wmv", MIME_VIDEO_X_MS_WMV}, + {"asf", MIME_VIDEO_X_MS_ASF}, + {"3ga", MIME_AUDIO_M4A}, + {"xmf", MIME_AUDIO_XMF}, + {"mxmf", MIME_AUDIO_MOBILE_XMF}, + {"pvx", MIME_VIDEO_X_PV_PVX}, + {"oro", MIME_APPLICATION_VND_OMA_DRM_RO_XML}, + {"odf", MIME_APPLICATION_VND_OMA_DRM_DCF} +}; + + +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_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_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_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_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_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 166 +#define EXT_MAX 67 +#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 whether a mime is downloadable or not. + * + * @param mime [in] Enumeration number for a MIME type. + * @return This function returns true if downloadable, or false. + */ +bool MimeIsDownloadableInt(MimeType mime) +{ + int index; + + index = __MimeGetTableIndexInt(mime); + if (index == MIME_UNKNOWN) + return false; + + return mimeTable[index].bDownloadable; +} + +/* + * This function checks whether a mime is downloadable or not. + * + * @param mime [in] MIME string. + * @return This function returns true if downloadable, or false. + */ +bool MimeIsDownloadableString(const char *szMime) +{ + int index; + + index = __MimeGetTableIndexString(szMime); + if (index == MIME_UNKNOWN) + return false; + + return mimeTable[index].bDownloadable; +} + +/* + * 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 checks main type of a MIME. + * + * @param mime [in] MIME string. + * @return This function returns main type of a MIME. + */ +MimeMainType MimeGetMainTypeString(const char *szMime) +{ + int index; + + index = __MimeGetTableIndexString(szMime); + 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 a extension name for a specified MIME. + * + * @param mime [in] MIME string. + * @return This function returns Extension string. + */ +char *MimeGetExtFromMimeString(const char *szMime) +{ + int index; + + index = __MimeGetTableIndexString(szMime); + if (index == MIME_UNKNOWN) + return NULL; + + return (char *)mimeTable[index].szExt; +} + + +/* + * This function returns a MIME type for a specified Extension. + * + * @param mime [in] Extension string. + * @return This function returns MIME string. + */ +char *MimeGetMimeFromExtString(const char *szExt) +{ + int i; + + for (i = 0; i < EXT_MAX; i++) { + if (!strcasecmp( extTable[i].szExt, szExt)) { + int index; + + index = __MimeGetTableIndexInt(extTable[i].mimeType); + if (index == MIME_UNKNOWN) + return NULL; + + return (char *)mimeTable[index].szMIME; + } + } + + return NULL; +} + +/* + * This function returns a MIME type for a specified Extension. + * + * @param mime [in] Extension string. + * @return This function returns MIME string. + */ +MimeType MimeGetMimeFromExtInt(const char *szExt) +{ + int i; + + for (i = 0; i < EXT_MAX; i++) { + if (!strcasecmp( extTable[i].szExt, szExt)) + return extTable[i].mimeType; + } + + return MIME_UNKNOWN; +} + +/* + * 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; +} + + +#define MIME_MAX_LEN 43 +/* + * 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; + } + strcpy(szMIMEType, 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; +} + + + +// 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; +} + +// BinaryCode -> MimeInt +char *MimeGetMimeStringFromBi(int binCode) +{ + int index; + + if (binCode < 0x00 || binCode > 0x4b) + return NULL; + + for (index = 0; index < MIME_MAX_NUM; index++) { + if (binCode == mimeTable[index].binary) + return (char *)mimeTable[index].szMIME; + } + + return NULL; +} + +// Mimeint -> Binary Value +int MimeGetBinaryValueFromMimeInt(MimeType mime) +{ + int index; + + index = __MimeGetTableIndexInt(mime); + if (index == MIME_UNKNOWN) + return UNDEFINED_BINARY; + + return mimeTable[index].binary; +} + +// MimeString -> Binary value +int MimeGetBinaryValueFromMimeString(const char *szMime) +{ + int index; + + index = __MimeGetTableIndexString(szMime); + if (index == MIME_UNKNOWN) + return UNDEFINED_BINARY; + + return mimeTable[index].binary; +} + + +/* + * This function checks main type of a MIME. + * + * @param mime [in] Enumeration number for a MIME type. + * @return This function returns application type of a MIME. + */ +MimeAppType MimeGetAppTypeFromInt(MimeType mime) +{ + int index; + + index = __MimeGetTableIndexInt(mime); + if (index == MIME_UNKNOWN) + return MIME_APPLICATION_NONE; + + return mimeTable[index].appType; +} + +/* + * This function checks main type of a MIME. + * + * @param mime [in] MIME string. + * @return This function returns application type of a MIME. + */ +MimeAppType MimeGetAppTypeFromString(const char *szMime) +{ + int index; + + index = __MimeGetTableIndexString(szMime); + if (index == MIME_UNKNOWN) + return MIME_APPLICATION_NONE; + + return mimeTable[index].appType; +} + + +/* + * This function returns a application type for a specified Extension. + * + * @param mime [in] Extension string. + * @return This function returns application type. + */ +MimeAppType MimeGetAppTypeFromExtString(const char *szExt) +{ + int i; + + for (i = 0; i < EXT_MAX; i++) { + if (!strcasecmp( extTable[i].szExt, szExt)) { + int index; + + index = __MimeGetTableIndexInt(extTable[i].mimeType); + if (index == MIME_UNKNOWN) + return MIME_APPLICATION_NONE; + return mimeTable[index].appType; + } + } + + return MIME_APPLICATION_NONE; +} + +/* + * This function gets the representative mime type from MimeType + * + * @param mime [in] Enumeration number for a MIME type. + * @return representative mime type Enumeration number + */ + +MimeType MimeGetContentTypeFromInt(MimeType mime) +{ + int index; + + for (index = 0; index < MIME_MAX_NUM; index++) { + if (mime == mimeTable[index].mime) + return mimeTable[index].contentType; + } + + return MIME_UNKNOWN; +} + +/* + * This function gets the representative mime type from mime string + * + * @param szMime - string name of MimeType + * @return representative mime type Enumeration number + */ + +MimeType MimeGetContentTypeFromString(const char *szMime) +{ + int index; + + for (index = 0; index < MIME_MAX_NUM; index++) { + if (!strcasecmp(szMime, mimeTable[index].szMIME)) + return mimeTable[index].contentType; + } + + return MIME_UNKNOWN; +} + +/* + * This function gets the index from mime string + * + * @param szMime - string name of MimeType + * @return Enumeration number for a MIME type. + */ + +MimeType MimeGetMimeTypeFromString(const char *szMime) +{ + int index; + + for (index = 0; index < MIME_MAX_NUM; index++) { + if (!strcasecmp(szMime, mimeTable[index].szMIME)) + return mimeTable[index].mime; + } + + return MIME_UNKNOWN; +} + + +int MsgGetCode(MsgHeaderField tableId, char *pStr) +{ + int cCode = 0; + int nNum = MSG_FIELD_UNKNOWN; + char **pTable = NULL; + + switch (tableId) { + case MSG_FIELD: + nNum = MSG_FIELD_NUM; + pTable = (char **)szMsgField; + break; + + case MSG_PARAM: + nNum = MSG_PARAM_NUM; + pTable = (char **)szMsgParam; + break; + + case MSG_TYPE: + return MimeGetMimeIntFromMimeString(pStr); + + case MSG_CHARSET: + nNum = MSG_CHARSET_NUM; + pTable = (char **)szMsgCharset; + break; + + case MSG_ENCODING: + nNum = MSG_ENCODING_NUM; + pTable = (char **)szMsgEncoding; + break; + + case MSG_DISPOSITION: + nNum = MSG_DISPOSITION_NUM; + pTable = (char **)szMsgDisposition; + break; + + case MSG_ADDR_TYPE: + nNum = MSG_ADDR_TYPE_NUM; + pTable = (char **)szMsgAddrType; + break; + + default: + break; + } + + for (cCode = 0; cCode < nNum; cCode++) { + if (!strcasecmp(pStr, pTable[cCode])) { + return cCode; + } + } + + return -1; +} + + +char *MsgGetString(MsgHeaderField tableId, int code) +{ + int nNum = MSG_FIELD_UNKNOWN; + char **pTable = NULL; + + switch (tableId) { + case MSG_FIELD: + nNum = MSG_FIELD_NUM; + pTable = (char **)szMsgField; + break; + + case MSG_PARAM: + nNum = MSG_PARAM_NUM; + pTable = (char **)szMsgParam; + break; + + case MSG_TYPE: + if (code != MIME_UNKNOWN && code != -1) + return MimeGetMimeStringFromMimeInt(code); + else + return (char *)MSG_UNKNOWN_TYPE_STRING; + + case MSG_CHARSET: + nNum = MSG_CHARSET_NUM; + pTable = (char **)szMsgCharset; + break; + + case MSG_ENCODING: + nNum = MSG_ENCODING_NUM; + pTable = (char **)szMsgEncoding; + break; + + case MSG_DISPOSITION: + nNum = MSG_DISPOSITION_NUM; + pTable = (char **)szMsgDisposition; + break; + + case MSG_ADDR_TYPE: + nNum = MSG_ADDR_TYPE_NUM; + pTable = (char **)szMsgAddrType; + break; + + default: + break; + } + + if (code < 0 || code >= nNum || !pTable) + return (char *)MSG_UNKNOWN_TYPE_STRING; + + return pTable[code]; +} + +char *_MsgSkipWS3(char *s) +{ + while (true) { + if ((*s == MSG_CH_CR) || + (*s == MSG_CH_LF) || + (*s == MSG_CH_SP) || + (*s == MSG_CH_TAB)) + ++s; + else + return s; + } +} + + +int _MsgGetCode(MsgHeaderField tableId, char *pStr) +{ + int cCode = 0; + int nNum = MSG_FIELD_UNKNOWN; + char **pTable = NULL; + + switch (tableId) { + case MSG_FIELD: + nNum = MSG_FIELD_NUM; + pTable = (char **)szMsgField; + break; + + case MSG_PARAM: + nNum = MSG_PARAM_NUM; + pTable = (char **)szMsgParam; + break; + + case MSG_TYPE: + return MimeGetMimeIntFromMimeString(pStr); + + case MSG_CHARSET: + nNum = MSG_CHARSET_NUM; + pTable = (char **)szMsgCharset; + break; + + case MSG_ENCODING: + nNum = MSG_ENCODING_NUM; + pTable = (char **)szMsgEncoding; + break; + + case MSG_DISPOSITION: + nNum = MSG_DISPOSITION_NUM; + pTable = (char **)szMsgDisposition; + break; + + case MSG_ADDR_TYPE: + nNum = MSG_ADDR_TYPE_NUM; + pTable = (char **)szMsgAddrType; + break; + + default: + MSG_DEBUG("_MsgGetCode: Invalid tableId [%d] \n", tableId); + break; + } + + for (cCode = 0; cCode < nNum; cCode++) { + if (pTable[cCode] != NULL) { + if (!strcasecmp( pStr, pTable[cCode])) { + return cCode; + } + } + } + + return INVALID_HOBJ; +} + diff --git a/plugin/mms_plugin/MmsPluginMain.cpp b/plugin/mms_plugin/MmsPluginMain.cpp new file mode 100755 index 0000000..f46ef61 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginMain.cpp @@ -0,0 +1,342 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include + +#include "MmsPluginTypes.h" +#include "MmsPluginMain.h" +#include "MmsPluginTransport.h" +#include "MsgDebug.h" +#include "MsgException.h" + +#include "MmsPluginMain.h" +#include "MmsPluginMessage.h" +#include "MmsPluginStorage.h" +#include "MmsPluginInternal.h" +#include "MmsPluginEventHandler.h" +#include "MsgGconfWrapper.h" +#include "MmsPluginCodec.h" +#include "MsgUtilFile.h" +#include "MmsPluginUserAgent.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle) +{ + if (pPluginHandle == NULL) { + MSG_DEBUG("MMS plugin: create handler error "); + return MSG_ERR_NULL_POINTER; + } else { + pPluginHandle->pfInitialize = MmsInitialize; + pPluginHandle->pfFinalize = MmsFinalize; + pPluginHandle->pfRegisterListener = MmsRegisterListener; + pPluginHandle->pfSubmitRequest = MmsSubmitRequest; + pPluginHandle->pfAddMessage = MmsAddMessage; + pPluginHandle->pfProcessReceivedInd = MmsProcessReceivedInd; + pPluginHandle->pfUpdateMessage = MmsUpdateMessage; + pPluginHandle->pfGetMmsMessage = MmsGetMmsMessage; + pPluginHandle->pfUpdateRejectStatus = MmsUpdateRejectStatus; + pPluginHandle->pfComposeReadReport = MmsComposeReadReport; + pPluginHandle->pfRestoreMsg = MmsRestoreMsg; + + MSG_DEBUG("MMS plugin: create handler OK"); + MSG_DEBUG ("MMS plugin %p", pPluginHandle); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle) +{ + MSG_BEGIN(); + + if (pPluginHandle != NULL) { + free(pPluginHandle); + pPluginHandle = NULL; + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsInitialize() +{ + MSG_BEGIN(); + + // remove temp files + MsgMmsInitDir(); + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsFinalize() +{ + MSG_BEGIN(); + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsRegisterListener(MSG_PLUGIN_LISTENER_S *pListener) +{ + MSG_BEGIN(); + + MmsPluginEventHandler::instance()->registerListener(pListener); + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo, bool bReqCb) +{ + MSG_BEGIN(); + + try { + MmsPluginTransport::instance()->submitRequest(pReqInfo); + } catch (MsgException& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_TRANSPORT; + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_TRANSPORT; + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData) +{ + MSG_BEGIN(); + + try { + MmsPluginStorage::instance()->addMessage(pMsgInfo, pSendOptInfo, pFileData); + } catch (MsgException& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_TRANSPORT; + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_TRANSPORT; + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsProcessReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject) +{ + MSG_BEGIN(); + + MSG_DEBUG("MMS Plugin ProcessReceivedInd"); + + try { + MmsPluginInternal::instance()->processReceivedInd(pMsgInfo, pRequest, bReject); + } catch (MsgException& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_TRANSPORT; + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_TRANSPORT; + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsUpdateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + try { + if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND) { + 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) { + err = MmsPluginStorage::instance()->updateConfMessage(pMsgInfo); + } else { + err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); + } + } + } catch (MsgException& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_STORAGE; + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_STORAGE; + } + + MSG_END(); + + return err; +} + + +MSG_ERROR_T MmsGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + try { + err = MmsPluginStorage::instance()->plgGetMmsMessage(pMsg, pSendOptInfo, pMmsMsg, pDestMsg); + } catch (MsgException& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_STORAGE; + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_STORAGE; + } + + MSG_END(); + + return err; +} + + +MSG_ERROR_T MmsUpdateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + try { + char szTrID[MMS_TR_ID_LEN + 1] = {0x00}; + bool bReportAllowed; + + err = MmsPluginStorage::instance()->getTrID(pMsgInfo,szTrID,sizeof(szTrID)); + if (err != MSG_SUCCESS) + MSG_DEBUG("MmsPlgUpdRejectStatus : Get MMS Transacation id Failed"); + + memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); + MsgSettingGetBool(MMS_SEND_REPORT_ALLOWED, &bReportAllowed); + if (MmsPluginInternal::instance()->encodeNotifyRespInd(szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pMsgInfo->msgData)) { + MSG_DEBUG("MmsPlgUpdRejectStatus : Encode Notify Response Success"); + pMsgInfo->dataSize = strlen(pMsgInfo->msgData); + pMsgInfo->bTextSms = true; + } else + MSG_DEBUG("MmsPlgSetRejectStatus : Encode Notify Response Failed"); + } catch (MsgException& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_STORAGE; + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_STORAGE; + } + + if (err != MSG_SUCCESS) + MSG_DEBUG("MmsPlgSetRejectStatus : Update MMS Message Failed"); + + MSG_END(); + + return err; +} + + +MSG_ERROR_T MmsComposeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo) +{ + MSG_BEGIN(); + + try { + MmsPluginStorage::instance()->composeReadReport(pMsgInfo); + } catch (MsgException& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_STORAGE; + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + return MSG_ERR_PLUGIN_STORAGE; + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvdBodyLen, char *filePath) +{ + MSG_BEGIN(); + + if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) { + FILE *pFile; + _MmsInitHeader(); + _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX); + + if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) { + MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData); + } else { + //Decode Header + if (!MmsBinaryDecodeMsgHeader(pFile, rcvdBodyLen)) + MSG_DEBUG("Decoding Header Failed \r\n"); + + MsgCloseFile(pFile); + } + } else { + MSG_DEBUG(":::%d :%s ",rcvdBodyLen, pRcvBody); + + if (filePath) { + snprintf(filePath, MAX_FULL_PATH_SIZE, MSG_DATA_PATH"BODY_%lu.DATA", random() % 1000000000 + 1); + } else { + return MSG_ERR_NULL_POINTER; + } + + // create temp file + if (!MsgOpenCreateAndOverwriteFile(filePath, (char*)pRcvBody,rcvdBodyLen)) + return MSG_ERR_PLUGIN_STORAGE; + } + + MSG_END(); + + return MSG_SUCCESS; +} + diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp new file mode 100755 index 0000000..1915c23 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -0,0 +1,1479 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include + +#include "MsgTypes.h" +#include "MsgCppTypes.h" +#include "MsgException.h" +#include "MsgStorageTypes.h" +#include "MsgSettingTypes.h" +#include "MmsPluginMessage.h" +#include "MmsPluginMIME.h" +#include "MmsPluginAvCodec.h" +#include "MsgUtilFile.h" +#include "MsgDebug.h" +#include "MmsPluginCodec.h" +#include "MmsPluginStorage.h" +#include "MsgMmsMessage.h" +#include "MsgGconfWrapper.h" + +#include "MmsPluginSMILValidate.h" + + +bool MmsInitMsgAttrib(MmsAttrib *pAttrib) +{ + MSG_DEBUG("MmsInitMsgAttrib"); + + pAttrib->bAskDeliveryReport = false; + + pAttrib->bAskReadReply = false; + pAttrib->bRead = false; + pAttrib->bReportAllowed = false; + pAttrib->readReportAllowedType = MMS_RECEIVE_READ_REPORT_ALLOWED; + pAttrib->readReportSendStatus = MMS_RECEIVE_READ_REPORT_NO_SEND; + pAttrib->bReadReportSent = false; + + pAttrib->bHideAddress = false; + pAttrib->date = 0; + pAttrib->bUseDeliveryCustomTime = false; + pAttrib->deliveryTime.type = MMS_TIMETYPE_RELATIVE; + pAttrib->deliveryTime.time = 0; + pAttrib->bUseExpiryCustomTime = false; + pAttrib->expiryTime.type = MMS_TIMETYPE_RELATIVE; + pAttrib->expiryTime.time = 0; + memset(&pAttrib->expiryTime, 0, sizeof(MmsTimeStruct)); + pAttrib->msgClass = MMS_MSGCLASS_PERSONAL; + pAttrib->msgStatus = MSG_DELIVERY_REPORT_NONE; + pAttrib->priority = MMS_PRIORITY_NORMAL; + pAttrib->responseStatus = MMS_RESPSTATUS_ERROR; + pAttrib->retrieveStatus = MMS_RETRSTATUS_ERROR; + pAttrib->contentType = MIME_UNKNOWN; + pAttrib->msgSize = 0; + pAttrib->bLeaveCopy = true; + + pAttrib->specialMsgType = MMS_SPECIAL_MSG_TYPE_NONE; +#ifdef __SUPPORT_DRM__ + pAttrib->drmType = MSG_DRM_TYPE_NONE; + pAttrib->roWaitingTimerMax = 0; + pAttrib->pszDrmData = NULL; +#endif + pAttrib->version = MMS_VERSION; + + memset(pAttrib->szFrom, 0, MSG_LOCALE_ADDR_LEN + 10); + memset(pAttrib->szResponseText, 0, MMS_LOCALE_RESP_TEXT_LEN + 1); + memset(pAttrib->szRetrieveText, 0, MMS_LOCALE_RESP_TEXT_LEN + 1); + memset(pAttrib->szSubject, 0, MSG_LOCALE_SUBJ_LEN + 1); + pAttrib->szTo = NULL; + pAttrib->szCc = NULL; + pAttrib->szBcc = NULL; + + pAttrib->pMultiStatus = NULL; + + pAttrib->replyCharge.chargeType = MMS_REPLY_NONE; + memset(&pAttrib->replyCharge.deadLine , 0, sizeof(MmsTimeStruct)); + pAttrib->replyCharge.chargeSize = 0; + memset(pAttrib->replyCharge.szChargeID, 0, MMS_MSG_ID_LEN); + + return true; +} + +bool MmsInitMsgType(MsgType *pMsgType) +{ + MSG_DEBUG("MmsInitMsgType"); + pMsgType->offset = 0; + pMsgType->size = 0; + pMsgType->contentSize = 0; + pMsgType->disposition = -1; + pMsgType->encoding = -1; + pMsgType->type = MIME_UNKNOWN; + pMsgType->section = -1; + + pMsgType->szOrgFilePath[0] = '\0'; + pMsgType->szContentID[0] = '\0'; + pMsgType->szContentLocation[0] = '\0'; + + pMsgType->szContentRepPos[0] = '\0'; + pMsgType->szContentRepSize[0] = '\0'; + pMsgType->szContentRepIndex[0] = '\0'; + + MmsInitMsgContentParam(&pMsgType->param); +#ifdef __SUPPORT_DRM__ + __MsgInitMsgDRMInfo(&pMsgType->drmInfo); +#endif + + return true; +} + +bool MmsInitMsgBody(MsgBody *pMsgBody) +{ + MSG_DEBUG("MmsInitMsgBody"); + pMsgBody->offset = 0; + pMsgBody->size = 0; + pMsgBody->body.pText = NULL; + + MmsInitMsgType(&pMsgBody->presentationType); + pMsgBody->pPresentationBody = NULL; + + memset(pMsgBody->szOrgFilePath, 0, MSG_FILEPATH_LEN_MAX); + + return true; +} + +bool MmsInitMsgContentParam(MsgContentParam *pMsgContentParam) +{ + MSG_DEBUG("MmsInitMsgContentParam"); + pMsgContentParam->charset = MSG_CHARSET_UNKNOWN; + pMsgContentParam->type = MIME_UNKNOWN; + pMsgContentParam->szBoundary[0] = '\0'; + pMsgContentParam->szFileName[0] = '\0'; + pMsgContentParam->szName[0] = '\0'; + 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 +#ifdef FEATURE_JAVA_MMS + pMsgContentParam->szApplicationID = NULL; + pMsgContentParam->szReplyToApplicationID = NULL; +#endif + return true; +} + +bool MmsSetMsgAddressList(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S * pMsgInfo) +{ + MSG_DEBUG("MmsSetMsgAddressList"); + pAttrib->szTo = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_TO); + MSG_DEBUG("To address: %s", pAttrib->szTo); + pAttrib->szCc = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_CC); + MSG_DEBUG("Cc address: %s", pAttrib->szCc); + pAttrib->szBcc = MmsComposeAddress(pMsgInfo, MSG_RECIPIENTS_TYPE_BCC); + MSG_DEBUG("Bcc address: %s", pAttrib->szBcc); + + return true; +} + +void MmsSetMsgMultiStatus(MmsAttrib *pAttrib, const MSG_MESSAGE_INFO_S *pMsgInfo) +{ + int nAddressCnt = 0; + + nAddressCnt = pMsgInfo->nAddressCnt; + + for (int i = 0; i < nAddressCnt; ++i) { + pAttrib->pMultiStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus)); + + memset(pAttrib->pMultiStatus->szTo, 0, MAX_ADDRESS_VAL_LEN + 1); + strncpy(pAttrib->pMultiStatus->szTo, pMsgInfo->addressList[i].addressVal, MAX_ADDRESS_VAL_LEN); + + MSG_DEBUG("### pMultistatus->szTo = %s ####", pAttrib->pMultiStatus->szTo); + pAttrib->pMultiStatus->bDeliveryReportIsRead = false; + pAttrib->pMultiStatus->bDeliveyrReportIsLast = false; + pAttrib->pMultiStatus->msgStatus = MMS_MSGSTATUS_NONE; + pAttrib->pMultiStatus->handledTime = 0; + pAttrib->pMultiStatus->bReadReplyIsRead = false; + pAttrib->pMultiStatus->bReadReplyIsLast = false; + pAttrib->pMultiStatus->readStatus = MMS_READSTATUS_NONE; + pAttrib->pMultiStatus->readTime = 0; + + pAttrib->pMultiStatus = pAttrib->pMultiStatus->pNext; + } +} + +char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType) +{ + MSG_DEBUG("MmsComposeAddress"); + int addrLen = 0; + int nAddressCnt = 0; + int nRecpCnt = 0; + char pString[MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3] = {0, }; + char *szCompose; + + nAddressCnt = pMsgInfo->nAddressCnt; + + // Calculate allocated buffer size + for (int i = 0; i < nAddressCnt; ++i) { + MSG_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal); + if (pMsgInfo->addressList[i].recipientType == recipientType) { + if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_PLMN) { + addrLen += strlen(MsgGetString(MSG_ADDR_TYPE, MSG_ADDR_TYPE_PHONE)); + addrLen += strlen(pMsgInfo->addressList[i].addressVal); + } 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 + + nRecpCnt++; + } + } + + if (nRecpCnt > 1) + addrLen = addrLen + nRecpCnt - 1; + szCompose = (char *)calloc(addrLen + 1, 1); + + // Address String copy + for (int i = 0; i < nAddressCnt; ++i) { + if (pMsgInfo->addressList[i].recipientType == recipientType) { + if (strlen(szCompose) > 0) + strcat(szCompose, MSG_STR_ADDR_DELIMETER); + + memset(pString, 0x00, (MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3) * sizeof(char)); + if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_PLMN) { + snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s%s", pMsgInfo->addressList[i].addressVal, MsgGetString(MSG_ADDR_TYPE, MSG_ADDR_TYPE_PHONE)); + MSG_DEBUG("%s", pString); + } 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 + + strcat(szCompose, pString); + } + } + + return szCompose; +} + + +bool MmsGetMsgBodyfromMsgInfo(const MSG_MESSAGE_INFO_S *pMsgInfo, MMS_MESSAGE_DATA_S *pMsgBody, char *pFileData) +{ + MSG_DEBUG("MmsGetMsgBodyfromMsgInfo"); + memset(pMsgBody, 0, sizeof(MMS_MESSAGE_DATA_S)); + + if (pMsgInfo->bTextSms == false) { //if the message body was stored in file. + _MsgMmsDeserializeMessageData(pMsgBody, pFileData); + } + + return true; +} + +int MmsGetSmilRawData(MMS_MESSAGE_DATA_S *pMsgBody, char **pRawdata) +{ + MSG_BEGIN(); + + if (MsgReadSmilFile(pMsgBody->szSmilFilePath, pRawdata) < 0) + return false; + + MsgDeleteSmilFile(pMsgBody->szSmilFilePath); + + MSG_END(); + + return true; +} + + +bool MmsInsertPresentation(MmsMsg *pMsg, MsgContentType mimeType, char *pData, int size) +{ + MSG_DEBUG("MmsInsertPresentation"); + + if (pMsg == NULL) { + MSG_DEBUG("pMsg is NULL"); + return false; + } + + if (pMsg->msgBody.pPresentationBody != NULL) + goto __CATCH; + + memset(&pMsg->msgBody.presentationType, 0, sizeof(MsgType)); + pMsg->msgBody.pPresentationBody = (MsgBody *)malloc(sizeof(MsgBody)); + if (pMsg->msgBody.pPresentationBody == NULL) + goto __CATCH; + + MmsInitMsgBody(pMsg->msgBody.pPresentationBody); + + pMsg->msgBody.pPresentationBody->body.pText = (char *)malloc(size + 1); + if (pMsg->msgBody.pPresentationBody->body.pText == NULL) + goto __CATCH; + + pMsg->msgBody.pPresentationBody->size = size; + pMsg->msgBody.presentationType.type = mimeType; + pMsg->msgBody.presentationType.param.charset = MSG_CHARSET_UTF8; + snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>"); + + snprintf(pMsg->msgType.param.szStart, MSG_MSG_ID_LEN + 1, pMsg->msgBody.presentationType.szContentID); + pMsg->msgType.param.type = mimeType; + + memset(pMsg->msgBody.pPresentationBody->body.pText, 0, size + 1); + strncpy(pMsg->msgBody.pPresentationBody->body.pText, pData, size); + + return true; + +__CATCH: + + if (pMsg->msgBody.pPresentationBody != NULL) { + if (pMsg->msgBody.pPresentationBody->body.pText != NULL) { + free(pMsg->msgBody.pPresentationBody->body.pText); + pMsg->msgBody.pPresentationBody->body.pText = NULL; + } + + free(pMsg->msgBody.pPresentationBody); + pMsg->msgBody.pPresentationBody = NULL; + } + + return false; +} + + +bool MmsInsertPartFromFile(MmsMsg *pMsg, char *szTitleName, char *szOrgFilePath, char *szContentID) +{ + MSG_DEBUG("MmsInsertPartFromFile"); + + MsgMultipart *pMultipart = NULL; + MsgMultipart *pLastPart = NULL; + int nFileSize; + MsgContentType mimeType = MIME_UNKNOWN; + char *pExt = NULL; + + pExt = strrchr(szOrgFilePath, '.'); + + if (pExt == NULL || pExt[0] == '\0' || strrchr(pExt, '/')) + mimeType = MIME_UNKNOWN; + else { + if (strcasecmp(pExt, ".dcf") == 0) + mimeType = MIME_APPLICATION_VND_OMA_DRM_CONTENT; + else { + if (MmsGetTypeByFileName((int *)&mimeType, szOrgFilePath) == false) + goto __CATCH; + } + } + + if (mimeType == MIME_UNKNOWN) + mimeType = MIME_APPLICATION_OCTET_STREAM; + + if (MmsIsMultipart(pMsg->msgType.type) == true) { + /* Insert as a multipart */ + if (MsgGetFileSize(szOrgFilePath, &nFileSize) == false) { + MSG_DEBUG("MsgGetFileSize: failed"); + goto __CATCH; + } + + pMultipart = MmsMakeMultipart(mimeType, szTitleName, szOrgFilePath, NULL, 0, nFileSize, szContentID); + if (pMultipart == NULL) + goto __CATCH; + + if (pMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || + pMsg->mmsAttrib.contentType == MIME_MULTIPART_MIXED) + pMultipart->type.disposition = MSG_DISPOSITION_ATTACHMENT; + + if (pMsg->msgBody.body.pMultipart == NULL) { + pMsg->msgBody.body.pMultipart = pMultipart; + } else { + pLastPart = pMsg->msgBody.body.pMultipart; + while (pLastPart->pNext) { + pLastPart = pLastPart->pNext; + } + + pLastPart->pNext = pMultipart; + } + + pMsg->msgBody.size += pMultipart->pBody->size; + pMsg->msgType.contentSize += pMultipart->pBody->size; + } else { + /* Single part - Insert as a message body */ + if (pMsg->mmsAttrib.contentType != mimeType || pMsg->msgType.type != mimeType) + goto __CATCH; + + strncpy(pMsg->msgType.param.szName, szTitleName, MSG_LOCALE_FILENAME_LEN_MAX); + + if (MmsIsText(pMsg->msgType.type) == true) { + pMsg->msgType.param.charset = MSG_CHARSET_UTF8; + if (pMultipart) + pMultipart->type.encoding = MSG_ENCODING_8BIT; + } else { + if (pMultipart) + pMultipart->type.encoding = MSG_ENCODING_BINARY; + } + + strncpy(pMsg->msgBody.szOrgFilePath, szOrgFilePath, MSG_FILEPATH_LEN_MAX - 1); + if (MsgGetFileSize(szOrgFilePath, &nFileSize) == false) { + MSG_DEBUG("MsgGetFileSize: failed"); + goto __CATCH; + } + + pMsg->msgBody.offset = 0; + pMsg->msgBody.size = nFileSize; + pMsg->msgType.contentSize = nFileSize; + } + + pMsg->nPartCount++; + + return true; + +__CATCH: + return false; + +} + +bool MmsIsMultipart(int type) +{ + MSG_DEBUG("MmsIsMultipart"); + if (type == MIME_MULTIPART_RELATED || + type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || + type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED || + type == MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC || + type == MIME_MULTIPART_MIXED || + type == MIME_MULTIPART_REPORT) { + return true; + } else { + return false; + } +} + +bool MmsIsText(int type) +{ + if (type == MIME_TEXT_PLAIN || + type == MIME_TEXT_HTML || + type == MIME_TEXT_VND_WAP_WML || + type == MIME_TEXT_X_VCARD || + type == MIME_TEXT_X_VCALENDAR || + type == MIME_TEXT_X_VNOTE || + type == MIME_APPLICATION_SMIL || + type == MIME_TEXT_X_IMELODY) { + MSG_DEBUG("MmsIsText true."); + return true; + } else { + MSG_DEBUG("MmsIsText false."); + return false; + } +} + +bool MmsIsVitemContent (int type, char *pszName) +{ + switch (type) { + +/* +* To make Encoding information right. +* case MIME_TEXT_X_VCARD : +* case MIME_TEXT_X_VCALENDAR : +* case MIME_TEXT_X_VNOTE : // vnt +* { +* MSG_DEBUG("MmsIsVitemContent true."); +* return true; +* } +* +*/ + case MIME_TEXT_X_VCARD: + case MIME_TEXT_X_VCALENDAR: + case MIME_TEXT_X_VNOTE: // vnt + case MIME_TEXT_PLAIN: // vbm - It SHOULD be distinguished from a normal text file. + { + char *pszExt = NULL; + + if (!pszName) + break; + + // search file extension. + if ((pszExt = strrchr(pszName, '.')) == NULL) + break; + + if (!strcasecmp(pszExt, ".vbm")) { + MSG_DEBUG("MmsIsVitemContent true."); + return true; + } + } + break; + + default: + break; + } + + MSG_DEBUG("MmsIsVitemContent false."); + return false; +} + +bool _MsgIsASCII(char *pszText) +{ + int length = strlen(pszText); + + for (int i = 0; i < length; ++i) { + if (!isascii(pszText[i])) { + MSG_DEBUG("_MsgIsASCII false."); + return false; + } + } + + MSG_DEBUG("_MsgIsASCII true."); + return true; +} + + +bool _MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar) +{ + MSG_DEBUG("_MsgReplaceNonAscii"); + int nCount = 0; + int index = 0; + int cLen = 0; + char *pNew = NULL; + + cLen = strlen(szInText); + + pNew = (char *)malloc(cLen + 1); + + if (pNew == NULL) + return false; + + memset(pNew, 0, cLen + 1); + + while (*(szInText+nCount) != '\0') { + if (0x0001 <= *(szInText+nCount) && *(szInText+nCount) <= 0x007F) { + MSG_DEBUG("_MsgReplaceNonAscii: non ascii characters (1bytes). \n"); + pNew[index] = szInText[nCount]; + nCount += 1; + index += 1; + } else { + MSG_DEBUG("_MsgReplaceNonAscii: UTF-8 characters (2bytes). \n"); + pNew[index] = replaceChar; + nCount += 1; + index +=1; + } + } + + *szOutText = pNew; + return true; +} + +bool _MsgIsSpace(char *pszText) +{ + MSG_DEBUG("_MsgIsSpace"); + if (!pszText) { + MSG_DEBUG("_MsgIsSpace: pszText == NULL!\n"); + return false; + } + + if (strchr(pszText, ' ') != NULL) + return true; + else + return false; +} + +bool _MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar) +{ + MSG_DEBUG("_MsgReplaceSpecialChar"); + char *pszOutText = NULL; + char szBuf[10] = {0, }; + char temp[5] = {0, }; + int cLen = 0; + int i = 0; + + if (!szInText) { + MSG_DEBUG("_MsgReplaceSpecialChar: szInText == NULL! \n"); + return false; + } + + if (!szOutText) + return false; + + cLen = strlen(szInText); + + if (specialChar == ' ') { + if ((pszOutText = (char *)malloc(cLen + 1)) == NULL) { + MSG_DEBUG("_MsgReplaceSpecialChar : %d line. MemAlloc failed.\n", __LINE__); + return false; + } + memset(pszOutText, 0, cLen + 1); + + *szOutText = pszOutText; + } + + for (i = 0; i 0) + strcat(szOutputStr, szInputStr2); + + free(szInputStr1); + szInputStr1 = NULL; + } + + return szOutputStr; + +__CATCH: + return NULL; +} + +char *MsgStrCopy(const char *string) +{ + char *pDst = NULL; + + if (string) { + pDst = (char *)malloc(1 + strlen(string)); + if (pDst == NULL) { + MSG_DEBUG("MsgStrCopy: pDst MemAlloc Fail \n"); + return NULL; + } + + memset(pDst, 0, strlen(string) + 1); + + strcpy(pDst,string); + + return pDst; + } + + return NULL; +} + +char *MsgStrNCopy(const char *string, int length) +{ + char *pDst = NULL; + + if (string) { + pDst = (char *)malloc(1 + length); + if (pDst == NULL) { + MSG_DEBUG("MsgStrNCopy: pDst MemAlloc Fail \n"); + return NULL; + } + + memset(pDst, 0, length + 1); + strncpy(pDst,string, length); + + return pDst; + } + + return NULL; +} + +int MsgStrlen(char * pStr) +{ + if (pStr == NULL) + return 0; + + return strlen(pStr); +} + +bool _MsgConvertCharToHex(char pSrc, char *pDest) +{ + static unsigned char saucHex[] = "0123456789ABCDEF"; + + pDest[0] = saucHex[pSrc >> 4]; + pDest[1] = saucHex[pSrc & 0xF]; + pDest[2] = 0; + + return true; +} + +MsgMultipart *MmsAllocMultipart(void) +{ + MsgMultipart *pMultipart = NULL; + + pMultipart = (MsgMultipart *)malloc(sizeof(MsgMultipart)); + + if (pMultipart == NULL) + goto __CATCH; + + pMultipart->pBody = (MsgBody *)malloc(sizeof(MsgBody)); + + if (pMultipart == NULL) + goto __CATCH; + + MmsInitMsgType(&pMultipart->type); + MmsInitMsgBody(pMultipart->pBody); + + pMultipart->pNext = NULL; + + return pMultipart; + +__CATCH: + + if (pMultipart) { + if (pMultipart->pBody) { + free(pMultipart->pBody); + pMultipart->pBody = NULL; + } + + free(pMultipart); + pMultipart = NULL; + } + + return NULL; +} + + + +MsgMultipart *MmsMakeMultipart(MsgContentType mimeType, char *szTitleName, char *szOrgFilePath, void *pData, int offset, int size, char *szContentID) +{ + MsgMultipart *pMultipart = NULL; + + if ((pMultipart = MmsAllocMultipart()) == NULL) + goto __CATCH; + + pMultipart->type.type = mimeType; + + 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); + } + + if (szContentID && szContentID[0]) { + memset(pMultipart->type.szContentID, 0, MSG_MSG_ID_LEN + 1); + snprintf(pMultipart->type.szContentID, MSG_MSG_ID_LEN + 1, "<%s>", szContentID); + + memset(pMultipart->type.szContentLocation, 0, MSG_MSG_ID_LEN + 1); + snprintf(pMultipart->type.szContentLocation, MSG_MSG_ID_LEN + 1, "%s", szContentID); + } + + if (MmsIsText(mimeType) == true) { + if (!MmsIsVitemContent (mimeType, pMultipart->type.param.szName)) { + pMultipart->type.param.charset = MSG_CHARSET_UTF8; + } + pMultipart->type.encoding = MSG_ENCODING_8BIT; + } else { + pMultipart->type.encoding = MSG_ENCODING_BINARY; + } + + if (szOrgFilePath == NULL) { + if (pData != NULL) { + if (MmsIsText(mimeType) == true) { + pMultipart->pBody->body.pText = (char *)malloc(size + 1); + if (pMultipart->pBody->body.pText == NULL) + goto __CATCH; + + memset(pMultipart->pBody->body.pText, 0, size + 1); + } else { + pMultipart->pBody->body.pBinary = malloc(size); + if (pMultipart->pBody->body.pBinary == NULL) + goto __CATCH; + + memset(pMultipart->pBody->body.pBinary, 0, size); + } + + memcpy(pMultipart->pBody->body.pBinary, pData, size); + pMultipart->pBody->size = size; + } + } else { + if (szOrgFilePath) + strncpy(pMultipart->pBody->szOrgFilePath, szOrgFilePath, MSG_FILEPATH_LEN_MAX - 1); + + pMultipart->pBody->offset = offset; + pMultipart->pBody->size = size; + } + + return pMultipart; + +__CATCH: + + if (pMultipart) { + if (pMultipart->pBody) { + if (pMultipart->pBody->body.pText) { + free(pMultipart->pBody->body.pText); + pMultipart->pBody->body.pText = NULL; + } + free(pMultipart->pBody); + pMultipart->pBody = NULL; + } + free(pMultipart); + pMultipart = NULL; + } + + return NULL; +} + + +bool MmsGetTypeByFileName(int *type, char *szFileName) +{ + char *pExt = NULL; + AvCodecType AvType = AV_CODEC_NONE; + + /* AVMS unknown or text/image file format identify type from file extention */ + + pExt = strrchr(szFileName, '.'); + if (pExt == NULL || pExt[0] == '\0') + goto __CATCH; + + pExt++; + + if (strcasecmp(pExt, "mp4") == 0 || strcasecmp(pExt, "mpeg4") == 0 || + strcasecmp(pExt, "3gp") == 0 || strcasecmp(pExt, "3gpp") == 0) { + /* Audio / Video format. If file exists already, AvGetFileCodecType() can identify the format */ + if (szFileName[0] != '/') + goto __CATCH; + + AvType = AvGetFileCodecType(szFileName); + + switch (AvType) { + case AV_DEC_AUDIO_MPEG4: + *type = MIME_AUDIO_MP4;//*type = MIME_AUDIO_3GPP; + break; + + case AV_DEC_VIDEO_MPEG4: + *type = MIME_VIDEO_MP4; + break; + + default: + *type = MIME_VIDEO_3GPP; + break; + } + return true; + } + + if (strcasecmp(pExt, "amr") == 0) { + *type = MIME_AUDIO_AMR; + return true; + } else if ((strcasecmp(pExt, "mid") == 0) || (strcasecmp(pExt, "midi") == 0)) { + *type = MIME_AUDIO_MIDI; + return true; + } else if (strcasecmp(pExt, "imy") == 0) { + *type = MIME_TEXT_X_IMELODY; + return true; + } + + *type = MimeGetMimeFromExtInt((const char *)pExt); + + return true; + +__CATCH: + + *type = MIME_UNKNOWN; + return false; + +} + +bool MmsComposeMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMsgData, char *pFileData) +{ + MSG_BEGIN(); + + char *pRawData = NULL; + AutoPtr buf(&pRawData); + + struct tm *timeInfo = NULL; + time_t RawTime = 0; + time_t nTimeInSecs = 0; + + MSG_ERROR_T err = MSG_SUCCESS; + + // Initialize mmsMsg structure + MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); + MmsInitMsgType(&pMmsMsg->msgType); + MmsInitMsgBody(&pMmsMsg->msgBody); + + // setting mmsMsg structure + pMmsMsg->mailbox = pMsgInfo->folderId; + pMmsMsg->msgID = pMsgInfo->msgId; + + memset(pMmsMsg->szTrID, 0, MMS_TR_ID_LEN + 1); + memset(pMmsMsg->szContentLocation, 0, MMS_LOCATION_LEN + 1); + memset(pMmsMsg->szMsgID, 0, MMS_MSG_ID_LEN + 1); + memset(pMmsMsg->szForwardMsgID, 0, MMS_MSG_ID_LEN + 1); + + pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT; + + MSG_DEBUG("## delivery = %d ##", pSendOptInfo->bDeliverReq); + MSG_DEBUG("## read = %d ##", pSendOptInfo->option.mmsSendOptInfo.bReadReq); + MSG_DEBUG("## priority = %d ##", pSendOptInfo->option.mmsSendOptInfo.priority); + MSG_DEBUG("## expiryTime = %d ##", pSendOptInfo->option.mmsSendOptInfo.expiryTime.time); + + if (pSendOptInfo->bSetting == false) { + unsigned int expiryTime; + MSG_MMS_DELIVERY_TIME_T deliveryTime; + + pMmsMsg->mmsAttrib.priority = (MmsPriority)MsgSettingGetInt(MMS_SEND_PRIORITY); + + MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &pMmsMsg->mmsAttrib.bAskDeliveryReport); + MsgSettingGetBool(MMS_SEND_READ_REPLY, &pMmsMsg->mmsAttrib.bAskReadReply); + MsgSettingGetBool(MSG_KEEP_COPY, &pMmsMsg->mmsAttrib.bLeaveCopy); + + expiryTime = (unsigned int)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME); + + if (expiryTime == 0) + pMmsMsg->mmsAttrib.expiryTime.type = MMS_TIMETYPE_NONE; + else { + pMmsMsg->mmsAttrib.expiryTime.type = MMS_TIMETYPE_RELATIVE; + pMmsMsg->mmsAttrib.expiryTime.time = expiryTime; + } + + deliveryTime = (MSG_MMS_DELIVERY_TIME_T)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); + + if (deliveryTime == MSG_DELIVERY_TIME_CUSTOM) { + pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = true; + + pMmsMsg->mmsAttrib.deliveryTime.type = MMS_TIMETYPE_RELATIVE; + pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY); + } else { + pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = false; + + pMmsMsg->mmsAttrib.deliveryTime.type = MMS_TIMETYPE_RELATIVE; + pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)deliveryTime; + } + } else { + pMmsMsg->mmsAttrib.priority = (MmsPriority)pSendOptInfo->option.mmsSendOptInfo.priority; + pMmsMsg->mmsAttrib.bAskDeliveryReport = pSendOptInfo->bDeliverReq; + pMmsMsg->mmsAttrib.bAskReadReply = pSendOptInfo->option.mmsSendOptInfo.bReadReq; + pMmsMsg->mmsAttrib.expiryTime.type = pSendOptInfo->option.mmsSendOptInfo.expiryTime.type; + pMmsMsg->mmsAttrib.bLeaveCopy = pSendOptInfo->bKeepCopy; + + if (pMmsMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) + pMmsMsg->mmsAttrib.expiryTime.time = pSendOptInfo->option.mmsSendOptInfo.expiryTime.time; + + pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = pSendOptInfo->option.mmsSendOptInfo.bUseDeliveryCustomTime; + pMmsMsg->mmsAttrib.deliveryTime.type = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.type; + pMmsMsg->mmsAttrib.deliveryTime.time = pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time; + } + + MSG_DEBUG("pSendOptInfo->bSetting = %d", pSendOptInfo->bSetting); + MSG_DEBUG("pMmsMsg->mmsAttrib.bLeaveCopy = %d", pMmsMsg->mmsAttrib.bLeaveCopy); + MSG_DEBUG("pMmsMsg->mmsAttrib.bUseDeliveryCustomTime = %d", pMmsMsg->mmsAttrib.bUseDeliveryCustomTime); + MSG_DEBUG("pMmsMsg->mmsAttrib.deliveryTime.type = %d", pMmsMsg->mmsAttrib.deliveryTime.type); + MSG_DEBUG("pMmsMsg->mmsAttrib.deliveryTime.time = %d", pMmsMsg->mmsAttrib.deliveryTime.time); + + /* MMS-1.3-con-739 */ + pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)MsgSettingGetInt(MMS_SEND_MSG_CLASS); + /* MMS-1.3-con-739 */ +#ifdef MMS_13_CON_742_ENABLED + /* MMS-1.3-con-742 */ + pMmsMsg->mmsAttrib.deliveryTime.time = (unsigned int)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME); + /* MMS-1.3-con-742 */ +#endif + + MSG_DEBUG("@@@ pMmsMsg->mmsAttrib.bAskDeliveryReport = %d @@@", pMmsMsg->mmsAttrib.bAskDeliveryReport); + MSG_DEBUG("@@@ pMmsMsg->mmsAttrib.bAskReadReply = %d @@@", pMmsMsg->mmsAttrib.bAskReadReply); + MSG_DEBUG("@@@ pMmsMsg->mmsAttrib.priority = %d @@@", pMmsMsg->mmsAttrib.priority); + + // setting date + time(&RawTime); + timeInfo = localtime(&RawTime); + nTimeInSecs = mktime(timeInfo); + pMmsMsg->mmsAttrib.date = nTimeInSecs; // todo: need to subtract timeline value to make GMT+0 time + + //setting subject + strcpy(pMmsMsg->mmsAttrib.szSubject, pMsgInfo->subject); + + //setting adddress + MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo); + MmsGetMsgBodyfromMsgInfo(pMsgInfo, pMsgData, pFileData); + + int pageCnt = _MsgMmsGetPageCount(pMsgData); + + if (pageCnt == 0) { // Multipart mixed + pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; + pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED; + } else { // Multipart related + + int RawDataSize = 0; + + time_t RawTime = 0; + time(&RawTime); + snprintf(pMsgData->szSmilFilePath, MSG_FILEPATH_LEN_MAX, "%lu", RawTime); + + MsgMMSCreateSMIL(pMsgData); + + RawDataSize = MmsGetSmilRawData(pMsgData, &pRawData); + if (RawDataSize < 0) { + MSG_DEBUG("Smil file size is less than 0"); + return false; + } + MSG_DEBUG("%s", pRawData); + if (pRawData) + MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, pRawData, strlen(pRawData)); + + pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; + pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; + + for (int i = 0; i < pageCnt; ++i) { + MMS_PAGE_S *pPage = _MsgMmsGetPage(pMsgData, i); + int mediaCnt = pPage->mediaCnt; + MSG_DEBUG("PAGE %d's media Cnt: %d", i+1, mediaCnt); + + for (int j = 0; j < mediaCnt; ++j) { + MMS_MEDIA_S *pMedia = _MsgMmsGetMedia(pPage, j); + + switch (pMedia->mediatype) { + case MMS_SMIL_MEDIA_IMG: + case MMS_SMIL_MEDIA_VIDEO: + case MMS_SMIL_MEDIA_AUDIO: + case MMS_SMIL_MEDIA_TEXT: + if (pMedia->szFilePath[0] != 0) { + if (!MmsInsertPartFromFile(pMmsMsg, pMedia->szFileName, pMedia->szFilePath, pMedia->szContentID)) + return false; + } + break; + + default: + break; + } + } + } + + char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };; + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms", pMsgInfo->msgId); + + MmsPluginStorage *pStorage = MmsPluginStorage::instance(); + err = pStorage->getMsgText(pMsgData, pMsgInfo->msgText); + err = pStorage->makeThumbnail(pMsgData, pMsgInfo->thumbPath, szFileName); + } + +#ifdef FEATURE_JAVA_MMS + MSG_DEBUG("msgAppId: valid:%d appId:%s replyToAppId:%s", pMsgData->msgAppId.valid, pMsgData->msgAppId.appId, pMsgData->msgAppId.replyToAppId); + if (pMsgData->msgAppId.valid) { // check if msgAppId.valid is true, both appId and replytoappId must have a meaning data + if (pMsgData->msgAppId.appId[0] != 0) { + pMmsMsg->msgType.param.szApplicationID = (char *)malloc(strlen(pMsgData->msgAppId.appId) + 1); + if (pMmsMsg->msgType.param.szApplicationID == NULL) { + MSG_DEBUG("Error: out of Memory"); + return false; + } + memset(pMmsMsg->msgType.param.szApplicationID, 0, strlen(pMsgData->msgAppId.appId) + 1); + + strcpy(pMmsMsg->msgType.param.szApplicationID, pMsgData->msgAppId.appId); + } + + if (pMsgData->msgAppId.replyToAppId[0] != 0) { + pMmsMsg->msgType.param.szReplyToApplicationID = (char *)malloc(strlen(pMsgData->msgAppId.replyToAppId) + 1); + if (pMmsMsg->msgType.param.szReplyToApplicationID == NULL) { + MSG_DEBUG("Error: out of Memory"); + return false; + } + memset(pMmsMsg->msgType.param.szReplyToApplicationID, 0, strlen(pMsgData->msgAppId.replyToAppId) + 1); + + strcpy(pMmsMsg->msgType.param.szReplyToApplicationID, pMsgData->msgAppId.replyToAppId); + } + } +#endif + + //Processing Attachment List + for (int i = 0; i < _MsgMmsGetAttachCount(pMsgData); ++i) { + MMS_ATTACH_S *pMedia = _MsgMmsGetAttachment(pMsgData, i); + if (pMedia->szFilePath[0] != 0) { + if (!MmsInsertPartFromFile(pMmsMsg, pMedia->szFileName, pMedia->szFilePath, NULL)) + return false; + } + } + + return true; +} + +void MmsComposeNotiMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_ID_T msgID) +{ + MSG_BEGIN(); + + struct tm *timeInfo = NULL; + time_t RawTime = 0; + time_t nTimeInSecs = 0; + + MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); + MmsInitMsgType(&pMmsMsg->msgType); + MmsInitMsgBody(&pMmsMsg->msgBody); + + pMmsMsg->msgID = msgID; + + pMmsMsg->mmsAttrib.version = mmsHeader.version; + + // setting date + time(&RawTime); + timeInfo = localtime(&RawTime); + nTimeInSecs = mktime(timeInfo); + pMmsMsg->mmsAttrib.date = nTimeInSecs; + + pMmsMsg->mmsAttrib.bReportAllowed = mmsHeader.reportAllowed; + pMmsMsg->mmsAttrib.bAskDeliveryReport = mmsHeader.deliveryReport; + + MSG_DEBUG("######## Version = %d ########", pMmsMsg->mmsAttrib.version); + + strncpy(pMmsMsg->szTrID, mmsHeader.szTrID, MMS_TR_ID_LEN); + strncpy(pMmsMsg->szMsgID, mmsHeader.szMsgID, MMS_MSG_ID_LEN); + pMmsMsg->szForwardMsgID[0] = '\0'; + + if (mmsHeader.pFrom) { + MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr ); + strncpy(pMmsMsg->mmsAttrib.szFrom, mmsHeader.pFrom->szAddr, MSG_LOCALE_ADDR_LEN + 9); + } + + strncpy(pMmsMsg->mmsAttrib.szSubject, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN); + strncpy(pMmsMsg->szContentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN); + + pMmsMsg->mmsAttrib.msgClass = mmsHeader.msgClass; + pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize; + pMmsMsg->mmsAttrib.expiryTime.type = mmsHeader.expiryTime.type; + pMmsMsg->mmsAttrib.expiryTime.time = mmsHeader.expiryTime.time; + pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_NOTIFY; + pMmsMsg->mmsAttrib.bRead = false; + pMmsMsg->mailbox = MSG_INBOX_ID; + + pMmsMsg->mmsAttrib.replyCharge.chargeType = mmsHeader.replyCharge.chargeType; + pMmsMsg->mmsAttrib.replyCharge.deadLine.type = mmsHeader.replyCharge.deadLine.type; + pMmsMsg->mmsAttrib.replyCharge.deadLine.time = mmsHeader.replyCharge.deadLine.time; + pMmsMsg->mmsAttrib.replyCharge.chargeSize = mmsHeader.replyCharge.chargeSize; + + strncpy(pMmsMsg->mmsAttrib.replyCharge.szChargeID, mmsHeader.replyCharge.szChargeID, MMS_MSG_ID_LEN); + + MSG_END(); +} + +bool MmsGetMmsMessageBody(MmsMsg *pMmsMsg, char *retrievedFilePath) +{ + FILE *pFile = NULL; + MsgMultipart *pMultipart = NULL; + int attachmax = MSG_ATTACH_MAX; + int nSize = 0; + + /* read from MMS raw file */ + if (retrievedFilePath) + strncpy(pMmsMsg->szFileName, retrievedFilePath + strlen(MSG_DATA_PATH), strlen(retrievedFilePath + strlen(MSG_DATA_PATH))); + else + goto __CATCH; + + pFile = MsgOpenFile(retrievedFilePath, "rb"); + + if (pFile == NULL) { + MSG_DEBUG( "_MmsReadMsgBody: invalid mailbox\n"); + goto __CATCH; + } + + if (MsgGetFileSize(retrievedFilePath, &nSize) == false) { + MSG_DEBUG("MsgGetFileSize: failed"); + goto __CATCH; + } + + _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, + gszMmsLoadBuf2, + MSG_MMS_DECODE_BUFFER_MAX); + + if (MmsBinaryDecodeMsgHeader(pFile, nSize) == false) { + MSG_DEBUG( "_MmsReadMsgBody: MmsBinaryDecodeMsgHeader fail...\n"); + goto __CATCH; + } + + if (MmsBinaryDecodeMsgBody(pFile, retrievedFilePath, nSize) == false) { + MSG_DEBUG( "_MmsReadMsgBody: MmsBinaryDecodeMsgBody fail\n"); + goto __CATCH; + } + + /* Set mmsHeader.msgType & msgBody to pMsg ----------- */ + + pMmsMsg->mmsAttrib.contentType = (MsgContentType)mmsHeader.msgType.type; + + memcpy(&(pMmsMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType)); + memcpy(&(pMmsMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody)); + + MSG_DEBUG("#############################"); + MSG_DEBUG("## pMmsMsg->msgType.type = %d ##", pMmsMsg->msgType.type); + MSG_DEBUG("## pMmsMsg->msgType.szContentID = %s ##", pMmsMsg->msgType.szContentID); + MSG_DEBUG("## pMmsMsg->msgType.szContentLocation = %s ##", pMmsMsg->msgType.szContentLocation); + MSG_DEBUG("#############################"); + + if (pMmsMsg->msgBody.pPresentationBody) { + if(MsgFseek(pFile, pMmsMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0) + goto __CATCH; + + pMmsMsg->msgBody.pPresentationBody->body.pText = (char *)malloc(pMmsMsg->msgBody.pPresentationBody->size + 1); + if (pMmsMsg->msgBody.pPresentationBody->body.pText == NULL) + goto __CATCH; + + memset(pMmsMsg->msgBody.pPresentationBody->body.pText, 0, pMmsMsg->msgBody.pPresentationBody->size + 1); + ULONG nRead = 0; + nRead = MsgReadFile(pMmsMsg->msgBody.pPresentationBody->body.pText, sizeof(char), pMmsMsg->msgBody.pPresentationBody->size, pFile); + + if (nRead == 0) + goto __CATCH; + } + + MsgCloseFile(pFile); + pFile = NULL; + + /* nPartCount */ + pMmsMsg->nPartCount = 0; + + if (MsgIsMultipart(mmsHeader.msgType.type) == true) { + pMultipart = pMmsMsg->msgBody.body.pMultipart; + while (pMultipart) { + pMmsMsg->nPartCount++; + + if (pMultipart->type.type == MIME_TEXT_PLAIN) + attachmax++; + + if ((mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED) || + (mmsHeader.msgType.type == MIME_MULTIPART_MIXED)) { + if ((pMmsMsg->nPartCount >= attachmax ) && (pMultipart->pNext != NULL)) { + _MsgFreeBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type); + + free(pMultipart->pNext->pBody); + pMultipart->pNext->pBody = NULL; + + free(pMultipart->pNext); + + pMultipart->pNext = NULL; + break; + } + } + pMultipart = pMultipart->pNext; + } + } else { + if (pMmsMsg->msgBody.size > 0) + pMmsMsg->nPartCount++; + } + + //call before processing urgent event. + _MmsInitHeader(); + _MmsUnregisterDecodeBuffer(); + + return true; + +__CATCH: + + _MmsInitHeader(); + _MmsUnregisterDecodeBuffer(); + + if (pFile != NULL) { + MsgCloseFile(pFile); + pFile = NULL; + } + + _MsgFreeBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type); + MSG_DEBUG("_MmsReadMsgBody: E N D ( fail ) ******************** \n"); + + return false; +} + +#ifdef MMS_DELIEVERY_IND_ENABLED +MmsMsgMultiStatus *MmsComposeDeliveryIndMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_ID_T msgId) +{ + MmsMsgMultiStatus *pStatus = NULL; + MmsMsgMultiStatus *pLastStatus = NULL; + bool bFound = false; + + MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); + MmsInitMsgType(&pMmsMsg->msgType); + MmsInitMsgBody(&pMmsMsg->msgBody); + + pMmsMsg->mmsAttrib.version = mmsHeader.version; + + pMmsMsg->mmsAttrib.pMultiStatus = MmsGetMultiStatus(msgId); + + pStatus = pMmsMsg->mmsAttrib.pMultiStatus; + + MSG_DEBUG("### pStatus->szTo = %s ###", pStatus->szTo); + + while (pStatus && !bFound) { + MSG_DEBUG("### MmsAddrUtilCompareAddr ###"); + MSG_DEBUG("### mmsHeader.pTo->szAddr = %s ###", mmsHeader.pTo->szAddr); + if (MmsAddrUtilCompareAddr(pStatus->szTo, mmsHeader.pTo->szAddr)) { + bFound = true; + break; + } + + pStatus = pStatus->pNext; + } + + if (bFound == false) { + MSG_DEBUG("### bFound == false ###"); + /* Queue the delivery report --------------------------- */ + + pStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus)); + memset(pStatus, 0, sizeof(MmsMsgMultiStatus)); + + pStatus->readStatus = MMS_READSTATUS_NONE; + + memset(pStatus->szTo, 0, MSG_ADDR_LEN + 1); + strncpy(pStatus->szTo, mmsHeader.pTo->szAddr, MSG_ADDR_LEN); + + if (pMmsMsg->mmsAttrib.pMultiStatus == NULL) { + /* first delivery report */ + pMmsMsg->mmsAttrib.pMultiStatus = pStatus; + } else { + pLastStatus = pMmsMsg->mmsAttrib.pMultiStatus; + while (pLastStatus->pNext) { + pLastStatus = pLastStatus->pNext; + } + + pLastStatus->pNext = pStatus; + pLastStatus = pStatus; + } + } + + pStatus->handledTime = mmsHeader.date; + pStatus->msgStatus = mmsHeader.msgStatus; + pStatus->bDeliveryReportIsRead = false; + + _MmsDataUpdateLastStatus(pMmsMsg); + + pStatus->bDeliveyrReportIsLast = true; + + return pStatus; +} +#endif + +void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, MSG_MESSAGE_ID_T selectedMsgId) +{ + struct tm *timeInfo = NULL; + time_t RawTime = 0; + time_t nTimeInSecs = 0; + + MmsInitMsgAttrib(&pMmsMsg->mmsAttrib); + MmsInitMsgType(&pMmsMsg->msgType); + MmsInitMsgBody(&pMmsMsg->msgBody); + + // setting mmsMsg structure + pMmsMsg->mailbox = pMsgInfo->folderId; + pMmsMsg->msgID = pMsgInfo->msgId; + + memset(pMmsMsg->szTrID, 0, MMS_TR_ID_LEN + 1); + memset(pMmsMsg->szContentLocation, 0, MMS_LOCATION_LEN + 1); + memset(pMmsMsg->szForwardMsgID, 0, MMS_MSG_ID_LEN + 1); + + pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT; + + // setting date + time(&RawTime); + timeInfo = localtime(&RawTime); + nTimeInSecs = mktime(timeInfo); + pMmsMsg->mmsAttrib.date = nTimeInSecs; + + // setting szMsgId + MmsPluginStorage::instance()->getMmsMessageId(selectedMsgId, pMmsMsg); + + //setting subject + strcpy(pMmsMsg->mmsAttrib.szSubject, pMsgInfo->subject); + + //setting adddress + MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo); + + if (pMmsMsg->mmsAttrib.szTo) + strncpy(pMmsMsg->mmsAttrib.szFrom, pMmsMsg->mmsAttrib.szTo, strlen(pMmsMsg->mmsAttrib.szTo)); +} + +int MmsSearchMsgId(char *toNumber, char *szMsgID) +{ + MSG_BEGIN(); + + int msgId; + + msgId = MmsPluginStorage::instance()->searchMsgId(toNumber, szMsgID); + + if (msgId < 0) + return 0; + + MSG_END(); + + return msgId; +} + +void MmsUpdateDeliveryReport(MSG_MESSAGE_ID_T msgId, MmsMsgMultiStatus *pStatus) +{ + MSG_BEGIN(); + + MmsPluginStorage::instance()->updateDeliveryReport(msgId, pStatus); + + MSG_END(); +} + +void MmsUpdateReadReport(MSG_MESSAGE_ID_T msgId, MmsMsgMultiStatus *pStatus) +{ + MSG_BEGIN(); + + MmsPluginStorage::instance()->updateReadReport(msgId, pStatus); + + MSG_END(); +} + +MmsMsgMultiStatus *MmsGetMultiStatus(MSG_MESSAGE_ID_T msgId) +{ + MmsMsgMultiStatus *pMultiStatus; + + pMultiStatus = MmsPluginStorage::instance()->getMultiStatus(msgId); + + MSG_DEBUG("### szTo = %s ###", pMultiStatus->szTo); + + MSG_END(); + + return pMultiStatus; +} + +bool MmsCheckAdditionalMedia(MMS_MESSAGE_DATA_S *pMsgData, MsgType *partHeader) +{ + if (_MsgMmsFindMatchedMedia(pMsgData, partHeader->param.szFileName)) + return false; + else + return true; +} + +#ifdef __SUPPORT_DRM__ +bool __MsgInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo) +{ + pMsgDrmInfo->contentType = MIME_UNKNOWN; + pMsgDrmInfo->drmType = MSG_DRM_TYPE_NONE; + + pMsgDrmInfo->szContentName = NULL; + pMsgDrmInfo->szContentURI = NULL; + pMsgDrmInfo->szContentDescription = NULL; + pMsgDrmInfo->szContentVendor = NULL; + pMsgDrmInfo->szRightIssuer = NULL; + pMsgDrmInfo->szDrm2FullPath = NULL; + pMsgDrmInfo->roWaitingTimerMax = 0; + pMsgDrmInfo->bFwdLock = false; + pMsgDrmInfo->bNoScreen = false; + pMsgDrmInfo->bNoRingTone = false; + pMsgDrmInfo->pszContentType = NULL; + + return true; +} +#endif diff --git a/plugin/mms_plugin/MmsPluginSMILValidate.cpp b/plugin/mms_plugin/MmsPluginSMILValidate.cpp new file mode 100755 index 0000000..8c31c63 --- /dev/null +++ b/plugin/mms_plugin/MmsPluginSMILValidate.cpp @@ -0,0 +1,506 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MmsPluginSMILValidate.h" +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MmsPluginSmil.h" +#include "MsgMmsMessage.h" + +#define MSG_RETURN_VAL_IF_FAIL(Expr, Val) \ + if (!(Expr)) { \ + MSG_DEBUG("%s:[%s] Failed - %d\n", __FUNCTION__, __LINE__, Val); \ + return Val; \ + }; + +MSG_SMIL_ERR_E MsgMMSCreateSMIL(MMS_MESSAGE_DATA_S *pMsgData) +{ + MSG_BEGIN(); + + MSG_SMIL_ERR_E eRet = MSG_SMIL_ERR_UNKNOWN; + bool bRegAdded = false; + + MSG_RETURN_VAL_IF_FAIL((pMsgData!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + MSG_RETURN_VAL_IF_FAIL((strlen(pMsgData->szSmilFilePath)> 0), MSG_SMIL_ERR_INVALID_SMIL_FILE_PATH); + + eRet = _MsgMMSValidateSMILRootLayout(pMsgData); + if (eRet != MSG_SMIL_SUCCESS) { + MSG_DEBUG("MsgMMSCreateSMIL: Root Layout Information Invalid eRet =%d\n", eRet); + return eRet; + } + + eRet = _MsgMMSValidateSMILRegion(pMsgData, &bRegAdded); + if (eRet != MSG_SMIL_SUCCESS) { + MSG_DEBUG("MsgMMSCreateSMIL: Region Information Invalid eRet =%d\n", eRet); + return eRet; + } + + eRet = _MsgMMSValidateSMILPage(pMsgData, bRegAdded); + if (eRet != MSG_SMIL_SUCCESS) { + MSG_DEBUG("MsgMMSCreateSMIL: Page Information Invalid eRet =%d\n", eRet); + return eRet; + } + + if (MMSGenerateSmilBuffer(pMsgData)) { + MSG_DEBUG("MsgMMSCreateSMIL: Generate SMIL Buffer is success eRet =%d\n", eRet); + eRet = MSG_SMIL_SUCCESS; + } else { + MSG_DEBUG("MsgMMSCreateSMIL: Generate SMIL Buffer failed eRet =%d\n", eRet); + eRet = MSG_SMIL_ERR_UNKNOWN; + } + + MSG_END(); + return eRet; +} + +MSG_SMIL_ERR_E _MsgMMSValidateSMILRootLayout(MMS_MESSAGE_DATA_S *pMsgData) +{ + MSG_BEGIN(); + + MSG_SMIL_ERR_E eRet = MSG_SMIL_ERR_INVALID_ROOTLAYOUT; + + MSG_RETURN_VAL_IF_FAIL((pMsgData!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + + if ((pMsgData->rootlayout.width.value > 0) && + (pMsgData->rootlayout.height.value> 0)) { + if (pMsgData->rootlayout.width.bUnitPercent == pMsgData->rootlayout.height.bUnitPercent) { + MSG_DEBUG("_MsgMMSValidateSMILRootLayout: Root Layout Information Valid \n"); + eRet = MSG_SMIL_SUCCESS; + } + } else { + MSG_DEBUG("_MsgMMSValidateSMILRootLayout: Root Layout Information not Present \n"); + eRet = _MsgMMSAddDefaultSMILRootLayout(pMsgData); + } + + MSG_END(); + return eRet; +} + +MSG_SMIL_ERR_E _MsgMMSAddDefaultSMILRootLayout(MMS_MESSAGE_DATA_S *pMsgData) +{ + MSG_BEGIN(); + + char *pContent = (char *)MSG_SMIL_ROOT_LAYOUT_BG_COLOR; + + MSG_RETURN_VAL_IF_FAIL((pMsgData!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + + pMsgData->rootlayout.width.value = MSG_SMIL_ROOT_LAYOUT_WIDTH; + pMsgData->rootlayout.width.bUnitPercent = MSG_SMIL_ROOT_LAYOUT_IN_PERCENT; + + pMsgData->rootlayout.height.value = MSG_SMIL_ROOT_LAYOUT_HEIGHT; + pMsgData->rootlayout.height.bUnitPercent = MSG_SMIL_ROOT_LAYOUT_IN_PERCENT; + + pMsgData->rootlayout.bgColor = MmsSmilAtoIHexa((char *)&pContent[1]); + + MSG_END(); + return MSG_SMIL_SUCCESS; +} + +MSG_SMIL_ERR_E _MsgMMSValidateSMILRegion(MMS_MESSAGE_DATA_S *pMsgData, bool *pbRegAdded) +{ + MSG_BEGIN(); + + MSG_SMIL_ERR_E eRet = MSG_SMIL_ERR_INVALID_REGION_INFO; + + MSG_RETURN_VAL_IF_FAIL((pMsgData!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + MSG_RETURN_VAL_IF_FAIL((pbRegAdded!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + + if (pMsgData->regionCnt == 0) { + bool bTextReg = MSG_SMIL_TEXT_ON_TOP; + bool bfullReg = false; + bool btwoReg = false; + + MSG_DEBUG("_MsgMMSValidateSMILRegion: Region Information not Present \n"); + + for (int PgIdx = 0; PgIdx < pMsgData->pageCnt; ++PgIdx) { + MMS_PAGE_S *pPage = _MsgMmsGetPage(pMsgData, PgIdx); + int nMediaCnt = 0; + + MSG_RETURN_VAL_IF_FAIL((NULL != pPage), MSG_SMIL_ERR_INVALID_PAGE_INFO); + + for (int MediaIdx = 0; MediaIdx < pPage->mediaCnt; ++MediaIdx) { + MMS_MEDIA_S *pMedia = _MsgMmsGetMedia(pPage, MediaIdx); + + MSG_RETURN_VAL_IF_FAIL((NULL != pMedia), MSG_SMIL_ERR_INVALID_PAGE_INFO); + + if (pMedia->mediatype != MMS_SMIL_MEDIA_AUDIO) + nMediaCnt++; + } + + if (nMediaCnt == 1) + bfullReg = true; + else if (nMediaCnt == 2) + btwoReg = true; + else if (nMediaCnt > 2) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Region Information\n"); + eRet = MSG_SMIL_ERR_INVALID_PAGE_INFO; + return eRet; + } + } + + if (bfullReg) { + eRet = _MsgMMSAddDefaultFullSMILRegion(pMsgData); + if (eRet != MSG_SMIL_SUCCESS) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Region Information\n"); + return eRet; + } + } + if (btwoReg) { + eRet = _MsgMMSAddDefaultFirstSMILRegion(pMsgData, bTextReg); + if (eRet != MSG_SMIL_SUCCESS) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Region Information\n"); + return eRet; + } + + eRet = _MsgMMSAddDefaultSecondSMILRegion(pMsgData,!bTextReg); + if (eRet != MSG_SMIL_SUCCESS) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Region Information\n"); + return eRet; + } + } + *pbRegAdded = true; + eRet = MSG_SMIL_SUCCESS; + } else { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Region Information Present \n"); + + for (int Idx = 0; Idx< pMsgData->regionCnt; ++Idx) { + MMS_SMIL_REGION *pRegion = _MsgMmsGetSmilRegion(pMsgData, Idx); + + if ((pRegion->width.value == 0) || + (pRegion->height.value == 0)) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Region information\n"); + + return eRet; + } + + if (pMsgData->rootlayout.width.bUnitPercent == true) { + if ((pRegion->width.value > 100) || + (pRegion->height.value > 100) || + (pRegion->nLeft.value > 100) || + (pRegion->nTop.value > 100)) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Region and root layout information does not map\n"); + + return eRet; + } + } else { + if (((pRegion->width.bUnitPercent == true) && (pRegion->width.value > 100)) || + ((pRegion->height.bUnitPercent == true) && (pRegion->height.value > 100)) || + ((pRegion->nLeft.bUnitPercent == true) && (pRegion->nLeft.value > 100)) || + ((pRegion->nTop.bUnitPercent == true) && (pRegion->nTop.value > 100))) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Region information\n"); + + return eRet; + } + } + } + + eRet = MSG_SMIL_SUCCESS; + } + + MSG_END(); + return eRet; +} + +MSG_SMIL_ERR_E _MsgMMSAddDefaultFirstSMILRegion(MMS_MESSAGE_DATA_S *pMsgData, bool bTextReg) +{ + MSG_BEGIN(); + + MSG_SMIL_ERR_E eRet = MSG_SMIL_ERR_INVALID_REGION_INFO; + MMS_SMIL_REGION *pRegion = NULL; + char *pszfit = (char *)MSG_SMIL_REG_FIT_TYPE; + char *pContent = (char *)MSG_SMIL_REG_BG_COLOR; + + MSG_RETURN_VAL_IF_FAIL((pMsgData!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + pRegion = (MMS_SMIL_REGION *)calloc(sizeof(MMS_SMIL_REGION), 1); + + if (pRegion == NULL) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Memory Allocation failed\n"); + return eRet; + } + + if (!strcmp(pszfit, "meet")) + pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET; + else + pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN; + pRegion->bgColor = MmsSmilAtoIHexa((char *)&pContent[1]); + + pRegion->nLeft.value = MSG_SMIL_FIRST_REG_LEFT; + pRegion->nLeft.bUnitPercent = true; + pRegion->nTop.value = MSG_SMIL_FIRST_REG_TOP; + pRegion->nTop.bUnitPercent = true; + pRegion->width.value = MSG_SMIL_FIRST_REG_WIDTH; + pRegion->width.bUnitPercent = true; + pRegion->height.value = MSG_SMIL_FIRST_REG_HEIGHT; + pRegion->height.bUnitPercent = true; + + if (bTextReg) + snprintf(pRegion->szID, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_TXT_REG); + else + snprintf(pRegion->szID, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_IMG_REG); + + if (_MsgMmsAddRegion(pMsgData,pRegion) != MSG_SUCCESS) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Add Region failed\n"); + free(pRegion); + + return eRet; + } + + eRet = MSG_SMIL_SUCCESS; + + MSG_END(); + return eRet; +} + +MSG_SMIL_ERR_E _MsgMMSAddDefaultSecondSMILRegion(MMS_MESSAGE_DATA_S *pMsgData, bool bTextReg) +{ + MSG_BEGIN(); + + MSG_SMIL_ERR_E eRet = MSG_SMIL_ERR_INVALID_REGION_INFO; + MMS_SMIL_REGION *pRegion = NULL; + char *pszfit = (char *)MSG_SMIL_REG_FIT_TYPE; + char *pContent = (char *)MSG_SMIL_REG_BG_COLOR; + + MSG_RETURN_VAL_IF_FAIL((pMsgData!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + pRegion = (MMS_SMIL_REGION *)calloc(sizeof(MMS_SMIL_REGION), 1); + + if (pRegion == NULL) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Memory Allocation failed\n"); + return eRet; + } + + if (!strcmp(pszfit, "meet")) + pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET; + else + pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN; + pRegion->bgColor = MmsSmilAtoIHexa((char *)&pContent[1]); + + pRegion->nLeft.value = MSG_SMIL_SECOND_REG_LEFT; + pRegion->nLeft.bUnitPercent = true; + pRegion->nTop.value = MSG_SMIL_SECOND_REG_TOP; + pRegion->nTop.bUnitPercent = true; + pRegion->width.value = MSG_SMIL_SECOND_REG_WIDTH; + pRegion->width.bUnitPercent = true; + pRegion->height.value = MSG_SMIL_SECOND_REG_HEIGHT; + pRegion->height.bUnitPercent = true; + + if (bTextReg) + snprintf(pRegion->szID, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_TXT_REG); + else + snprintf(pRegion->szID, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_IMG_REG); + + if (_MsgMmsAddRegion(pMsgData,pRegion) != MSG_SUCCESS) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Add Region failed\n"); + free(pRegion); + + return eRet; + } + + eRet = MSG_SMIL_SUCCESS; + + MSG_END(); + return eRet; +} + +MSG_SMIL_ERR_E _MsgMMSAddDefaultFullSMILRegion(MMS_MESSAGE_DATA_S *pMsgData) +{ + MSG_BEGIN(); + + MSG_SMIL_ERR_E eRet = MSG_SMIL_ERR_INVALID_REGION_INFO; + MMS_SMIL_REGION *pRegion = NULL; + char *pszfit = (char *)MSG_SMIL_REG_FIT_TYPE; + char *pContent = (char *)MSG_SMIL_REG_BG_COLOR; + + MSG_RETURN_VAL_IF_FAIL((pMsgData!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + pRegion = (MMS_SMIL_REGION *)calloc(sizeof(MMS_SMIL_REGION), 1); + + if (pRegion == NULL) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Memory Allocation failed\n"); + return eRet; + } + + if (!strcmp(pszfit, "meet")) + pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET; + else + pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN; + pRegion->bgColor = MmsSmilAtoIHexa((char *)&pContent[1]); + + pRegion->nLeft.value = MSG_SMIL_FULL_REG_LEFT; + pRegion->nLeft.bUnitPercent = true; + pRegion->nTop.value = MSG_SMIL_FULL_REG_TOP; + pRegion->nTop.bUnitPercent = true; + pRegion->width.value = MSG_SMIL_FULL_REG_WIDTH; + pRegion->width.bUnitPercent = true; + pRegion->height.value = MSG_SMIL_FULL_REG_HEIGHT; + pRegion->height.bUnitPercent = true; + + snprintf(pRegion->szID, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_FULL_REG); + + if (_MsgMmsAddRegion(pMsgData,pRegion) != MSG_SUCCESS) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Add Region failed\n"); + free(pRegion); + + return eRet; + } + + eRet = MSG_SMIL_SUCCESS; + + MSG_END(); + return eRet; +} + +MSG_SMIL_ERR_E _MsgMMSValidateSMILPage(MMS_MESSAGE_DATA_S *pMsgData, bool bRegAdded) +{ + MSG_BEGIN(); + + MSG_SMIL_ERR_E eRet = MSG_SMIL_ERR_INVALID_PAGE_INFO; + + MSG_RETURN_VAL_IF_FAIL((pMsgData!= NULL), MSG_SMIL_ERR_INVALID_PARAM); + MSG_RETURN_VAL_IF_FAIL((pMsgData->pageCnt > 0), eRet); + + for (int PgIdx = 0; PgIdx < pMsgData->pageCnt; ++PgIdx) { + MMS_PAGE_S *pPage = _MsgMmsGetPage(pMsgData, PgIdx); + int PageRegionCnt = 0; + int PageRegionIdx = 0; + bool bVidExists = false; + bool bImgExists = false; + bool bTxtExists = false; + bool bAudExists = false; + bool bImgOrVidExists = false; + bool bResetRegion = false; + + MSG_RETURN_VAL_IF_FAIL((NULL != pPage), MSG_SMIL_ERR_INVALID_PAGE_INFO); + MSG_RETURN_VAL_IF_FAIL((pPage->nDur >= 0), MSG_SMIL_ERR_INVALID_PAGE_DUR); + + for (int MediaIdx = 0; MediaIdx < pPage->mediaCnt; ++MediaIdx) { + MMS_MEDIA_S *pMedia = _MsgMmsGetMedia(pPage, MediaIdx); + + MSG_RETURN_VAL_IF_FAIL((NULL != pMedia), MSG_SMIL_ERR_INVALID_PAGE_INFO); + + bResetRegion = false; + if ((pMedia->mediatype != MMS_SMIL_MEDIA_AUDIO)) { + if (bRegAdded) { + bResetRegion = true; + } else if ((strlen(pMedia->regionId) == 0)) { + MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Region Information\n"); + return MSG_SMIL_ERR_INVALID_REGION_INFO; + } + PageRegionCnt++; + } + } + + for (int MediaIdx = 0; MediaIdx < pPage->mediaCnt; ++MediaIdx) { + MMS_MEDIA_S *pMedia = _MsgMmsGetMedia(pPage, MediaIdx); + + MSG_RETURN_VAL_IF_FAIL((NULL != pMedia), MSG_SMIL_ERR_INVALID_PAGE_INFO); + 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; + } + break; + 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; + } + break; + 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; + } + break; + 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"); + return eRet; + } + + if (bResetRegion) { + if (PageRegionCnt > 1) { + if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) { + memset(pMedia->regionId,0x00, MAX_SMIL_REGION_ID); + continue; + } + + if (pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) + snprintf(pMedia->regionId, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_TXT_REG); + else + snprintf(pMedia->regionId, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_IMG_REG); + } else + snprintf(pMedia->regionId, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_FULL_REG); + } + PageRegionIdx++; + } + } + + eRet = MSG_SMIL_SUCCESS; + + MSG_END(); + + return eRet; +} + diff --git a/plugin/mms_plugin/MmsPluginSmil.cpp b/plugin/mms_plugin/MmsPluginSmil.cpp new file mode 100755 index 0000000..635213a --- /dev/null +++ b/plugin/mms_plugin/MmsPluginSmil.cpp @@ -0,0 +1,2174 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include "MmsPluginSmil.h" +#include "MmsPluginMessage.h" +#include "MmsPluginStorage.h" +#include "MsgDebug.h" +#include "MmsPluginCodec.h" +#include "MsgMmsMessage.h" + +#include "MsgTypes.h" +#include "MmsPluginSetup.h" +#include "MsgUtilFile.h" + +/* static variables */ +static char gszEmptyRawDoc[] = ""; +static MmsSmilDoc *__gpaMmsSmilDoc[MMS_SMIL_MAX_DOC]={NULL, }; +static char gszColor[MMS_SMIL_COLOR_SIZE] = {0, }; + + +char *MmsSmilGetPresentationData(MSG_MESSAGE_ID_T msgId) +{ + MmsMsg *pMsg; + + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + + if (pMsg == NULL) { + MSG_DEBUG("pMsg is NULL"); + goto _LCATCH; + } + + if (msgId != pMsg->msgID) { + MSG_DEBUG("Invalid Message Id"); + return NULL; + } + + if (!pMsg->msgBody.pPresentationBody) + goto _LCATCH; + + if (!pMsg->msgBody.pPresentationBody->body.pText) + goto _LCATCH; + else + return pMsg->msgBody.pPresentationBody->body.pText; + +_LCATCH: + return NULL; +} + +bool MmsSmilParseSmilDoc(MMS_MESSAGE_DATA_S *pMmsMsg, char *pSmilDoc) +{ + xmlDocPtr doc; + xmlNodePtr cur; + MSG_DEBUG("%s", pSmilDoc); + doc = xmlParseMemory(pSmilDoc, strlen(pSmilDoc)); + + if (doc == NULL) { + MSG_DEBUG("Document not parsed successfully. \n"); + return false; + } + + cur = xmlDocGetRootElement(doc); + + if (cur == NULL) { + MSG_DEBUG("empty document\n"); + xmlFreeDoc(doc); + return false; + } + + if (xmlStrcmp(cur->name, (const xmlChar *) "smil")) { + MSG_DEBUG("document of the wrong type, root node != smil"); + xmlFreeDoc(doc); + return false; + } + + MmsSmilGetElement(pMmsMsg, cur); + + xmlFreeDoc(doc); + + return true; +} + +void MmsSmilGetElement(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node) +{ + MSG_BEGIN(); + + int elementType; + int attrType; + MMS_SMIL_ROOTLAYOUT rootlayout = {}; + static bool cmd[ELEMENT_MAX] = {false, }; + static MMS_SMIL_REGION *pRegion; + static MMS_PAGE_S *pPage; + static MMS_MEDIA_S *pMedia; + static MMS_SMIL_TRANSITION *pTransition; + static MMS_SMIL_META *pMeta; + + xmlNode *cur_node = NULL; + + for (cur_node = a_node; cur_node; cur_node = cur_node->next) { + MSG_DEBUG("******* node, name: %s ***\n", cur_node->name); + + if (cur_node->type == XML_ELEMENT_NODE) { + // Get Smil Element ===================================================== + MSG_DEBUG("*** node type: Element, name: %s ***\n", cur_node->name); + + switch (elementType = MmsSmilGetElementID((char *)cur_node->name)) { + case ELEMENT_ROOTLAYOUT: + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_ROOTLAYOUT] = true; + break; + + case ELEMENT_REGION: + pRegion = (MMS_SMIL_REGION *)calloc(sizeof(MMS_SMIL_REGION), 1); + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_REGION] = true; + break; + + case ELEMENT_TRANSITION: + pTransition = (MMS_SMIL_TRANSITION *)calloc(sizeof(MMS_SMIL_TRANSITION), 1); + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_TRANSITION] = true; + break; + + case ELEMENT_META: + pMeta = (MMS_SMIL_META *)calloc(sizeof(MMS_SMIL_META), 1); + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_META] = true; + break; + + case ELEMENT_PAR: + pPage = (MMS_PAGE_S *)calloc(sizeof(MMS_PAGE_S), 1); + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_PAR] = true; + break; + + case ELEMENT_PARAM: // Need to check the original element type + break; + + case ELEMENT_TEXT: + pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); + pMedia->mediatype = MMS_SMIL_MEDIA_TEXT; + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_TEXT] = true; + break; + + case ELEMENT_IMG: + pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); + pMedia->mediatype = MMS_SMIL_MEDIA_IMG; + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_IMG] = true; + break; + + case ELEMENT_AUDIO: + pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); + pMedia->mediatype = MMS_SMIL_MEDIA_AUDIO; + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_AUDIO] = true; + break; + + case ELEMENT_VIDEO: + pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); + pMedia->mediatype = MMS_SMIL_MEDIA_VIDEO; + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_VIDEO] = true; + break; + + case ELEMENT_REF: + pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); + pMedia->mediatype = MMS_SMIL_MEDIA_IMG_OR_VIDEO; + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_REF] = true; + break; + + case ELEMENT_ANIMATE: + pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); + pMedia->mediatype = MMS_SMIL_MEDIA_ANIMATE; + memset(cmd, 0, ELEMENT_MAX); + cmd[ELEMENT_ANIMATE] = true; + break; + + default: + memset(cmd, 0, ELEMENT_MAX); + break; + } + + //Get Smil Attribute ===================================================== + xmlAttr *pAttr = cur_node->properties; + SMIL_ATTRIBUTE_T paramType = ATTRIBUTE_UNKNOWN; + + for ( ; pAttr; pAttr = pAttr->next) { + MSG_DEBUG("AttributeType: (%s, %s) ", pAttr->name, pAttr->children->content); + switch (attrType = MmsSmilGetAttrID((char *)pAttr->name)) { + case ATTRIBUTE_ID: + { + if (cmd[ELEMENT_REGION]) { + strncpy(pRegion->szID, (char *)pAttr->children->content, MAX_SMIL_REGION_ID - 1); + } else if (cmd[ELEMENT_TRANSITION]) { + strncpy(pTransition->szID, (char *)pAttr->children->content, MAX_SMIL_TRANSITION_ID - 1); + } else if (cmd[ELEMENT_META]) { + strncpy(pMeta->szID, (char *)pAttr->children->content, MAX_SMIL_META_ID - 1); + } + } + break; + + case ATTRIBUTE_TOP: + { + int bUnitPercent; + int value; + + if (strchr((char *)pAttr->children->content, '%')) + bUnitPercent = true; + else + bUnitPercent = false; + + value = atoi((char *)pAttr->children->content); + + if (cmd[ELEMENT_REGION]) { + pRegion->nTop.bUnitPercent = bUnitPercent; + pRegion->nTop.value = value; + } + } + break; + + case ATTRIBUTE_LEFT: + { + int bUnitPercent; + int value; + + if (strchr((char *)pAttr->children->content, '%')) + bUnitPercent = true; + else + bUnitPercent = false; + + value = atoi((char *)pAttr->children->content); + + if (cmd[ELEMENT_REGION]) { + pRegion->nLeft.bUnitPercent = bUnitPercent; + pRegion->nLeft.value = value; + } + } + break; + + + case ATTRIBUTE_WIDTH: + { + int bUnitPercent; + int value; + + if (strchr((char *)pAttr->children->content, '%')) + bUnitPercent = true; + else + bUnitPercent = false; + + value = atoi((char *)pAttr->children->content); + + if (cmd[ELEMENT_ROOTLAYOUT]) { + rootlayout.width.bUnitPercent = bUnitPercent; + rootlayout.width.value = value; + } else if (cmd[ELEMENT_REGION]) { + pRegion->width.bUnitPercent = bUnitPercent; + pRegion->width.value = value; + } + } + break; + + case ATTRIBUTE_HEIGHT: + { + int bUnitPercent; + int value; + + if (strchr((char *)pAttr->children->content, '%')) + bUnitPercent = true; + else + bUnitPercent = false; + + value = atoi((char *)pAttr->children->content); + + if (cmd[ELEMENT_ROOTLAYOUT]) { + rootlayout.height.bUnitPercent = bUnitPercent; + rootlayout.height.value = value; + } else if (cmd[ELEMENT_REGION]) { + pRegion->height.bUnitPercent = bUnitPercent; + pRegion->height.value = value; + } + } + break; + + case ATTRIBUTE_FIT: + if (cmd[ELEMENT_REGION]) { + if (!strcmp((char *)pAttr->children->content, "meet")) { + pRegion->fit = MMSUI_IMAGE_REGION_FIT_MEET; + } else { + pRegion->fit = MMSUI_IMAGE_REGION_FIT_HIDDEN; + } + } + break; + + case ATTRIBUTE_BGCOLOR: + if (cmd[ELEMENT_ROOTLAYOUT]) + rootlayout.bgColor = MmsSmilGetColorValue(pAttr->children->content); + else if (cmd[ELEMENT_REGION]) + pRegion->bgColor = MmsSmilGetColorValue(pAttr->children->content); + else if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nBgColor = MmsSmilGetColorValue(pAttr->children->content); + else + pMedia->sMedia.sAVI.nBgColor = MmsSmilGetColorValue(pAttr->children->content); + + break; + + case ATTRIBUTE_DUR: + if (cmd[ELEMENT_PAR]) + pPage->nDur = MmsSmilGetTime((char *)pAttr->children->content); + else if (cmd[ELEMENT_TRANSITION]) + pTransition->nDur = MmsSmilGetTime((char *)pAttr->children->content); + else if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nDurTime = MmsSmilGetTime((char *)pAttr->children->content); + else + pMedia->sMedia.sAVI.nDurTime = MmsSmilGetTime((char *)pAttr->children->content); + +#ifdef MMS_SMIL_ANIMATE + if (cmd[ELEMENT_ANIMATE]) + pMedia->sMedia.sAVI.nDur = MmsSmilGetTime((char *)pAttr->children->content); +#endif + break; + + case ATTRIBUTE_SRC: + { + char *szSrc; + char szTmpSrc[MSG_FILEPATH_LEN_MAX] = {0,}; + char szOutBuf[MSG_FILEPATH_LEN_MAX] = {0, }; + int cLen; + MsgMultipart *pPart = NULL; + MmsMsg *pMsg; + + szSrc = MsgChangeHexString((char *)pAttr->children->content); + + memcpy(pMedia->szSrc, szSrc, strlen(szSrc) + 1); + free(szSrc); + + cLen = strlen(pMedia->szSrc); + if (!strncasecmp(pMedia->szSrc, "cid:", 4)) { + strncpy(szTmpSrc, pMedia->szSrc + 4, cLen - 4); + szTmpSrc[cLen - 4] = '\0'; + } else { + strncpy(szTmpSrc, pMedia->szSrc, cLen); + szTmpSrc[cLen] = '\0'; + } + + MmsPluginStorage::instance()->getMmsMessage(&pMsg); + pPart = pMsg->msgBody.body.pMultipart; +#ifndef __SUPPORT_DRM__ + MmsSmilGetMediaSrcForNormalMsg(szOutBuf, szTmpSrc, pPart); +#else + MmsSmilGetMediaSrcForNormalMsg(szOutBuf, szTmpSrc, pPart, pMedia); +#endif + + strcpy(pMedia->szSrc, szOutBuf); + MmsSmilGetMediaFilePath(pMedia, szTmpSrc, pMsg->msgID); + } + break; + + case ATTRIBUTE_COLOR: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nColor = MmsSmilGetColorValue(pAttr->children->content); + break; + + case ATTRIBUTE_SIZE: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nSize = atoi((char *)pAttr->children->content); + break; + + case ATTRIBUTE_BOLD: + if (cmd[ELEMENT_TEXT]) { + pMedia->sMedia.sText.bBold = MmsSmilGetFontAttrib((char *)pAttr->children->content); + } + break; + + case ATTRIBUTE_UNDERLINE: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.bUnderLine = MmsSmilGetFontAttrib((char *)pAttr->children->content); + break; + + case ATTRIBUTE_ITALIC: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.bItalic = MmsSmilGetFontAttrib((char *)pAttr->children->content); + break; + + case ATTRIBUTE_REVERSE: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.bReverse = MmsSmilGetFontAttrib((char *)pAttr->children->content); + break; + + case ATTRIBUTE_DIRECTION: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nDirection = MmsSmilGetFontDirection((char *)pAttr->children->content); + break; + + case ATTRIBUTE_REGION: + strncpy(pMedia->regionId, (char *)pAttr->children->content, MAX_SMIL_REGION_ID - 1); + break; + + case ATTRIBUTE_TRANSIN: + if (cmd[ELEMENT_TEXT]) + strncpy(pMedia->sMedia.sText.szTransInId, (char *)pAttr->children->content, MAX_SMIL_TRANSIN_ID - 1); + else + strncpy(pMedia->sMedia.sAVI.szTransInId, (char *)pAttr->children->content, MAX_SMIL_TRANSIN_ID - 1); + break; + + case ATTRIBUTE_TRANSOUT: + if (cmd[ELEMENT_TEXT]) + strncpy(pMedia->sMedia.sText.szTransOutId, (char *)pAttr->children->content, MAX_SMIL_TRANSOUT_ID - 1); + else + strncpy(pMedia->sMedia.sAVI.szTransOutId, (char *)pAttr->children->content, MAX_SMIL_TRANSOUT_ID - 1); + break; + + case ATTRIBUTE_BEGIN: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nBegin = MmsSmilGetTime((char *)pAttr->children->content); + else + pMedia->sMedia.sAVI.nBegin = MmsSmilGetTime((char *)pAttr->children->content); + break; + + case ATTRIBUTE_END: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nEnd = MmsSmilGetTime((char *)pAttr->children->content); + else + pMedia->sMedia.sAVI.nEnd = MmsSmilGetTime((char *)pAttr->children->content); + break; + + case ATTRIBUTE_REPEAT_COUNT: + if (cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nRepeat = atoi((char *)pAttr->children->content); + else + pMedia->sMedia.sAVI.nRepeat = atoi((char *)pAttr->children->content); + break; + + case ATTRIBUTE_NAME: + if (!strcmp((char *)pAttr->children->content, "foreground-color") || !strcmp((char *)pAttr->children->content, "foregroundcolor")) + paramType = ATTRIBUTE_FGCOLOR; + else if (!strcmp((char *)pAttr->children->content, "background-color") || !strcmp((char *)pAttr->children->content, "backgroundcolor")) + paramType = ATTRIBUTE_BGCOLOR; + else if (!strcmp((char *)pAttr->children->content, "textsize")) + paramType = ATTRIBUTE_SIZE; + else if (!strcmp((char *)pAttr->children->content, "textattribute")) + paramType = ATTRIBUTE_TEXTFORMAT; + + if (cmd[ELEMENT_META]) + strncpy(pMeta->szName, (char *)pAttr->children->content, MAX_SMIL_META_NAME - 1); + break; + + case ATTRIBUTE_VALUE: + if (paramType == ATTRIBUTE_SIZE && cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nSize = MmsSmilGetFontSizeValue((char *)pAttr->children->content); + else if (paramType == ATTRIBUTE_FGCOLOR && cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nColor = MmsSmilGetColorValue(pAttr->children->content); + else if (paramType == ATTRIBUTE_BGCOLOR && cmd[ELEMENT_TEXT]) + pMedia->sMedia.sText.nBgColor = MmsSmilGetColorValue(pAttr->children->content); + else if (paramType == ATTRIBUTE_TEXTFORMAT && cmd[ELEMENT_TEXT]) { + MmsSmilFontType fontType; + + fontType = MmsSmilGetFontTypeValue((char *)pAttr->children->content); + + if (fontType == MMS_SMIL_FONT_TYPE_BOLD) + pMedia->sMedia.sText.bBold = true; + else + pMedia->sMedia.sText.bBold = false; + + if (fontType == MMS_SMIL_FONT_TYPE_ITALIC) + pMedia->sMedia.sText.bItalic = true; + else + pMedia->sMedia.sText.bItalic = false; + + if (fontType == MMS_SMIL_FONT_TYPE_UNDERLINE) + pMedia->sMedia.sText.bUnderLine = true; + else + pMedia->sMedia.sText.bUnderLine = false; + } + break; + + case ATTRIBUTE_ALT: + strncpy(pMedia->szAlt, (char *)pAttr->children->content, MAX_SMIL_ALT_LEN - 1); + break; + + case ATTRIBUTE_TYPE: + pTransition->nType = (MmsSmilTransType)atoi((char *)pAttr->children->content); + + switch (pTransition->nType) { + case MMS_SMIL_TRANS_SLIDEWIPE: + pTransition->nSubType = MMS_SMIL_TRANS_SUB_FROM_LEFT; + break; + case MMS_SMIL_TRANS_BARWIPE: + pTransition->nSubType = MMS_SMIL_TRANS_SUB_TOP_TO_BOTTOM; + break; + case MMS_SMIL_TRANS_BARNDOORWIPE: + pTransition->nSubType = MMS_SMIL_TRANS_SUB_HORIZONTAL; + break; + default: + pTransition->nSubType = MMS_SMIL_TRANS_SUB_NONE; + break; + } + + break; + + case ATTRIBUTE_SUBTYPE: + pTransition->nSubType = (MmsSmilTransSubType)atoi((char *)pAttr->children->content); + break; + + case ATTRIBUTE_CONTENT: + strncpy(pMeta->szContent, (char *)pAttr->children->content, MAX_SMIL_META_CONTENT - 1); + break; +#ifdef MMS_SMIL_ANIMATE + case ATTRIBUTE_ATTRIBUTE_NAME: + strcpy(pMedia->sMedia.sAVI.nAttributeName, (char *)pAttr->children->content); + break; + + case ATTRIBUTE_ATTRIBUTE_TYPE: + strcpy(pMedia->sMedia.sAVI.nAttributeType, (char *)pAttr->children->content); + break; + + case ATTRIBUTE_TARGET_ELEMENT: + strcpy(pMedia->sMedia.sAVI.nTargetElement, (char *)pAttr->children->content); + break; + + case ATTRIBUTE_FROM: + pMedia->sMedia.sAVI.nFrom = atoi((char *)pAttr->children->content); + break; + + case ATTRIBUTE_TO: + pMedia->sMedia.sAVI.nTo = atoi((char *)pAttr->children->content); + break; + + case ATTRIBUTE_BY: + pMedia->sMedia.sAVI.nBy = atoi((char *)pAttr->children->content); + break; + + case ATTRIBUTE_VALUES: + pMedia->sMedia.sAVI.nValues = atoi((char *)pAttr->children->content); + break; + + case ATTRIBUTE_CALCMODE: + strcpy(pMedia->sMedia.sAVI.nCalcMode, (char *)pAttr->children->content); + break; +#endif + default: + MSG_DEBUG("Undefined Attribute was found!!!!!"); + } + } + + if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_REGION]) { + // Insert a region to region list + _MsgMmsAddRegion(pMmsMsg, pRegion); + } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_PAR]) { + //Insert a page to page list + _MsgMmsAddPage(pMmsMsg, pPage); + } else if (paramType == ATTRIBUTE_UNKNOWN && (cmd[ELEMENT_TEXT] ||cmd[ELEMENT_IMG] ||cmd[ELEMENT_AUDIO] ||cmd[ELEMENT_VIDEO] ||cmd[ELEMENT_ANIMATE])) { + //Insert a media to media list + _MsgMmsAddMedia(pPage, pMedia); + } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_ROOTLAYOUT]) { + _MsgMmsSetRootLayout(pMmsMsg, &rootlayout); + } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_TRANSITION]) { + //Insert a transition to transition list + _MsgMmsAddTransition(pMmsMsg, pTransition); + } else if (paramType == ATTRIBUTE_UNKNOWN && cmd[ELEMENT_META]) { + //Insert a meta to meta list + _MsgMmsAddMeta(pMmsMsg, pMeta); + } + + paramType = ATTRIBUTE_UNKNOWN; + } + + MmsSmilGetElement(pMmsMsg, cur_node->children); + } + + MSG_END(); +} + + +int MmsSmilGetColorValue(xmlChar *content) +{ + int color; + + if (content[0] == '#') // RGB value + color = MmsSmilAtoIHexa((char *)&content[1]); + else if (content[0] == '0' && (content[1] == 'x' || content[1] == 'X')) + color = MmsSmilAtoIHexa((char *)&content[2]); + else { + MSG_DEBUG("Invalid Color Value"); + color = -1; + } + + return color; +} + +int MmsSmilAtoIHexa(char *pInput) +{ + int res = 0; + int len = 0; + int temp = 1; + int i = 0; + int j = 0; + char *pOutput = NULL; + + MSG_DEBUG("__MmsSmilAtoIHexa() enter..\n"); + + len = strlen(pInput); + pOutput = (char *)malloc(len + 1); + + if (pOutput == NULL) { + MSG_DEBUG("__MmsSmilAtoIHexa: Memory full \n"); + goto __CATCH; + } + + memset(pOutput, 0, len + 1); + + for (i = len - 1; i >= 0; i--) { + for (j = 0; j < (len - 1 - i); j++) { + temp *= 16; + } + + switch (pInput[i]) { + case '0': + pOutput[i] = 0; + break; + + case '1': + pOutput[i] = 1; + break; + + case '2': + pOutput[i] = 2; + break; + + case '3': + pOutput[i] = 3; + break; + + case '4': + pOutput[i] = 4; + break; + + case '5': + pOutput[i] = 5; + break; + + case '6': + pOutput[i] = 6; + break; + + case '7': + pOutput[i] = 7; + break; + + case '8': + pOutput[i] = 8; + break; + + case '9': + pOutput[i] = 9; + break; + + case 'a': + case 'A': + pOutput[i] = 10; + break; + + case 'b': + case 'B': + pOutput[i] = 11; + break; + + case 'c': + case 'C': + pOutput[i] = 12; + break; + + case 'd': + case 'D': + pOutput[i] = 13; + break; + + case 'e': + case 'E': + pOutput[i] = 14; + break; + + case 'f': + case 'F': + pOutput[i] = 15; + break; + } + + res += (pOutput[i] * temp); + temp = 1; + } + +__CATCH: + + if (pOutput) { + free(pOutput); + pOutput = NULL; + } + + return res; +} + +int MmsSmilGetTime(char *pValue) +{ + char *pTemp = NULL; + bool bMSec = false; + int retVal = 0; + int i = 0; + int len = 0; + + if (pValue == NULL || pValue[0] == '\0') + return 0; + + len = strlen(pValue); + + /* Default time unit -> millisecond */ + if (strstr(pValue, "msec")) + bMSec = true; + + if (strstr(pValue, "ms")) + bMSec = true; + + pTemp = (char *)malloc(strlen(pValue) + 1); + + if (NULL == pTemp) { + MSG_DEBUG("__MmsSmilGet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3IR@xiq8_DP2j$ui-VNVdekO5(N&9tX H?tlN;#X-{m literal 0 HcmV?d00001 diff --git a/test_app/mms_files/Temp0_2.txt b/test_app/mms_files/Temp0_2.txt new file mode 100755 index 0000000..74c7dd8 --- /dev/null +++ b/test_app/mms_files/Temp0_2.txt @@ -0,0 +1 @@ +Test MMS Message \ No newline at end of file diff --git a/test_app/mms_files/Temp1_0.txt b/test_app/mms_files/Temp1_0.txt new file mode 100755 index 0000000..f6d6f92 --- /dev/null +++ b/test_app/mms_files/Temp1_0.txt @@ -0,0 +1 @@ +Second Slide \ No newline at end of file diff --git a/test_app/mms_files/V091120_104905.3gp b/test_app/mms_files/V091120_104905.3gp new file mode 100755 index 0000000000000000000000000000000000000000..7cdcb31318e617df57fc08f13e4fce9efd99fbec GIT binary patch literal 53258 zcmYIv1ymbdv^DNl+@)x7cc%r4Q?$6d6EwJMf#OiCxVsayXmKeTytrHN{PcV8t$)_a ztdTpJnU#I_IcM(^7#J9GD}av+kF^Ug3=ABMt-G`1+lTvq_F+)0+$=3&V1|etEldGO zBa+BS7kRHQX)ym5oP%eanB%0o9{pzEC6%k4yxC#m?Vn!>L4Ol(_OThi&%KSoD~ijF z17gI-{&Js4(U!eg8ABz{VD0^P#_n^XR+w!Xp_pb{EY4R^F>Wc^x5LlI14)7?-zbkK zBN8eLaZM_y|BZ!3EeJDhipfr#lgye%NWOJ04thK4j+&nW+fa{!(Sl?Q31stq8_7VE z{Gs^!a!Bf6gA=fwG#&VF9Mfo&FiU*>BGv1{Su>LN+pxEV0Vi<(L45JPwo+X(EmAyo zk?=OM&N=sS-XLAnIP-tTxcUpI&iM#ZwVc&f5{b4e?XjswrB)a|c2fM$`L{J&sah#p zoOBHGg!v|rXwY4U*OI)qhfY>YX1)$JhHFO|Wv}+oDAqCP|E_Q?weym*aJ424IJ!#8 zNa|175b_vL9f-YlO81B3i(4Mjf9vw3736jtKv`3xm{Q2pD}0&RXB zIP)LYUvB|AS3O12-X#d^JsGz?>->e1o>6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h1$`cb#nRN) z=^_Wd+^kH^{>-COd`+;!LB`15)Yc4~bji%l%HAC8Cvvm9xamKOL}&WPF$z;BGxRy= z5BfO1tCKCwANfo7on4G=LEhEb#rdMK|JV;PbLQlJ1oG(5Kkxa+o+3~s8IVN_`tv`} z_+$Uy-y|p$*dR0oca@S-RDs~4ucC2wadG~A&OP)FAkn{5%-^Zj@AU2ORQz`;0n$rA z{<)35{>ks-BEM5~5wU^%^Spmwhx4!F|J;`ReIN9F|9Rd2w*UWCuK%qZ|GXc%9_aIU z!AtqGeJ&ad?4ty77YIENW*}@p&@YM?2ym){hykGh*O`D6{XyUBAA*5C=6P}Ck1tR! ztUZu50-_C0{RGl?KtPNlWB>?yBm!j7Knm`4QC9GtuoggG35YNdbe+)WjDb`gh!7BdussS=g+KBa zb>;^9ropx{5FQ|$U>kj3^flTxFq0wD$0k|QAyDr-kpDJ2Iy<=9|MNEZYG8-yU$Y|?+wa-&y7M2iI-_$~q!3KVr5mER(Hoas(BBYjOrk3| z80dBb{q3*$4}B}?Kc<-fbNsUZYy5(1(DM=|c&8Y%K*0OO0R09%PBFl^!T|3N1N4`R z{0>Ob$3XwUyaEIpE+#$@c95S3vI+!!90#P}_{H@{ zAO&^7Bm@GgeDN%>4`T@k7$cZq>|%m(h~AG0`u)Xy&}BfE6O`kkT!$bR!USU%083K`%0k8E180XPooP*OsN>wn{J-}E8<*ILnKpOW!yQsUGx)^~}!PddV3Z#(RZ6IglV&!0OXm4a^ qhMo%k7BOcRCkJ~6J1Y|-TSH?9QxAxksi_tEWUy`T;9}+s`Tqckou>}~ literal 0 HcmV?d00001 diff --git a/test_app/mms_files/audio.amr b/test_app/mms_files/audio.amr new file mode 100755 index 0000000000000000000000000000000000000000..645ec5dc1aee04829fb88165df9cc78f457f2f8c GIT binary patch literal 8710 zcmWkzbzGBw7u|rt=n)R-(MU@Qex(^9CEYbjx>H(O`Jse_NJ$7N9nwfhsR#&&f*X?3 zDU$Erzn{JUD!i(+(7j6J+CS#v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o Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +extern "C" +{ + #include +} + +#include "MsgDebug.h" +#include "MsgUtilStorage.h" +#include "MsgGconfWrapper.h" +#include "MsgContact.h" + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +static bool isContactSvcOpened = false; + +MsgDbHandler ContactDbHandle; + +MsgContactChangeCB cbFunction = NULL; +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +static void MsgContactSvcCallback(void *pData) +{ + MSG_DEBUG("Contact Data is Changed!!!"); + + MsgSyncContact(); + + if (ContactDbHandle.disconnect() != MSG_SUCCESS) + { + MSG_DEBUG("DB Disconnect Fail"); + } +} + + +MSG_ERROR_T MsgOpenContactSvc() +{ + int errCode = CTS_SUCCESS; + + if(!isContactSvcOpened) + { + errCode = contacts_svc_connect(); + + if (errCode == CTS_SUCCESS) + { + MSG_DEBUG("Connect to Contact Service Success"); + isContactSvcOpened = true; + } + else + { + MSG_DEBUG("Connect to Contact Service Fail [%d]", errCode); + isContactSvcOpened = false; + return MSG_ERR_DB_CONNECT; + } + } + else + { + MSG_DEBUG("Already connected to Contact Service."); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgCloseContactSvc() +{ + int errCode = CTS_SUCCESS; + + if(isContactSvcOpened) + { + errCode = contacts_svc_disconnect(); + + if (errCode == CTS_SUCCESS) + { + MSG_DEBUG("Disconnect to Contact Service Success"); + } + else + { + MSG_DEBUG("Disconnect to Contact Service Fail [%d]", errCode); + return MSG_ERR_DB_DISCONNECT; + } + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgInitContactSvc(MsgContactChangeCB cb) +{ + int errCode = CTS_SUCCESS; + + if (cb != NULL) + cbFunction = cb; + + // Register callback function + errCode = contacts_svc_subscribe_change(CTS_SUBSCRIBE_CONTACT_CHANGE, MsgContactSvcCallback, NULL); + + if (errCode == CTS_SUCCESS) + { + MSG_DEBUG("Register Contact Service Callback"); + } + else + { + MSG_DEBUG("Fail to Register Contact Service Callback [%d]", errCode); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_INFO_S *pContactInfo) +{ + MSG_BEGIN(); + + MSG_DEBUG("Address Type [%d], Address Value [%s]", pAddrInfo->addressType, pAddrInfo->addressVal); + + memset(pContactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); + + if (pAddrInfo->addressType == MSG_ADDRESS_TYPE_PLMN && strlen(pAddrInfo->addressVal) > (MAX_PHONE_NUMBER_LEN+1)) + { + MSG_DEBUG("Phone Number is too long [%s]", pAddrInfo->addressVal); + return MSG_ERR_INVALID_PARAMETER; + } + + int index, ret = -1; + + CTSstruct* contact = NULL; + + cts_find_op recordType; + + if (pAddrInfo->addressType == MSG_ADDRESS_TYPE_EMAIL) + recordType = CTS_FIND_BY_EMAIL; + else + recordType = CTS_FIND_BY_NUMBER; + + index = contacts_svc_find_contact_by(recordType, (char*)pAddrInfo->addressVal); + + if (index > CTS_SUCCESS) + { + MSG_DEBUG("Index : [%d]", index); + ret = contacts_svc_get_contact(index, &contact); + } + + if (ret < 0) + { + MSG_DEBUG("No Contact Info"); + return MSG_SUCCESS; + } + + CTSvalue* name = NULL; + + ret = contacts_svc_struct_get_value(contact, CTS_CF_NAME_VALUE, &name); + + if (ret != CTS_SUCCESS) + { + MSG_DEBUG("contacts_svc_struct_get_value() Error [%d]", ret); + return MSG_SUCCESS; + } + + const char* strDisplayName = contacts_svc_value_get_str(name, CTS_NAME_VAL_DISPLAY_STR); + const char* strFirstName = contacts_svc_value_get_str(name, CTS_NAME_VAL_FIRST_STR); + const char* strLastName = contacts_svc_value_get_str(name, CTS_NAME_VAL_LAST_STR); + + MSG_DEBUG("Display Name : [%s], First Name : [%s], Last Name : [%s]", strDisplayName, strFirstName, strLastName); + + if (strDisplayName != NULL) + { + strncpy(pContactInfo->displayName, strDisplayName, MAX_DISPLAY_NAME_LEN); + } + + if (strFirstName != NULL) + { + strncpy(pContactInfo->firstName, strFirstName, MAX_DISPLAY_NAME_LEN); + } + + if (strLastName != NULL) + { + strncpy(pContactInfo->lastName, strLastName, MAX_DISPLAY_NAME_LEN); + } + + CTSvalue* base = NULL; + + ret = contacts_svc_struct_get_value(contact, CTS_CF_BASE_INFO_VALUE, &base); + + if (ret != CTS_SUCCESS) + { + MSG_DEBUG("contacts_svc_struct_get_value() Error [%d]", ret); + return MSG_SUCCESS; + } + + pContactInfo->contactId = contacts_svc_value_get_int(base, CTS_BASE_VAL_ID_INT); + + MSG_DEBUG("Contact ID [%d]", pContactInfo->contactId); + + const char* strImagePath = contacts_svc_value_get_str(base, CTS_BASE_VAL_IMG_PATH_STR); + + if (strImagePath != NULL) + { + strncpy(pContactInfo->imagePath , strImagePath, MAX_IMAGE_PATH_LEN); + } + + MSG_DEBUG("Image Path [%s]", pContactInfo->imagePath); + + contacts_svc_value_free(base); + contacts_svc_value_free(name); + + contacts_svc_struct_free(contact); + + MSG_END(); + + return MSG_SUCCESS; +} + + +void MsgSyncContact() +{ + int ret = -1; + int index_num = 0; + int changed_count = 0; + int lastSyncTime = 0; + + /* get contact sync time */ + lastSyncTime = MsgSettingGetInt(CONTACT_SYNC_TIME); + + if (lastSyncTime < 0) { + MSG_DEBUG("Fail to get CONTACT_SYNC_TIME."); + lastSyncTime = 0; + } + + CTSiter* pIter; + + ret = contacts_svc_get_updated_contacts(0, lastSyncTime, &pIter); + + if (ret != CTS_SUCCESS) + { + MSG_DEBUG("contacts_svc_get_updated_contacts() Error [%d]", ret); + return; + } + + while (contacts_svc_iter_next(pIter) == CTS_SUCCESS) + { + CTSvalue *row_info = NULL; + + row_info = contacts_svc_iter_get_info(pIter); + + index_num = contacts_svc_value_get_int(row_info, CTS_LIST_CHANGE_ID_INT); + + MSG_DEBUG("index (%d)", index_num); + + int type = contacts_svc_value_get_int(row_info, CTS_LIST_CHANGE_TYPE_INT); + + if (type == CTS_OPERATION_UPDATED || type == CTS_OPERATION_INSERTED) + { + MsgUpdateContact(index_num, type); + } + else // Delete + { + MSG_DEBUG("Delete Contact"); + + MsgDeleteContact(index_num); + } + + if(lastSyncTime < contacts_svc_value_get_int(row_info, CTS_LIST_CHANGE_VER_INT)) + lastSyncTime = contacts_svc_value_get_int(row_info, CTS_LIST_CHANGE_VER_INT); + + contacts_svc_value_free(row_info); + + changed_count++; + + } + + MsgSettingSetInt(CONTACT_SYNC_TIME, lastSyncTime); + MSG_DEBUG("lastSyncTime : %d", lastSyncTime); + + contacts_svc_iter_remove(pIter); + + if(changed_count > 0) + cbFunction(); +} + + +bool MsgInsertContact(MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber) +{ + if (!pNumber || strlen(pNumber) <= 0) + return false; + + if (MsgStoAddContactInfo(&ContactDbHandle, pContactInfo, pNumber) != MSG_SUCCESS) + { + MSG_DEBUG("Fail to add contact info."); + return false; + } + + return true; +} + + +bool MsgUpdateContact(int index, int type) +{ + int ret = -1; + + CTSstruct *contact = NULL; + + ret = contacts_svc_get_contact(index, &contact); + + if (ret != CTS_SUCCESS) + { + MSG_DEBUG("contacts_svc_get_contact() Error [%d]", ret); + return false; + } + + // Base Info + CTSvalue *base = NULL; + + ret = contacts_svc_struct_get_value(contact, CTS_CF_BASE_INFO_VALUE, &base); + + if (ret != CTS_SUCCESS) + { + MSG_DEBUG("contacts_svc_struct_get_value() Error [%d]", ret); + return false; + } + + MSG_CONTACT_INFO_S contactInfo = {0}; + + contactInfo.contactId = contacts_svc_value_get_int(base, CTS_BASE_VAL_ID_INT); + + MSG_DEBUG("Contact ID [%d]", contactInfo.contactId); + + const char* strImagePath = contacts_svc_value_get_str(base, CTS_BASE_VAL_IMG_PATH_STR); + + if (strImagePath != NULL) + { + strncpy(contactInfo.imagePath , strImagePath, MAX_IMAGE_PATH_LEN); + } + + MSG_DEBUG("Image Path [%s]", contactInfo.imagePath); + + // Name Info + CTSvalue* name = NULL; + + ret = contacts_svc_struct_get_value(contact, CTS_CF_NAME_VALUE, &name); + + if (ret != CTS_SUCCESS) + { + MSG_DEBUG("contacts_svc_struct_get_value() Error [%d]", ret); + return MSG_SUCCESS; + } + + const char* strDisplayName = contacts_svc_value_get_str(name, CTS_NAME_VAL_DISPLAY_STR); + const char* strFirstName = contacts_svc_value_get_str(name, CTS_NAME_VAL_FIRST_STR); + const char* strLastName = contacts_svc_value_get_str(name, CTS_NAME_VAL_LAST_STR); + + MSG_DEBUG("Display Name : [%s], First Name : [%s], Last Name : [%s]", strDisplayName, strFirstName, strLastName); + + if (strDisplayName != NULL) + { + strncpy(contactInfo.displayName, strDisplayName, MAX_DISPLAY_NAME_LEN); + } + + if (strFirstName != NULL) + { + strncpy(contactInfo.firstName, strFirstName, MAX_DISPLAY_NAME_LEN); + } + + if (strLastName != NULL) + { + strncpy(contactInfo.lastName, strLastName, MAX_DISPLAY_NAME_LEN); + } + + MsgStoClearContactInfo(&ContactDbHandle, index); + + GSList *get_list, *cursor; + + get_list = NULL; + + contacts_svc_struct_get_list(contact, CTS_CF_NUMBER_LIST, &get_list); + + cursor = get_list; + + // No phone number in contact + if (cursor == NULL) + { + contacts_svc_struct_free(contact); + + return true; + } + + for(; cursor; cursor = g_slist_next(cursor)) + { + MSG_DEBUG("Add Contact Data"); + + const char* strNumber = contacts_svc_value_get_str((CTSvalue*)cursor->data, CTS_NUM_VAL_NUMBER_STR); + + MSG_DEBUG("Number = %s", strNumber); + + if (MsgInsertContact(&contactInfo, strNumber) == false) + { + continue; + } + } + + contacts_svc_struct_free(contact); + + return true; +} + + +bool MsgDeleteContact(int index) +{ + if (MsgStoClearContactInfo(&ContactDbHandle, index) != MSG_SUCCESS) + { + return false; + } + + return true; +} + + +int MsgGetContactNameOrder() +{ + int ret = 0; + + cts_order_type order = CTS_ORDER_NAME_FIRSTLAST; + + order = contacts_svc_get_order(CTS_ORDER_OF_DISPLAY); + + if (order == CTS_ORDER_NAME_FIRSTLAST) + ret = 0; + else if (order == CTS_ORDER_NAME_LASTFIRST) + ret = 1; + + return ret; +} + + +int MsgContactSVCBeginTrans() +{ + return contacts_svc_begin_trans(); +} + + +int MsgContactSVCEndTrans(bool bSuccess) +{ + return contacts_svc_end_trans(bSuccess); +} diff --git a/utils/MsgDebug.cpp b/utils/MsgDebug.cpp new file mode 100755 index 0000000..a403c52 --- /dev/null +++ b/utils/MsgDebug.cpp @@ -0,0 +1,304 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) +{ + switch ( cmdType ) + { +// 0 + case MSG_CMD_OPEN_HANDLE: + return "MSG_CMD_OPEN_HANDLE"; + case MSG_CMD_CLOSE_HANDLE: + return "MSG_CMD_CLOSE_HANDLE"; + case MSG_CMD_GET_STORAGELIST: + return "MSG_CMD_GET_STORAGELIST"; + case MSG_CMD_ADD_MSG: + return "MSG_CMD_ADD_MSG"; + case MSG_CMD_ADD_SYNCML_MSG: + return "MSG_CMD_ADD_SYNCML_MSG"; + +// 5 + case MSG_CMD_UPDATE_MSG: + return "MSG_CMD_UPDATE_MSG"; + case MSG_CMD_UPDATE_READ: + return "MSG_CMD_UPDATE_READ"; + case MSG_CMD_UPDATE_PROTECTED: + return "MSG_CMD_UPDATE_PROTECTED"; + case MSG_CMD_DELETE_MSG: + return "MSG_CMD_DELETE_MSG"; + case MSG_CMD_DELALL_MSGINFOLDER: + return "MSG_CMD_DELALL_MSGINFOLDER"; + +// 10 + case MSG_CMD_MOVE_MSGTOFOLDER: + return "MSG_CMD_MOVE_MSGTOFOLDER"; + case MSG_CMD_MOVE_MSGTOSTORAGE: + return "MSG_CMD_MOVE_MSGTOSTORAGE"; + case MSG_CMD_COUNT_MSG: + return "MSG_CMD_COUNT_MSG"; + case MSG_CMD_GET_MSG: + return "MSG_CMD_GET_MSG"; + case MSG_CMD_GET_FOLDERVIEWLIST: + return "MSG_CMD_GET_FOLDERVIEWLIST"; + +// 15 + case MSG_CMD_ADD_FOLDER: + return "MSG_CMD_ADD_FOLDER"; + case MSG_CMD_UPDATE_FOLDER: + return "MSG_CMD_UPDATE_FOLDER"; + case MSG_CMD_DELETE_FOLDER: + return "MSG_CMD_DELETE_FOLDER"; + case MSG_CMD_GET_FOLDERLIST: + return "MSG_CMD_GET_FOLDERLIST"; + case MSG_CMD_SET_CONFIG: + return "MSG_CMD_SET_CONFIG"; + +// 20 + case MSG_CMD_GET_CONFIG: + return "MSG_CMD_GET_CONFIG"; + case MSG_CMD_GET_MSG_TYPE: + return "MSG_CMD_GET_MSG_TYPE"; + case MSG_CMD_SUBMIT_REQ: + return "MSG_CMD_SUBMIT_REQ"; + case MSG_CMD_CANCEL_REQ: + return "MSG_CMD_CANCEL_REQ"; + case MSG_CMD_REG_SENT_STATUS_CB: + return "MSG_CMD_REG_SENT_STATUS_CB"; + +// 25 + case MSG_CMD_REG_STORAGE_CHANGE_CB: + return "MSG_CMD_REG_STORAGE_CHANGE_CB"; + case MSG_CMD_REG_INCOMING_MSG_CB: + return "MSG_CMD_REG_INCOMING_MSG_CB"; + case MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB: + return "MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB"; + case MSG_CMD_REG_INCOMING_SYNCML_MSG_CB: + return "MSG_CMD_REG_INCOMING_SYNCML_MSG_CB"; + case MSG_CMD_REG_INCOMING_LBS_MSG_CB: + return "MSG_CMD_REG_INCOMING_LBS_MSG_CB"; + +// 30 + case MSG_CMD_PLG_SENT_STATUS_CNF: + return "MSG_CMD_PLG_SENT_STATUS_CNF"; + case MSG_CMD_PLG_STORAGE_CHANGE_IND: + return "MSG_CMD_PLG_STORAGE_CHANGE_IND"; + case MSG_CMD_PLG_INCOMING_MSG_IND: + return "MSG_CMD_PLG_INCOMING_MSG_IND"; + case MSG_CMD_PLG_INCOMING_MMS_CONF: + return "MSG_CMD_PLG_INCOMING_MMS_CONF"; + case MSG_CMD_PLG_INCOMING_SYNCML_IND: + return "MSG_CMD_PLG_INCOMING_SYNCML_IND"; + +// 35 + case MSG_CMD_PLG_INCOMING_LBS_IND: + return "MSG_CMD_PLG_INCOMING_LBS_IND"; + case MSG_CMD_PLG_INIT_SIM_BY_SAT: + return "MSG_CMD_PLG_INIT_SIM_BY_SAT"; + case MSG_CMD_GET_THREADVIEWLIST: + return "MSG_CMD_GET_THREADVIEWLIST"; + case MSG_CMD_GET_CONVERSATIONVIEWLIST: + return "MSG_CMD_GET_CONVERSATIONVIEWLIST"; + case MSG_CMD_DELETE_THREADMESSAGELIST: + return "MSG_CMD_DELETE_THREADMESSAGELIST"; + +// 40 + case MSG_CMD_GET_CONTACT_COUNT: + return "MSG_CMD_GET_CONTACT_COUNT"; + case MSG_CMD_GET_QUICKPANEL_DATA: + return "MSG_CMD_GET_QUICKPANEL_DATA"; + case MSG_CMD_COUNT_BY_MSGTYPE: + return "MSG_CMD_COUNT_BY_MSGTYPE"; + case MSG_CMD_RESET_DB: + return "MSG_CMD_RESET_DB"; + case MSG_CMD_GET_MEMSIZE: + return "MSG_CMD_GET_MEMSIZE"; + +// 45 + case MSG_CMD_BACKUP_MESSAGE: + return "MSG_CMD_BACKUP_MESSAGE"; + case MSG_CMD_RESTORE_MESSAGE: + return "MSG_CMD_RESTORE_MESSAGE"; + case MSG_CMD_UPDATE_THREAD_READ: + return "MSG_CMD_UPDATE_THREAD_READ"; + case MSG_CMD_REG_SYNCML_MSG_OPERATION_CB: + return "MSG_CMD_REG_SYNCML_MSG_OPERATION_CB"; + case MSG_CMD_SYNCML_OPERATION: + return "MSG_CMD_SYNCML_OPERATION"; + +// 50 + case MSG_CMD_GET_REPORT_STATUS: + return "MSG_CMD_GET_REPORT_STATUS"; + + default: + return "Unknown Command Type!!!"; + } + + return NULL; +} + +const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) +{ + switch ( evtType ) + { +// 0 + case MSG_EVENT_OPEN_HANDLE: + return "MSG_EVENT_OPEN_HANDLE"; + case MSG_EVENT_CLOSE_HANDLE: + return "MSG_EVENT_CLOSE_HANDLE"; + case MSG_EVENT_GET_STORAGELIST: + return "MSG_EVENT_GET_STORAGELIST"; + case MSG_EVENT_ADD_MSG: + return "MSG_EVENT_ADD_MSG"; + case MSG_EVENT_ADD_SYNCML_MSG: + return "MSG_EVENT_ADD_SYNCML_MSG"; +// 5 + case MSG_EVENT_UPDATE_MSG: + return "MSG_EVENT_UPDATE_MSG"; + case MSG_EVENT_UPDATE_READ: + return "MSG_EVENT_UPDATE_READ"; + case MSG_EVENT_UPDATE_PROTECTED: + return "MSG_EVENT_UPDATE_PROTECTED"; + case MSG_EVENT_DELETE_MSG: + return "MSG_EVENT_DELETE_MSG"; + case MSG_EVENT_DELALL_MSGINFOLDER: + return "MSG_EVENT_DELALL_MSGINFOLDER"; +// 10 + case MSG_EVENT_MOVE_MSGTOFOLDER: + return "MSG_EVENT_MOVE_MSGTOFOLDER"; + case MSG_EVENT_MOVE_MSGTOSTORAGE: + return "MSG_EVENT_MOVE_MSGTOSTORAGE"; + case MSG_EVENT_COUNT_MSG: + return "MSG_EVENT_COUNT_MSG"; + case MSG_EVENT_GET_MSG: + return "MSG_EVENT_GET_MSG"; + case MSG_EVENT_GET_FOLDERVIEWLIST: + return "MSG_EVENT_GET_FOLDERVIEWLIST"; +// 15 + case MSG_EVENT_ADD_FOLDER: + return "MSG_EVENT_ADD_FOLDER"; + case MSG_EVENT_UPDATE_FOLDER: + return "MSG_EVENT_UPDATE_FOLDER"; + case MSG_EVENT_DELETE_FOLDER: + return "MSG_EVENT_DELETE_FOLDER"; + case MSG_EVENT_GET_FOLDERLIST: + return "MSG_EVENT_GET_FOLDERLIST"; + case MSG_EVENT_SET_CONFIG: + return "MSG_EVENT_SET_CONFIG"; +// 20 + case MSG_EVENT_GET_CONFIG: + return "MSG_EVENT_GET_CONFIG"; + case MSG_EVENT_GET_MSG_TYPE: + return "MSG_EVENT_GET_MSG_TYPE"; + case MSG_EVENT_SUBMIT_REQ: + return "MSG_EVENT_SUBMIT_REQ"; + case MSG_EVENT_CANCEL_REQ: + return "MSG_EVENT_CANCEL_REQ"; + case MSG_EVENT_REG_SENT_STATUS_CB: + return "MSG_EVENT_REG_SENT_STATUS_CB"; +// 25 + case MSG_EVENT_REG_STORAGE_CHANGE_CB: + return "MSG_EVENT_REG_STORAGE_CHANGE_CB"; + case MSG_EVENT_REG_INCOMING_MSG_CB: + return "MSG_EVENT_REG_INCOMING_MSG_CB"; + case MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB: + return "MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB"; + case MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB: + return "MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB"; + case MSG_EVENT_REG_INCOMING_LBS_MSG_CB: + return "MSG_EVENT_REG_INCOMING_LBS_MSG_CB"; +// 30 + case MSG_EVENT_PLG_SENT_STATUS_CNF: + return "MSG_EVENT_PLG_SENT_STATUS_CNF"; + case MSG_EVENT_PLG_STORAGE_CHANGE_IND: + return "MSG_EVENT_STORAGE_CHANGE_CB"; + case MSG_EVENT_PLG_INCOMING_MSG_IND: + return "MSG_EVENT_PLG_INCOMING_MSG_IND"; + case MSG_EVENT_PLG_INCOMING_MMS_CONF: + return "MSG_EVENT_PLG_INCOMING_MMS_CONF"; + case MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND: + return "MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND"; +// 35 + case MSG_EVENT_PLG_INCOMING_LBS_MSG_IND: + return "MSG_EVENT_PLG_INCOMING_LBS_MSG_IND"; + case MSG_EVENT_PLG_INIT_SIM_BY_SAT: + return "MSG_EVENT_PLG_INIT_SIM_BY_SAT"; + case MSG_EVENT_GET_THREADVIEWLIST: + return "MSG_EVENT_GET_THREADVIEWLIST"; + case MSG_EVENT_GET_CONVERSATIONVIEWLIST: + return "MSG_EVENT_GET_CONVERSATIONVIEWLIST"; + case MSG_EVENT_DELETE_THREADMESSAGELIST: + return "MSG_EVENT_DELETE_THREADMESSAGELIST"; +// 40 + case MSG_EVENT_GET_CONTACT_COUNT: + return "MSG_EVENT_GET_CONTACT_COUNT"; + case MSG_EVENT_GET_QUICKPANEL_DATA: + return "MSG_EVENT_GET_QUICKPANEL_DATA"; + case MSG_EVENT_COUNT_BY_MSGTYPE: + return "MSG_EVENT_COUNT_BY_MSGTYPE"; + case MSG_EVENT_RESET_DB: + return "MSG_EVENT_RESET_DB"; + case MSG_EVENT_GET_MEMSIZE: + return "MSG_EVENT_GET_MEMSIZE"; +// 45 + case MSG_EVENT_BACKUP_MESSAGE: + return "MSG_EVENT_BACKUP_MESSAGE"; + case MSG_EVENT_RESTORE_MESSAGE: + return "MSG_EVENT_RESTORE_MESSAGE"; + case MSG_EVENT_UPDATE_THREAD_READ: + return "MSG_EVENT_UPDATE_THREAD_READ"; + case MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB: + return "MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB"; + case MSG_EVENT_SYNCML_OPERATION: + return "MSG_EVENT_SYNCML_OPERATION"; +// 50 + case MSG_EVENT_GET_REPORT_STATUS: + return "MSG_EVENT_GET_REPORT_STATUS"; + + + default: + return "Unknown Event Type!!!"; + } + + return NULL; +} + + +int get_tid() +{ + return syscall(__NR_gettid); +} + diff --git a/utils/MsgDrmWrapper.cpp b/utils/MsgDrmWrapper.cpp new file mode 100755 index 0000000..a183c6b --- /dev/null +++ b/utils/MsgDrmWrapper.cpp @@ -0,0 +1,617 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MsgDrmWrapper.h" +#include "MsgUtilFile.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "drm-service.h" + + +typedef struct { + DRM_RIGHTS_CONSUME_HANDLE hRightsConsume; + MSG_DRM_TYPE eDRMType; //to have a drm type + char *szOpenedDRMFileName; +} MSG_OPENEDDRM_INFO_T; + + +#define MSG_MAX_DRM_FILE_PATH MSG_FILEPATH_LEN_MAX + + +bool MsgDrmRegisterFile(MSG_DRM_OPENMODE eMode, char *pBuffer, int nSize) +{ + if (eMode == MSG_MODE_STREAM) { + MSG_DEBUG("Fail(eMode == MSG_MODE_STREAM)"); + return false; + } + + if (pBuffer == NULL) { + MSG_DEBUG("[Error] pBuffer is NULL"); + return false; + } + + MSG_DEBUG("buffer = %s, nSize = %d", pBuffer, nSize); + + if (!drm_svc_is_drm_file(pBuffer)) { // Check whether DRM file or not + MSG_DEBUG("file is not drm file"); + return false; + } + + DRM_RESULT eDRMResult = drm_svc_register_file(pBuffer); // Register a DCF file + if (DRM_RESULT_SUCCESS != eDRMResult) { + MSG_DEBUG("drm_svc_register_file is failed : %d", eDRMResult); + return false; + } + + return true; +} + +bool MsgDrmUnregisterFile(char *szFilename) +{ + if (szFilename == NULL) { + MSG_DEBUG("[Error] szFilename is NULL"); + return false; + } + + MSG_DEBUG("szFilename = %s", szFilename); + + DRM_RESULT eDRMResult = drm_svc_unregister_file(szFilename, DRM_TRUE); // Unregister a DCF file + if (DRM_RESULT_SUCCESS != eDRMResult) { + MSG_DEBUG("drm_svc_unregister_file : %d", eDRMResult); + return false; + } + + return true; +} + +bool MsgDrmIsDrmFile(const char *szFilePath) +{ + if (drm_svc_is_drm_file(szFilePath) == DRM_FALSE) { + MSG_DEBUG("file is not drm file"); + return false; + } + + return true; +} + +/*Added to convert the .dm files in to .dcf files since our platform supports only .dcf :: Start*/ +bool MsgDrmConvertDmtoDcfType(char *inputFile, char *outputFile) +{ + if ((NULL == inputFile) || (NULL == outputFile)) { + MSG_DEBUG("Invalid Input parameters"); + return false; + } + + if (strstr(inputFile, ".dm")) { + MSG_DEBUG("Current File extension is .dm %s", inputFile); + DRM_RESULT ret; + DRM_CONVERT_HANDLE hConvert = NULL; + unsigned long written; + + FILE *fp = MsgOpenFile(inputFile, "rb");//Check fp + + if (fp == NULL) { + MSG_DEBUG("[File Open Fail(Errno=%d)][ErrStr=%s]", errno, strerror(errno)); + strncpy(outputFile, inputFile, MSG_MAX_DRM_FILE_PATH); + return false; + } + + if (MsgFseek(fp, 0L, SEEK_END) < 0) { + MsgCloseFile(fp); + MSG_DEBUG("MsgFseek() returns negative value!!!"); + return false; + } + long retVal = MsgFtell(fp); + + if (retVal < 0) { + MsgCloseFile(fp); + MSG_DEBUG("ftell() returns negative value: [%ld]!!!", retVal); + strncpy(outputFile, inputFile, MSG_MAX_DRM_FILE_PATH); + return false; + } + + unsigned long bufLen = retVal; + MSG_DEBUG("fopen buffer len = %d", bufLen); + if (MsgFseek(fp, 0, SEEK_SET) < 0) { + MsgCloseFile(fp); + MSG_DEBUG("MsgFseek() returns negative value!!!"); + return false; + } + + char *buffer = (char *)malloc(bufLen); + int readed_size = 0; + int pathLen = strlen(inputFile); + + if (buffer == NULL) { + MsgCloseFile(fp); + MSG_DEBUG("malloc is failed "); + strncpy(outputFile, inputFile, MSG_MAX_DRM_FILE_PATH); + return false; + } + + strncpy(outputFile, inputFile, pathLen - 2); + strncat(outputFile, "dcf", 3); + + readed_size = MsgReadFile(buffer, 1, bufLen, fp);//Check for error + MSG_DEBUG("fread read size = %d", readed_size); + if (readed_size == 0) { + MsgCloseFile(fp); + free(buffer); + MSG_DEBUG("MsgReadFile returns 0"); + return false; + } + + ret = drm_svc_open_convert(outputFile, DRM_TRUE, &hConvert);//Check return value + if (ret != DRM_RESULT_SUCCESS) { + free(buffer); + MsgCloseFile(fp); + MSG_DEBUG("drm_svc_open_convert() return = failed (%d)", ret); + strncpy(outputFile, inputFile, MSG_MAX_DRM_FILE_PATH); + return false; + } + + /*We can call drm_svc_write_convert in loop if file size is large*/ + ret = drm_svc_write_convert(hConvert, (unsigned char *)buffer, bufLen, &written);//check for error + if (ret != DRM_RESULT_SUCCESS) { + free(buffer); + MsgCloseFile(fp); + MSG_DEBUG("drm_svc_write_convert() return = failed (%d)", ret); + strncpy(outputFile, inputFile, MSG_MAX_DRM_FILE_PATH); + return false; + } + + ret = drm_svc_close_convert(hConvert);//check for error + if (ret != DRM_RESULT_SUCCESS) { + free(buffer); + MsgCloseFile(fp); + MSG_DEBUG("drm_svc_close_convert() return = failed (%d)", ret); + strncpy(outputFile, inputFile, MSG_MAX_DRM_FILE_PATH); + return false; + } + + MsgCloseFile(fp); + free(buffer); + } else { + MSG_DEBUG("Current File extension is not .dm"); + + MSG_DEBUG("inputFile = (%s)", inputFile); + strncpy(outputFile, inputFile, MSG_MAX_DRM_FILE_PATH); + + return false; + } + + return true; +} + +bool MsgDrmIsConvertedFL(char *szFilePath) +{ + int ret = 0; + + if (szFilePath == NULL) { + MSG_DEBUG("szFilePath is NULL."); + return false; + } + + MSG_DEBUG("szFilePath = [%s]", szFilePath); + + ret = drm_svc_is_converted_fl(szFilePath); + + if (ret != DRM_RESULT_SUCCESS) { + MSG_DEBUG("Drm2IsConvertedEmbeddedFile returns false ret = %d", ret); + return false; + } + + return true; +} + +int MsgDrmGetStreamSize(MSG_DRMHANDLE pHandle) +{ // Get DRM buffer size + MSG_DEBUG("start"); + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)pHandle; + if (pOpenDRMInfo == NULL) { + MSG_DEBUG("end : Fail"); + return 0; + } + + drm_file_attribute_t tDRMAttribute = {0,}; + DRM_RESULT eDRMResult = drm_svc_get_fileattribute(pOpenDRMInfo->szOpenedDRMFileName, &tDRMAttribute); // Get attribute of DRM File + MSG_DEBUG("drm_svc_get_fileattribute : %d", eDRMResult); + if (DRM_RESULT_SUCCESS == eDRMResult) { + return tDRMAttribute.size; + } + MSG_DEBUG("end : Fail"); + return 0; +} + +bool MsgDrmGetStream(MSG_DRMHANDLE pHandle, int nStreamSize, unsigned char *pStream) +{ // Get DRM buffer + MSG_DEBUG("start %d", nStreamSize); + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)pHandle; + if (pOpenDRMInfo == NULL) { + MSG_DEBUG("end : Fail"); + return false; + } + + DRM_RESULT eDRMResult = DRM_RESULT_UNKNOWN_ERROR; + DRM_FILE_HANDLE hFileHandle = NULL; + eDRMResult = drm_svc_open_file(pOpenDRMInfo->szOpenedDRMFileName, DRM_PERMISSION_ANY, &hFileHandle); // Opens a DRM file + MSG_DEBUG("drm_svc_open_file(%s) : %d", pOpenDRMInfo->szOpenedDRMFileName, eDRMResult); + + unsigned int nRealReadSize = 0; + if (hFileHandle) { + eDRMResult = drm_svc_read_file(hFileHandle, pStream, nStreamSize, &nRealReadSize); // Read the Decrypted Data from File Handle + drm_svc_close_file(hFileHandle); // Close a DRM File which was opened before + if (DRM_RESULT_SUCCESS == eDRMResult) { + MSG_DEBUG("end : Success"); + return true; + } + } + MSG_DEBUG("\n end : Fail \n=========================================\n"); + return false; +} + +bool MsgDrmOpen(MSG_DRM_OPENMODE eMode, const char *pBuffer, int nSize, MSG_DRMHANDLE *pHandle) +{ + MSG_DEBUG("start (%d, %s, %d)", eMode, pBuffer, nSize); + if (eMode == MSG_MODE_STREAM) { + MSG_DEBUG("end : Fail(eMode == MSG_MODE_STREAM)"); + return false; + } + + char szFullFilePath[MSG_MAX_DRM_FILE_PATH] = {0,}; + char szFinalFullFilePath[MSG_MAX_DRM_FILE_PATH] = {0,}; + memset(szFullFilePath, 0x00, sizeof(char) * MSG_MAX_DRM_FILE_PATH); + if (pBuffer) + strncpy(szFullFilePath, pBuffer, strlen(pBuffer)); + + MsgDrmConvertDmtoDcfType(szFullFilePath, szFinalFullFilePath); + + if (!drm_svc_is_drm_file(szFinalFullFilePath)) { // Check whether DRM file or not + MSG_DEBUG("return eDRM_NOT_DRM_FILE"); + *pHandle = NULL; + return false; + } + + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)malloc(sizeof(MSG_OPENEDDRM_INFO_T)); + if (pOpenDRMInfo) { + memset(pOpenDRMInfo, 0x0, sizeof(MSG_OPENEDDRM_INFO_T)); + pOpenDRMInfo->szOpenedDRMFileName = (char *)malloc(sizeof(char) * (strlen(szFinalFullFilePath) + 1)); + if (pOpenDRMInfo->szOpenedDRMFileName) { + memset(pOpenDRMInfo->szOpenedDRMFileName, 0x0, sizeof(char) * (strlen(szFinalFullFilePath) + 1)); + strncpy(pOpenDRMInfo->szOpenedDRMFileName, szFinalFullFilePath, strlen(szFinalFullFilePath)); + pOpenDRMInfo->eDRMType = MSG_DRM_NONE; + *pHandle = (MSG_DRMHANDLE)pOpenDRMInfo; + MSG_DEBUG("end : Success"); + + return true; + } + free(pOpenDRMInfo); + } + MSG_DEBUG("end : Fail"); + return false; +} + +bool MsgDrmClose(MSG_DRMHANDLE pHandle) +{ // Close DRM + MSG_DEBUG("start"); + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)pHandle; + if (pOpenDRMInfo == NULL) { + MSG_DEBUG("end : Fail"); + return false; + } + //free allocated memory from MsgDrmOpen + if (pOpenDRMInfo->szOpenedDRMFileName) { + free(pOpenDRMInfo->szOpenedDRMFileName); + pOpenDRMInfo->szOpenedDRMFileName = NULL; + } + + free(pOpenDRMInfo); + + MSG_DEBUG("end : Success"); + return true; +} + +bool MsgDrmGetMimeType(MSG_DRMHANDLE pHandle, char *szMimeType, int nMimeTypeLen) +{ + MSG_DEBUG("start"); + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)pHandle; + if (pOpenDRMInfo == NULL) { + MSG_DEBUG("end : Fail"); + return false; + } + + drm_content_info_t tdcfContentinfo; + memset(&tdcfContentinfo, 0x00, sizeof(drm_content_info_t)); + DRM_RESULT eDRMResult = drm_svc_get_content_info(pOpenDRMInfo->szOpenedDRMFileName, &tdcfContentinfo); // Get attribute of DRM File + MSG_DEBUG("drm_svc_get_content_info : %d", eDRMResult); + if (DRM_RESULT_SUCCESS == eDRMResult) { + MSG_DEBUG("end Success (%s)", tdcfContentinfo.contentType); + snprintf(szMimeType, nMimeTypeLen, "%s", tdcfContentinfo.contentType); + return true; + } + MSG_DEBUG("end : Fail"); + return false; +} + +bool MsgDrmGetDrmType(const char *szFileName, MSG_DRM_TYPE *eDRMType) +{ + if (szFileName == NULL || eDRMType == NULL) { + MSG_DEBUG("Param is NULL"); + return false; + } + + if (drm_svc_get_drm_type(szFileName) == DRM_FILE_TYPE_OMA) { + drm_dcf_info_t drmInfo; + DRM_RESULT eDRMResult = drm_svc_get_dcf_file_info(szFileName, &drmInfo); // Get information of DRM contents + if (DRM_RESULT_SUCCESS != eDRMResult) { + MSG_DEBUG("drm_svc_get_dcf_file_info is Fail eDRMResult = %d", eDRMResult); + return false; + } + + // Convert DRM_METHOD into MSG_DRM_TYPE + switch (drmInfo.method) { + case DRM_METHOD_FL: + *eDRMType = MSG_DRM_FORWARD_LOCK; + break; + case DRM_METHOD_CD: + *eDRMType = MSG_DRM_COMBINED_DELIVERY; + break; + case DRM_METHOD_SSD: + *eDRMType = MSG_DRM_SEPARATE_DELIVERY; + break; + case DRM_METHOD_SD: + *eDRMType = MSG_DRM_SEPARATE_DELIVERY; + break; + default: + *eDRMType = MSG_DRM_NONE; + break; + } + MSG_DEBUG("eDRMType : %d", *eDRMType); + } else { + MSG_DEBUG("This is not a DRM_FILE_TYPE_OMA type"); + return false; + } + + return true; +} + +bool MsgDrmConsumeRights(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType, long nMiliSecs) +{ + MSG_DEBUG("start %d, %ld", eRightType, nMiliSecs); + MSG_DEBUG("end : Success"); + return true; +} + +bool MsgDrmIsAvailable(MSG_DRMHANDLE pHandle) +{ + MSG_DEBUG("start"); + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)pHandle; + if (pOpenDRMInfo == NULL) { + MSG_DEBUG("end : Fail"); + return false; + } + + if (pOpenDRMInfo->eDRMType == MSG_DRM_FORWARD_LOCK) { //fl Àº ro ¾øÀ̵µ »ç¿ë°¡´É + MSG_DEBUG("end : Success"); + return true; + } + + DRM_PERMISSION_TYPE ePerType = DRM_PERMISSION_ANY; + drm_best_rights_t tBestRight; //ro ÀÖ´ÂÁö ¿©ºÎ¸¸ ¾Ë¸é µÇ¹Ç·Î drm_svc_get_best_ro ·Î üũÇϵµ·Ï ¼öÁ¤ + memset(&tBestRight, 0x00, sizeof(drm_best_rights_t)); + bool eReturn = false; + DRM_RESULT eDRMResult = drm_svc_get_best_ro(pOpenDRMInfo->szOpenedDRMFileName, ePerType, &tBestRight); // Check the valided Rights or not by DCF file + MSG_DEBUG("drm_svc_get_best_ro : %d", eDRMResult); + if (DRM_RESULT_SUCCESS == eDRMResult && tBestRight.rightStatus == DRM_RIGHT_VALID) { + eReturn = true; + MSG_DEBUG("end : Success"); + } else { + MSG_DEBUG("end : Fail"); + } + return eReturn; +} + +bool MsgDrmOnStart(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType) +{ // Start consume + MSG_DEBUG("start %d", eRightType); + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)pHandle; + if (pOpenDRMInfo == NULL) { + MSG_DEBUG("end : Fail"); + return false; + } + + if (pOpenDRMInfo->eDRMType == MSG_DRM_FORWARD_LOCK) { + MSG_DEBUG("end : Success"); + return true; + } + + DRM_PERMISSION_TYPE eDRMUsage = DRM_PERMISSION_ANY; + DRM_RIGHTS_CONSUME_HANDLE hRightsConsume = 0; + switch (eRightType) { + case MMS_DRM_RIGHT_PLAY: + eDRMUsage = DRM_PERMISSION_PLAY; + break; + case MSG_DRM_RIGHT_DISPLAY: + eDRMUsage = DRM_PERMISSION_DISPLAY; + break; + case MSG_DRM_RIGHT_EXECUTE: + eDRMUsage = DRM_PERMISSION_EXECUTE; + break; + case MSG_DRM_RIGHT_PRINT: + eDRMUsage = DRM_PERMISSION_PRINT; + break; + case MSG_DRM_RIGHT_EXPORT: + eDRMUsage = DRM_PERMISSION_EXPORT_MOVE; // DRM_PERMISSION_EXPORT_COPY µµ »ç¿ëÇؾßÇÔ + break; + } + DRM_RESULT eDRMResult = drm_svc_open_consumption(pOpenDRMInfo->szOpenedDRMFileName, eDRMUsage, &hRightsConsume); // Open for consumption + MSG_DEBUG("drm_svc_open_consumption : %d", eDRMResult); + if (DRM_RESULT_SUCCESS != eDRMResult) { + MSG_DEBUG("end : Fail"); + return false; + } + pOpenDRMInfo->hRightsConsume = hRightsConsume; + eDRMResult = drm_svc_start_consumption(pOpenDRMInfo->hRightsConsume); // Start the consumption + MSG_DEBUG("drm_svc_start_consumption : %d", eDRMResult); + if (DRM_RESULT_SUCCESS == eDRMResult) { + MSG_DEBUG("end : Success"); + return true; + } + MSG_DEBUG("end : Fail"); + return false; +} + +bool MsgDrmOnPause(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType) +{ + MSG_DEBUG("start %d", eRightType); + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)pHandle; + if (pOpenDRMInfo == NULL) { + MSG_DEBUG("end : Fail"); + return false; + } + + if (pOpenDRMInfo->eDRMType == MSG_DRM_FORWARD_LOCK) { + MSG_DEBUG("end : Success"); + return true; + } + + DRM_RESULT eDRMResult = drm_svc_pause_consumption(pOpenDRMInfo->hRightsConsume); // Pause the consumption + MSG_DEBUG("drm_svc_pause_consumption : %d", eDRMResult); + if (DRM_RESULT_SUCCESS == eDRMResult) { + MSG_DEBUG("end : Success"); + return true; + } + MSG_DEBUG("end : Fail"); + return false; +} + +bool MsgDrmOnResume(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType) +{ + MSG_DEBUG("start %d", eRightType); + MSG_DEBUG("end : Success"); + return true; +} + +bool MsgDrmOnStop(MSG_DRMHANDLE pHandle, MSG_DRM_RIGHT_TYPE eRightType) +{ + MSG_DEBUG("start %d", eRightType); + MSG_OPENEDDRM_INFO_T *pOpenDRMInfo = (MSG_OPENEDDRM_INFO_T *)pHandle; + if (pOpenDRMInfo == NULL) { + MSG_DEBUG("end : Fail"); + return false; + } + + if (pOpenDRMInfo->eDRMType == MSG_DRM_FORWARD_LOCK) { + MSG_DEBUG("end : Success"); + return true; + } + + DRM_RESULT eDRMResult = drm_svc_stop_consumption(pOpenDRMInfo->hRightsConsume); // Stop the consumption + MSG_DEBUG("drm_svc_stop_consumption : %d", eDRMResult); + if (DRM_RESULT_SUCCESS != eDRMResult) { + MSG_DEBUG("end : Fail"); + return false; + } + + eDRMResult = drm_svc_close_consumption(&(pOpenDRMInfo->hRightsConsume)); // Close the consumption + MSG_DEBUG("drm_svc_close_consumption : %d", eDRMResult); + if (DRM_RESULT_SUCCESS == eDRMResult) { + pOpenDRMInfo->hRightsConsume = 0; + MSG_DEBUG("end : Success"); + return true; + } + MSG_DEBUG("end : Fail"); + return false; +} + +bool MsgDrmGetMimeTypeEx(const char *szFileName, char *szMimeType, int nMimeTypeLen) +{ + if (!szFileName || !szMimeType || !nMimeTypeLen) { + MSG_DEBUG("param is NULL"); + return false; + } + + char strTemp[MSG_MAX_DRM_FILE_PATH + 1] = {0,}; + + strncpy(strTemp, szFileName, strlen(szFileName)); + + drm_content_info_t tdcfContentinfo; + memset(&tdcfContentinfo, 0x00, sizeof(drm_content_info_t)); + DRM_RESULT eDRMResult = drm_svc_get_content_info(strTemp, &tdcfContentinfo); // Get attribute of DRM File + if (DRM_RESULT_SUCCESS == eDRMResult) { + MSG_DEBUG("contentType = %s", tdcfContentinfo.contentType); + snprintf(szMimeType, nMimeTypeLen, "%s", tdcfContentinfo.contentType); + + return true; + } else { + MSG_DEBUG("drm_svc_get_content_info is failed %d", eDRMResult); + } + + return false; +} + +bool MsgDrmGetContentID(const char *szFileName, char *szContentID, int nContentIDLen) +{ + if (!szFileName || !szContentID || !nContentIDLen) { + MSG_DEBUG("param is NULL"); + return false; + } + + char strTemp[MSG_MAX_DRM_FILE_PATH + 1] = {0,}; + + strncpy(strTemp, szFileName, sizeof(strTemp)); + + drm_content_info_t tdcfContentinfo; + memset(&tdcfContentinfo, 0x00, sizeof(drm_content_info_t)); + DRM_RESULT eDRMResult = drm_svc_get_content_info(strTemp, &tdcfContentinfo); + if (DRM_RESULT_SUCCESS == eDRMResult) { + MSG_DEBUG("contentID = %s", tdcfContentinfo.contentID); + snprintf(szContentID, nContentIDLen, "%s", tdcfContentinfo.contentID); + + return true; + } else { + MSG_DEBUG("drm_svc_get_content_info is failed %d", eDRMResult); + } + + return false; +} + diff --git a/utils/MsgException.cpp b/utils/MsgException.cpp new file mode 100755 index 0000000..a7f373a --- /dev/null +++ b/utils/MsgException.cpp @@ -0,0 +1,57 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgException.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +string MsgException::errorStrings[NUM_ERRORS] = +{ + "SUCCESS", + + "INVALID_PARAM", + "INVALID_RESULT", + "SELECT_ERROR", + "IPC_ERROR", + "OUT_OF_RANGE" , //5 + + "SMS_PLG_ERROR", + "MMS_PLG_ERROR", + "PLUGIN_ERROR", + "SENT_STATUS_ERROR", + "INCOMING_MSG_ERROR", //10 + + "FILE_OPERATION_ERROR", + "SECURITY_ERROR" + "SERVER_READY_ERROR" +}; + diff --git a/utils/MsgGconfWrapper.cpp b/utils/MsgGconfWrapper.cpp new file mode 100755 index 0000000..a98defd --- /dev/null +++ b/utils/MsgGconfWrapper.cpp @@ -0,0 +1,185 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include + +#include "MsgDebug.h" +#include "MsgUtilStorage.h" +#include "MsgGconfWrapper.h" + + +/*================================================================================================== + DEFINES +==================================================================================================*/ +#define MSG_UNREAD_CNT "db/badge/org.tizen.message" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgSettingSetString(const char *pKey, const char *pSetValue) +{ + if (pKey == NULL || pSetValue == NULL) + { + MSG_DEBUG("IN Parameter is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if (vconf_set_str(pKey, pSetValue) != 0) + return MSG_ERR_SET_SETTING; + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSettingSetInt(const char *pKey, int nSetValue) +{ + if (pKey == NULL) + { + MSG_DEBUG("IN Parameter is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if (vconf_set_int(pKey, nSetValue) != 0) + return MSG_ERR_SET_SETTING; + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSettingSetBool(const char *pKey, bool bSetValue) +{ + if (pKey == NULL) + { + MSG_DEBUG("IN Parameter is NULL"); + return MSG_ERR_NULL_POINTER; + } + + if (vconf_set_bool(pKey, bSetValue) != 0) + return MSG_ERR_SET_SETTING; + + return MSG_SUCCESS; +} + + +char* MsgSettingGetString(const char *pKey) +{ + if (pKey == NULL) + { + MSG_DEBUG("IN Parameter is NULL"); + return NULL; + } + + return vconf_get_str(pKey); +} + + +int MsgSettingGetInt(const char *pKey) +{ + if (pKey == NULL) + { + MSG_DEBUG("IN Parameter is NULL"); + return -1; + } + + int retVal = 0; + + if (vconf_get_int(pKey, &retVal) < 0) + return -1; + + return retVal; +} + + +int MsgSettingGetBool(const char *pKey, bool *pVal) +{ + if (pKey == NULL) + { + MSG_DEBUG("IN Parameter is NULL"); + return -1; + } + + int retVal = 0, param = 0; + + if (vconf_get_bool(pKey, ¶m) < 0) + return -1; + + *pVal = (bool)param; + + return retVal; +} + + +MSG_ERROR_T MsgSettingHandleNewMsg(int SmsCnt, int MmsCnt) +{ + MSG_BEGIN(); + + MSG_DEBUG("smsCnt = %d, mmsCnt = %d ##", SmsCnt, MmsCnt); + + // Set Msg Count into VConf + if (MsgSettingSetIndicator(SmsCnt, MmsCnt) != MSG_SUCCESS) + { + MSG_DEBUG("MsgSettingSetIndicator() FAILED"); + return MSG_ERR_SET_SETTING; + } + + if (SmsCnt == 0 && MmsCnt == 0) + { + MSG_DEBUG("No New Message."); + } + else + { + MSG_DEBUG("New Message."); + pm_change_state(LCD_NORMAL); + } + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgSettingSetIndicator(int SmsCnt, int MmsCnt) +{ + + if (MsgSettingSetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE, SmsCnt) != 0) + return MSG_ERR_SET_SETTING; + if (MsgSettingSetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE, MmsCnt) != 0) + return MSG_ERR_SET_SETTING; + + int sumCnt = SmsCnt + MmsCnt; + + if (MsgSettingSetInt(MSG_UNREAD_CNT, sumCnt) != 0) + return MSG_ERR_SET_SETTING; + + return MSG_SUCCESS; +} diff --git a/utils/MsgIpcSocket.cpp b/utils/MsgIpcSocket.cpp new file mode 100755 index 0000000..832a75a --- /dev/null +++ b/utils/MsgIpcSocket.cpp @@ -0,0 +1,519 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "MsgDebug.h" +#include "MsgException.h" +#include "MsgIpcSocket.h" + + +/*================================================================================================== + IMPLEMENTATION OF MsgIpcClientSocket - Member Functions +==================================================================================================*/ +MsgIpcClientSocket::MsgIpcClientSocket() : sockfd(-1), remotefd(-1), maxfd(-1) +{ + FD_ZERO(&fds); +} + + +MSG_ERROR_T MsgIpcClientSocket::connect(const char* path) +{ + MSG_BEGIN(); + + if (!path || strlen(path) > strlen(MSG_SOCKET_PATH)) { + THROW(MsgException::IPC_ERROR, "path is null"); + } + + sockfd = socket(AF_UNIX, SOCK_STREAM, 0); + + if (sockfd < 0) { + THROW(MsgException::IPC_ERROR,"socket not opened %s",strerror(errno)); + } + + struct sockaddr_un serverSA = {0, }; + serverSA.sun_family = AF_UNIX; + + memset(serverSA.sun_path, 0x00, sizeof(serverSA.sun_path)); + strncpy(serverSA.sun_path, path, sizeof(serverSA.sun_path)-1); /* // "./socket" */ + + int len = strlen(serverSA.sun_path) + sizeof(serverSA.sun_family); + + if (::connect(sockfd, (struct sockaddr *)&serverSA, len) == CUSTOM_SOCKET_ERROR) { + THROW(MsgException::IPC_ERROR,"cannot connect server %s", strerror(errno)); + } + + /* add fd for select() */ + addfd(sockfd); + + /* read remote fd for reg func */ + char *rfd = NULL; + AutoPtr wrap(&rfd); + int rlen; + + read(&rfd, &rlen); + + if (rfd == NULL) { + THROW(MsgException::IPC_ERROR,"rfd is NULL %s", strerror(errno)); + } + + memcpy(&remotefd, rfd, sizeof(rlen)); + + MSG_DEBUG("Connected: client fd [%d] <----> remote fd [%d]", sockfd, remotefd); + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgIpcClientSocket::close() +{ + if (sockfd < 0) { + MSG_FATAL("Client socket is not opened (check if you call close twice by accident) [%d]", sockfd); + return MSG_ERR_UNKNOWN; + } + + /* it means that client is going to close the connection.*/ + int cmd = CLOSE_CONNECTION_BY_USER; + int len = sizeof(cmd); + + char cmdbuf[len]; + bzero(cmdbuf, len); + memcpy(cmdbuf, &cmd, len); + + ::close(sockfd); + sockfd = CUSTOM_SOCKET_ERROR; + + return MSG_SUCCESS; +} + +void MsgIpcClientSocket::addfd(int fd) +{ + MSG_DEBUG("%d added", fd); + FD_SET(fd, &fds); + if (fd > maxfd) + maxfd = fd; +} + +int MsgIpcClientSocket::writen (const char *buf, int len) +{ + int nleft, nwrite; + + nleft = len; + while (nleft > 0) { + nwrite = ::write(sockfd, (const void*) buf, nleft); + if (nwrite < 0) { + MSG_FATAL("writen: sockfd [%d] error [%s]", sockfd, strerror(errno)); + return nwrite; + } + else if (nwrite == 0) + break; + + nleft -= nwrite; + buf += nwrite; + } + return (len-nleft); +} + +int MsgIpcClientSocket::write(const char* buf, int len) +{ + if (sockfd < 0) { + MSG_FATAL("sockfd is not opened [%d]", sockfd); + return CUSTOM_SOCKET_ERROR; + } + + if (!buf || len <= 0) { + MSG_FATAL("buf[%p] and len[%d] MUST NOT NULL", buf, len); + return CUSTOM_SOCKET_ERROR; + } + + /* send the data size first */ + int n = writen((const char*)&len, sizeof(len)); + if (n != sizeof(len)) { + MSG_FATAL("WARNING: write header_size[%d] not matched [%d]", n, sizeof(len)); + return CUSTOM_SOCKET_ERROR; + } + + /* send the data in subsequence */ + n = writen(buf, len); + if (n != len) { + MSG_FATAL("WARNING: write data_size[%d] not matched [%d]", n, len); + return CUSTOM_SOCKET_ERROR; + } + + return len; +} + +int MsgIpcClientSocket::readn( char *buf, int len ) +{ + int nleft, nread; + + nleft = len; + while (nleft > 0) { + nread = ::read(sockfd, (void*) buf, nleft); + if (nread < 0) { + MSG_FATAL("WARNING read value %d: %s", nread, strerror(errno)); + return nread; + } + else if( nread == 0 ) + break; + + nleft -= nread; + buf += nread; + } + return (len-nleft); +} + + +/* what if the buf is shorter than data? */ +int MsgIpcClientSocket::read(char** buf, int* len) +{ + if (sockfd < 0) { + MSG_FATAL("socket is not opened [%d]", sockfd); + return CUSTOM_SOCKET_ERROR; + } + + if (!buf || !len) { + MSG_FATAL("rbuf and rlen MUST NOT NULL"); + return CUSTOM_SOCKET_ERROR; + } + + /* read the data size first */ + int n = readn((char*) len, sizeof(int)); + if (n == CLOSE_CONNECTION_BY_SIGNAL) { /* if msgfw gets down, it signals to all IPC clients */ + MSG_FATAL("sockfd [%d] CLOSE_CONNECTION_BY_SIGNAL", sockfd); + return n; + } + + else if (n != sizeof(int)) { + MSG_FATAL("WARNING: read header_size[%d] not matched [%d]", n, sizeof(int)); + return CUSTOM_SOCKET_ERROR; + } + + /* read the data in subsequence */ + if ((*len) > 0) { + *buf = new char[*len+1]; + bzero(*buf, *len+1); + n = readn(*buf, *len); + + if (n != *len) { + MSG_FATAL("WARNING: read data_size [%d] not matched [%d]", n, *len); + return CUSTOM_SOCKET_ERROR; + } + } + + return n; +} + + +/*================================================================================================== + IMPLEMENTATION OF MsgIpcServerSocket - Member Functions +==================================================================================================*/ +MsgIpcServerSocket::MsgIpcServerSocket() : sockfd(-1), maxfd(-1) +{ + FD_ZERO(&fds); +} + +void MsgIpcServerSocket::addfd(int fd) +{ + MSG_DEBUG("%d added", fd); + FD_SET(fd, &fds); + + std::map::iterator it = mapFds.find(fd); + if (it != mapFds.end()) + MSG_FATAL("Duplicate FD %d", fd); + else + mapFds[fd] = fd; + + if (fd > maxfd) + maxfd = fd; +} + +MSG_ERROR_T MsgIpcServerSocket::open(const char* path) +{ + MSG_BEGIN(); + + if (!path || strlen(path) > strlen(MSG_SOCKET_PATH)) { + MSG_FATAL("path is null"); + return MSG_ERR_INVALID_PARAMETER; + } + + if (sockfd != CUSTOM_SOCKET_ERROR) { + MSG_FATAL("WARNING: server_socket already opened %d at %p", sockfd, &sockfd); + return MSG_ERR_UNKNOWN; + } + + sockfd = socket(AF_UNIX, SOCK_STREAM, 0); + + if (sockfd == CUSTOM_SOCKET_ERROR) { + MSG_FATAL("socket failed: %s", strerror(errno)); + return MSG_ERR_UNKNOWN; + } + + MSG_DEBUG("server_socket(%p) opened : %d", &sockfd, sockfd); + + struct sockaddr_un local = {0, }; + + local.sun_family = AF_UNIX; + memset(local.sun_path, 0x00, sizeof(local.sun_path)); + strncpy(local.sun_path, path, sizeof(local.sun_path)-1); + + unlink(local.sun_path); + + int len = strlen(local.sun_path) + sizeof(local.sun_family); + + if (bind(sockfd, (struct sockaddr *)&local, len) == CUSTOM_SOCKET_ERROR) { + MSG_FATAL("bind: %s", strerror(errno)); + return MSG_ERR_UNKNOWN; + } + + /** + * determine permission of socket file + * + * - S_IRWXU : for user, allow read and write and execute + * - S_IRWXG : for group, allow read and write and execute + * - S_IRWXO : for other, allow read and write and execute + * + * - S_IRUSR, S_IWUSR, S_IXUSR : for user, allow only read, write, execute respectively + * - S_IRGRP, S_IWGRP, S_IXGRP : for group, allow only read, write, execute respectively + * - S_IROTH, S_IWOTH, S_IXOTH : for other, allow only read, write, execute respectively + */ + mode_t sock_mode = (S_IRWXU | S_IRWXG | S_IRWXO); /* has 777 permission */ + + if (chmod(path, sock_mode) == CUSTOM_SOCKET_ERROR) { + MSG_FATAL("chmod: %s", strerror(errno)); + return MSG_ERR_UNKNOWN; + } + + if (listen(sockfd, CUSTOM_SOCKET_BACKLOG) == CUSTOM_SOCKET_ERROR) { + MSG_FATAL("listen: %s", strerror(errno)); + return MSG_ERR_UNKNOWN; + } + + addfd(sockfd); + + MSG_END(); + + return MSG_SUCCESS; +} + +MSG_ERROR_T MsgIpcServerSocket::accept() +{ + MSG_BEGIN(); + + if (sockfd == CUSTOM_SOCKET_ERROR) { + MSG_FATAL("server_socket not init"); + return MSG_ERR_UNKNOWN; + } + + struct sockaddr_un remote; + + int t = sizeof(remote); + int fd = ::accept(sockfd, (struct sockaddr *)&remote, (socklen_t*) &t); + if (fd < 0) { + MSG_FATAL("accept: %s", strerror(errno)); + return MSG_ERR_UNKNOWN; + } + + addfd(fd); + MSG_DEBUG("%d is added", fd); + + /* write the registerd fd */ + write(fd, (const char*) &fd, sizeof(fd)); + + MSG_END(); + + return MSG_SUCCESS; +} + +void MsgIpcServerSocket::close(int fd) +{ + MSG_BEGIN(); + + if (sockfd == CUSTOM_SOCKET_ERROR) { + MSG_FATAL("server_socket not init"); + return; + } + + MSG_DEBUG("%d to be removed", fd); + FD_CLR(fd, &fds); + + std::map::iterator it = mapFds.find(fd); + if (it == mapFds.end()) + MSG_FATAL("No FD %d", fd); + else + mapFds.erase(it); + + if (fd == maxfd) { + int newmax = 0; + for (it = mapFds.begin() ; it != mapFds.end() ; it++) + newmax = (it->second > newmax )? it->second : newmax; + maxfd = newmax; + } + MSG_DEBUG("fd %d removal done", fd); + ::close(fd); + + MSG_END(); +} + +int MsgIpcServerSocket::readn( int fd, char *buf, int len ) +{ + int nleft, nread; + + nleft = len; + while (nleft > 0) { + nread = ::read(fd, (void*)buf, nleft); + if (nread < 0) { + MSG_FATAL("read: %s", strerror(errno)); + return nread; + } + else if (nread == 0) + break; + + nleft -= nread; + buf += nread; + } + return (len-nleft); +} + +int MsgIpcServerSocket::read(int fd, char** buf, int* len ) +{ + if (sockfd == CUSTOM_SOCKET_ERROR) { + MSG_FATAL("server_socket(%p) is not initd %d", &sockfd, sockfd); + return CUSTOM_SOCKET_ERROR; + } + + if (!buf || !len) { + MSG_FATAL("buf[%p] and len[%p] MUST NOT NULL", buf, len); + return CUSTOM_SOCKET_ERROR; + } + + /* read the data size first */ + int n = readn(fd, (char*) len, sizeof(int)); + + if (n == CLOSE_CONNECTION_BY_SIGNAL) { + MSG_FATAL("fd %d CLOSE_CONNECTION_BY_SIGNAL", fd); + return n; + } + + else if (n != sizeof(int)) { + MSG_FATAL("readn %d(%d)", n, sizeof(int)); + return CUSTOM_SOCKET_ERROR; + } + + MSG_DEBUG("MsgLen %d", *len); + if (*len == CLOSE_CONNECTION_BY_USER) + return *len; + + if ((*len) > 0) { + /* read the data in subsequence */ + *buf = new char[*len+1]; + bzero(*buf, *len+1); + n = readn(fd, *buf, *len); + + if (n != *len) { + MSG_FATAL("WARNING: read data_size [%d] not matched [%d]", n, *len); + return CUSTOM_SOCKET_ERROR; + } + } + + return n; +} + +int MsgIpcServerSocket::writen(int fd, const char *buf, int len) +{ + int nleft, nwrite; + + nleft = len; + + while (nleft > 0) { + /* MSG_NOSIGNAL to prevent SIGPIPE Error */ + /* MSG_DONTWAIT to avoid socket block */ + nwrite = ::send(fd, (const void*) buf, nleft, MSG_NOSIGNAL|MSG_DONTWAIT); + + if (nwrite < 0) { + MSG_FATAL("write: %s", strerror(errno)); + return nwrite; + } + else if (nwrite == 0) { /* Nothing is send. */ + break; + } + else { + nleft -= nwrite; + buf += nwrite; + } + } + + return (len-nleft); +} + + +int MsgIpcServerSocket::write(int fd, const char* buf, int len) +{ + MSG_BEGIN(); + + if (!buf || len <= 0) { + MSG_FATAL("buf [%p] and len [%d] MUST NOT NULL", buf, len); + return CUSTOM_SOCKET_ERROR; + } + + MSG_DEBUG("for debug - fd : [%d], buf : [%p], len : [%d]", fd, buf, len); + + /* send the data size first */ + int n = writen(fd, (const char*)&len, sizeof(len)); + + if (n != sizeof(len)) { + MSG_FATAL("WARNING: write header_size[%d] not matched [%d]", n, sizeof(len)); + return CUSTOM_SOCKET_ERROR; + } + + /* send the data in subsequence */ + n = writen(fd, buf, len); + + MSG_DEBUG("Writing %d bytes", n); + + if (n != len) { + MSG_FATAL("Written byte (%d) is not matched to input byte (%d)", n, len); + return CUSTOM_SOCKET_ERROR; + } + + MSG_END(); + + return len; +} diff --git a/utils/MsgMemory.cpp b/utils/MsgMemory.cpp new file mode 100755 index 0000000..0d2fd4c --- /dev/null +++ b/utils/MsgMemory.cpp @@ -0,0 +1,55 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgDebug.h" +#include "MsgSqliteWrapper.h" +#include "MsgMemory.h" + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +void MsgReleaseMemory() +{ + MSG_BEGIN(); + + // Release Malloc Memory + malloc_trim(0); + + // Release Stack Memory +// stack_trim(); + + // Release Memory using in sqlite + MsgReleaseMemoryDB(); + + MSG_END(); +} + diff --git a/utils/MsgMmsMessage.cpp b/utils/MsgMmsMessage.cpp new file mode 100755 index 0000000..7526961 --- /dev/null +++ b/utils/MsgMmsMessage.cpp @@ -0,0 +1,1179 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include +#include + +#include "MsgTypes.h" +#include "MsgMmsTypes.h" +#include "MsgMmsMessage.h" +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgStorageTypes.h" +#include "MsgInternalTypes.h" + + +MMS_SMIL_ROOTLAYOUT rootlayout; + +static void __release_glist_element(gpointer data, gpointer user_data); +static void __release_page_element(gpointer data, gpointer user_data); + +int msg_verify_number(const char *raw, char *trimmed) +{ + if (!(raw && trimmed)) { + MSG_DEBUG("Phone Number is NULL"); + return MSG_ERR_NULL_POINTER; + } + + for (int i = 0, j = 0; raw[i]; i++) { + if ((raw[i] >= '0' && raw[i] <= '9') || (raw[i] == ',') || raw[i] == ' ' || raw[i] == '+') { + trimmed[j++] = raw[i]; + } else if (raw[i] == '-') { + continue; + } else { + MSG_DEBUG("Unacceptable character in telephone number: [%c]", raw[i]); + return MSG_ERR_INVALID_PARAMETER; + } + } + + MSG_DEBUG("Trimming [%s]->[%s]", raw, trimmed); + return MSG_SUCCESS; +} + +int msg_verify_email(const char *raw) +{ + bool onlyNum = true; + bool atExist = false; + + if (!raw) { + MSG_DEBUG("Email is NULL"); + return MSG_ERR_NULL_POINTER; + } + + for (int i = 0; raw[i]; i++) { + + if (raw[i] == '@') { + onlyNum = false; + + if (atExist == false) { + atExist = true; + continue; + } else { + MSG_DEBUG("Character [@] is included more than twice in email address."); + return MSG_ERR_INVALID_PARAMETER; + } + } + + if ((raw[i] >= '0' && raw[i] <= '9') || raw[i] == ' ' || raw[i] == '+') { + continue; + } else if ((raw[i] >= 'a' && raw[i] <= 'z') ||(raw[i] >= 'A' && raw[i] <= 'Z') ||(raw[i] == '.') || raw[i] == '_' || raw[i] == '-') { + onlyNum = false; + continue; + } else if (raw[i] == ',') { + if (onlyNum == false && atExist == false) { + MSG_DEBUG("Unacceptable type in address."); + return MSG_ERR_INVALID_PARAMETER; + } + atExist = false; + onlyNum = true; + continue; + } else { + MSG_DEBUG("Unacceptable character in address : [%c]", raw[i]); + return MSG_ERR_INVALID_PARAMETER; + } + } + + return MSG_SUCCESS; +} + +static void __release_glist_element(gpointer data, gpointer user_data) +{ + if(data != NULL) { + free(data); + } +} + +static void __release_page_element(gpointer data, gpointer user_data) +{ + if(data != NULL) { + MMS_PAGE_S *page = (MMS_PAGE_S *)data; + + if (page->medialist) { + MMS_MEDIA_S *media = NULL; + int mediaCnt = g_list_length(page->medialist); + + for (int i = 0; i < mediaCnt; i++) { + media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, i); + if (media) + free(media); + } + + g_list_free(page->medialist); + page->medialist = NULL; + page->mediaCnt = 0; + } + + free(page); + } +} + +MSG_ERROR_T _MsgMmsReleasePageList(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + if (pMsgData->pagelist) { + g_list_foreach(pMsgData->pagelist, __release_page_element, NULL); + g_list_free(pMsgData->pagelist); + pMsgData->pagelist = NULL; + } + + pMsgData->pageCnt = 0; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsReleaseRegionList(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + if (pMsgData->regionlist) { + g_list_foreach(pMsgData->regionlist, __release_glist_element, NULL); + g_list_free(pMsgData->regionlist); + pMsgData->regionlist = NULL; + } + + pMsgData->regionCnt = 0; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsReleaseAttachList(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + if (pMsgData->attachlist) { + g_list_foreach(pMsgData->attachlist, __release_glist_element, NULL); + g_list_free(pMsgData->attachlist); + pMsgData->attachlist = NULL; + } + + pMsgData->attachCnt = 0; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsReleaseTransitionList(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + if (pMsgData->transitionlist) { + g_list_foreach(pMsgData->transitionlist, __release_glist_element, NULL); + g_list_free(pMsgData->transitionlist); + pMsgData->transitionlist = NULL; + } + + pMsgData->transitionCnt = 0; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsReleaseMetaList(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return MSG_ERR_INVALID_PARAMETER; + } + + if (pMsgData->metalist) { + g_list_foreach(pMsgData->metalist, __release_glist_element, NULL); + g_list_free(pMsgData->metalist); + pMsgData->metalist = NULL; + } + + pMsgData->metaCnt = 0; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsAddRegion(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_REGION* pRegion) +{ + if(pMsgData == NULL || pRegion == NULL) + return MSG_ERR_INVALID_PARAMETER; + + pMsgData->regionlist = g_list_append(pMsgData->regionlist, pRegion); + pMsgData->regionCnt++; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsAddPage(MMS_MESSAGE_DATA_S *pMsgData, MMS_PAGE_S *pPage) +{ + if(pMsgData == NULL || pPage == NULL) + return MSG_ERR_INVALID_PARAMETER; + + pMsgData->pagelist = g_list_append(pMsgData->pagelist, pPage); + pMsgData->pageCnt++; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsAddMedia(MMS_PAGE_S* pPage, MMS_MEDIA_S *pMedia) +{ + if(pPage == NULL || pMedia == NULL) + return MSG_ERR_INVALID_PARAMETER; + + pPage->medialist = g_list_append(pPage->medialist, pMedia); + pPage->mediaCnt++; + MSG_DEBUG("media's mediatype: %d", pMedia->mediatype); + MSG_DEBUG("media's filename: %s", pMedia->szFileName); + MSG_DEBUG("media's filepath: %s", pMedia->szFilePath); + MSG_DEBUG("media's contentId: %s", pMedia->szContentID); + MSG_DEBUG("page's media count: %d", pPage->mediaCnt); + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsAddTransition(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_TRANSITION* pTransition) +{ + if(pMsgData == NULL || pTransition == NULL) + return MSG_ERR_INVALID_PARAMETER; + + pMsgData->transitionlist = g_list_append(pMsgData->transitionlist, pTransition); + pMsgData->transitionCnt++; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsAddMeta(MMS_MESSAGE_DATA_S *pMsgData, MMS_SMIL_META* pMeta) +{ + if(pMsgData == NULL || pMeta == NULL) + return MSG_ERR_INVALID_PARAMETER; + + pMsgData->metalist = g_list_append(pMsgData->metalist, pMeta); + pMsgData->metaCnt++; + + return MSG_SUCCESS; +} + +MSG_ERROR_T _MsgMmsAddAttachment(MMS_MESSAGE_DATA_S *pMsgData, MMS_ATTACH_S *pAttach) +{ + if(pMsgData == NULL || pAttach == NULL) + return MSG_ERR_INVALID_PARAMETER; + + pMsgData->attachlist = g_list_append(pMsgData->attachlist, pAttach); + pMsgData->attachCnt++; + + return MSG_SUCCESS; +} + +bool _MsgMmsFindMatchedMedia(MMS_MESSAGE_DATA_S *pMsgData, char *pszFilePath) +{ + if (pMsgData == NULL || pszFilePath == NULL) + return false; + + if (pMsgData->pagelist) { + for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) { + MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); + + if (page && page->medialist) { + for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) { + MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx); + if (media) { + if (strcmp(pszFilePath, media->szFilePath) == 0) + return true; + } + } + } + } + } + + return false; +} + +MSG_ERROR_T _MsgMmsAddSmilDoc(char* pSmil, MMS_MESSAGE_DATA_S* pMsgData) +{ + MSG_DEBUG("MsgMmsAddSmilDoc"); + + if(pSmil == NULL || pMsgData == NULL) + return MSG_ERR_INVALID_PARAMETER; + + char fullpath[MSG_FILEPATH_LEN_MAX] = {0,}; + char smilFileName[MSG_FILENAME_LEN_MAX+1] = {0,}; + time_t RawTime = 0; + + //Create smilFileName + time(&RawTime); + snprintf(smilFileName, MSG_FILENAME_LEN_MAX+1, "%lu", RawTime); + snprintf(fullpath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_SMIL_FILE_PATH, smilFileName); + + if (MsgWriteSmilFile(fullpath, pSmil, strlen(pSmil)) == false) { + MSG_DEBUG("MsgWriteSmilFile error"); + return MSG_ERR_MMS_ERROR; + } + strncpy(pMsgData->szSmilFilePath, smilFileName, MSG_FILEPATH_LEN_MAX-1); + + return MSG_SUCCESS; +} + + +char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S* pMsgData, unsigned int *pSize) +{ + MSG_DEBUG("MsgMmsSerializeMessageData"); + + if (pMsgData == NULL) + return NULL; + + int bufsize = 0; + int offset = 0; + int pageCnt = 0; + char *buf = NULL; + + pageCnt = pMsgData->pageCnt; + + int mediaCnt = 0; + + if (pMsgData->pagelist) { + for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++) { + bufsize += sizeof(int); // Media cnt + + MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); + mediaCnt = page->mediaCnt; + + if (page->medialist) { + for (int i = 0; i < mediaCnt; i++) { + MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, i); + + if (media->mediatype == MMS_SMIL_MEDIA_TEXT) { + bufsize += (sizeof(MmsSmilMediaType) + MSG_FILENAME_LEN_MAX + 2 * MSG_FILEPATH_LEN_MAX + MSG_MSG_ID_LEN + 1 + + MAX_SMIL_ALT_LEN + MAX_SMIL_REGION_ID +#ifdef __SUPPORT_DRM__ + + sizeof(MsgDrmType) + MSG_FILEPATH_LEN_MAX +#endif + + MAX_SMIL_TRANSIN_ID + MAX_SMIL_TRANSOUT_ID + + 7 * sizeof(int) + 3* sizeof(bool) + sizeof(MmsTextDirection) + sizeof(MmsSmilFontType)); + } else { + bufsize += (sizeof(MmsSmilMediaType) + MSG_FILENAME_LEN_MAX + 2 * MSG_FILEPATH_LEN_MAX + MSG_MSG_ID_LEN + 1 + + MAX_SMIL_ALT_LEN + MAX_SMIL_REGION_ID +#ifdef __SUPPORT_DRM__ + + sizeof(MsgDrmType) + MSG_FILEPATH_LEN_MAX +#endif + + MAX_SMIL_TRANSIN_ID + MAX_SMIL_TRANSOUT_ID + 5 * sizeof(int) + ); + } + } + } + + bufsize += sizeof(int) * 6; + } + } + + bufsize += sizeof(int); // region count; + if (pMsgData->regionlist) { + int elementSize = g_list_length(pMsgData->regionlist); + bufsize += elementSize * (MAX_SMIL_REGION_ID + 4 * sizeof(MMS_LENGTH) + sizeof(int) + sizeof(REGION_FIT_TYPE_T)); + } + + bufsize += sizeof(int); // attachment count; + if (pMsgData->attachlist) { + int elementSize = g_list_length(pMsgData->attachlist); + bufsize += elementSize * (sizeof(MimeType) + MSG_FILENAME_LEN_MAX + MSG_FILEPATH_LEN_MAX + sizeof(int) +#ifdef __SUPPORT_DRM__ + + sizeof(MsgDrmType) + MSG_FILEPATH_LEN_MAX +#endif + ); + } + + bufsize += sizeof(int); // transition count; + if (pMsgData->transitionlist) { + int elementSize = g_list_length(pMsgData->transitionlist); + bufsize += elementSize * (MAX_SMIL_TRANSITION_ID + sizeof(MmsSmilTransType) + sizeof(MmsSmilTransSubType) + sizeof(int)); + } + + bufsize += sizeof(int); // meta count; + if (pMsgData->metalist) { + int elementSize = g_list_length(pMsgData->metalist); + bufsize += elementSize * (MAX_SMIL_META_ID + MAX_SMIL_META_NAME + MAX_SMIL_META_CONTENT); + } + + bufsize += sizeof(MMS_SMIL_ROOTLAYOUT); + +#ifdef FEATURE_JAVA_MMS + bufsize += sizeof(MMS_APPID_INFO_S); +#endif + + int filePathLen = strlen(pMsgData->szSmilFilePath); + + bufsize += sizeof(int) + filePathLen + sizeof(int); + + MSG_DEBUG("MsgMmsSerializeMessageData: bufsize = %d", bufsize); + + buf = (char *)calloc(bufsize, 1); + + // copy file path length + MSG_DEBUG("MsgMmsSerializeMessageData: smilFilePath Length = %d", filePathLen); + + memcpy(buf, &filePathLen, sizeof(int)); + + offset += sizeof(int); + + // copy file path + MSG_DEBUG("MsgMmsSerializeMessageData: smilFilePath = %s", pMsgData->szSmilFilePath); + + if (filePathLen > 0) { + memcpy(buf + offset, pMsgData->szSmilFilePath, filePathLen); + + offset += filePathLen; + } + + // copy page count + MSG_DEBUG("MsgMmsSerializeMessageData: pageCnt = %d", pMsgData->pageCnt); + + memcpy(buf + offset, &(pMsgData->pageCnt), sizeof(int)); + + offset += sizeof(int); + + if (pMsgData->pagelist) { + for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++) + { + MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); + mediaCnt = page->mediaCnt; + + memcpy(buf + offset, &mediaCnt, sizeof(int)); + offset += sizeof(int); + + MSG_DEBUG("MsgMmsSerializeMessageData: mediaCnt = %d", mediaCnt); + if (page->medialist) { + for (int i = 0; i < mediaCnt; ++ i) { + MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, i); + + memcpy(buf + offset, &(media->mediatype), sizeof(MmsSmilMediaType)); + offset += sizeof(MmsSmilMediaType); + MSG_DEBUG("%d media's mediatype = %d", i, media->mediatype); + + memcpy(buf + offset, media->szSrc, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; + + memcpy(buf + offset, media->szFileName, MSG_FILENAME_LEN_MAX); + offset += MSG_FILENAME_LEN_MAX; + MSG_DEBUG("%d media's filename = %s", i, media->szFileName); + + memcpy(buf + offset, media->szFilePath, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; + MSG_DEBUG("%d media's filepath = %s", i, media->szFilePath); + + memcpy(buf + offset, media->szContentID, MSG_MSG_ID_LEN + 1); + offset += MSG_MSG_ID_LEN + 1; + MSG_DEBUG("%d media's contentID = %s", i, media->szContentID); + + memcpy(buf + offset, media->regionId, MAX_SMIL_REGION_ID); + offset += MAX_SMIL_REGION_ID; + MSG_DEBUG("%d media's regionId = %s", i, media->regionId); + + memcpy(buf + offset, media->szAlt, MAX_SMIL_ALT_LEN); + offset += MAX_SMIL_ALT_LEN; + +#ifdef __SUPPORT_DRM__ + memcpy(buf + offset, &(media->drmType), sizeof(MsgDrmType)); + offset += sizeof(MsgDrmType); + memcpy(buf + offset, media->szDrm2FullPath, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; +#endif + + if (media->mediatype == MMS_SMIL_MEDIA_TEXT) { + MSG_DEBUG("##### Media = TEXT #####"); + memcpy(buf + offset, media->sMedia.sText.szTransInId, MAX_SMIL_TRANSIN_ID); + offset += MAX_SMIL_TRANSIN_ID; + + memcpy(buf + offset, media->sMedia.sText.szTransOutId, MAX_SMIL_TRANSOUT_ID); + offset += MAX_SMIL_TRANSOUT_ID; + + memcpy(buf + offset, &(media->sMedia.sText.nRepeat), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sText.nBegin), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sText.nEnd), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sText.nDurTime), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sText.nBgColor), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sText.bBold), sizeof(bool)); + offset += sizeof(bool); + + memcpy(buf + offset, &(media->sMedia.sText.bUnderLine), sizeof(bool)); + offset += sizeof(bool); + + memcpy(buf + offset, &(media->sMedia.sText.bItalic), sizeof(bool)); + offset += sizeof(bool); + + memcpy(buf + offset, &(media->sMedia.sText.bReverse), sizeof(bool)); + offset += sizeof(bool); + + memcpy(buf + offset, &(media->sMedia.sText.nDirection), sizeof(MmsTextDirection)); + offset += sizeof(MmsTextDirection); + + //memcpy(buf + offset, &(media->sMedia.sText.nFont), sizeof(MmsSmilFontType)); + //offset += sizeof(MmsSmilFontType); + + memcpy(buf + offset, &(media->sMedia.sText.nSize), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sText.nColor), sizeof(int)); + offset += sizeof(int); + } else { + MSG_DEBUG("##### Media = IMAGE, AUDIO, VIDEO #####"); + memcpy(buf + offset, media->sMedia.sAVI.szTransInId, MAX_SMIL_TRANSIN_ID); + offset += MAX_SMIL_TRANSIN_ID; + + memcpy(buf + offset, media->sMedia.sAVI.szTransOutId, MAX_SMIL_TRANSOUT_ID); + offset += MAX_SMIL_TRANSOUT_ID; + + memcpy(buf + offset, &(media->sMedia.sAVI.nRepeat), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sAVI.nBegin), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sAVI.nEnd), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sAVI.nDurTime), sizeof(int)); + offset += sizeof(int); + + memcpy(buf + offset, &(media->sMedia.sAVI.nBgColor), sizeof(int)); + offset += sizeof(int); + } + } + } + + memcpy(buf + offset, &page->nDur, sizeof(int)); + offset += sizeof(int); + memcpy(buf + offset, &page->nBegin, sizeof(int)); + offset += sizeof(int); + memcpy(buf + offset, &page->nEnd, sizeof(int)); + offset += sizeof(int); + memcpy(buf + offset, &page->nMin, sizeof(int)); + offset += sizeof(int); + memcpy(buf + offset, &page->nMax, sizeof(int)); + offset += sizeof(int); + memcpy(buf + offset, &page->nRepeat, sizeof(int)); + offset += sizeof(int); + } + } + + memcpy(buf + offset, &pMsgData->regionCnt, sizeof(int)); + offset += sizeof(int); + MSG_DEBUG("pMsgData->regionCnt: %d", pMsgData->regionCnt); + + if (pMsgData->regionlist) { + for (int i = 0; i < pMsgData->regionCnt; ++ i) { + MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)g_list_nth_data(pMsgData->regionlist, i); + + memcpy(buf + offset, region->szID, MAX_SMIL_REGION_ID); + offset += MAX_SMIL_REGION_ID; + MSG_DEBUG("%d region's ID = %s", i, region->szID); + memcpy(buf + offset, ®ion->nLeft, sizeof(MMS_LENGTH)); + offset += sizeof(MMS_LENGTH); + memcpy(buf + offset, ®ion->nTop, sizeof(MMS_LENGTH)); + offset += sizeof(MMS_LENGTH); + memcpy(buf + offset, ®ion->width, sizeof(MMS_LENGTH)); + offset += sizeof(MMS_LENGTH); + memcpy(buf + offset, ®ion->height, sizeof(MMS_LENGTH)); + offset += sizeof(MMS_LENGTH); + memcpy(buf + offset, ®ion->bgColor, sizeof(int)); + offset += sizeof(int); + memcpy(buf + offset, ®ion->fit, sizeof(REGION_FIT_TYPE_T)); + offset += sizeof(REGION_FIT_TYPE_T); + } + } + + memcpy(buf + offset, &pMsgData->attachCnt, sizeof(int)); + offset += sizeof(int); + MSG_DEBUG("pMsgData->attachCnt: %d", pMsgData->attachCnt); + + if (pMsgData->attachlist) { + for (int i = 0; i < pMsgData->attachCnt; ++ i) { + MMS_ATTACH_S *attach = (MMS_ATTACH_S *)g_list_nth_data(pMsgData->attachlist, i); + + memcpy(buf + offset, &(attach->mediatype), sizeof(MimeType)); + offset += sizeof(MimeType); + MSG_DEBUG("%d attachment's mediatype = %d", i, attach->mediatype); + + memcpy(buf + offset, attach->szFileName, MSG_FILENAME_LEN_MAX); + offset += MSG_FILENAME_LEN_MAX; + MSG_DEBUG("%d attachment's filename = %s", i, attach->szFileName); + + memcpy(buf + offset, attach->szFilePath, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; + MSG_DEBUG("%d attachment's filepath = %s", i, attach->szFilePath); + + memcpy(buf + offset, &(attach->fileSize), sizeof(int)); + offset += sizeof(int); + MSG_DEBUG("%d attachment's file size = %d", i, attach->fileSize); + +#ifdef __SUPPORT_DRM__ + memcpy(buf + offset, &(attach->drmType), sizeof(MsgDrmType)); + offset += sizeof(MsgDrmType); + memcpy(buf + offset, attach->szDrm2FullPath, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; +#endif + } + } + + memcpy(buf + offset, &pMsgData->transitionCnt, sizeof(int)); + offset += sizeof(int); + MSG_DEBUG("pMsgData->transitionCnt: %d", pMsgData->transitionCnt); + + if (pMsgData->transitionlist) { + for (int i = 0; i < pMsgData->transitionCnt; ++ i) { + MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)g_list_nth_data(pMsgData->transitionlist, i); + + memcpy(buf + offset, transition->szID, MAX_SMIL_TRANSITION_ID); + offset += MAX_SMIL_TRANSITION_ID; + MSG_DEBUG("%d transition's ID = %s", i, transition->szID); + + memcpy(buf + offset, &transition->nType, sizeof(MmsSmilTransType)); + offset += sizeof(MmsSmilTransType); + memcpy(buf + offset, &transition->nSubType, sizeof(MmsSmilTransSubType)); + offset += sizeof(MmsSmilTransSubType); + memcpy(buf + offset, &transition->nDur, sizeof(int)); + offset += sizeof(int); + } + } + + memcpy(buf + offset, &pMsgData->metaCnt, sizeof(int)); + offset += sizeof(int); + MSG_DEBUG("pMsgData->metaCnt: %d", pMsgData->metaCnt); + + if (pMsgData->metalist) { + for (int i = 0; i < pMsgData->metaCnt; ++ i) { + MMS_SMIL_META *meta = (MMS_SMIL_META *)g_list_nth_data(pMsgData->metalist, i); + + memcpy(buf + offset, meta->szID, MAX_SMIL_META_ID); + offset += MAX_SMIL_META_ID; + MSG_DEBUG("%d meta's ID = %s", i, meta->szID); + + memcpy(buf + offset, meta->szName, MAX_SMIL_META_NAME); + offset += MAX_SMIL_META_NAME; + MSG_DEBUG("%d meta's ID = %s", i, meta->szID); + + memcpy(buf + offset, meta->szContent, MAX_SMIL_META_CONTENT); + offset += MAX_SMIL_META_CONTENT; + MSG_DEBUG("%d meta's ID = %s", i, meta->szID); + } + } + + memcpy(buf + offset, &pMsgData->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT)); + offset += sizeof(MMS_SMIL_ROOTLAYOUT); + +#ifdef FEATURE_JAVA_MMS + memcpy(buf + offset, &pMsgData->msgAppId, sizeof(MMS_APPID_INFO_S)); + offset += sizeof(MMS_APPID_INFO_S); +#endif + + *pSize = offset; + + return buf; +} + +int _MsgMmsGetPageCount(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return 0; + } + + int count = 0; + + if (pMsgData->pagelist) + count = g_list_length(pMsgData->pagelist); + + MSG_DEBUG("Page Count: %d", count); + return count; +} + +MMS_PAGE_S *_MsgMmsGetPage(MMS_MESSAGE_DATA_S *pMsgData, int pageIdx) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return NULL; + } + + MMS_PAGE_S *page = NULL; + + if (pMsgData->pagelist) + page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); + + return page; +} + +int _MsgMmsGetAttachCount(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return 0; + } + + int count = 0; + + if (pMsgData->attachlist) + count = g_list_length(pMsgData->attachlist); + + MSG_DEBUG("Attachment Count: %d", count); + return count; +} + +MMS_ATTACH_S *_MsgMmsGetAttachment(MMS_MESSAGE_DATA_S *pMsgData, int attachIdx) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return NULL; + } + + MMS_ATTACH_S *attach = NULL; + if (pMsgData->attachlist) + attach = (MMS_ATTACH_S *)g_list_nth_data(pMsgData->attachlist, attachIdx); + + return attach; +} + +MMS_SMIL_REGION *_MsgMmsGetSmilRegion(MMS_MESSAGE_DATA_S *pMsgData, int regionIdx) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return NULL; + } + + MMS_SMIL_REGION *region = NULL; + + if (pMsgData->regionlist) + region = (MMS_SMIL_REGION *)g_list_nth_data(pMsgData->regionlist, regionIdx); + + return region; +} + +MMS_MEDIA_S *_MsgMmsGetMedia(MMS_PAGE_S *pPage, int mediaIdx) +{ + if (!pPage) { + MSG_FATAL("pPage is NULL"); + return NULL; + } + + if (mediaIdx > pPage->mediaCnt || mediaIdx < 0) { + MSG_FATAL("Invalid media index = %d", mediaIdx); + return NULL; + } + + MMS_MEDIA_S *media = NULL; + if (pPage->medialist) + media = (MMS_MEDIA_S *)g_list_nth_data(pPage->medialist, mediaIdx); + + return media; + +} + +int _MsgMmsGetTransitionCount(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return 0; + } + + int count = 0; + + if (pMsgData->transitionlist) + count = g_list_length(pMsgData->transitionlist); + + MSG_DEBUG("Transition Count: %d", count); + return count; +} + +MMS_SMIL_TRANSITION *_MsgMmsGetTransition(MMS_MESSAGE_DATA_S *pMsgData, int transitionIdx) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return NULL; + } + + MMS_SMIL_TRANSITION *transition = NULL; + if (pMsgData->transitionlist) + transition = (MMS_SMIL_TRANSITION *)g_list_nth_data(pMsgData->transitionlist, transitionIdx); + + return transition; +} + +MMS_SMIL_META *_MsgMmsGetMeta(MMS_MESSAGE_DATA_S *pMsgData, int metaIdx) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return NULL; + } + + MMS_SMIL_META *meta = NULL; + + if (pMsgData->metalist) + meta = (MMS_SMIL_META *)g_list_nth_data(pMsgData->metalist, metaIdx); + + return meta; +} + +int _MsgMmsGetMetaCount(MMS_MESSAGE_DATA_S *pMsgData) +{ + if (pMsgData == NULL) { + MSG_DEBUG("pMsgData is NULL"); + return 0; + } + + int count = 0; + + if (pMsgData->metalist) + count = g_list_length(pMsgData->metalist); + + MSG_DEBUG("Meta Count: %d", count); + return count; +} + + +bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S* pBody, char* pData) +{ + MSG_DEBUG("MmsGetMsgBodyfromFile"); + + if (pBody == NULL || pData == NULL) { + MSG_DEBUG("param is NULL. pBody = %x, pData = %x", pBody, pData); + return false; + } + + int offset = 0; + int pageCnt = 0; + int filePathLen = 0; + + MMS_PAGE_S *pPage = NULL; + MMS_MEDIA_S *pMedia = NULL; + MMS_SMIL_REGION *pRegion = NULL; + MMS_ATTACH_S *pAttach = NULL; + MMS_SMIL_TRANSITION *pTransition = NULL; + MMS_SMIL_META *pMeta = NULL; + + memcpy(&filePathLen, pData, sizeof(int)); + + offset += sizeof(int); + + MSG_DEBUG("Smil File Path Length : %d", filePathLen); + + if (filePathLen > MSG_FILEPATH_LEN_MAX) { + MSG_DEBUG("Smil File Path Length is abnormal."); + return false; + } + + memset(pBody->szSmilFilePath, 0x00, MSG_FILEPATH_LEN_MAX); + + if (filePathLen > 0) { + memcpy(pBody->szSmilFilePath, pData + offset, filePathLen); + + offset += filePathLen; + } + + memcpy(&(pBody->pageCnt), pData + offset, sizeof(int)); + + offset += sizeof(int); + + pageCnt = pBody->pageCnt; + + MSG_DEBUG("MMS PAGE COUNT: %d", pageCnt); + + for (int j = 0; j < pageCnt; ++j) { + pPage = (MMS_PAGE_S *)calloc(sizeof(MMS_PAGE_S), 1); + + memcpy(&pPage->mediaCnt, pData + offset, sizeof(int)); + offset += sizeof(int); + MSG_DEBUG("MMS MEDIA COUNT: %d", pPage->mediaCnt); + + for (int i = 0; i < pPage->mediaCnt; ++i) { + pMedia = (MMS_MEDIA_S *)calloc(sizeof(MMS_MEDIA_S), 1); + + memcpy(&pMedia->mediatype, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(pMedia->szSrc, pData + offset, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; + + memcpy(pMedia->szFileName, pData + offset, MSG_FILENAME_LEN_MAX); + offset += MSG_FILENAME_LEN_MAX; + + memcpy(pMedia->szFilePath, pData + offset, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; + + memcpy(pMedia->szContentID, pData + offset, MSG_MSG_ID_LEN+1); + offset += MSG_MSG_ID_LEN + 1; + + memcpy(pMedia->regionId, pData + offset, MAX_SMIL_REGION_ID); + offset += MAX_SMIL_REGION_ID; + + memcpy(pMedia->szAlt, pData + offset, MAX_SMIL_ALT_LEN); + offset += MAX_SMIL_ALT_LEN; + +#ifdef __SUPPORT_DRM__ + memcpy(&pMedia->drmType, pData + offset, sizeof(MsgDrmType)); + offset += sizeof(MsgDrmType); + + memcpy(pMedia->szDrm2FullPath, pData + offset, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; +#endif + + if (pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) { + MSG_DEBUG("##### MEDIA TYPE = TEXT #####"); + memcpy(pMedia->sMedia.sText.szTransInId, pData + offset, MAX_SMIL_TRANSIN_ID); + offset += MAX_SMIL_TRANSIN_ID; + + memcpy(pMedia->sMedia.sText.szTransOutId, pData + offset, MAX_SMIL_TRANSOUT_ID); + offset += MAX_SMIL_TRANSOUT_ID; + + memcpy(&pMedia->sMedia.sText.nRepeat, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sText.nBegin, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sText.nEnd, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sText.nDurTime, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sText.nBgColor, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sText.bBold, pData + offset, sizeof(bool)); + offset += sizeof(bool); + + memcpy(&pMedia->sMedia.sText.bUnderLine, pData + offset, sizeof(bool)); + offset += sizeof(bool); + + memcpy(&pMedia->sMedia.sText.bItalic, pData + offset, sizeof(bool)); + offset += sizeof(bool); + + memcpy(&pMedia->sMedia.sText.bReverse, pData + offset, sizeof(bool)); + offset += sizeof(bool); + + memcpy(&pMedia->sMedia.sText.nDirection, pData + offset, sizeof(MmsTextDirection)); + offset += sizeof(MmsTextDirection); + + //memcpy(&pMedia->sMedia.sText.nFont, pData + offset, sizeof(MmsSmilFontType)); + //offset += sizeof(MmsSmilFontType); + + memcpy(&pMedia->sMedia.sText.nSize, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sText.nColor, pData + offset, sizeof(int)); + offset += sizeof(int); + } else { + MSG_DEBUG("##### MEDIA TYPE = IMAGE, AUDIO, VIDEO #####"); + memcpy(pMedia->sMedia.sAVI.szTransInId, pData + offset, MAX_SMIL_TRANSIN_ID); + offset += MAX_SMIL_TRANSIN_ID; + + memcpy(pMedia->sMedia.sAVI.szTransOutId, pData + offset, MAX_SMIL_TRANSOUT_ID); + offset += MAX_SMIL_TRANSOUT_ID; + + memcpy(&pMedia->sMedia.sAVI.nRepeat, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sAVI.nBegin, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sAVI.nEnd, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sAVI.nDurTime, pData + offset, sizeof(int)); + offset += sizeof(int); + + memcpy(&pMedia->sMedia.sAVI.nBgColor, pData + offset, sizeof(int)); + offset += sizeof(int); + } + pPage->medialist = g_list_append(pPage->medialist, pMedia); + } + + memcpy(&pPage->nDur , pData + offset, sizeof(int)); + offset += sizeof(int); + memcpy(&pPage->nBegin , pData + offset, sizeof(int)); + offset += sizeof(int); + memcpy(&pPage->nEnd , pData + offset, sizeof(int)); + offset += sizeof(int); + memcpy(&pPage->nMin , pData + offset, sizeof(int)); + offset += sizeof(int); + memcpy(&pPage->nMax , pData + offset, sizeof(int)); + offset += sizeof(int); + memcpy(&pPage->nRepeat , pData + offset, sizeof(int)); + offset += sizeof(int); + + pBody->pagelist = g_list_append(pBody->pagelist, pPage); + } + + //Processing Region List + memcpy(&pBody->regionCnt, pData + offset, sizeof(int)); + offset += sizeof(int); + + MSG_DEBUG(" pBody->regionCnt: %d", pBody->regionCnt); + + for (int i = 0; i < pBody->regionCnt; ++i) { + pRegion = (MMS_SMIL_REGION *)calloc(sizeof(MMS_SMIL_REGION), 1); + + memcpy(pRegion->szID, pData + offset, MAX_SMIL_REGION_ID); + offset += MAX_SMIL_REGION_ID; + memcpy(&pRegion->nLeft, pData + offset, sizeof(MMS_LENGTH)); + offset += sizeof(MMS_LENGTH); + memcpy(&pRegion->nTop, pData + offset, sizeof(MMS_LENGTH)); + offset += sizeof(MMS_LENGTH); + memcpy(&pRegion->width, pData + offset, sizeof(MMS_LENGTH)); + offset += sizeof(MMS_LENGTH); + memcpy(&pRegion->height, pData + offset, sizeof(MMS_LENGTH)); + offset += sizeof(MMS_LENGTH); + memcpy(&pRegion->bgColor, pData + offset, sizeof(int)); + offset += sizeof(int); + memcpy(&pRegion->fit, pData + offset, sizeof(REGION_FIT_TYPE_T)); + offset += sizeof(REGION_FIT_TYPE_T); + + pBody->regionlist = g_list_append(pBody->regionlist, pRegion); + } + + //Processing Attachment List + memcpy(&pBody->attachCnt, pData + offset, sizeof(int)); + offset += sizeof(int); + + MSG_DEBUG(" pBody->attachCnt: %d", pBody->attachCnt); + + for (int i = 0; i < pBody->attachCnt; ++i) { + pAttach = (MMS_ATTACH_S *)calloc(sizeof(MMS_ATTACH_S), 1); + + memcpy(&pAttach->mediatype, pData + offset, sizeof(MimeType)); + offset += sizeof(MimeType); + + memcpy(pAttach->szFileName, pData + offset, MSG_FILENAME_LEN_MAX); + offset += MSG_FILENAME_LEN_MAX; + + memcpy(pAttach->szFilePath, pData + offset, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; + + memcpy(&pAttach->fileSize, pData + offset, sizeof(int)); + offset += sizeof(int); + +#ifdef __SUPPORT_DRM__ + memcpy(&pAttach->drmType, pData + offset, sizeof(MsgDrmType)); + offset += sizeof(MsgDrmType); + + memcpy(pAttach->szDrm2FullPath, pData + offset, MSG_FILEPATH_LEN_MAX); + offset += MSG_FILEPATH_LEN_MAX; +#endif + + pBody->attachlist = g_list_append(pBody->attachlist, pAttach); + } + + //Processing Transition List + memcpy(&pBody->transitionCnt, pData + offset, sizeof(int)); + offset += sizeof(int); + + MSG_DEBUG(" pBody->transitionCnt: %d", pBody->transitionCnt); + + for (int i = 0; i < pBody->transitionCnt; ++i) { + pTransition = (MMS_SMIL_TRANSITION *)calloc(sizeof(MMS_SMIL_TRANSITION), 1); + + memcpy(pTransition->szID, pData + offset, MAX_SMIL_TRANSITION_ID); + offset += MAX_SMIL_TRANSITION_ID; + + memcpy(&pTransition->nType, pData + offset, sizeof(MmsSmilTransType)); + offset += sizeof(MmsSmilTransType); + memcpy(&pTransition->nSubType, pData + offset, sizeof(MmsSmilTransSubType)); + offset += sizeof(MmsSmilTransSubType); + memcpy(&pTransition->nDur, pData + offset, sizeof(int)); + offset += sizeof(int); + + pBody->transitionlist = g_list_append(pBody->transitionlist, pTransition); + } + + //Processing Meta List + memcpy(&pBody->metaCnt, pData + offset, sizeof(int)); + offset += sizeof(int); + + MSG_DEBUG(" pBody->metaCnt: %d", pBody->metaCnt); + + for (int i = 0; i < pBody->metaCnt; ++i) { + pMeta = (MMS_SMIL_META *)calloc(sizeof(MMS_SMIL_META), 1); + + memcpy(pMeta->szID, pData + offset, MAX_SMIL_META_ID); + offset += MAX_SMIL_META_ID; + + memcpy(pMeta->szName, pData + offset, MAX_SMIL_META_NAME); + offset += MAX_SMIL_META_NAME; + + memcpy(pMeta->szContent, pData + offset, MAX_SMIL_META_CONTENT); + offset += MAX_SMIL_META_CONTENT; + + pBody->metalist = g_list_append(pBody->metalist, pMeta); + } + + memcpy(&pBody->rootlayout, pData + offset, sizeof(MMS_SMIL_ROOTLAYOUT)); + offset += sizeof(MMS_SMIL_ROOTLAYOUT); + +#ifdef FEATURE_JAVA_MMS + memcpy(&pBody->msgAppId, pData + offset, sizeof(MMS_APPID_INFO_S)); + offset += sizeof(MMS_APPID_INFO_S); + MSG_DEBUG("java_app_id valid:%d, appId:%s repleToAppId:%s", pBody->msgAppId.valid, pBody->msgAppId.appId, pBody->msgAppId.replyToAppId); +#endif + //free(pData); + + return true; +} + +bool _MsgMmsSetRootLayout(MMS_MESSAGE_DATA_S* pMmsMsg, MMS_SMIL_ROOTLAYOUT* pRootlayout) +{ + memcpy(&pMmsMsg->rootlayout, pRootlayout, sizeof(MMS_SMIL_ROOTLAYOUT)); + return true; +} + diff --git a/utils/MsgMutex.cpp b/utils/MsgMutex.cpp new file mode 100755 index 0000000..746fdaf --- /dev/null +++ b/utils/MsgMutex.cpp @@ -0,0 +1,45 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include /* O_RDWR */ +#include +#include + +#include "MsgDebug.h" +#include "MsgMutex.h" + +#define MSG_SHM_NAME "/msg_fw_shm" + +typedef struct { + pthread_mutex_t mutex; + pthread_cond_t condvar; + int ready; +} MSG_MUTEX_S; + diff --git a/utils/MsgNotificationWrapper.cpp b/utils/MsgNotificationWrapper.cpp new file mode 100755 index 0000000..26fac92 --- /dev/null +++ b/utils/MsgNotificationWrapper.cpp @@ -0,0 +1,643 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MsgContact.h" +#include "MsgStorageTypes.h" +#include "MsgNotificationWrapper.h" + +extern "C" +{ + #include +} + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +MSG_ERROR_T MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg) +{ + + notification_h noti = NULL; + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + bundle* args; + + int contactId = 0; + int threadId = 0; + time_t msgTime = 0; + char tempId[6]; + char addressVal[MAX_ADDRESS_VAL_LEN+1]; + char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1]; + char displayName[MAX_DISPLAY_NAME_LEN+1]; + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(tempId, 0x00, sizeof(tempId)); + memset(addressVal, 0x00, sizeof(addressVal)); + memset(firstName, 0x00, sizeof(firstName)); + memset(lastName, 0x00, sizeof(lastName)); + memset(displayName, 0x00, sizeof(displayName)); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_ID, A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, \ + B.DISPLAY_TIME, A.CONTACT_ID \ + FROM %s A, %s B \ + WHERE B.MSG_ID=%d AND A.ADDRESS_ID=B.ADDRESS_ID;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) { + threadId = pDbHandle->columnInt(0); + + if (pDbHandle->columnText(1) != NULL) + strncpy(addressVal, (char*)pDbHandle->columnText(1), MAX_ADDRESS_VAL_LEN); + + + char *pTempDisplayName = (char *)pDbHandle->columnText(2); + if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') { + strncpy(displayName, pTempDisplayName, MAX_DISPLAY_NAME_LEN); + } else { + if (pDbHandle->columnText(3) != NULL) + strncpy(firstName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN); + + if (pDbHandle->columnText(4) != NULL) + strncpy(lastName, (char*)pDbHandle->columnText(4), MAX_DISPLAY_NAME_LEN); + + int order = MsgGetContactNameOrder(); + + if (order == 0) { + if (firstName[0] != '\0') { + strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (lastName[0] != '\0') { + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } else if (order == 1) { + if (lastName[0] != '\0') { + strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + + if (firstName[0] != '\0') { + strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + } + + msgTime = (time_t)pDbHandle->columnInt(5); + + contactId = pDbHandle->columnInt(6); + } else { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + + args = bundle_create(); + + if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_CB_SMS) { + + noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId); + if (noti == NULL) { + MSG_DEBUG("notification_new is failed."); + bundle_free(args); + return MSG_ERR_UNKNOWN; + } + + noti_err = notification_set_application(noti, "org.tizen.message"); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_application : %d", noti_err); + } + + noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, CB_MSG_ICON_PATH); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_image : %d", noti_err); + } + + memset(&tempId, 0x00, sizeof(tempId)); + + snprintf(tempId, 5, "%d", threadId); + bundle_add(args, "threadId", tempId); + } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.classType == MSG_CLASS_0) { + + noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); + if (noti == NULL) { + MSG_DEBUG("notification_new is failed."); + bundle_free(args); + return MSG_ERR_UNKNOWN; + } + + noti_err = notification_set_application(noti, "org.tizen.msg-ui-class0"); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_application : %d", noti_err); + } + + snprintf(tempId, 5, "%d", pMsg->msgId); + bundle_add(args, "msg_id", tempId); + } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_MWI_VOICE_SMS) { + + noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId); + if (noti == NULL) { + MSG_DEBUG("notification_new is failed."); + bundle_free(args); + return MSG_ERR_UNKNOWN; + } + + noti_err = notification_set_application(noti, "org.tizen.message"); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_application : %d", noti_err); + } + + noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, VOICE_MSG_ICON_PATH); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_image : %d", noti_err); + } + + memset(&tempId, 0x00, sizeof(tempId)); + + snprintf(tempId, 5, "%d", threadId); + bundle_add(args, "threadId", tempId); + } else { + MSG_DEBUG("notification_new pMsg->msgId [%d]", pMsg->msgId); + noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId); + if (noti == NULL) { + MSG_DEBUG("notification_new is failed."); + bundle_free(args); + return MSG_ERR_UNKNOWN; + } + + noti_err = notification_set_application(noti, "org.tizen.message"); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_application : %d", noti_err); + } + + noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NORMAL_MSG_ICON_PATH); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_image : %d", noti_err); + } + + memset(&tempId, 0x00, sizeof(tempId)); + + snprintf(tempId, 5, "%d", threadId); + bundle_add(args, "threadId", tempId); + } + + bundle_add(args, "type", "msg_id"); + + snprintf(tempId, 5, "%d", pMsg->msgId); + bundle_add(args, "msgId", tempId); + + if (displayName[0] == '\0') + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + else + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + + if (pMsg->msgType.mainType == MSG_SMS_TYPE) + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + else + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg->subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + + + if (args != NULL) { + noti_err = notification_set_args(noti, args, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_args : %d", noti_err); + } + } + + noti_err = notification_set_time(noti, msgTime); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_time : %d", noti_err); + } + + noti_err = notification_insert(noti, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_insert"); + } + + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_free"); + } + + bundle_free(args); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId, MSG_DELIVERY_REPORT_STATUS_T Status) +{ + notification_h noti = NULL; + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + + char addressVal[MAX_ADDRESS_VAL_LEN+1]; + char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1]; + char displayName[MAX_DISPLAY_NAME_LEN+1]; + char contents[MAX_DISPLAY_NAME_LEN+1]; + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(addressVal, 0x00, sizeof(addressVal)); + memset(firstName, 0x00, sizeof(firstName)); + memset(lastName, 0x00, sizeof(lastName)); + memset(displayName, 0x00, sizeof(displayName)); + memset(contents, 0x00, sizeof(contents)); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME \ + FROM %s A, %s B \ + WHERE B.MSG_ID = %d \ + AND A.ADDRESS_ID = B.ADDRESS_ID;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MsgId); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) { + if (pDbHandle->columnText(0) != NULL) + strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN); + + if (pDbHandle->columnText(1) != NULL) { + strncpy(displayName, (char*)pDbHandle->columnText(1), MAX_DISPLAY_NAME_LEN); + } else { + if (pDbHandle->columnText(2) != NULL) + strncpy(firstName, (char*)pDbHandle->columnText(2), MAX_DISPLAY_NAME_LEN); + + if (pDbHandle->columnText(3) != NULL) + strncpy(lastName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN); + + int order = MsgGetContactNameOrder(); + + if (order == 0) { + if (firstName[0] != '\0') { + strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (lastName[0] != '\0') { + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } else if (order == 1) { + if (lastName[0] != '\0') { + strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + + if (firstName[0] != '\0') { + strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + } + } else { + MSG_DEBUG("query : %s", sqlQuery); + + pDbHandle->finalizeQuery(); + + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + + noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); + if (noti == NULL) { + MSG_DEBUG("notification_new is failed."); + return MSG_ERR_UNKNOWN; + } + + noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_image : %d", noti_err); + } + + if (displayName[0] == '\0') + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + else + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + + + if (Status == MSG_DELIVERY_REPORT_SUCCESS) + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Delivered."); + else + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deliver Failed."); + + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + + noti_err = notification_insert(noti, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_insert"); + } + + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_free"); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg) +{ + + notification_h noti = NULL; + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + + MSG_DELIVERY_REPORT_STATUS_T deliveryStatus; + MSG_READ_REPORT_STATUS_T readStatus; + + char addressVal[MAX_ADDRESS_VAL_LEN+1]; + char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1]; + char displayName[MAX_DISPLAY_NAME_LEN+1]; + char contents[MAX_DISPLAY_NAME_LEN+1]; + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(addressVal, 0x00, sizeof(addressVal)); + memset(firstName, 0x00, sizeof(firstName)); + memset(lastName, 0x00, sizeof(lastName)); + memset(displayName, 0x00, sizeof(displayName)); + memset(contents, 0x00, sizeof(contents)); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.DELIVERY_REPORT_STATUS, B.READ_REPORT_STATUS \ + FROM %s A, %s B \ + WHERE B.MSG_ID=%d AND A.ADDRESS_ID=B.ADDRESS_ID;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) { + if (pDbHandle->columnText(0) != NULL) + strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN); + + + char *pTempDisplayName = (char *)pDbHandle->columnText(1); + if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') { + strncpy(displayName, pTempDisplayName, MAX_DISPLAY_NAME_LEN); + } else { + if (pDbHandle->columnText(2) != NULL) + strncpy(firstName, (char*)pDbHandle->columnText(2), MAX_DISPLAY_NAME_LEN); + + if (pDbHandle->columnText(3) != NULL) + strncpy(lastName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN); + + int order = MsgGetContactNameOrder(); + + if (order == 0) { + if (firstName[0] != '\0') { + strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN); + } + + if (lastName[0] != '\0') { + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } else if (order == 1) { + if (lastName[0] != '\0') { + strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN); + strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + + if (firstName[0] != '\0') { + strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName)); + } + } + } + + deliveryStatus = (MSG_DELIVERY_REPORT_STATUS_T)pDbHandle->columnInt(4); + readStatus = (MSG_READ_REPORT_STATUS_T)pDbHandle->columnInt(5); + + } else { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); + if (noti == NULL) { + MSG_DEBUG("notification_new is failed."); + return MSG_ERR_UNKNOWN; + } + + noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_image : %d", noti_err); + } + + if (displayName[0] == '\0') + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + else + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + + if (pMsg->msgType.subType == MSG_DELIVERYIND_MMS) { + + switch(deliveryStatus) { + case MSG_DELIVERY_REPORT_NONE: + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_free"); + } + + return MSG_ERR_UNKNOWN; + + case MSG_DELIVERY_REPORT_EXPIRED: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Expired."); + break; + + case MSG_DELIVERY_REPORT_REJECTED: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Rejected."); + break; + + case MSG_DELIVERY_REPORT_DEFERRED: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deferred."); + break; + + case MSG_DELIVERY_REPORT_UNRECOGNISED: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Unrecognised."); + break; + + case MSG_DELIVERY_REPORT_INDETERMINATE: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Indeterminate."); + break; + + case MSG_DELIVERY_REPORT_FORWARDED: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Forwarded."); + break; + + case MSG_DELIVERY_REPORT_UNREACHABLE: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Unreachable."); + break; + + case MSG_DELIVERY_REPORT_ERROR: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Error."); + break; + + default : + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Delivered."); + } + + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + + noti_err = notification_insert(noti, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("Fail to notification_insert"); + + } else if (pMsg->msgType.subType == MSG_READORGIND_MMS) { + + switch(readStatus) { + case MSG_READ_REPORT_NONE: + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) + MSG_DEBUG("Fail to notification_free"); + + return MSG_ERR_UNKNOWN; + + case MSG_READ_REPORT_IS_DELETED: + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deleted."); + break; + + default : + snprintf(contents, MAX_DISPLAY_NAME_LEN, "Read."); + } + + notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + + noti_err = notification_insert(noti, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_insert"); + } + } else { + MSG_DEBUG("No matching subtype. subtype [%d]", pMsg->msgType.subType); + + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_free"); + } + return MSG_SUCCESS; + } + + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_free"); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgDeleteNotiByMsgId(MSG_MESSAGE_ID_T msgId) +{ + + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + + MSG_DEBUG("notification_delete_by_priv_id msgId [%d]", msgId); + + noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, msgId); + + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_delete_by_priv_id noti_err [%d]", noti_err); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgDeleteNotiByThreadId(MSG_THREAD_ID_T ThreadId) +{ + notification_delete_group_by_group_id(NULL, NOTIFICATION_TYPE_NOTI, ThreadId); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg) +{ + + MSG_DEBUG("pTickerMsg [%s]", pTickerMsg); + MSG_DEBUG("pLocaleTickerMsg [%s]", pLocaleTickerMsg); + + notification_h noti = NULL; + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); + if (noti == NULL) { + MSG_DEBUG("notification_new is failed."); + return MSG_ERR_UNKNOWN; + } + + noti_err = notification_set_application(noti, "org.tizen.message"); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_application : %d", noti_err); + } + + noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, CB_MSG_ICON_PATH); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_image : %d", noti_err); + } + + noti_err = notification_set_text_domain(noti, MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_text_domain."); + } + + noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, pTickerMsg, pLocaleTickerMsg, NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_text : %d", noti_err); + } + + noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, pTickerMsg, pLocaleTickerMsg, NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_text : %d", noti_err); + } + + noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_display_applist : %d", noti_err); + } + + noti_err = notification_insert(noti, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_text_domain"); + } + + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) { + MSG_DEBUG("Fail to notification_set_text_domain"); + } + + return MSG_SUCCESS; +} diff --git a/utils/MsgSoundPlayer.cpp b/utils/MsgSoundPlayer.cpp new file mode 100755 index 0000000..b7c9b95 --- /dev/null +++ b/utils/MsgSoundPlayer.cpp @@ -0,0 +1,272 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include + +#include "MsgHelper.h" +#include "MsgDebug.h" +#include "MsgGconfWrapper.h" +#include "MsgSettingTypes.h" +#include "MsgSoundPlayer.h" + +#include + + + /*================================================================================================== + VARIABLES +==================================================================================================*/ +static bool g_bRepeat = false; +static alarm_id_t g_alarmId = 0; + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ + + +void MsgSoundPlayStart() +{ + MSG_BEGIN(); + + // Run helper App + pid_t childpid; + childpid = fork(); + + if (childpid == -1) + { + MSG_DEBUG("Failed to fork"); + } + + if (childpid == 0) + { + MSG_DEBUG("Child Process - Run helper app for Sound"); + + execl("/usr/bin/msg-helper", MSG_SOUND_START, NULL); + + MSG_DEBUG("Faild to run helper app for Sound"); + + exit(0); + } + else if (childpid != 0) + { + MSG_DEBUG("Parent Process - Mms Plugin Storage."); + } + + if (g_bRepeat == false) + g_bRepeat = MsgSoundSetRepeatAlarm(); + + MSG_END(); +} + +void MsgSoundPlayStop() +{ + MSG_BEGIN(); + + // Run helper App + pid_t childpid; + childpid = fork(); + + if (childpid == -1) + { + MSG_DEBUG("Failed to fork"); + } + + if (childpid == 0) + { + MSG_DEBUG("Child Process - Run helper app for Sound"); + + execl("/usr/bin/msg-helper", MSG_SOUND_STOP, NULL); + + MSG_DEBUG("Faild to run helper app for Sound"); + + exit(0); + } + else if (childpid != 0) + { + MSG_DEBUG("Parent Process - Mms Plugin Storage."); + } + + MSG_END(); +} + + +bool MsgSoundSetRepeatAlarm() +{ + bool bRet = false; + + int nRepeatValue = 0; + long nRepeatTime = 0; + + nRepeatValue = MsgSettingGetInt(MSG_ALERT_TONE); + + switch (nRepeatValue) + { + case MSG_ALERT_TONE_ONCE: + nRepeatTime = 0; + break; + + case MSG_ALERT_TONE_2MINS: + nRepeatTime = 2; + break; + + case MSG_ALERT_TONE_5MINS: + nRepeatTime = 5; + break; + + case MSG_ALERT_TONE_10MINS: + nRepeatTime = 10; + break; + + default: + MSG_DEBUG("Invalid Repetition time"); + break; + } + + MSG_DEBUG("nRepeatTime = %d", nRepeatTime); + + if (nRepeatTime > 0) + { + bRet = MsgSoundCreateRepeatAlarm(nRepeatTime); + } + + return bRet; +} + + +bool MsgSoundCreateRepeatAlarm(int RepeatTime) +{ + MSG_BEGIN(); + + time_t current_time; + struct tm current_tm; + + time(¤t_time); + + localtime_r(¤t_time, ¤t_tm); + + int retval =0; + + retval = alarmmgr_init("msg-service-tools"); + + if (retval != 0) + { + MSG_FATAL("alarmmgr_init() error [%d]", retval); + return false; + } + + alarm_info_t* alarm_info; + alarm_date_t target_time; + + alarm_info = alarmmgr_create_alarm(); + + target_time.year = 0; + target_time.month = 0; + target_time.day = 0; + + if (current_tm.tm_min+RepeatTime < 60) + { + target_time.hour = current_tm.tm_hour; + target_time.min = current_tm.tm_min+RepeatTime; + } + else + { + if (current_tm.tm_hour < 12) + { + target_time.hour = current_tm.tm_hour+1; + } + else + { + target_time.hour = (current_tm.tm_hour+1)%12; + } + + target_time.min = (current_tm.tm_min+RepeatTime)%60; + } + + target_time.sec = current_tm.tm_sec; + + alarmmgr_set_time(alarm_info, target_time); + alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_ONCE, 0); + alarmmgr_set_type(alarm_info, ALARM_TYPE_VOLATILE); + alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &g_alarmId); + + retval = alarmmgr_set_cb(MsgSoundRepeatAlarmCB, NULL); + + if (retval != 0) + { + MSG_DEBUG("alarmmgr_set_cb() error [%d]", retval); + return false; + } + + MSG_DEBUG("Repeat Alarm Time : [%d-%d-%d %d:%d:%d]", + target_time.year,target_time.month,target_time.day, + target_time.hour, target_time.min, target_time.sec); + + MSG_END(); + + return true; +} + + +int MsgSoundRepeatAlarmCB(int TimerId, void *pUserParam) +{ + MSG_BEGIN(); + + g_bRepeat = false; + + if (MsgSoundGetUnreadMsgCnt() <= 0) + { + MSG_DEBUG("no unread msg"); + + return 0; + } + + MsgSoundPlayStart(); + + MSG_END(); + + return 0; +} + + +int MsgSoundGetUnreadMsgCnt() +{ + int unreadCnt = 0; + + // Get SMS Count + unreadCnt = MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE); + + // Get MMS Count + unreadCnt += MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE); + + MSG_DEBUG("unread count : [%d]", unreadCnt); + + return unreadCnt; +} + diff --git a/utils/MsgSqliteWrapper.cpp b/utils/MsgSqliteWrapper.cpp new file mode 100755 index 0000000..a0c641d --- /dev/null +++ b/utils/MsgSqliteWrapper.cpp @@ -0,0 +1,486 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include + +#include "MsgDebug.h" +#include "MsgSqliteWrapper.h" + +extern "C" +{ + #include +} + + +/*================================================================================================== + VARIABLES +==================================================================================================*/ +__thread sqlite3 *handle = NULL; +__thread sqlite3_stmt *stmt = NULL; +__thread char **result = NULL; + + +/*================================================================================================== + IMPLEMENTATION OF MsgDbHandler - Member Functions +==================================================================================================*/ +MsgDbHandler::MsgDbHandler() +{ + handle = NULL; + stmt = NULL; + result = NULL; +} + + +MsgDbHandler::~MsgDbHandler() +{ + if(handle != NULL) + disconnect(); + + if(stmt != NULL) + finalizeQuery(); + + if(result != NULL) + freeTable(); +} + + +MSG_ERROR_T MsgDbHandler::connect() +{ + int ret = 0; + + if (handle == NULL) + { + char strDBName[64]; + + memset(strDBName, 0x00, sizeof(strDBName)); + snprintf(strDBName, 64, "%s", MSGFW_DB_NAME); + + ret = db_util_open(strDBName, &handle, DB_UTIL_REGISTER_HOOK_METHOD); + + if (ret == SQLITE_OK) + { + MSG_DEBUG("DB Connect Success : [%p]", handle); + return MSG_SUCCESS; + } + else + { + MSG_DEBUG("DB Connect Fail [%d]", ret); + return MSG_ERR_DB_CONNECT; + } + } + else + { + MSG_DEBUG("DB Connect exist : [%p]", handle); + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgDbHandler::disconnect() +{ + int ret = 0; + + if (handle != NULL) + { + ret = db_util_close(handle); + + if (ret == SQLITE_OK) + { + handle = NULL; + MSG_DEBUG("DB Disconnect Success"); + return MSG_SUCCESS; + } + else + { + MSG_DEBUG("DB Disconnect Fail [%d]", ret); + return MSG_ERR_DB_DISCONNECT; + } + } + + return MSG_SUCCESS; +} + + +bool MsgDbHandler::checkTableExist(const char *pTableName) +{ + char strQuery[256]; + int nRowCnt = 0, nResult = 0; + + /* Formulate the Query */ + memset(strQuery, 0x00, sizeof(strQuery)); + snprintf(strQuery, sizeof(strQuery), "select count(name) from sqlite_master where name='%s'", pTableName); + + if (getTable(strQuery, &nRowCnt) != MSG_SUCCESS) + { + freeTable(); + return false; + } + + nResult = getColumnToInt(1); + MSG_DEBUG("Result [%d]", nResult); + + freeTable(); + + if (nResult > 0) + return true; + else + return false; +} + + +MSG_ERROR_T MsgDbHandler::execQuery(const char *pQuery) +{ + int ret = 0; + + if (!pQuery) + return MSG_ERR_INVALID_PARAMETER; + + if(connect() != MSG_SUCCESS) + return MSG_ERR_DB_DISCONNECT; + + ret = sqlite3_exec(handle, pQuery, 0, 0, NULL); + + if (ret == SQLITE_OK) + { + MSG_DEBUG("Execute Query Success"); + return MSG_SUCCESS; + } + else + { + MSG_DEBUG("Execute Query Fail [%d]", ret); + return MSG_ERR_DB_EXEC; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgDbHandler::getTable(const char *pQuery, int *pRowCnt) +{ + int ret = 0; + + *pRowCnt = 0; + + if(connect() != MSG_SUCCESS) + return MSG_ERR_DB_DISCONNECT; + + + ret = sqlite3_get_table(handle, pQuery, &result, pRowCnt, 0, NULL); + + if (ret == SQLITE_OK) + { + if (*pRowCnt == 0) // when the no record return 'MSG_ERR_DB_NORECORD' + { + MSG_DEBUG("No Query Result"); + return MSG_ERR_DB_NORECORD; + } + + MSG_DEBUG("Get Table Success"); + return MSG_SUCCESS; + } + else + { + MSG_DEBUG("Get Table Fail [%d]", ret); + return MSG_ERR_DB_GETTABLE; + } + + return MSG_SUCCESS; +} + + +void MsgDbHandler::freeTable() +{ + if (result) + { + sqlite3_free_table(result); + result = NULL; + } +} + + +MSG_ERROR_T MsgDbHandler::bindText(const char *pBindStr, int index) +{ + int ret = 0; + + if (pBindStr != NULL) + ret = sqlite3_bind_text(stmt, index, pBindStr, (strlen(pBindStr) + sizeof(unsigned char)), SQLITE_STATIC); + + return ret; +} + + +MSG_ERROR_T MsgDbHandler::bindBlob(const void * pBindBlob, int size, int index) +{ + int ret = 0; + + ret = sqlite3_bind_blob(stmt, index, pBindBlob, size, SQLITE_STATIC); + + return ret; +} + + +MSG_ERROR_T MsgDbHandler::prepareQuery(const char *pQuery) +{ + int ret = 0; + + stmt = NULL; + + if(connect() != MSG_SUCCESS) + return MSG_ERR_DB_DISCONNECT; + + + if ((ret = sqlite3_prepare_v2(handle, pQuery, strlen(pQuery), &stmt, NULL)) == SQLITE_OK) + { + MSG_DEBUG("Prepare Query Success"); + return MSG_SUCCESS; + } + else + { + MSG_DEBUG("Prepare Query Fail [%d]", ret); + return MSG_ERR_DB_PREPARE; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgDbHandler::stepQuery() +{ + int ret = 0; + + ret = sqlite3_step(stmt); + + if (ret == SQLITE_ROW) + { + MSG_DEBUG("MsgStepQuery() SQLITE_ROW"); + return MSG_ERR_DB_ROW; + } + else if (ret == SQLITE_DONE) + { + MSG_DEBUG("MsgStepQuery() SQLITE_DONE"); + return MSG_ERR_DB_DONE; + } + else + { + MSG_DEBUG("MsgStepQuery() Fail [%d]", ret); + return MSG_ERR_DB_STEP; + } + + return MSG_SUCCESS; +} + + +void MsgDbHandler::finalizeQuery() +{ + if(stmt != NULL) + sqlite3_finalize(stmt); + stmt = NULL; +} + + +int MsgDbHandler::columnInt(int ColumnIndex) +{ + return sqlite3_column_int(stmt, ColumnIndex); +} + + +const unsigned char* MsgDbHandler::columnText(int ColumnIndex) +{ + return sqlite3_column_text(stmt, ColumnIndex); +} + + +const void* MsgDbHandler::columnBlob(int ColumnIndex) +{ + return sqlite3_column_blob(stmt, ColumnIndex); +} + + +MSG_ERROR_T MsgDbHandler::beginTrans() +{ + int ret = 0; + + if(connect() != MSG_SUCCESS) + return MSG_ERR_DB_DISCONNECT; + + + ret = sqlite3_exec(handle, "BEGIN deferred;", 0, 0, NULL); + + if (ret == SQLITE_OK) + { + MSG_DEBUG("Begin Transaction Success"); + return MSG_SUCCESS; + } + else + { + MSG_DEBUG("Begin Transaction Fail [%d]", ret); + return MSG_ERR_DB_EXEC; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgDbHandler::endTrans(bool Success) +{ + int ret = 0; + + if(connect() != MSG_SUCCESS) + return MSG_ERR_DB_DISCONNECT; + + + if (Success == true) + { + ret = sqlite3_exec(handle, "END;", 0, 0, NULL); + } + else + { + ret = sqlite3_exec(handle, "rollback", 0, 0, NULL); + ret = sqlite3_exec(handle, "END;", 0, 0, NULL); + } + + if (ret == SQLITE_OK) + { + MSG_DEBUG("End Transaction Success"); + return MSG_SUCCESS; + } + else + { + MSG_DEBUG("End Transaction Fail [%d]", ret); + return MSG_ERR_DB_EXEC; + } + + return MSG_SUCCESS; +} + + +int MsgDbHandler::getColumnToInt(int RowIndex) +{ + char* pTemp = result[RowIndex]; + + int nTemp = 0; + + if (pTemp == NULL) + { + MSG_DEBUG("NULL"); + return nTemp; + } + + nTemp = (int)strtol(pTemp, (char**)NULL, 10); + + return nTemp; +} + + +char MsgDbHandler::getColumnToChar(int RowIndex) +{ + char* pTemp = result[RowIndex]; + + if (pTemp == NULL) + { + MSG_DEBUG("NULL"); + return '\0'; + } + + return *pTemp; +} + + +void MsgDbHandler::getColumnToString(int RowIndex, int Length, char *pString) +{ + char* pTemp = result[RowIndex]; + + if (pTemp == NULL) + { + MSG_DEBUG("NULL"); + return; + } + + strncpy(pString, pTemp, Length); +} + + +MSG_ERROR_T MsgDbHandler::getRowId(const char *pTableName, unsigned int *pRowId) +{ + int ret = 0, nRowId = 0, nRowCnt = 0; + char strQuery[256]; + + if (pTableName == NULL || pRowId == NULL) + return MSG_ERR_INVALID_PARAMETER; + + MSG_DEBUG("Table Name [%s]", pTableName); + + memset(strQuery, 0x00, sizeof(strQuery)); + snprintf(strQuery, sizeof(strQuery), "select max(rowid) from %s", pTableName); + + ret = getTable(strQuery, &nRowCnt); + + if (ret == SQLITE_OK) + { + nRowId = getColumnToInt(1); + + if ((nRowCnt <= 1) && (nRowId == 0)) + *pRowId = 1; + else + *pRowId = nRowId + 1; + } + else + { + MSG_DEBUG("MsgGetRowId failed"); + *pRowId = 0; + freeTable(); + return MSG_ERR_DB_GETTABLE; + } + + freeTable(); + + MSG_DEBUG("Row ID [%d]", *pRowId); + + return MSG_SUCCESS; +} + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +void MsgReleaseMemoryDB() +{ + int freeSize = 0; + + freeSize = sqlite3_release_memory(-1); + + MSG_DEBUG("freed memory size (bytes) : [%d]", freeSize); +} + diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp new file mode 100755 index 0000000..ca6512a --- /dev/null +++ b/utils/MsgUtilFile.cpp @@ -0,0 +1,924 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include //sync() + +#include "MsgStorageTypes.h" +#include "MsgDebug.h" +#include "MsgException.h" +#include "MsgUtilFile.h" +#include "MsgMmsTypes.h" +#include "MsgInternalTypes.h" +#include "MsgDrmWrapper.h" + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +// File operation wrappers +FILE *MsgOpenFile(const char *filepath, const char *opt) +{ + if (!filepath || !opt) { + MSG_FATAL("Null parameter"); + return NULL; + } + + MSG_DEBUG("[FILE] filepath : [%s], opt [%s]", filepath, opt); + + FILE *pFile = NULL; + + try { + pFile = fopen(filepath, opt); + MSG_DEBUG("[FILE] pFile [%p]", pFile); + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + return NULL; + } + + return pFile; +} + +void MsgCloseFile(FILE *pFile) +{ + if (!pFile) { + MSG_FATAL("NULL parameter"); + return; + } + + MSG_DEBUG("[FILE] pFile [%p]", pFile); + + try { + fclose(pFile); + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + } +} + +int MsgFseek(FILE *pFile, long int offset, int origin) +{ + if (!pFile) { + MSG_FATAL("pFile NULL"); + return -1; + } + + int ret = -1; + + MSG_DEBUG("[FILE] pFile [%p], offset [%d], origin [%d]", pFile, offset, origin); + + try { + ret = fseek(pFile, offset, origin); // return 0, if success. + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + return -1; + } + + return ret; +} + +size_t MsgWriteFile(const char *pData, size_t size, size_t count, FILE *pFile) +{ + if (!pData || !pFile) { + MSG_FATAL("pData or pFile NULL"); + return 0; + } + + size_t nWrite = 0; + + MSG_DEBUG("[FILE] pData [%p], size [%d], count [%d], pFile [%p]", pData, size, count, pFile); + + try { + nWrite = fwrite(pData, size, count, pFile); + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + } + + return nWrite; +} + +size_t MsgReadFile(void *pData, size_t size, size_t count, FILE *pFile) +{ + if (!pData || !pFile) { + MSG_FATAL("pData or pFile NULL"); + return 0; + } + + size_t nRead = 0; + + try { + nRead = fread(pData, size, count, pFile); + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + } + + return nRead; +} + +long int MsgFtell(FILE *pFile) +{ + if (!pFile) { + MSG_FATAL("pFile NULL"); + return -1L; + } + + long int ret = -1L; // -1L return if error occured. + + try { + ret = ftell(pFile); + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + } + + return ret; +} + +int MsgFflush(FILE *pFile) +{ + if(!pFile) { + MSG_FATAL("pFile NULL"); + return -1; + } + + int ret = -1; + + try { + ret = fflush(pFile); // return 0 if success + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + } + + return ret; +} + +int MsgFsync(FILE *pFile) +{ + if(!pFile) { + MSG_FATAL("pFile NULL"); + return -1; + } + + int ret = -1; + + try { + ret = fdatasync(pFile->_fileno); // return 0 if success + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + } + + return ret; +} + +bool MsgCreateFileName(char *pFileName) +{ + if (pFileName == NULL) { + MSG_DEBUG("[ERROR] pFileName is NULL"); + return false; + } + + struct timespec ts; + + try { + if (clock_gettime(CLOCK_REALTIME, &ts) < 0) { + MSG_DEBUG("clock_gettime() error: %s", strerror(errno)); + return false; + } + + // Create Random Number + srandom((unsigned int)ts.tv_nsec); + + MSG_DEBUG("ts.tv_nsec : %d", ts.tv_nsec); + + // between 1 - 1000000000 + snprintf(pFileName, MSG_FILENAME_LEN_MAX, "MSG_%lu.DATA", random()%1000000000+1); + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + return false; + } + + return true; +} + + +bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize) +{ + MSG_DEBUG("MsgOpenAndReadFile"); + + FILE *pFile = NULL; + + char fullPath[MAX_FULL_PATH_SIZE] = {0}; + + snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_IPC_DATA_PATH"%s", pFileName); + MSG_DEBUG("open file name: %s", fullPath); + + + pFile = MsgOpenFile(fullPath, "rb"); + + if (pFile == NULL) { + MSG_DEBUG("File Open Error: %s", strerror(errno)); + return false; + } + + if (MsgFseek(pFile, 0L, SEEK_END) < 0) { + MsgCloseFile(pFile); + MSG_DEBUG("File Read Error: %s", strerror(errno)); + return false; + } + + int FileSize = MsgFtell(pFile); + + if (FileSize <= 0) { + MSG_DEBUG("Filesize is error : %d", FileSize); + *pDataSize = 0; + MsgCloseFile(pFile); + return false; + } + + *ppData = new char[FileSize]; + + if (MsgFseek(pFile, 0L, SEEK_SET) < 0) { + MsgCloseFile(pFile); + MSG_DEBUG("File seek Error: %s", strerror(errno)); + return false; + } + + if (MsgReadFile(*ppData, sizeof(char), FileSize, pFile) != (size_t)FileSize) { + MsgCloseFile(pFile); + MSG_DEBUG("File Read Error: %s", strerror(errno)); + return false; + } + + *pDataSize = FileSize; + + MsgCloseFile(pFile); + + return true; +} + + +bool MsgReadFileForDecode(FILE *pFile, char *pBuf, int length, int *nSize) +{ + MSG_BEGIN(); + + if (MsgFseek(pFile, 0L, SEEK_CUR) < 0) { + MSG_DEBUG("File Seek Error: %s", strerror(errno)); + MsgCloseFile(pFile); + return false; + } + + *nSize = MsgReadFile(pBuf, sizeof(char), length, pFile); + + MSG_END(); + return true; +} + + +bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize) +{ + if (!pFileName) { + MSG_DEBUG("NULL parameter, pFileName [%p], pData [%p]", pFileName, pData); + return false; + } + + char fullPath[MAX_FULL_PATH_SIZE] = {0}; + + snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_IPC_DATA_PATH"%s", pFileName); + + FILE *pFile = MsgOpenFile(fullPath, "wb+"); + + if (pFile == NULL) { + MSG_DEBUG("File Open Error: %s", strerror(errno)); + return false; + } + + if (MsgFseek(pFile, 0L, SEEK_SET) < 0) { + MsgCloseFile(pFile); + MSG_DEBUG("File Seek Error: %s", strerror(errno)); + return false; + } + + if (MsgWriteFile(pData, sizeof(char), DataSize, pFile) != (size_t)DataSize) { + MsgCloseFile(pFile); + MSG_DEBUG("File Write Error: %s", strerror(errno)); + return false; + } + + MsgFflush(pFile); + MsgCloseFile(pFile); + + if (chmod(fullPath, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP ) != 0) { + MSG_DEBUG("File chmod Error: %s", strerror(errno)); + } + + if (chown(fullPath, 0, 6502 ) != 0) { + MSG_DEBUG("File chown Error: %s", strerror(errno)); + } + + return true; +} + +int MsgReadSmilFile(const char *pFileName, char **ppData) +{ + if (!pFileName) { + MSG_DEBUG("pFileName is NULL"); + return -1; + } + + int nSize = 0; + char fullPath[MAX_FULL_PATH_SIZE] = {0}; + + snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_SMIL_FILE_PATH"%s", pFileName); + + MSG_DEBUG("open file name: %s", fullPath); + + FILE *pFile = MsgOpenFile(fullPath, "rb"); + + if (pFile == NULL) { + MSG_DEBUG("File Open Error: %s", strerror(errno)); + return -1; + } + + if (MsgFseek(pFile, 0L, SEEK_END) < 0) { + MsgCloseFile(pFile); + MSG_DEBUG("File Seek Error: %s", strerror(errno)); + return -1; + } + + int FileSize = MsgFtell(pFile); + + if (FileSize <= 0) { + MSG_DEBUG("Filesize is error : %d", FileSize); + MsgCloseFile(pFile); + return FileSize; + } + + *ppData = new char[FileSize + 1]; + + if (MsgFseek(pFile, 0L, SEEK_SET) < 0) { + MsgCloseFile(pFile); + MSG_DEBUG("File Sead Error: %s", strerror(errno)); + return -1; + } + + if (MsgReadFile(*ppData, sizeof(char), FileSize, pFile) != (size_t)FileSize) { + MsgCloseFile(pFile); + MSG_DEBUG("File Read Error: %s", strerror(errno)); + return -1; + } + + ppData[FileSize] = '\0'; + + nSize = FileSize; + + MsgCloseFile(pFile); + + return nSize; +} + + +bool MsgWriteSmilFile(const char *pFilePath,char *pData, int DataSize) +{ + if(!pFilePath) { + MSG_DEBUG("pFilePath is NULL"); + return false; + } + + if (mkdir(MSG_SMIL_FILE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { + if (errno == EEXIST) { + MSG_DEBUG("The %s already exists", MSG_SMIL_FILE_PATH); + } else { + MSG_DEBUG("Error while mkdir %s", MSG_SMIL_FILE_PATH); + } + } + + FILE *pFile = MsgOpenFile(pFilePath, "wb+"); + + if (pFile == NULL) { + MSG_DEBUG("File Open Error: %s", strerror(errno)); + return false; + } + + if (MsgFseek(pFile, 0L, SEEK_SET) < 0) { + MsgCloseFile(pFile); + MSG_DEBUG("File Seek Error: %s", strerror(errno)); + return false; + } + + if (MsgWriteFile(pData, sizeof(char), DataSize, pFile) != (size_t)DataSize) { + MsgCloseFile(pFile); + MSG_DEBUG("File Write Error: %s", strerror(errno)); + return false; + } + + MsgFflush(pFile); + MsgCloseFile(pFile); + + return true; +} + + +void MsgDeleteFile(const char *pFileName) +{ + if (!pFileName) { + MSG_FATAL("pFileName is NULL"); + return; + } + + if (strlen(pFileName) == 0) { + MSG_FATAL("pFileName has zero length"); + return; + } + + char fullPath[MAX_FULL_PATH_SIZE] = {0}; + + try { + snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_IPC_DATA_PATH"%s", pFileName); + + MSG_DEBUG("%s", fullPath); + + if (remove(fullPath) != 0) + MSG_FATAL("File Delete Error [%s]: %s", fullPath, strerror(errno)); + } catch (exception &e) { + MSG_FATAL ("%s", e.what()); + } + +} + + +void MsgDeleteSmilFile(const char *pFileName) +{ + if (!pFileName ) { + MSG_FATAL("pFileName NULL"); + return; + } + + try { + char fullPath[MAX_FULL_PATH_SIZE] = {0}; + + snprintf(fullPath, MAX_FULL_PATH_SIZE, MSG_SMIL_FILE_PATH"%s", pFileName); + + if (remove(fullPath) != 0) + MSG_FATAL("File Delete Error [%s]: %s", fullPath, strerror(errno)); + } catch (exception &e) { + MSG_FATAL("%s", e.what()); + } +} + + +bool MsgGetFileSize(const char *pFilePath, int *nSize) +{ + if (!pFilePath) { + MSG_FATAL("pFileName NULL"); + return false; + } + + FILE *pFile = NULL; + + pFile = MsgOpenFile(pFilePath, "rb"); + + if (!pFile) { + MSG_DEBUG("File Open error: %s", strerror(errno)); + return false; + } + + if (MsgFseek(pFile, 0L, SEEK_END) < 0) { + MsgCloseFile(pFile); + MSG_FATAL("File Read Error: %s", strerror(errno)); + return false; + } + + *nSize = MsgFtell(pFile); + + MsgCloseFile(pFile); + + return true; +} + + +FILE *MsgOpenMMSFile(char *pFileName) +{ + int len; + + if (!pFileName) { + MSG_DEBUG("pFileName NULL: %s", strerror(errno)); + return NULL; + } + + len = strlen(pFileName); + + for (int i = 0; i < len; i++) { + switch (pFileName[i]) { + case '*': + pFileName[i] = '-'; + break; + } + } + + MSG_DEBUG("pFileName = %s", pFileName); + + char fullPath[MAX_FULL_PATH_SIZE+1] = {0}; + + snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s.mms", pFileName); + + FILE *pFile = MsgOpenFile(fullPath, "wb+"); + + if (pFile == NULL) { + MSG_FATAL("File Open Error: %s", strerror(errno)); + return NULL; + } + + if (MsgFseek(pFile, 0L, SEEK_CUR) < 0) { + MsgCloseFile(pFile); + MSG_DEBUG("File Read Error: %s", strerror(errno)); + return NULL; + } + + return pFile; +} + + +bool MsgWriteDataFromEncodeBuffer(FILE *pFile, char *pInBuffer, int *pPtr, int maxLen, int *pOffset ) +{ + if (!pFile || !pPtr || !pInBuffer || !pOffset) { + MSG_FATAL(" NULL parameter passed"); + return false; + } + + MSG_DEBUG("MsgWriteDataFromEncodeBuffer:"); + MSG_DEBUG("pInBuffer %x", pInBuffer); + MSG_DEBUG("pPtr %d", (*pPtr)); + MSG_DEBUG("before to fwite %x", pFile); + + if (MsgWriteFile(pInBuffer, sizeof(char), (*pPtr), pFile) != (size_t)(*pPtr)) { + MSG_FATAL("MsgWriteFile failed"); + return false; + } + + MSG_DEBUG("after to fwite \n"); + + MsgFflush(pFile); + + memset( pInBuffer, 0, maxLen ); + + *pPtr = 0; + + if (MsgFseek(pFile, 0L, SEEK_END) < 0) { + MSG_FATAL("MsgFseek failed"); + return false; + } + + *pOffset = MsgFtell(pFile); + + if (*pOffset == -1L) { + MSG_FATAL("MsgFtell failed"); + return false; + } + + return true; +} + + +bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength) +{ + FILE *pFile = NULL ; + mode_t file_mode; + + file_mode = (S_IRUSR | S_IWUSR); + + if ((pFile = MsgOpenFile(pFullPath, "wb+")) == NULL) { + MSG_FATAL("MsgOpenFile errer"); + return false; + } + + if (MsgWriteFile(pBuff, sizeof(char), TotalLength, pFile) != (size_t)TotalLength) { + MsgCloseFile( pFile ); + return false; + } + + MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off + MsgFflush(pFile); + MsgCloseFile(pFile); + + if (chmod(pFullPath, file_mode) < 0) + MSG_FATAL("File chmod Error: %s", strerror(errno)); + + return true; +} + + +char *MsgOpenAndReadMmsFile( const char *szFilePath, int offset, int size, int *npSize ) +{ + FILE *pFile = NULL; + char *pData = NULL; + int readSize = 0; + + if (szFilePath == NULL) { + MSG_DEBUG("MsgOpenAndReadMmsFile: [ERROR] szFilePath id NULL"); + goto __CATCH; + } + + *npSize = 0; + + pFile = MsgOpenFile( szFilePath, "rb" ); + + if (pFile == NULL) { + MSG_DEBUG("MsgOpenAndReadMmsFile: [ERROR] Can't open filepath", strerror(errno)); + goto __CATCH; + } + + if( size == -1 ) { + if (MsgGetFileSize(szFilePath, & readSize) == false) { + MSG_DEBUG("MsgGetFileSize: failed"); + goto __CATCH; + } + } else { + readSize = size; + } + + if (readSize > FM_READ_WRITE_BUFFER_MAX) { + MSG_DEBUG("MsgOpenAndReadMmsFile: File size tried to read too big"); + goto __CATCH; + } + + pData = (char *)malloc(readSize + 1); + if ( NULL == pData ) { + MSG_DEBUG( "MsgOpenAndReadMmsFile: [ERROR] pData MemAlloc Fail", strerror(errno) ); + goto __CATCH; + } + memset( pData, 0, readSize + 1 ); + + if (MsgFseek( pFile, offset, SEEK_SET) < 0) { + MSG_DEBUG( "MsgOpenAndReadMmsFile: [ERROR] FmSeekFile failed", strerror(errno) ); + goto __CATCH; + } + + *npSize = MsgReadFile(pData, sizeof(char), readSize, pFile); + + MsgCloseFile(pFile); + + pFile = NULL; + + *(pData + (*npSize)) = '\0'; + + return pData; + +__CATCH: + + if (pData) { + free( pData ); + pData = NULL; + } + + *npSize = 0; + + if (pFile != NULL) { + MsgCloseFile( pFile ); + pFile = NULL; + } + + return NULL; +} + +// it is equivalent to "rm -rf pDirPath" +int MsgRmRf(char *pDirPath) +{ + struct dirent *d; + DIR *dir; + + dir = opendir(pDirPath); + + if (dir == NULL) { + MSG_FATAL("error opendir: %s", strerror(errno)); + return -1; + } + + int size = strlen(pDirPath) + 256; + + char *path = (char*)malloc(size); + + if (path == NULL) { + MSG_DEBUG("path is NULL"); + return -1; + } + + bzero(path, size); + + while ((d = readdir(dir)) != NULL) { + if (d->d_type == DT_DIR) { + snprintf(path, size, "%s/%s", pDirPath, d->d_name); + + if ((strcmp(".", d->d_name) == 0) || (strcmp("..", d->d_name) == 0)) + continue; + + MsgRmRf(path); + + if (rmdir(path) != 0) { + + if (path != NULL) + free(path); + + closedir(dir); + + MSG_FATAL("error rmdir: %s", strerror(errno)); + + return -1; + } + } else { + snprintf(path, size, "%s/%s", pDirPath, d->d_name); + + if (MsgDrmIsDrmFile(path)) + MsgDrmUnregisterFile(path); + + if (remove(path) != 0) { + + if (path != NULL) + free(path); + + closedir(dir); + + MSG_FATAL("error remove: %s", strerror(errno)); + + return -1; + } + } + } + + closedir(dir); + + if (path != NULL) + free(path); + + return 0; +} + + +int MsgGetFileSize(const char *pFileName) +{ + struct stat file_stat; + + if (lstat(pFileName, &file_stat)) { + MSG_FATAL("error lstat: %s", strerror(errno)); + return -1; + } + + return file_stat.st_size; +} + + +// it is equivalent to "du dir_path" +unsigned int MsgDu(const char *pDirPath) +{ + struct dirent *d; + DIR *dir; + + dir = opendir(pDirPath); + + if (dir == NULL) { + MSG_FATAL("error opendir: %s", strerror(errno)); + return -1; + } + + int size = strlen(pDirPath) + 256; + char *path = (char*)malloc(size); + bzero(path, size); + + unsigned int totalFileSize = 0; + + while ((d = readdir(dir)) != NULL) { + if( d->d_type == DT_DIR) { + snprintf(path, size, "%s/%s", pDirPath, d->d_name); + + if ((strcmp(".", d->d_name) == 0) || (strcmp("..", d->d_name) == 0)) + continue; + + unsigned int dirSize = MsgDu(path); + + if (dirSize == 0) { + MSG_FATAL("error MsgDu"); + return dirSize; + } + + totalFileSize += dirSize; + } else { + snprintf(path, size, "%s/%s", pDirPath, d->d_name); + int fileSize = MsgGetFileSize(path); + + if (fileSize < 0) { + MSG_FATAL("error MsgGetFileSize"); + return fileSize; + } + + totalFileSize += fileSize; + } + } + + closedir(dir); + + free(path); + + return totalFileSize; +} + + +bool MsgAppendFile(const char *pFilePath, const char *pData, int DataSize) +{ + if (!pFilePath) { + MSG_FATAL("NULL check error, pFileName %p, pData %p", pFilePath, pData); + return false; + } + + char fullPath[MAX_FULL_PATH_SIZE] = {0}; + + snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s", pFilePath); + + FILE *pFile = MsgOpenFile(fullPath, "a+"); + + if (pFile == NULL) { + MSG_FATAL("File Open Error: %s", strerror(errno)); + return false; + } + + if (MsgFseek(pFile, 0L, SEEK_CUR) < 0) { + MsgCloseFile(pFile); + MSG_FATAL("File Sead Error: %s", strerror(errno)); + return false; + } + + if (MsgWriteFile(pData, sizeof(char), DataSize, pFile) != (size_t)DataSize) { + MsgCloseFile(pFile); + MSG_FATAL("File Write Error: %s", strerror(errno)); + return false; + } + + MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off + MsgFflush(pFile); + MsgCloseFile(pFile); + return true; +} + +/** +* Remove temporal Mms folder (/opt/data/msg-service/msgdata/*.dir) +*/ + +void MsgMmsInitDir() +{ + struct dirent *d = NULL; + DIR* dir = NULL; + + dir = opendir(MSG_DATA_PATH); + + if (dir == NULL) { + MSG_FATAL("error opendir: %s", strerror(errno)); + return; + } + + while ((d = readdir(dir)) != NULL) { + if (d->d_type == DT_DIR) { + if ((strcmp(".", d->d_name) == 0) || (strcmp("..", d->d_name) == 0)) + continue; + + if(strstr(d->d_name, ".dir") != NULL) { + char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + snprintf(filePath, MSG_FILEPATH_LEN_MAX, MSG_DATA_PATH"%s", d->d_name); + + MsgRmRf(filePath); + rmdir(filePath); + } + } + } + + closedir(dir); +} diff --git a/utils/MsgUtilFunction.cpp b/utils/MsgUtilFunction.cpp new file mode 100755 index 0000000..e8ed7ef --- /dev/null +++ b/utils/MsgUtilFunction.cpp @@ -0,0 +1,703 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MsgUtilFunction.h" + + /*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ + +// Encoders +int MsgEncodeCountInfo(MSG_COUNT_INFO_S *pCountInfo, char **ppDest) +{ + int dataSize = 0; + + dataSize = sizeof(MSG_COUNT_INFO_S); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, pCountInfo, dataSize); + + return dataSize; +} + + +int MsgEncodeRecipientList(MSG_RECIPIENTS_LIST_S *pRecipientList, char **ppDest) +{ + int count = 0, dataSize = 0; + + count = pRecipientList->recipientCnt; + dataSize = sizeof(int) + (sizeof(MSG_ADDRESS_INFO_S)*count); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &count, sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + for (int i = 0; i < count; i++) + { + memcpy(p, &(pRecipientList->recipientAddr[i]), sizeof(MSG_ADDRESS_INFO_S)); + p = (void*)((char*)p + sizeof(MSG_ADDRESS_INFO_S)); + } + + return dataSize; +} + + +int MsgEncodeCountByMsgType(int MsgCount, char **ppDest) +{ + int dataSize = 0; + + dataSize = sizeof(int); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &MsgCount, dataSize); + + return dataSize; +} + + +int MsgEncodeMsgId(MSG_MESSAGE_ID_T *pMsgId, char **ppDest) +{ + int dataSize = 0; + + dataSize = (sizeof(MSG_MESSAGE_ID_T)); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, pMsgId, dataSize); + + return dataSize; +} + + +int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest) +{ + int dataSize = 0; + + dataSize = sizeof(MSG_MESSAGE_INFO_S); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + p = (void*)((char*)p + sizeof(MSG_MESSAGE_INFO_S)); + + return dataSize; +} + + +int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char **ppDest) +{ + int dataSize = 0; + + dataSize = (sizeof(MSG_MESSAGE_INFO_S) + sizeof(MSG_SENDINGOPT_INFO_S)); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); + + p = (void*)((char*)p + sizeof(MSG_MESSAGE_INFO_S)); + + memcpy(p, pSendOptInfo, sizeof(MSG_SENDINGOPT_INFO_S)); + + return dataSize; +} + + +int MsgEncodeFolderViewList(MSG_LIST_S *pFolderViewList, char **ppDest) +{ + int count = 0, dataSize = 0; + + count = pFolderViewList->nCount; + + dataSize = sizeof(int) + (sizeof(MSG_MESSAGE_S)*count); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &count, sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + for (int i = 0; i < count; i++) + { + memcpy(p, &(pFolderViewList->msgInfo[i]), sizeof(MSG_MESSAGE_S)); + p = (void*)((char*)p + sizeof(MSG_MESSAGE_S)); + } + + return dataSize; +} + + +int MsgEncodeFolderList(MSG_FOLDER_LIST_S *pFolderList, char **ppDest) +{ + int count = 0, dataSize = 0; + + count = pFolderList->nCount; + dataSize = sizeof(int) + (sizeof(MSG_FOLDER_INFO_S)*count); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &count, sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + for (int i = 0; i < count; i++) + { + memcpy(p, &(pFolderList->folderInfo[i]), sizeof(MSG_FOLDER_INFO_S)); + p = (void*)((char*)p + sizeof(MSG_FOLDER_INFO_S)); + } + + return dataSize; +} + + +int MsgEncodeSetting(MSG_SETTING_S *pSetting, char **ppDest) +{ + int dataSize = sizeof(MSG_OPTION_TYPE_T); + + switch (pSetting->type) + { + case MSG_GENERAL_OPT : + dataSize += sizeof(MSG_GENERAL_OPT_S); + break; + case MSG_SMS_SENDOPT : + dataSize += sizeof(MSG_SMS_SENDOPT_S); + break; + case MSG_SMSC_LIST : + dataSize += sizeof(MSG_SMSC_LIST_S); + break; + case MSG_MMS_SENDOPT : + dataSize += sizeof(MSG_MMS_SENDOPT_S); + break; + case MSG_MMS_RECVOPT : + dataSize += sizeof(MSG_MMS_RECVOPT_S); + break; + case MSG_MMS_STYLEOPT : + dataSize += sizeof(MSG_MMS_STYLEOPT_S); + break; + case MSG_PUSHMSG_OPT : + dataSize += sizeof(MSG_PUSHMSG_OPT_S); + break; + case MSG_CBMSG_OPT : + dataSize += sizeof(MSG_CBMSG_OPT_S); + break; + case MSG_VOICEMAIL_OPT : + dataSize += sizeof(MSG_VOICEMAIL_OPT_S); + break; + case MSG_MSGSIZE_OPT : + dataSize += sizeof(MSG_MSGSIZE_OPT_S); + break; + } + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, pSetting, dataSize); + + return dataSize; +} + + +int MsgEncodeMsgType(MSG_MESSAGE_TYPE_S *pMsgType, char **ppDest) +{ + int dataSize = 0; + + dataSize = (sizeof(MSG_MESSAGE_TYPE_S)); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, pMsgType, dataSize); + + return dataSize; +} + + +int MsgEncodeThreadViewList(MSG_THREAD_VIEW_LIST_S *pThreadViewList, char **ppDest) +{ + int count = 0, dataSize = 0; + + count = pThreadViewList->nCount; + + dataSize = sizeof(int) + (sizeof(MSG_THREAD_VIEW_S)*count); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &count, sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + for (int i = 0; i < count; i++) + { + memcpy(p, &(pThreadViewList->msgThreadInfo[i]), sizeof(MSG_THREAD_VIEW_S)); + p = (void*)((char*)p + sizeof(MSG_THREAD_VIEW_S)); + } + + return dataSize; +} + + +int MsgEncodeConversationViewList(MSG_LIST_S *pConvViewList, char **ppDest) +{ + int count = 0, dataSize = 0; + + count = pConvViewList->nCount; + + dataSize = sizeof(int) + (sizeof(MSG_LIST_S)*count); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &count, sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + for (int i = 0; i < count; i++) + { + memcpy(p, &(pConvViewList->msgInfo[i]), sizeof(MSG_LIST_S)); + p = (void*)((char*)p + sizeof(MSG_LIST_S)); + } + + return dataSize; +} + + +int MsgEncodeMsgGetContactCount(MSG_THREAD_COUNT_INFO_S *threadCountInfo, char **ppDest) +{ + int dataSize = sizeof(int) + sizeof(int) + sizeof(int) + sizeof(int); + + MSG_DEBUG("datasize = [%d] \n", dataSize); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &(threadCountInfo->totalCount), sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + memcpy(p, &(threadCountInfo->unReadCount), sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + memcpy(p, &(threadCountInfo->mmsMsgCount), sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + memcpy(p, &(threadCountInfo->smsMsgCount), sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + return dataSize; +} + +int MsgEncodeMemSize(unsigned int *memsize, char **ppDest) +{ + int dataSize = 0; + + dataSize = sizeof(unsigned int); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, memsize, dataSize); + + return dataSize; +} + + +int MsgEncodeSyncMLOperationData(int msgId, int extId, char **ppDest) +{ + int dataSize = 0; + + dataSize = sizeof(int) + sizeof(int); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &msgId, sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + memcpy(p, &extId, sizeof(int)); + + return dataSize; +} + + +int MsgEncodeStorageChangeData(const MSG_STORAGE_CHANGE_TYPE_T storageChangeType, const MSG_MSGID_LIST_S *pMsgIdList, char **ppDest) +{ + int dataSize = 0; + int count = 0; + + count = pMsgIdList->nCount; + + dataSize = sizeof(MSG_STORAGE_CHANGE_TYPE_T) + sizeof(int) + (sizeof(MSG_MESSAGE_ID_T)*count); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, &storageChangeType, sizeof(MSG_STORAGE_CHANGE_TYPE_T)); + p = (void*)((char*)p + sizeof(MSG_STORAGE_CHANGE_TYPE_T)); + + memcpy(p, &count, sizeof(int)); + p = (void*)((char*)p + sizeof(int)); + + for (int i = 0; i < count; i++) { + memcpy(p, &(pMsgIdList->msgIdList[i]), sizeof(MSG_MESSAGE_ID_T)); + p = (void*)((char*)p + sizeof(MSG_MESSAGE_ID_T)); + } + + return dataSize; +} + + +int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, char **ppDest) +{ + int dataSize = 0; + + dataSize = (sizeof(MSG_REPORT_STATUS_INFO_S)); + + *ppDest = (char*)new char[dataSize]; + + void* p = (void*)*ppDest; + + memcpy(p, pReportStatus, dataSize); + + return dataSize; +} + + +// Decoders +void MsgDecodeMsgId(char *pSrc, MSG_MESSAGE_ID_T *pMsgId) +{ + memcpy(pMsgId, pSrc, sizeof(MSG_MESSAGE_ID_T)); +} + + +void MsgDecodeCountInfo(char *pSrc, MSG_COUNT_INFO_S *pCountInfo) +{ + memcpy(pCountInfo, pSrc, sizeof(MSG_COUNT_INFO_S)); +} + + +void MsgDecodeMemSize(char *pSrc, unsigned int *memsize) +{ + memcpy(memsize, pSrc, sizeof(unsigned int)); +} + + +void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo) +{ + memcpy(pMsgInfo, pSrc, sizeof(MSG_MESSAGE_INFO_S)); + + pSrc = pSrc + sizeof(MSG_MESSAGE_INFO_S); + + memcpy(pSendOptInfo, pSrc, sizeof(MSG_SENDINGOPT_INFO_S)); +} + + +void MsgDecodeFolderViewList(char *pSrc, MSG_LIST_S *pFolderViewList) +{ + int count = 0; + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + + if( count > 0 ) + { + pFolderViewList->nCount = count; + pFolderViewList->msgInfo = (msg_message_t*)new char[sizeof(MSG_MESSAGE_S)*count]; + + MSG_MESSAGE_S* pInfoTmp = (MSG_MESSAGE_S*)pFolderViewList->msgInfo; + + for (int i = 0; i < count; i++) + { + memcpy(pInfoTmp, pSrc, sizeof(MSG_MESSAGE_S)); + pSrc = pSrc + sizeof(MSG_MESSAGE_S); + pInfoTmp++; + } + } + else if ( count == 0 ) + { + pFolderViewList->nCount = count; + pFolderViewList->msgInfo = NULL; + } +} + + +void MsgDecodeRecipientList(char *pSrc, MSG_RECIPIENTS_LIST_S *pRecipientList) +{ + int count = 0; + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + + pRecipientList->recipientCnt= count; + pRecipientList->recipientAddr = (MSG_ADDRESS_INFO_S*)new char[sizeof(MSG_ADDRESS_INFO_S)*count]; + + MSG_ADDRESS_INFO_S* pInfoTmp = pRecipientList->recipientAddr; + + for (int i = 0; i < count; i++) + { + memcpy(pInfoTmp, pSrc, sizeof(MSG_ADDRESS_INFO_S)); + pSrc = pSrc + sizeof(MSG_ADDRESS_INFO_S); + pInfoTmp++; + } +} + + +void MsgDecodeFolderList(char *pSrc, MSG_FOLDER_LIST_S *pFolderList) +{ + int count = 0; + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + + pFolderList->nCount = count; + pFolderList->folderInfo = (MSG_FOLDER_INFO_S*)new char[sizeof(MSG_FOLDER_INFO_S)*count]; + + MSG_FOLDER_INFO_S* pInfoTmp = pFolderList->folderInfo; + + for (int i = 0; i < count; i++) + { + memcpy(pInfoTmp, pSrc, sizeof(MSG_FOLDER_INFO_S)); + pSrc = pSrc + sizeof(MSG_FOLDER_INFO_S); + pInfoTmp++; + } +} + + +void MsgDecodeSetting(char *pSrc, MSG_SETTING_S *pSetting) +{ + int dataSize = sizeof(MSG_OPTION_TYPE_T); + + switch (pSetting->type) + { + case MSG_GENERAL_OPT : + dataSize += sizeof(MSG_GENERAL_OPT_S); + break; + case MSG_SMS_SENDOPT : + dataSize += sizeof(MSG_SMS_SENDOPT_S); + break; + case MSG_SMSC_LIST : + dataSize += sizeof(MSG_SMSC_LIST_S); + break; + case MSG_MMS_SENDOPT : + dataSize += sizeof(MSG_MMS_SENDOPT_S); + break; + case MSG_MMS_RECVOPT : + dataSize += sizeof(MSG_MMS_RECVOPT_S); + break; + case MSG_MMS_STYLEOPT : + dataSize += sizeof(MSG_MMS_STYLEOPT_S); + break; + case MSG_PUSHMSG_OPT : + dataSize += sizeof(MSG_PUSHMSG_OPT_S); + break; + case MSG_CBMSG_OPT : + dataSize += sizeof(MSG_CBMSG_OPT_S); + break; + case MSG_VOICEMAIL_OPT : + dataSize += sizeof(MSG_VOICEMAIL_OPT_S); + break; + case MSG_MSGSIZE_OPT : + dataSize += sizeof(MSG_MSGSIZE_OPT_S); + break; + } + + memcpy(pSetting, pSrc, dataSize); +} + + +void MsgDecodeMsgType(char *pSrc, MSG_MESSAGE_TYPE_S* pMsgType) +{ + memcpy(pMsgType, pSrc, sizeof(MSG_MESSAGE_TYPE_S)); +} + + +void MsgDecodeThreadViewList(char *pSrc, MSG_THREAD_VIEW_LIST_S *pThreadViewList) +{ + int count = 0; + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + + if (count > 0) + { + pThreadViewList->nCount = count; + pThreadViewList->msgThreadInfo = (msg_thread_view_t*)new char[sizeof(MSG_THREAD_VIEW_S)*count]; + + MSG_THREAD_VIEW_S* pInfoTmp = (MSG_THREAD_VIEW_S*)pThreadViewList->msgThreadInfo; + + for (int i = 0; i < count; i++) + { + memcpy(pInfoTmp, pSrc, sizeof(MSG_THREAD_VIEW_S)); + pSrc = pSrc + sizeof(MSG_THREAD_VIEW_S); + pInfoTmp++; + } + } + else if (count == 0) + { + pThreadViewList->nCount = count; + pThreadViewList->msgThreadInfo = NULL; + } +} + + +void MsgDecodeConversationViewList(char *pSrc, MSG_LIST_S *pConvViewList) +{ + int count = 0; + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + + if (count > 0) + { + pConvViewList->nCount = count; + pConvViewList->msgInfo = (msg_message_t*)new char[sizeof(MSG_MESSAGE_S)*count]; + + MSG_MESSAGE_S* pInfoTmp = (MSG_MESSAGE_S*)pConvViewList->msgInfo; + + for (int i = 0; i < count; i++) + { + memcpy(pInfoTmp, pSrc, sizeof(MSG_MESSAGE_S)); + pSrc = pSrc + sizeof(MSG_MESSAGE_S); + pInfoTmp++; + } + } + else if (count == 0) + { + pConvViewList->nCount = count; + pConvViewList->msgInfo = NULL; + } +} + + +void MsgDecodeContactCount(char *pSrc, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList) +{ + int count = 0; + + if(pSrc == NULL) + return; + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + pMsgThreadCountList->totalCount = count; + + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + pMsgThreadCountList->unReadCount = count; + + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + pMsgThreadCountList->mmsMsgCount = count; + + + memcpy(&count, pSrc, sizeof(int)); + pSrc = pSrc + sizeof(int); + pMsgThreadCountList->smsMsgCount = count; + + + return; +} + + +void MsgDecodeReportStatus(char *pSrc, MSG_REPORT_STATUS_INFO_S *pReportStatus) +{ + int count = 0; + + if(pSrc == NULL) + return; + + memcpy(&count, pSrc, sizeof(MSG_DELIVERY_REPORT_STATUS_T)); + pSrc = pSrc + sizeof(MSG_DELIVERY_REPORT_STATUS_T); + pReportStatus->deliveryStatus = count; + + + memcpy(&count, pSrc, sizeof(time_t)); + pSrc = pSrc + sizeof(time_t); + pReportStatus->deliveryStatusTime = count; + + + memcpy(&count, pSrc, sizeof(MSG_READ_REPORT_STATUS_T)); + pSrc = pSrc + sizeof(MSG_READ_REPORT_STATUS_T); + pReportStatus->readStatus = count; + + + memcpy(&count, pSrc, sizeof(time_t)); + pSrc = pSrc + sizeof(time_t); + pReportStatus->readStatusTime = count; + + + return; +} + + +// Event Encoder +int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, MSG_ERROR_T MsgError, void **ppEvent) +{ + MSG_EVENT_S* pMsgEvent = NULL; + + *ppEvent = (MSG_EVENT_S*)new char[sizeof(MSG_EVENT_S) + DataSize]; + + pMsgEvent = (MSG_EVENT_S*)*ppEvent; + + pMsgEvent->eventType = MsgEvent; + pMsgEvent->result = MsgError; + + MSG_DEBUG("eventType [%d : %s]", pMsgEvent->eventType, MsgDbgEvtStr(pMsgEvent->eventType)); + MSG_DEBUG("result [%d]", pMsgEvent->result); + + if (DataSize > 0) + memcpy((void*)pMsgEvent->data, pData, DataSize); + + return (sizeof(MSG_EVENT_S) + DataSize); +} diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp new file mode 100755 index 0000000..74a755d --- /dev/null +++ b/utils/MsgUtilStorage.cpp @@ -0,0 +1,1009 @@ +/* +* +* Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved. +* +* This file is part of msg-service. +* +* Contact: Jaeyun Jeong +* Sangkoo Kim +* Seunghwan Lee +* SoonMin Jung +* Jae-Young Lee +* KeeBum Kim +* +* PROPRIETARY/CONFIDENTIAL +* +* This software is the confidential and proprietary information of +* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered +* into with SAMSUNG ELECTRONICS. +* +* SAMSUNG make no representations or warranties about the suitability +* of the software, either express or implied, including but not limited +* to the implied warranties of merchantability, fitness for a particular +* purpose, or non-infringement. SAMSUNG shall not be liable for any +* damages suffered by licensee as a result of using, modifying or +* distributing this software or its derivatives. +* +*/ + +#include "MsgDebug.h" +#include "MsgUtilFile.h" +#include "MsgContact.h" +#include "MsgCppTypes.h" +#include "MsgGconfWrapper.h" +#include "MsgNotificationWrapper.h" +#include "MsgUtilStorage.h" + +#include +#include + + +static int msgCntLimit[MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX][MSG_COUNT_LIMIT_MSG_TYPE_MAX] = {{1500, 500, 0, 50, 50}, {50, 50, 0, 0, 0}, {1000, 250, 0, 0, 0}, {50, 50, 0, 0, 0}, {0, 0, 200, 0, 0}}; + + +/*================================================================================================== + FUNCTION IMPLEMENTATION +==================================================================================================*/ +unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsgInfo, unsigned int AddrId) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + unsigned int msgId = 0; + + err = pDbHandle->getRowId(MSGFW_MESSAGE_TABLE_NAME, &msgId); + + if (err != MSG_SUCCESS) + { + return 0; + } + + int fileSize = 0; + + char* pFileData = NULL; + AutoPtr buf(&pFileData); + + // Get File Data + if (pMsgInfo->bTextSms == false) + { + if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false) + return 0; + + MSG_DEBUG("file size [%d]", fileSize); + } + + // Add Message + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, %d, 0, %d, 0, 0);", + MSGFW_MESSAGE_TABLE_NAME, msgId, AddrId, pMsgInfo->folderId, msgId, pMsgInfo->storageId, + pMsgInfo->msgType.mainType, pMsgInfo->msgType.subType, pMsgInfo->displayTime, pMsgInfo->dataSize, + pMsgInfo->networkStatus, pMsgInfo->bRead, pMsgInfo->bProtected, pMsgInfo->priority, + pMsgInfo->direction, pMsgInfo->scheduledTime, pMsgInfo->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE); + + MSG_DEBUG("QUERY : %s", sqlQuery); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + { + return 0; + } + + pDbHandle->bindText(pMsgInfo->subject, 1); + + pDbHandle->bindText(pMsgInfo->msgData, 2); + + pDbHandle->bindText(pMsgInfo->thumbPath, 3); + + if (pMsgInfo->bTextSms == false) + pDbHandle->bindText(pFileData, 4); + else + pDbHandle->bindText(pMsgInfo->msgText, 4); + + if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) + { + pDbHandle->finalizeQuery(); + return 0; + } + + pDbHandle->finalizeQuery(); + + return msgId; +} + + +MSG_ERROR_T MsgStoSetReadStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId, bool bRead) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_STATUS = %d WHERE MSG_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, (int)bRead, MsgId); + + if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + // Get MAIN_TYPE, SUB_TYPE, STORAGE_ID + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MAIN_TYPE, A.SUB_TYPE, B.CONTACT_ID, B.ADDRESS_ID \ + FROM %s A, %s B \ + WHERE A.MSG_ID = %d AND A.ADDRESS_ID = B.ADDRESS_ID;", + MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MsgId); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + MSG_MESSAGE_TYPE_S msgType; + MSG_CONTACT_ID_T contactId; + unsigned int addrId; + + if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) + { + msgType.mainType = pDbHandle->columnInt(0); + msgType.subType = pDbHandle->columnInt(1); + contactId = pDbHandle->columnInt(2); + addrId = pDbHandle->columnInt(3); + } + else + { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + MSG_DEBUG("Main Type:[%d] SubType:[%d] ContactId:[%d] AddrId:[%d]", msgType.mainType, msgType.subType, contactId, addrId); + + if (MsgStoUpdateAddress(pDbHandle, addrId) != MSG_SUCCESS) + { + MSG_DEBUG("MsgStoUpdateAddress() Error"); + return MSG_ERR_STORAGE_ERROR; + } + + int smsCnt = 0, mmsCnt = 0; + + smsCnt = MsgStoGetUnreadCnt(pDbHandle, MSG_SMS_TYPE); + mmsCnt = MsgStoGetUnreadCnt(pDbHandle, MSG_MMS_TYPE); + + MsgSettingSetIndicator(smsCnt, mmsCnt); + + MsgDeleteNotiByMsgId(MsgId); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetOldestMessage(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsgInfo, MSG_MESSAGE_ID_T *pMsgId) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID \ + FROM %s \ + WHERE SUB_TYPE = %d AND FOLDER_ID = %d AND STORAGE_ID = %d AND PROTECTED = 0 \ + ORDER BY DISPLAY_TIME ASC", + MSGFW_MESSAGE_TABLE_NAME, pMsgInfo->msgType.subType, pMsgInfo->folderId, MSG_STORAGE_PHONE); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) + { + *pMsgId = pDbHandle->columnInt(0); + } + else + { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S* pMsgType, MSG_FOLDER_ID_T FolderId) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + struct statfs buf = {0}; + + if (statfs(MSG_DATA_ROOT_PATH, &buf) == -1) + { + MSG_DEBUG("statfs(\"%s\") failed - %d", MSG_DATA_ROOT_PATH); + return MSG_ERR_STORAGE_ERROR; + } + + unsigned long freeSpace = (buf.f_bfree * buf.f_bsize); + + MSG_DEBUG("f_bfree [%d] f_bsize [%d]", buf.f_bfree, buf.f_bsize); + MSG_DEBUG("Free space of storage is [%ul] MB.", freeSpace); + + if (freeSpace < SMS_MINIMUM_SPACE && pMsgType->mainType == MSG_SMS_TYPE) + err = MSG_ERR_MESSAGE_COUNT_FULL; + else if(freeSpace < MMS_MINIMUM_SPACE && pMsgType->mainType == MSG_MMS_TYPE) + err = MSG_ERR_MESSAGE_COUNT_FULL; + + return err; + + MSG_END(); + + return err; +} + + +MSG_ERROR_T MsgStoCountMsgByLimitCategory(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount, MSG_FOLDER_ID_T folderId ) +{ + if (pMsgType == NULL) + { + MSG_DEBUG("pMsgType is NULL"); + return MSG_ERR_NULL_POINTER; + } + + *pMsgCount = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_WAP_SI_SMS ||pMsgType->subType == MSG_WAP_SL_SMS)) // PUSH + { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d) AND FOLDER_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_WAP_SI_SMS, MSG_WAP_SL_SMS, MSG_INBOX_ID); + } + else if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_CB_SMS)) // CB + { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d) AND FOLDER_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_CB_SMS, MSG_CBMSGBOX_ID); + } + else if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_SYNCML_CP)) // Provision + { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d) AND FOLDER_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_SYNCML_CP, MSG_INBOX_ID); + } + else if ((pMsgType->mainType == MSG_SMS_TYPE)) // SMS + { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d, %d) AND FOLDER_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_WAP_SI_SMS, MSG_WAP_SL_SMS, MSG_CB_SMS, MSG_SYNCML_CP, MSG_INBOX_ID); // etc SMS + } + else if ((pMsgType->mainType == MSG_MMS_TYPE) && (pMsgType->subType == MSG_SENDREQ_MMS || pMsgType->subType == MSG_SENDCONF_MMS || pMsgType->subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgType->subType == MSG_RETRIEVE_MANUALCONF_MMS || pMsgType->subType == MSG_NOTIFICATIONIND_MMS)) // MMS + { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d, %d, %d, %d) AND FOLDER_ID = %d;", + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_SENDREQ_MMS, MSG_SENDCONF_MMS, MSG_RETRIEVE_AUTOCONF_MMS, MSG_RETRIEVE_MANUALCONF_MMS, MSG_NOTIFICATIONIND_MMS, folderId); + } + else + { + return MSG_ERR_INVALID_PARAMETER; + } + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) + { + *pMsgCount = pDbHandle->columnInt(0); + } + else + { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + return MSG_SUCCESS; +} + + +int MsgStoCheckMsgCntLimit(const MSG_MESSAGE_TYPE_S* pMsgType, MSG_FOLDER_ID_T FolderId) +{ + int msgboxType = -1; + int msgType= -1; + + switch (FolderId) + { + case MSG_INBOX_ID : + msgboxType = MSG_COUNT_LIMIT_INBOX_TYPE; + break; + + case MSG_OUTBOX_ID : + msgboxType = MSG_COUNT_LIMIT_OUTBOX_TYPE; + break; + + case MSG_SENTBOX_ID : + msgboxType = MSG_COUNT_LIMIT_SENTBOX_TYPE; + break; + + case MSG_DRAFT_ID : + msgboxType = MSG_COUNT_LIMIT_DRAFTBOX_TYPE; + break; + + case MSG_CBMSGBOX_ID : + msgboxType = MSG_COUNT_LIMIT_CBMSGBOX_TYPE; + break; + + default: + MSG_DEBUG("Unknown mailbox Type [%d]", FolderId); + return -1; + } + + switch (pMsgType->subType) + { + case MSG_NORMAL_SMS: + case MSG_REPLACE_TYPE1_SMS: + case MSG_REPLACE_TYPE2_SMS: + case MSG_REPLACE_TYPE3_SMS: + case MSG_REPLACE_TYPE4_SMS: + case MSG_REPLACE_TYPE5_SMS: + case MSG_REPLACE_TYPE6_SMS: + case MSG_REPLACE_TYPE7_SMS: + case MSG_MWI_VOICE_SMS: + case MSG_MWI_FAX_SMS: + case MSG_MWI_EMAIL_SMS: + case MSG_MWI_OTHER_SMS: + case MSG_STATUS_REPORT_SMS: + msgType = MSG_COUNT_LIMIT_SMS_TYPE; + break; + + case MSG_CB_SMS: + msgType = MSG_COUNT_LIMIT_CB_TYPE; + break; + + case MSG_WAP_SI_SMS: + case MSG_WAP_SL_SMS: + msgType = MSG_COUNT_LIMIT_WAPPUSH_TYPE; + break; + + case MSG_SYNCML_CP: + msgType = MSG_COUNT_LIMIT_PROVISION_TYPE; + break; + + case MSG_SENDREQ_MMS: + case MSG_SENDCONF_MMS: + case MSG_NOTIFICATIONIND_MMS: + case MSG_RETRIEVE_AUTOCONF_MMS: + case MSG_RETRIEVE_MANUALCONF_MMS: + msgType = MSG_COUNT_LIMIT_MMS_TYPE; + break; + + default: + MSG_DEBUG("Unknown Message Type [%d]", pMsgType->subType); + return -1; + } + + return msgCntLimit[msgboxType][msgType]; +} + + +MSG_ERROR_T MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_ADDRESS_INFO_S *pAddrInfo, unsigned int *pAddrId) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + // Check if new address or not + if (MsgExistAddress(pDbHandle, pAddrInfo->addressVal, pAddrId) == true) + { + MSG_DEBUG("The address already exists. ID : [%d], Value : [%s]", *pAddrId, pAddrInfo->addressVal); + return err; + } + + // Get Contact Info + MSG_CONTACT_INFO_S contactInfo = {0}; + + err = MsgGetContactInfo(pAddrInfo, &contactInfo); + + if (err != MSG_SUCCESS) + { + MSG_DEBUG("MsgGetContactInfo() fail [%d]", err); + return err; + } + + if (pDbHandle->getRowId(MSGFW_ADDRESS_TABLE_NAME, pAddrId) != MSG_SUCCESS) + { + return err; + } + + // Add Address + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, '%s', %d, ?, ?, ?, '%s', 0, 0, 0, 0, 0, 0, 0, 0, '');", + MSGFW_ADDRESS_TABLE_NAME, *pAddrId, pAddrInfo->addressType, pAddrInfo->recipientType, pAddrInfo->addressVal, + contactInfo.contactId, contactInfo.imagePath); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + pDbHandle->bindText(contactInfo.displayName, 1); + pDbHandle->bindText(contactInfo.firstName, 2); + pDbHandle->bindText(contactInfo.lastName, 3); + + if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) + { + pDbHandle->finalizeQuery(); + MSG_DEBUG("Add Address Info. Fail [%s]", sqlQuery); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + return err; +} + + +MSG_ERROR_T MsgStoUpdateAddress(MsgDbHandler *pDbHandle, unsigned int AddrId) +{ + MSG_BEGIN(); + + MSG_ERROR_T err = MSG_SUCCESS; + + int unreadCnt = 0, smsCnt = 0, mmsCnt = 0; + + char msgText[MAX_THREAD_DATA_LEN+1]; + char sqlQuery[MAX_QUERY_LEN+1]; + + // Get Unread Count + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s \ + WHERE ADDRESS_ID = %d \ + AND FOLDER_ID = %d \ + AND READ_STATUS = 0;", + MSGFW_MESSAGE_TABLE_NAME, AddrId, MSG_INBOX_ID); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + err = pDbHandle->stepQuery(); + + if (err == MSG_ERR_DB_ROW) + { + unreadCnt = pDbHandle->columnInt(0); + } + else if (err != MSG_ERR_DB_DONE) + { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + // Get SMS Count + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s \ + WHERE ADDRESS_ID = %d \ + AND MAIN_TYPE = %d \ + AND FOLDER_ID > 0 AND FOLDER_ID < %d;", + MSGFW_MESSAGE_TABLE_NAME, AddrId, MSG_SMS_TYPE, MSG_CBMSGBOX_ID); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + err = pDbHandle->stepQuery(); + + if (err == MSG_ERR_DB_ROW) + { + smsCnt = pDbHandle->columnInt(0); + } + else if (err != MSG_ERR_DB_DONE) + { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + // Get MMS Count + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s \ + WHERE ADDRESS_ID = %d \ + AND MAIN_TYPE = %d \ + AND SUB_TYPE NOT IN (%d, %d, %d) \ + AND FOLDER_ID > 0 AND FOLDER_ID < %d;", + MSGFW_MESSAGE_TABLE_NAME, AddrId, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, + MSG_READRECIND_MMS, MSG_READORGIND_MMS, MSG_CBMSGBOX_ID); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + err = pDbHandle->stepQuery(); + + if (err == MSG_ERR_DB_ROW) + { + mmsCnt = pDbHandle->columnInt(0); + } + else if (err != MSG_ERR_DB_DONE) + { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + // Get Latest Msg Data + MSG_MAIN_TYPE_T mainType = MSG_UNKNOWN_TYPE; + MSG_SUB_TYPE_T subType = MSG_NORMAL_SMS; + MSG_DIRECTION_TYPE_T direction = MSG_DIRECTION_TYPE_MO; + time_t msgTime = 0; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, SUBJECT, MSG_TEXT FROM %s \ + WHERE ADDRESS_ID = %d \ + AND FOLDER_ID > 0 AND FOLDER_ID < %d \ + ORDER BY DISPLAY_TIME DESC;", + MSGFW_MESSAGE_TABLE_NAME, AddrId, MSG_CBMSGBOX_ID); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + err = pDbHandle->stepQuery(); + + if (err == MSG_ERR_DB_ROW) + { + mainType = pDbHandle->columnInt(0); + subType = pDbHandle->columnInt(1); + direction = pDbHandle->columnInt(2); + + msgTime = (time_t)pDbHandle->columnInt(3); + + memset(msgText, 0x00, sizeof(msgText)); + + if (mainType == MSG_SMS_TYPE) + { + if (pDbHandle->columnText(5) != NULL) + strncpy(msgText, (char*)pDbHandle->columnText(5), MAX_THREAD_DATA_LEN); + } + else if (mainType == MSG_MMS_TYPE) + { + if (pDbHandle->columnText(4) != NULL) + { + strncpy(msgText, (char*)pDbHandle->columnText(4), MAX_THREAD_DATA_LEN); + } + + if ((strlen(msgText) <= 0) && (pDbHandle->columnText(5) != NULL) && (subType != MSG_NOTIFICATIONIND_MMS)) + { + memset(msgText, 0x00, sizeof(msgText)); + strncpy(msgText, (char*)pDbHandle->columnText(5), MAX_THREAD_DATA_LEN); + } + } + } + else if (err != MSG_ERR_DB_DONE) + { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + // Update Address Table + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET UNREAD_CNT = %d, SMS_CNT = %d, MMS_CNT = %d, MAIN_TYPE = %d, SUB_TYPE = %d, MSG_DIRECTION = %d, MSG_TIME = %ld, MSG_TEXT = ? \ + WHERE ADDRESS_ID = %d;", + MSGFW_ADDRESS_TABLE_NAME, unreadCnt, smsCnt, mmsCnt, mainType, subType, direction, msgTime, AddrId); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + pDbHandle->bindText(msgText, 1); + + if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) + { + pDbHandle->finalizeQuery(); + MSG_DEBUG("Update Address Info. Fail [%d] [%s]", err, sqlQuery); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + MSG_END(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoClearAddressTable(MsgDbHandler *pDbHandle) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s \ + WHERE ADDRESS_ID NOT IN (SELECT ADDRESS_ID FROM %s) \ + AND ADDRESS_ID <> 0;", + MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + + err = pDbHandle->execQuery(sqlQuery); + + return err; +} + + +void MsgConvertNumber(const char* pSrcNum, char* pDestNum) +{ + int overLen = 0; + int i = 0; + + overLen = strlen(pSrcNum) - MAX_PRECONFIG_NUM; + + for (i = 0; i < MAX_PRECONFIG_NUM; i++) + pDestNum[i] = pSrcNum[i+overLen]; + + pDestNum[i] = '\0'; +} + + +bool MsgExistAddress(MsgDbHandler *pDbHandle, const char *pAddress, unsigned int *pAddrId) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + *pAddrId = 0; + + if (strlen(pAddress) > MAX_PRECONFIG_NUM) + { + char newPhoneNum[MAX_PRECONFIG_NUM+1]; + + memset(newPhoneNum, 0x00, sizeof(newPhoneNum)); + + MsgConvertNumber(pAddress, newPhoneNum); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_ID FROM %s WHERE ADDRESS_VAL LIKE '%%%%%s';", + MSGFW_ADDRESS_TABLE_NAME, newPhoneNum); + } + else + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_ID FROM %s WHERE ADDRESS_VAL = '%s';", + MSGFW_ADDRESS_TABLE_NAME, pAddress); + } + + int rowCnt = 0, addrId = 0; + + err = pDbHandle->getTable(sqlQuery, &rowCnt); + + // No record or other error + if (err != MSG_SUCCESS) + { + pDbHandle->freeTable(); + return false; + } + + addrId = pDbHandle->getColumnToInt(1); + + MSG_DEBUG("AddressId : [%d]", addrId); + + if (addrId > 0) + { + *pAddrId = addrId; + + pDbHandle->freeTable(); + return true; + } + else + { + pDbHandle->freeTable(); + return false; + } + + pDbHandle->freeTable(); + + return false; +} + + +int MsgStoGetUnreadCnt(MsgDbHandler *pDbHandle, MSG_MAIN_TYPE_T MsgType) +{ + int msgCnt = 0; + + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if (MsgType == MSG_SMS_TYPE) + { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s \ + WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d, %d, %d, %d, %d, %d) AND \ + FOLDER_ID = %d AND READ_STATUS = 0;", + MSGFW_MESSAGE_TABLE_NAME, MSG_SMS_TYPE, MSG_NORMAL_SMS, MSG_STATUS_REPORT_SMS, MSG_CONCAT_SIM_SMS, MSG_WAP_SI_SMS, MSG_WAP_SL_SMS, MSG_MWI_VOICE_SMS, MSG_SYNCML_CP, MSG_INBOX_ID); + } + else if (MsgType == MSG_MMS_TYPE) + { + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s \ + WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d, %d) AND \ + FOLDER_ID = %d AND READ_STATUS = 0;", + MSGFW_MESSAGE_TABLE_NAME, MSG_MMS_TYPE, MSG_RETRIEVE_AUTOCONF_MMS, MSG_RETRIEVE_MANUALCONF_MMS, MSG_NOTIFICATIONIND_MMS, MSG_INBOX_ID); + } + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return 0; + + if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) + { + msgCnt = pDbHandle->columnInt(0); + } + else + { + pDbHandle->finalizeQuery(); + return 0; + } + + pDbHandle->finalizeQuery(); + + return msgCnt; +} + + +MSG_ERROR_T MsgStoAddContactInfo(MsgDbHandler *pDbHandle, MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber) +{ + char newPhoneNum[MAX_PRECONFIG_NUM+1]; + char sqlQuery[MAX_QUERY_LEN+1]; + + if (strlen(pNumber) > MAX_PRECONFIG_NUM) + { + memset(newPhoneNum, 0x00, sizeof(newPhoneNum)); + MsgConvertNumber(pNumber, newPhoneNum); + + MSG_DEBUG("Phone Number to Compare : [%s]", newPhoneNum); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE MSG_ADDRESS_TABLE SET CONTACT_ID = %d, DISPLAY_NAME = ?, FIRST_NAME = ?, LAST_NAME = ?, IMAGE_PATH = '%s' \ + WHERE ADDRESS_VAL LIKE '%%%%%s';", + pContactInfo->contactId, + pContactInfo->imagePath, + newPhoneNum); + } + else + { + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE MSG_ADDRESS_TABLE SET CONTACT_ID = %d, DISPLAY_NAME = ?, FIRST_NAME = ?, LAST_NAME = ?, IMAGE_PATH = '%s' \ + WHERE ADDRESS_VAL = '%s';", + pContactInfo->contactId, + pContactInfo->imagePath, + pNumber); + } + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + pDbHandle->bindText(pContactInfo->displayName, 1); + + pDbHandle->bindText(pContactInfo->firstName, 2); + + pDbHandle->bindText(pContactInfo->lastName, 3); + + if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) + { + pDbHandle->finalizeQuery(); + MSG_DEBUG("Update contact Info. Fail [%s]", sqlQuery); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int ContactId) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE MSG_ADDRESS_TABLE SET CONTACT_ID = 0, DISPLAY_NAME = '', FIRST_NAME = '', LAST_NAME = '', IMAGE_PATH = '' \ + WHERE CONTACT_ID = %d;", ContactId); + + if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS) + { + MSG_DEBUG("Fail to execute query"); + return MSG_ERR_DB_EXEC; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int ContactId, const char *pNumber) +{ + char newPhoneNum[MAX_PRECONFIG_NUM+1]; + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(newPhoneNum, 0x00, sizeof(newPhoneNum)); + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + if (strlen(pNumber) > MAX_PRECONFIG_NUM) + { + MsgConvertNumber(pNumber, newPhoneNum); + + MSG_DEBUG("Phone Number to Compare : [%s]", newPhoneNum); + + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE MSG_ADDRESS_TABLE SET CONTACT_ID = 0, DISPLAY_NAME = '', FIRST_NAME = '', LAST_NAME = '', IMAGE_PATH = '' \ + WHERE CONTACT_ID = %d AND ADDRESS_VAL NOT LIKE '%%%s';", ContactId, newPhoneNum); + } + else + { + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE MSG_ADDRESS_TABLE SET CONTACT_ID = 0, DISPLAY_NAME = '', FIRST_NAME = '', LAST_NAME = '', IMAGE_PATH = '' \ + WHERE CONTACT_ID = %d AND ADDRESS_VAL <> '%s';", ContactId, pNumber); + } + + if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS) + { + MSG_DEBUG("Fail to execute query"); + return MSG_ERR_DB_EXEC; + } + + return MSG_SUCCESS; +} + + +MSG_ERROR_T MsgStoGetMmsRawFilePath(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T msgId, char *pFilePath) +{ + char sqlQuery[MAX_QUERY_LEN+1]; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, msgId); + + if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_PREPARE; + + if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) + { + if (pDbHandle->columnText(0) != NULL) + { + strncpy(pFilePath, (char*)pDbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); + } + } + else + { + pDbHandle->finalizeQuery(); + return MSG_ERR_DB_STEP; + } + + pDbHandle->finalizeQuery(); + + return MSG_SUCCESS; +} + + +bool MsgStoCheckReadReportRequested(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + int rowCnt = 0; + bool bReadReportRequested = false; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ASK_READ_REPLY FROM %s WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MsgId); + + err = pDbHandle->getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) + { + pDbHandle->freeTable(); + MSG_DEBUG("[Error]Failed to Get Table"); + return bReadReportRequested; + } + + if (rowCnt != 1) + { + pDbHandle->freeTable(); + MSG_DEBUG("[Error]MSG_ERR_DB_NORECORD"); + return bReadReportRequested; + } + + bReadReportRequested = pDbHandle->getColumnToInt(1); + + pDbHandle->freeTable(); + + return bReadReportRequested; +} + + +bool MsgStoCheckReadReportIsSent(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId) +{ + MSG_ERROR_T err = MSG_SUCCESS; + + char sqlQuery[MAX_QUERY_LEN+1]; + + int rowCnt = 0; + bool bReadReportIsSent = true; + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT READ_REPORT_SENT FROM %s WHERE REFERENCE_ID IN \ + (SELECT REFERENCE_ID FROM %s WHERE MSG_ID = %d);", + MMS_PLUGIN_ATTRIBUTE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MsgId); + + err = pDbHandle->getTable(sqlQuery, &rowCnt); + + if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) + { + pDbHandle->freeTable(); + MSG_DEBUG("[Error]Failed to Get Table"); + return bReadReportIsSent; + } + + if (rowCnt != 1) + { + pDbHandle->freeTable(); + MSG_DEBUG("[Error]MSG_ERR_DB_NORECORD"); + return bReadReportIsSent; + } + + bReadReportIsSent = (bool)pDbHandle->getColumnToInt(1); + + pDbHandle->freeTable(); + + return bReadReportIsSent; +} + +char *MsgStoReplaceString(const char *origStr, const char *oldStr, const char *newStr) +{ + if (origStr == NULL) + return NULL; + + char *replaceStr = NULL; + char *pTemp = NULL; + int i = 0; + int matchedCnt = 0; + int oldStrLen = 0; + int newStrLen = 0; + int replaceSize = 0; + + if (g_strcmp0(oldStr, newStr) != 0) { + oldStrLen = strlen(oldStr); + newStrLen = strlen(newStr); + + for (i = 0; origStr[i] != '\0';) { + if (memcmp(&origStr[i], oldStr, oldStrLen) == 0) { + matchedCnt++; + i += oldStrLen; + } else { + i++; + } + } + } else { + return g_strdup(origStr); + } + + replaceStr = (char *)calloc(1, i + sizeof(char) * (matchedCnt * (newStrLen - oldStrLen) + 1)); + if (replaceStr == NULL) + return NULL; + + pTemp = replaceStr; + + while (*origStr) { + if (memcmp(origStr, oldStr, oldStrLen) == 0) { + memcpy(pTemp, newStr, newStrLen); + pTemp += newStrLen; + origStr += oldStrLen; + } else { + *pTemp++ = *origStr++; + } + } + + return replaceStr; +} diff --git a/version.sh b/version.sh new file mode 100755 index 0000000..b503b14 --- /dev/null +++ b/version.sh @@ -0,0 +1 @@ +sed -n '1p' ./debian/changelog | cut -f2 -d "(" | cut -f1 -d ")" -- 2.7.4