Modify flora license version.
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginWapPushHandler.h
1 /*
2 * Copyright 2012-2013  Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.1 (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
7 *
8 *    http://floralicense.org/license/
9 *
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.
15 */
16
17 #ifndef SMS_PLUGIN_WAPPUSH_HANDLER_H
18 #define SMS_PLUGIN_WAPPUSH_HANDLER_H
19
20
21 /*==================================================================================================
22                                          INCLUDE FILES
23 ==================================================================================================*/
24 #include <wbxml/wbxml.h>
25 #include <libxml/parser.h>
26
27
28 #include "SmsPluginTypes.h"
29
30
31 /*==================================================================================================
32                                          DEFINES
33 ==================================================================================================*/
34 #define WSP_STANDARD_STR_LEN_MAX        255
35 #define LENGTH_QUOTE  0x1F
36 #define NO_VALUE                                                0x00
37
38 #define WSP_CODE_BUFFER_LEFT_LEN_MAX    1024
39 #define WSP_CODE_BUFFER_RIGHT_LEN_MAX   2048
40
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))
44
45
46 /*==================================================================================================
47                                      CLASS DEFINITIONS
48 ==================================================================================================*/
49 class SmsPluginWapPushHandler
50 {
51 public:
52         static SmsPluginWapPushHandler* instance();
53
54         //void registerPushCallback();
55         bool IsWapPushMsg(SMS_USERDATA_S *pUserData);
56
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);
60
61 private:
62         SmsPluginWapPushHandler();
63         virtual ~SmsPluginWapPushHandler();
64
65         static SmsPluginWapPushHandler* pInstance;
66
67         SMS_WAP_APP_CODE_T getAppCode(const char *pPushHeader);
68
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);
79
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);
95
96
97         SMS_ADDRESS_S   tmpAddress;
98         SMS_TIMESTAMP_S tmpTimeStamp;
99 };
100
101 #endif //SmsPluginWapPushHandler
102