3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
5 * This file is part of msg-service.
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 * Sangkoo Kim <sangkoo.kim@samsung.com>
9 * Seunghwan Lee <sh.cat.lee@samsung.com>
10 * SoonMin Jung <sm0415.jung@samsung.com>
11 * Jae-Young Lee <jy4710.lee@samsung.com>
12 * KeeBum Kim <keebum.kim@samsung.com>
14 * PROPRIETARY/CONFIDENTIAL
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
31 #ifndef SMS_PLUGIN_WAPPUSH_HANDLER_H
32 #define SMS_PLUGIN_WAPPUSH_HANDLER_H
35 /*==================================================================================================
37 ==================================================================================================*/
38 #include <wbxml/wbxml.h>
39 #include <libxml/parser.h>
42 #include "SmsPluginTypes.h"
45 /*==================================================================================================
47 ==================================================================================================*/
48 #define WSP_STANDARD_STR_LEN_MAX 255
49 #define LENGTH_QUOTE 0x1F
52 #define WSP_CODE_BUFFER_LEFT_LEN_MAX 1024
53 #define WSP_CODE_BUFFER_RIGHT_LEN_MAX 2048
55 #define MemFree(x) {if(x != NULL) free(x);x=NULL;}
56 #define AcStrlen(x) ((x==NULL)?0:strlen(x))
57 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
60 /*==================================================================================================
62 ==================================================================================================*/
63 class SmsPluginWapPushHandler
66 static SmsPluginWapPushHandler* instance();
68 //void registerPushCallback();
69 bool IsWapPushMsg(SMS_USERDATA_S *pUserData);
71 void copyDeliverData(SMS_DELIVER_S *pDeliver);
72 void handleWapPushMsg(const char *pUserData, int DataSize);
73 void handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen);
76 SmsPluginWapPushHandler();
77 virtual ~SmsPluginWapPushHandler();
79 static SmsPluginWapPushHandler* pInstance;
81 SMS_WAP_APP_CODE_T getAppCode(const char *pPushHeader);
83 void handleMMSNotification(const char *pPushBody, int PushBodyLen);
84 void handleSIMessage(char* pPushBody, int PushBodyLen, bool isText);
85 void handleSLMessage(char* pPushBody, int PushBodyLen, bool isText);
86 void handleCOMessage(char* pPushBody, int PushBodyLen, bool isText);
87 void handleDrmVer1(char* pPushBody, int PushBodyLen);
88 void getXmlDoc(const char* pPushBody, const int PushBodyLen, xmlDocPtr *pXmlDoc, const bool isText);
89 void createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo);
90 unsigned long convertXmlCharToSec(char* pDate);
91 MSG_PUSH_ACTION_T convertSIActionStrToEnum(char* pAction);
92 MSG_PUSH_ACTION_T convertSLActionStrToEnum(char* pAction);
94 unsigned long wspRetriveUintvarDecode( unsigned char* sourceData, unsigned long* currentPointer );
95 unsigned long wspDecodeUintvar(unsigned long length, unsigned char* userVar );
96 void wspDecodeHeader( unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader);
97 unsigned long wspHeaderDecodeInteger( unsigned char* data );
98 void wspHeaderDecodeQValue( unsigned long length, unsigned char* data, char** pDecodedString);
99 unsigned long wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length );
100 char* wspExtendedDecodeType(char contentType );
101 void wspHeaderDecodeParameter( unsigned char* data, unsigned long length, char** pParam);
102 void wspHeaderDecodeCharset( unsigned long length, unsigned char* data, char**pDecodedString);
103 void wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString );
104 void wspHeaderDecodeDateValue( unsigned long length, unsigned char* data, char** pDecodedString );
105 void wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper );
106 void wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString );
107 void wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString );
108 void wspHeaderDecodeCacheControl(unsigned char* fieldValue, unsigned long fieldValueLen, char** pCacheString);
111 SMS_ADDRESS_S tmpAddress;
112 SMS_TIMESTAMP_S tmpTimeStamp;
115 #endif //SmsPluginWapPushHandler