2 * Copyright 2012-2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef SMS_PLUGIN_WAPPUSH_HANDLER_H
18 #define SMS_PLUGIN_WAPPUSH_HANDLER_H
21 /*==================================================================================================
23 ==================================================================================================*/
24 #include <wbxml/wbxml.h>
25 #include <libxml/parser.h>
28 #include "SmsPluginTypes.h"
31 /*==================================================================================================
33 ==================================================================================================*/
34 #define WSP_STANDARD_STR_LEN_MAX 255
35 #define LENGTH_QUOTE 0x1F
38 #define WSP_CODE_BUFFER_LEFT_LEN_MAX 1024
39 #define WSP_CODE_BUFFER_RIGHT_LEN_MAX 2048
41 #define MemFree(x) {if(x != NULL) free(x);x=NULL;}
42 #define AcStrlen(x) ((x==NULL)?0:strlen(x))
43 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
46 /*==================================================================================================
48 ==================================================================================================*/
49 class SmsPluginWapPushHandler
52 static SmsPluginWapPushHandler* instance();
54 //void registerPushCallback();
55 bool IsWapPushMsg(SMS_USERDATA_S *pUserData);
57 void copyDeliverData(SMS_DELIVER_S *pDeliver);
58 void handleWapPushMsg(const char *pUserData, int DataSize);
59 void handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen);
62 SmsPluginWapPushHandler();
63 virtual ~SmsPluginWapPushHandler();
65 static SmsPluginWapPushHandler* pInstance;
67 SMS_WAP_APP_CODE_T getAppCode(const char *pPushHeader);
69 void handleMMSNotification(const char *pPushBody, int PushBodyLen);
70 void handleSIMessage(char* pPushBody, int PushBodyLen, bool isText);
71 void handleSLMessage(char* pPushBody, int PushBodyLen, bool isText);
72 void handleCOMessage(char* pPushBody, int PushBodyLen, bool isText);
73 void handleDrmVer1(char* pPushBody, int PushBodyLen);
74 void getXmlDoc(const char* pPushBody, const int PushBodyLen, xmlDocPtr *pXmlDoc, const bool isText);
75 void createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo);
76 unsigned long convertXmlCharToSec(char* pDate);
77 msg_push_action_t convertSIActionStrToEnum(char* pAction);
78 msg_push_action_t convertSLActionStrToEnum(char* pAction);
80 unsigned long wspRetriveUintvarDecode( unsigned char* sourceData, unsigned long* currentPointer );
81 unsigned long wspDecodeUintvar(unsigned long length, unsigned char* userVar );
82 void wspDecodeHeader( unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader);
83 unsigned long wspHeaderDecodeInteger( unsigned char* data );
84 void wspHeaderDecodeQValue( unsigned long length, unsigned char* data, char** pDecodedString);
85 unsigned long wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length );
86 char* wspExtendedDecodeType(char contentType );
87 void wspHeaderDecodeParameter( unsigned char* data, unsigned long length, char** pParam);
88 void wspHeaderDecodeCharset( unsigned long length, unsigned char* data, char**pDecodedString);
89 void wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString );
90 void wspHeaderDecodeDateValue( unsigned long length, unsigned char* data, char** pDecodedString );
91 void wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper );
92 void wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString );
93 void wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString );
94 void wspHeaderDecodeCacheControl(unsigned char* fieldValue, unsigned long fieldValueLen, char** pCacheString);
97 SMS_ADDRESS_S tmpAddress;
98 SMS_TIMESTAMP_S tmpTimeStamp;
101 #endif //SmsPluginWapPushHandler