update tizen source
[framework/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginUDCodec.h
1 /*
2 *
3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
4 *
5 * This file is part of msg-service.
6 *
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>
13 *
14 * PROPRIETARY/CONFIDENTIAL
15 *
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.
21 *
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.
28 *
29 */
30
31 #ifndef SMS_PLUGIN_UDCODEC_H
32 #define SMS_PLUGIN_UDCODEC_H
33
34
35 /*==================================================================================================
36                                          INCLUDE FILES
37 ==================================================================================================*/
38 #include "SmsPluginTypes.h"
39
40
41 /*==================================================================================================
42                                      CLASS DEFINITIONS
43 ==================================================================================================*/
44 class SmsPluginUDCodec
45 {
46 public:
47         SmsPluginUDCodec();
48         virtual ~SmsPluginUDCodec();
49
50         static int encodeUserData(const SMS_USERDATA_S *pUserData, SMS_CODING_SCHEME_T CodingScheme, char *pEncodeData);
51         static int decodeUserData(const unsigned char *pTpdu, const int tpduLen, bool bHeaderInd, SMS_CODING_SCHEME_T CodingScheme, SMS_USERDATA_S *pUserData);
52         static int decodeUserData(const unsigned char *pTpdu, const int tpduLen, bool bHeaderInd, SMS_CODING_SCHEME_T CodingScheme, SMS_USERDATA_S *pUserData, SMS_TPUD_S *pTPUD);
53
54         static int pack7bitChar(const unsigned char *pUserData, int dataLen, int fillBits, char *pPackData);
55         static int unpack7bitChar(const unsigned char *pTpdu, unsigned char dataLen, int fillBits, char *pUnpackData);
56
57 private:
58         static int encodeGSMData(const SMS_USERDATA_S *pUserData, char *pEncodeData);
59         static int encode8bitData(const SMS_USERDATA_S *pUserData, char *pEncodeData);
60         static int encodeUCS2Data(const SMS_USERDATA_S *pUserData, char *pEncodeData);
61
62         static int decodeGSMData(const unsigned char *pTpdu, const int tpduLen, bool bHeaderInd, SMS_USERDATA_S *pUserData, SMS_TPUD_S *pTPUD);
63         static int decode8bitData(const unsigned char *pTpdu, bool bHeaderInd, SMS_USERDATA_S *pUserData, SMS_TPUD_S *pTPUD);
64         static int decodeUCS2Data(const unsigned char *pTpdu, const int tpduLen, bool bHeaderInd, SMS_USERDATA_S *pUserData, SMS_TPUD_S *pTPUD);
65
66         static int encodeHeader(const SMS_UDH_S header, char *pEncodeHeader);
67         static int decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeader);
68 };
69
70 #endif
71