blob: 75386f6b88df28a11e83046740e1fea212c4c746 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001
2#include <time.h>
3#include <ctype.h>
4#include "os_type_def.h"
5#include "sms_code.h"
6#ifdef WIN32
7#include <wchar.h>
8#endif
9#define NON_GSM (0x12a9+1311-0x17a8)
10#define NON_GSM_P NON_GSM
11extern T_zUfiSms_ConcatInfo g_zUfiSms_ConcatSms;static const wms_udh_s_type*
12const_header;char g_zUfiSms_DigAscMap[(0x463+219-0x52e)]={
13((char)(0x4e9+6897-0x1faa)),((char)(0x1466+1723-0x1af0)),
14((char)(0x1839+2622-0x2245)),((char)(0x358+3838-0x1223)),
15((char)(0xf5f+1843-0x165e)),((char)(0x57d+1589-0xb7d)),
16((char)(0x1289+561-0x1484)),((char)(0x79c+1722-0xe1f)),
17((char)(0x901+4092-0x18c5)),((char)(0x21c+8324-0x2267)),
18((char)(0xf0+1887-0x80e)),((char)(0x4bc+6636-0x1e66)),
19((char)(0x12fb+3089-0x1ec9)),((char)(0x2f8+8259-0x22f7)),
20((char)(0xed1+4858-0x2186)),((char)(0x10fd+1322-0x15e1))};extern SMS_PARAM
21g_zUfiSms_SendingSms;extern UINT16 g_zUfiSms_IsLanguageShift;extern int
22g_zUfiSms_Language;static int SerializeNumbers_sms(const char*pSrc,char*pDst,int
23 nSrcLength);const unsigned short g_zUfiSms_AsciiToGsmdefaultTable[]={
24((char)(0x1b59+2264-0x2411)),((char)(0xa4a+3435-0x1795)),
25((char)(0x1e1c+1160-0x2284)),((char)(0xd62+6547-0x26d5)),
26((char)(0x427+3775-0x12c6)),((char)(0x6d7+3747-0x155a)),
27((char)(0x1f0+2282-0xaba)),((char)(0x1b53+3032-0x270b)),
28((char)(0xbd4+4281-0x1c6d)),((char)(0x21c+3592-0x1004)),
29((char)(0x3e8+2334-0xce6)),((char)(0x60b+4269-0x1698)),
30((char)(0x1ec1+1243-0x237c)),((char)(0xa23+3666-0x1855)),
31((char)(0x5f1+8083-0x2564)),((char)(0x52+1628-0x68e)),
32((char)(0xd8b+4530-0x1f1d)),((char)(0x3cc+110-0x41a)),
33((char)(0x13a8+4676-0x25cc)),((char)(0x230+4120-0x1228)),
34((char)(0xd5c+321-0xe7d)),((char)(0x223f+445-0x23dc)),((char)(0x383+1870-0xab1))
35,((char)(0xe77+2428-0x17d3)),((char)(0x129b+973-0x1648)),
36((char)(0x6ad+5262-0x1b1b)),((char)(0x62a+6839-0x20c1)),
37((char)(0x520+1058-0x922)),((char)(0x17c3+575-0x19e2)),
38((char)(0x55a+4843-0x1825)),((char)(0x11f5+2066-0x19e7)),
39((char)(0x6f+7558-0x1dd5)),((char)(0x10ef+470-0x12a5)),
40((char)(0x1037+2812-0x1b12)),(0x1d2b+151-0x1da0),((char)(0x1160+2190-0x19cb)),
41(0x1e52+219-0x1f2b),((char)(0x6ac+2145-0xee8)),((char)(0x18f8+1258-0x1dbc)),
42(0x13fb+2283-0x1cbf),((char)(0x15b3+1410-0x1b0d)),((char)(0x347+7035-0x1e99)),
43((char)(0x82b+1337-0xd3a)),((char)(0x581+1980-0xd12)),((char)(0x604+1415-0xb5f))
44,((char)(0x82d+1071-0xc2f)),((char)(0x187d+3601-0x2660)),
45((char)(0x12ef+4496-0x2450)),((char)(0xbd8+6248-0x2410)),
46((char)(0x1d2a+133-0x1d7e)),((char)(0x193d+2996-0x24bf)),
47((char)(0xb7d+3699-0x19bd)),((char)(0x6e1+2613-0x10e2)),
48((char)(0x8dd+4977-0x1c19)),((char)(0xaff+4222-0x1b47)),
49((char)(0xc2a+2109-0x1430)),((char)(0xffa+4448-0x2122)),
50((char)(0x85d+1741-0xef1)),((char)(0x1012+1562-0x15f2)),
51((char)(0xb93+4357-0x1c5d)),((char)(0x21f+2441-0xb6c)),
52((char)(0x8a7+1615-0xeb9)),((char)(0xa6+5463-0x15bf)),
53((char)(0x1a2b+2006-0x21c2)),(0xdd2+2737-0x1883),((char)(0x1e2+4361-0x12aa)),
54((char)(0xb8a+2172-0x13c4)),((char)(0x5d6+8271-0x25e2)),
55((char)(0x795+6381-0x203e)),((char)(0x111d+4348-0x21d4)),
56((char)(0x1bfc+668-0x1e52)),((char)(0x1b5a+574-0x1d51)),
57((char)(0xc98+2019-0x1433)),((char)(0x1df+5472-0x16f6)),
58((char)(0x10a0+3258-0x1d10)),((char)(0x32d+6137-0x1adb)),
59((char)(0x15dc+560-0x17c0)),((char)(0x183+1641-0x79f)),
60((char)(0x291+4672-0x1483)),((char)(0xf4+6099-0x1878)),
61((char)(0x212+7110-0x1d88)),((char)(0x1352+856-0x1659)),
62((char)(0x1532+1852-0x1c1c)),((char)(0xca3+577-0xe91)),
63((char)(0xd56+3936-0x1c62)),((char)(0x112b+3355-0x1df1)),
64((char)(0xcbc+5816-0x231e)),((char)(0x3ff+2341-0xccd)),
65((char)(0x1dbf+684-0x2013)),((char)(0xa90+4252-0x1ad3)),
66((char)(0x242d+458-0x259d)),(0x231d+4987-0x1b5c),(0x2292+2641-0x11b4),
67(0x1e35+5905-0x1a08),6932,(0x15da+3068-0x21c5),((char)(0x679+2781-0x1136)),
68((char)(0x2d0+6132-0x1a63)),((char)(0x5e1+316-0x6bb)),((char)(0xdf+2026-0x866)),
69((char)(0x2fc+3749-0x113d)),((char)(0x164+1850-0x839)),
70((char)(0x145c+2838-0x1f0c)),((char)(0x1963+1887-0x205b)),
71((char)(0x16a3+526-0x1849)),((char)(0x66b+5678-0x1c30)),
72((char)(0x5d9+6593-0x1f30)),((char)(0x272+7929-0x2100)),
73((char)(0x1295+1718-0x18df)),((char)(0x719+5120-0x1aac)),
74((char)(0xb8+4168-0x1092)),((char)(0xd53+1971-0x1497)),
75((char)(0x6a0+3130-0x126a)),((char)(0x15d4+2654-0x1fc1)),
76((char)(0xa9d+1230-0xef9)),((char)(0xda+6269-0x18e4)),((char)(0xa14+459-0xb6b)),
77((char)(0x29c+168-0x2cf)),((char)(0xb1a+4418-0x1be6)),
78((char)(0x721+4214-0x1720)),((char)(0xa73+7141-0x25e0)),
79((char)(0xd28+4791-0x1f66)),((char)(0x7b9+4694-0x1995)),(0x1d7c+5347-0x1737),
80(0x1fb4+5129-0x187d),6953,(0x2306+1712-0xe79),((char)(0x72f+1004-0xafb)),
81((char)(0x467+7882-0x2311)),((char)(0x1f1c+1174-0x2392)),
82((char)(0x15d9+3826-0x24ab)),((char)(0xa5d+5388-0x1f49)),
83((char)(0xbcd+4101-0x1bb2)),((char)(0x1188+5015-0x24ff)),
84((char)(0x2261+987-0x261c)),((char)(0xd19+2999-0x18b0)),
85((char)(0xd43+6068-0x24d7)),((char)(0x5e6+8039-0x252d)),
86((char)(0xf5d+4130-0x1f5f)),((char)(0xc9f+1998-0x144d)),
87((char)(0xd17+2733-0x17a4)),((char)(0x7fa+1285-0xcdf)),
88((char)(0x1224+1229-0x16d1)),((char)(0x767+1385-0xcb0)),
89((char)(0x13d8+1440-0x1958)),((char)(0xae3+5826-0x2185)),
90((char)(0x7b8+288-0x8b8)),((char)(0x929+6220-0x2155)),
91((char)(0xf5b+3668-0x1d8f)),((char)(0xb9b+6414-0x2489)),
92((char)(0x753+7948-0x263f)),((char)(0x690+6104-0x1e48)),
93((char)(0x6c0+2866-0x11d2)),((char)(0x1146+412-0x12c2)),
94((char)(0x543+6055-0x1cca)),((char)(0x3e1+756-0x6b5)),
95((char)(0x1252+2717-0x1ccf)),((char)(0xeb5+2125-0x16e2)),
96((char)(0x1025+991-0x13e4)),((char)(0x1219+992-0x15d9)),
97((char)(0x963+6252-0x21af)),(0x17ba+534-0x1990),((char)(0x8a3+4263-0x192a)),
98(0x569+7857-0x2419),(0x3f9+3972-0x1359),(0xd18+3703-0x1b8c),
99((char)(0x487+1539-0xa6a)),(0x1550+2073-0x1d0a),((char)(0x368+5504-0x18c8)),
100((char)(0x16fc+1461-0x1c91)),((char)(0x25b+4912-0x156b)),
101((char)(0x101f+1540-0x1603)),((char)(0x528+6874-0x1fe2)),
102((char)(0x1194+4939-0x24bf)),((char)(0x117c+3790-0x202a)),
103((char)(0x9d4+6997-0x2509)),((char)(0x221+3902-0x113f)),
104((char)(0x7f1+7955-0x26e4)),((char)(0x574+4701-0x17b1)),
105((char)(0xa8+7789-0x1ef5)),((char)(0xdb9+1550-0x13a7)),
106((char)(0xd2f+6098-0x24e1)),((char)(0x1a25+2972-0x25a1)),
107((char)(0x5b4+5501-0x1b11)),(0x3c1+1921-0xb37),((char)(0x1db9+461-0x1f66)),
108((char)(0x95+9792-0x26b5)),((char)(0x8f2+1964-0x107e)),
109((char)(0x1989+466-0x1b3b)),((char)(0x1557+3380-0x226b)),
110((char)(0xc19+5250-0x207b)),(0x143+5416-0x160b),((char)(0x1c80+761-0x1f59)),
111((char)(0x1973+78-0x19a1)),((char)(0x1710+37-0x1715)),((char)(0x15d+181-0x1f2)),
112(0xa63+5237-0x1e7d),(0x9d5+3171-0x162a),(0x867+1706-0xef5),(0x162+6348-0x1a25),
113((char)(0x172b+1863-0x1e52)),(0x1d07+1873-0x2439),((char)(0x46f+5952-0x1b8f)),
114((char)(0x1be6+2304-0x24c6)),((char)(0x135f+3677-0x219c)),
115((char)(0x194+6897-0x1c65)),((char)(0x24ac+208-0x255c)),
116((char)(0x182+8480-0x2282)),((char)(0x15f8+2417-0x1f49)),(0x15c3+364-0x16d2),
117((char)(0x7c7+7600-0x2557)),((char)(0xf82+1661-0x15df)),
118((char)(0x1aa8+2881-0x25c9)),((char)(0x180+8285-0x21bd)),(0x42c+2006-0xba6),
119((char)(0x2099+1360-0x25c9)),((char)(0xb00+1538-0x10e2)),
120((char)(0xa1b+1144-0xe73)),((char)(0x206+9187-0x25c9)),
121((char)(0xdf4+6457-0x270d)),(0x501+7852-0x234f),((char)(0x49b+6441-0x1da4)),
122((char)(0x124b+3625-0x2054)),(0x1436+1395-0x198b),(0xee1+2907-0x19bd),
123((char)(0x936+3282-0x15e8)),((char)(0x15d9+812-0x18e5)),
124((char)(0x1474+4346-0x254e)),(0x1688+2996-0x21c1),(0x9b+7150-0x1c7a),
125(0xd6c+1350-0x1295),((char)(0x180+1370-0x6ba)),(0x46c+2473-0xe11),
126(0xe2d+1775-0x1517),((char)(0x301+3285-0xfb6)),((char)(0x1208+3021-0x1db5)),
127(0x1670+3685-0x24ce),((char)(0x44f+3399-0x1176)),((char)(0xbf8+2705-0x1669)),
128((char)(0x1766+1002-0x1b30)),((char)(0x7ca+7200-0x23ca)),(0x520+2182-0xd29),
129(0x2db+7680-0x20d3),((char)(0x1103+821-0x1418)),((char)(0x6eb+6306-0x1f6d)),
130((char)(0xfb7+4288-0x2057)),(0x7d6+3897-0x1693),((char)(0x53a+1656-0xb92)),
131(0x1651+1201-0x1af6),(0x215a+1432-0x26ec),((char)(0x25+6607-0x19d4)),
132((char)(0x18f+6593-0x1b30)),(0xf09+5467-0x23e6),((char)(0xb71+1639-0x11b8)),
133((char)(0x77+9415-0x251e)),((char)(0x250+1925-0x9b5)),};const unsigned short
134zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[][(0x19fc+1312-0x1f1a)]={{
135(0x474+2098-0xc9d),(0x10d8+5061-0x23b6)},{(0xedc+766-0x11d0),(0x482+7307-0x2101)
136},{(0x18fd+3084-0x24fc),(0x697+6277-0x1f0f)},{(0xc39+4122-0x1c3f),
137(0xc31+4109-0x1be0)},{(0x178d+2903-0x22bc),(0x10ca+5220-0x24b3)},{
138(0x349+5427-0x1853),(0x288+3391-0xf4a)},{(0x4a4+7724-0x22a1),
139(0x160f+1496-0x1b8b)},{(0x1cc+3384-0xec8),(0x129b+2407-0x1ba7)},{
140(0xe93+1681-0x14e7),(0x87b+978-0xbcf)},{(0xe5a+5541-0x23c1),(0xbaa+1814-0x1263)}
141,{(0x1823+3460-0x2567),(0x9e8+3312-0x165c)},{(0x6d8+4657-0x18c8),
142(0x9ca+331-0xa54)},{(0x2d1+7536-0x1ff8),(0x4e8+4081-0x140c)},{
143(0x6f0+7156-0x2295),(0x131f+1436-0x17e8)},{(0x39b+1702-0x9ec),(0x4a2+3047-0xfaf)
144},{(0x9fb+3555-0x177d),(0xbf5+4588-0x1d00)},{(0x5cd+4602-0x1762),8364},{
145(0x52d+5888-0x1bc4),(0x6fa+5944-0x1d45)},{(0xae9+6671-0x2489),(0x24c3+70-0x2416)
146},{(0x1396+4355-0x2424),(0x1055+5442-0x249d)},};const unsigned short
147Ucs2_To_Gsm7_SPANISH_Table_UCS[][(0xc92+1124-0x10f4)]={{(0x18c4+70-0x18fa),
148(0x17b5+170-0x14cb)},{(0xcea+4796-0x1f94),(0x1c1f+134-0x18ff)},{
149(0x110d+2733-0x1ba7),(0x17dc+1109-0x189e)},{(0xa56+4763-0x1cdd),
150(0xde9+1582-0x107c)},{(0x1954+2305-0x2240),(0x20b7+1030-0x2114)},{
151(0x1557+1451-0x1aec),(0x182c+706-0x174e)},{(0x1cf9+2077-0x24ff),
152(0x15fa+2656-0x1cb2)},{(0x131a+1741-0x19cf),(0x7d2+6929-0x1f40)},{
153(0xef+1490-0x6a8),(0x510+8558-0x22e6)},{(0x192d+1204-0x1dc7),(0x1a14+307-0x17a9)
154},};const unsigned char Ucs2_To_Gsm7_SPANISH_Table_ASC[]={NON_GSM,NON_GSM,
155NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
156(0xf86+1667-0x15ff),NON_GSM,NON_GSM,(0x23bd+135-0x2437),NON_GSM,NON_GSM,NON_GSM,
157NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
158NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x23a+3390-0xf58),(0x18b+7314-0x1dfc),
159(0x837+180-0x8c9),(0x14bc+688-0x1749),(0x1146+2696-0x1bcc),(0x1361+1178-0x17d6),
160(0x3d1+300-0x4d7),(0x6ed+6216-0x1f0e),(0xdf7+6054-0x2575),(0x748+5629-0x1d1c),
161(0xb32+7135-0x26e7),(0x101d+3881-0x1f1b),(0xa46+3868-0x1936),(0xe25+5719-0x244f)
162,(0xc95+6133-0x245c),(0x4b7+235-0x573),(0x424+6010-0x1b6e),(0x44b+4142-0x1448),
163(0x56+6951-0x1b4b),(0xe9a+5139-0x227a),(0x1e1d+1258-0x22d3),(0x7ed+1983-0xf77),
164(0x1c4a+2679-0x268b),(0xa01+6446-0x22f8),(0x1b66+309-0x1c63),(0x4b5+6499-0x1ddf)
165,(0x9b+686-0x30f),(0x6e8+6548-0x2041),(0x1897+940-0x1c07),(0xab6+75-0xac4),
166(0xd81+4006-0x1ce9),(0x10d9+5284-0x253e),(0x8d2+1349-0xe17),(0xb93+4461-0x1cbf),
167(0x9b0+3216-0x15fe),(0x15bd+3332-0x227e),(0x917+6757-0x2338),
168(0x1013+3634-0x1e00),(0x5f0+1855-0xce9),(0x52+1497-0x5e4),(0x9b6+7300-0x25f2),
169(0xd1a+3398-0x1a17),(0x1413+1431-0x1960),(0x1471+2839-0x1f3d),
170(0xb35+5853-0x21c6),(0xc6f+3611-0x1a3d),(0x1b65+2643-0x256a),
171(0x1749+2259-0x1fcd),(0x60+2860-0xb3c),(0x13a3+902-0x16d8),(0x998+5321-0x1e0f),
172(0xe26+5135-0x21e2),(0x3e2+4665-0x15c7),(0x1325+4328-0x23b8),(0xcbd+6512-0x25d7)
173,(0x1fc0+1624-0x25c1),(0x1cb+1205-0x628),(0xf62+6028-0x2695),(0x9a3+3470-0x16d7)
174,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x4bc+4549-0x1670),NON_GSM,(0xe7c+815-0x114a),
175(0x1ccc+2485-0x261f),(0x479+5337-0x18ef),(0x910+3655-0x16f3),(0xdb3+4829-0x202b)
176,(0x20a0+230-0x2120),(0xe0b+3132-0x19e0),(0x1b58+2569-0x24f9),
177(0xf81+4394-0x2042),(0x1b23+2622-0x24f7),(0x5c5+3958-0x14d0),
178(0x16e8+2902-0x21d2),(0x4f7+8328-0x2512),(0x143a+4229-0x2451),
179(0x9ba+4944-0x1c9b),(0x1028+922-0x1352),(0x603+1124-0x9f6),(0x3ba+6040-0x1ae0),
180(0x465+2999-0xfa9),(0x988+4109-0x1921),(0x465+2820-0xef4),(0x1af+2322-0xa4b),
181(0x17d9+3717-0x25e7),(0x2301+825-0x25c2),(0x1354+2322-0x1bed),
182(0x1acf+1890-0x21b7),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
183NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
184NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
185NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
186(0x74d+285-0x84f),(0x14c+707-0x3cf),NON_GSM,(0x148d+4354-0x258e),
187(0x218a+1117-0x25c3),(0x9a5+1876-0x10f6),NON_GSM,(0x723+3425-0x1425),NON_GSM,
188NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
189NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
190NON_GSM,NON_GSM,(0x658+6484-0x1f4c),NON_GSM,NON_GSM,NON_GSM,NON_GSM,
191(0x1f3+9350-0x261e),(0x6a0+2209-0xf33),(0x14b+4361-0x1238),(0x4c+1122-0x4a5),
192NON_GSM,(0x1d72+1034-0x215d),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
193NON_GSM,(0x4b6+1717-0xb0e),NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xaf9+6173-0x22ba),
194NON_GSM,(0x18c1+412-0x1a52),NON_GSM,NON_GSM,NON_GSM,(0x1118+4577-0x229b),NON_GSM
195,NON_GSM,(0x169+3534-0xf19),(0x4db+6988-0x1fa8),NON_GSM,NON_GSM,NON_GSM,
196(0xd76+4568-0x1ed3),(0x1350+4604-0x253d),(0x1a6+4466-0x12fb),NON_GSM,
197(0x19+9775-0x2644),(0xe3b+1307-0x1351),NON_GSM,NON_GSM,(0x4c9+7910-0x23a8),
198NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x4b4+4391-0x155e),(0x13bc+2405-0x1d19),NON_GSM
199,NON_GSM,NON_GSM,(0x347+4768-0x156b),NON_GSM,(0x9a+8173-0x207b),
200(0x1bd+2281-0xaa0),NON_GSM,NON_GSM,(0x1962+193-0x19a5),NON_GSM,NON_GSM,NON_GSM};
201const unsigned short zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[][
202(0x452+8009-0x2399)]={{(0x1437+2965-0x1fc7),(0x909+1536-0xe1f)},{
203(0x271+902-0x5ee),(0xaaf+873-0xd31)},{(0x141+8379-0x21f2),(0x1a7+2825-0xca4)},{
204(0x4e3+86-0x52e),(0xe9a+3844-0x1cca)},{(0x189a+1021-0x1c8b),(0xf65+5318-0x2337)}
205,{(0x1570+2326-0x1e79),(0xdc8+1603-0x13fe)},{(0xf50+1988-0x1706),
206(0x75c+2114-0xedd)},{(0xc04+3880-0x1b1d),(0xa45+476-0xb40)},{(0x494+8304-0x24f2)
207,(0x1621+3946-0x21e5)},{(0x1830+1943-0x1fb4),(0x99a+2726-0x10ad)},{
208(0x208f+489-0x2264),(0x6b1+313-0x78c)},{(0x1cf5+1997-0x24ad),(0xf47+399-0xd2d)},
209{(0x780+3921-0x16bb),(0x88c+6319-0x1d9b)},{(0x13bb+2444-0x1d30),
210(0x125a+1836-0x15de)},{(0x865+7056-0x23dd),(0x8f1+5780-0x1be2)},{
211(0xe02+4687-0x2038),(0x1fcc+1113-0x208d)},{(0x143+9226-0x252e),
212(0xd01+1285-0x113c)},{(0xd4c+5482-0x228e),(0x19cb+2583-0x2367)},{
213(0x601+4864-0x18d8),(0x619+6775-0x2013)},{(0x1686+1732-0x1d1b),
214(0xd92+6035-0x24c9)},{(0x67b+6644-0x2033),(0x18b+651-0x3bb)},{
215(0x67a+2881-0x117e),(0x753+4652-0x1901)},{(0xd4+4469-0x120b),
216(0x17a5+1079-0x1b7f)},{(0x1241+1997-0x19ce),(0x9aa+7523-0x2691)},{
217(0x18f+4497-0x12df),(0x15a4+3477-0x2279)},{(0x2464+458-0x25e5),
218(0x122c+3772-0x201b)},{(0xd00+893-0x102e),(0x1486+4631-0x25ca)},{
219(0x48d+933-0x7dd),(0x1d4a+1588-0x22a4)},{(0x7b4+5369-0x1c52),
220(0x118d+3074-0x1ccc)},{(0x376+6097-0x1aeb),(0xda8+4065-0x1cb4)},{
221(0xb85+2791-0x160b),(0x39a+6842-0x1d92)},{(0x154d+4619-0x26f3),8364},{
222(0xf86+3432-0x1c85),(0xc58+2842-0x1685)},{(0xebd+2941-0x19cb),(0xd20+184-0xce5)}
223,{(0x109a+5292-0x24d1),(0x1616+3501-0x22c9)},{(0xe5a+403-0xf72),
224(0xa3c+4285-0x1a16)},{(0xe77+24-0xe13),(0x12d4+3117-0x1e0c)},{(0x606+1088-0x9c7)
225,(0xc52+2656-0x15d0)},};const unsigned short Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[]
226[(0x10ef+3025-0x1cbe)]={{(0x241b+641-0x268c),(0x158d+1573-0x181e)},{
227(0x736+2214-0xfc7),8929},{(0x10e1+3472-0x1e59),8364},{(0xb91+6247-0x2393),
228(0x24ed+6063-0x1bf0)},};const unsigned char Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[]=
229{NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM
230,(0x87c+1075-0xca5),NON_GSM,NON_GSM,(0x19c9+807-0x1ce3),NON_GSM,NON_GSM,NON_GSM,
231NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
232NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xcaf+5746-0x2301),(0x1771+922-0x1aea),
233(0x643+7351-0x22d8),(0x1a14+1868-0x213d),(0xc1f+3912-0x1b65),(0x94+3808-0xf4f),
234(0x1fb9+759-0x228a),(0x23a+7757-0x2060),(0xaf5+2167-0x1344),(0x148a+763-0x175c),
235(0x191d+2029-0x20e0),(0x7f4+5302-0x1c7f),(0x132b+1148-0x177b),
236(0x1744+1193-0x1bc0),(0xebd+4331-0x1f7a),(0xec5+3021-0x1a63),(0xa6b+5996-0x21a7)
237,(0x1697+3046-0x224c),(0x809+2381-0x1124),(0x1176+85-0x1198),(0x5bf+4610-0x178d)
238,(0x11f7+3961-0x213b),(0x1ce1+1006-0x2099),(0x1c5+8807-0x23f5),
239(0x9a8+3224-0x1608),(0x7d3+970-0xb64),(0x9ea+3941-0x1915),(0x1431+2923-0x1f61),
240(0x15ab+589-0x17bc),(0x925+4600-0x1ae0),(0xfad+3134-0x1bad),(0x7fb+7142-0x23a2),
241(0xabd+1849-0x11f6),(0x4a8+97-0x4c8),(0x1bfa+2852-0x26dc),(0x5c5+6290-0x1e14),
242(0x15f+2467-0xabe),(0x1cc4+2068-0x2493),(0xa0c+334-0xb14),(0xc3+1645-0x6e9),
243(0x21d+6131-0x19c8),(0xa74+5369-0x1f24),(0xaa3+5627-0x2054),(0x9e7+841-0xce5),
244(0x400+5158-0x17da),(0x909+4443-0x1a17),(0xd34+5748-0x235a),(0x438+2470-0xd8f),
245(0x86a+4871-0x1b21),(0x8f9+5148-0x1cc4),(0x4ef+5409-0x19be),(0x1f6a+165-0x1fbc),
246(0x251+7606-0x1fb3),(0x398+9041-0x2694),(0x6a6+3608-0x1468),(0x1b1c+2889-0x260e)
247,(0xd41+1406-0x1267),(0x12d+7031-0x1c4b),(0x7cd+5512-0x1cfb),NON_GSM,
248(0x12ca+5145-0x26cc),NON_GSM,(0x220+3394-0xf4c),(0xfe4+5087-0x23b2),
249(0xb8a+4015-0x1abc),(0x10da+2471-0x1a20),(0xa7a+1793-0x1119),(0x244+2311-0xae8),
250(0x141a+4792-0x266e),(0x6c2+6816-0x20fd),(0x282+6427-0x1b37),(0x382+1768-0xa03),
251(0x61f+8125-0x2574),(0x284+3519-0xfda),(0x2032+1389-0x2535),(0xc51+3099-0x1801),
252(0x109c+5749-0x26a5),(0xea+3541-0xe52),(0xae0+4070-0x1a58),(0x1ef8+1759-0x2568),
253(0x15da+867-0x18cd),(0x1bc9+2479-0x2507),(0x30f+7974-0x21c3),
254(0x1119+1496-0x167e),(0x80d+3599-0x15a8),(0x103c+5905-0x26d8),
255(0xd25+3174-0x1915),(0x77c+665-0x99e),(0x1759+266-0x17eb),(0xedc+4392-0x1f8b),
256(0x12ff+5184-0x26c5),NON_GSM,(0x1b6f+2576-0x2565),NON_GSM,(0x6a5+609-0x8a6),
257NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
258NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
259NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
260NON_GSM,NON_GSM,NON_GSM,(0x5bc+935-0x948),NON_GSM_P,NON_GSM,(0xf35+794-0x124e),
261NON_GSM_P,(0xf85+3451-0x1cfd),NON_GSM,(0x1b08+708-0x1d6d),NON_GSM,NON_GSM,
262(0x1b3b+1682-0x21bb),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x51d+3422-0x1257)
263,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM
264,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x503+1041-0x900),(0x4b+5586-0x160f),
265(0x619+4911-0x192c),(0x1ebc+427-0x200c),NON_GSM_P,NON_GSM_P,NON_GSM_P,
266(0x1a+5621-0x15fc),NON_GSM,(0x1509+2311-0x1df1),(0x1004+2655-0x1a45),NON_GSM,
267NON_GSM,(0x13fd+1550-0x19cb),NON_GSM,NON_GSM,NON_GSM,NON_GSM_P,NON_GSM,
268(0x1950+2184-0x21bf),(0x1e12+929-0x21a8),(0x149c+3736-0x22d8),NON_GSM_P,NON_GSM,
269NON_GSM_P,NON_GSM,(0xf42+61-0xf22),NON_GSM,(0xf74+4101-0x1f1b),NON_GSM,NON_GSM,
270NON_GSM_P,(0x1bd4+2896-0x26a5),(0x13ea+2709-0x1e70),(0x206+2908-0xd45),
271(0x1a69+2954-0x2578),NON_GSM_P,NON_GSM_P,NON_GSM_P,(0x1508+1767-0x1be6),
272NON_GSM_P,(0x299+5476-0x17f8),(0xf35+1156-0x13b5),NON_GSM,NON_GSM_P,
273(0x8b3+5689-0x1ee5),NON_GSM,NON_GSM,NON_GSM,NON_GSM_P,NON_GSM_P,
274(0x1305+1530-0x18f7),(0x56b+7569-0x22f0),(0x1202+3435-0x1ef1),NON_GSM_P,NON_GSM,
275NON_GSM_P,NON_GSM_P,(0x195+9444-0x2673),NON_GSM,(0x14b1+3600-0x2243),NON_GSM,
276NON_GSM,NON_GSM};const unsigned short zte_sms_GSMDefault_To_UCS2_Table_Ex[][
277(0x1d63+1467-0x231c)]={{(0x12f8+165-0x1393),(0x936+6287-0x21b9)},{
278(0x1318+2143-0x1b63),(0x2350+136-0x237a)},{(0xeca+3915-0x1ded),
279(0x193d+3634-0x26f4)},{(0x7dd+7067-0x234f),(0xb34+1980-0x1273)},{
280(0x130+9587-0x2674),(0xc3+7671-0x1e5e)},{(0x454+6292-0x1cac),(0x177+4399-0x124b)
281},{(0xdd4+599-0xfee),(0xf3+2838-0xb8b)},{(0x22e5+160-0x2347),(0x5cf+2913-0x10d3)
282},{(0x80b+1673-0xe54),(0x11e9+922-0x1507)},{(0xcf5+2789-0x1775),
283(0x245f+5948-0x1aef)},};const unsigned short UCS2_To_GSMDefault_Table_UCS2[][
284(0x129+1822-0x845)]={{(0x327+5735-0x197e),(0x1f68+1741-0x22a1)},{
285(0xbcf+124-0xc39),(0xdc2+765-0xd19)},{(0x96c+1217-0xe1a),(0xc37+561-0xad5)},{
286(0x1b3c+1168-0x1fb8),(0x121f+5548-0x2430)},{(0x1094+2671-0x1aee),
287(0x958+967-0x976)},{(0x269+8432-0x2343),(0xa70+7668-0x24c4)},{
288(0xb68+1820-0x126d),(0xb48+2604-0x11cc)},{(0x6c5+8146-0x267f),
289(0x3dd+9169-0x240b)},{(0x53c+8659-0x26f6),(0x9f6+1946-0xdf8)},{
290(0xaed+4740-0x1d57),(0x3c8+3987-0xfbd)},};const unsigned char
291UCS2_To_GSMDefault_Table_ASC[]={NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
292NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xeb6+1409-0x142d),NON_GSM,NON_GSM,
293(0xb7+1894-0x810),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
294NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
295NON_GSM,(0x38d+6073-0x1b26),(0x23f0+176-0x247f),(0x1833+3397-0x2556),
296(0x243d+56-0x2452),(0x16a8+3865-0x25bf),(0x1857+3611-0x264d),(0x667+6756-0x20a5)
297,(0x1362+4314-0x2415),(0x1a4b+2228-0x22d7),(0x7bb+5537-0x1d33),(0x4fd+309-0x608)
298,(0x3ea+4773-0x1664),(0x1042+2517-0x19eb),(0x112f+4887-0x2419),
299(0x726+5014-0x1a8e),(0x1223+143-0x1283),(0x1d7+4439-0x12fe),(0x962+5489-0x1ea2),
300(0x13d+6150-0x1911),(0xbc8+6103-0x236c),(0x3bc+5821-0x1a45),(0x21ef+134-0x2240),
301(0x4e6+1338-0x9ea),(0x1d7+7509-0x1ef5),(0x100c+3047-0x1bbb),(0x1434+4172-0x2447)
302,(0xfc+2578-0xad4),(0xaf2+6772-0x252b),(0xa4b+1981-0x11cc),(0x6fc+2883-0x1202),
303(0xd8b+2735-0x17fc),(0x1236+1092-0x163b),(0x763+5048-0x1b1b),(0xcad+5614-0x225a)
304,(0x1e87+688-0x20f5),(0x204d+879-0x2379),(0xa73+577-0xc70),(0x95f+1338-0xe54),
305(0x987+7577-0x26da),(0xff4+4035-0x1f70),(0x21b+3956-0x1147),(0x163c+2442-0x1f7d)
306,(0x705+3359-0x13da),(0xc2f+2299-0x14df),(0x1609+850-0x190f),(0x759+6585-0x20c5)
307,(0x736+6049-0x1e89),(0xdab+2789-0x1841),(0xac4+4221-0x1af1),(0x7f8+2990-0x1355)
308,(0xce3+638-0xf0f),(0x122b+327-0x131f),(0x16b6+3254-0x2318),(0x3c4+84-0x3c3),
309(0x11a6+3696-0x1fc0),(0x98c+2974-0x14d3),(0x8a8+985-0xc29),(0x6ba+396-0x7ed),
310(0x22f2+389-0x241d),NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xd3a+5534-0x22c7),NON_GSM,
311(0x18b+4685-0x1377),(0xb98+3382-0x186c),(0x45c+305-0x52a),(0x615+8057-0x252a),
312(0xcbb+2056-0x145e),(0x15f8+3724-0x241e),(0x1086+5186-0x2461),
313(0xe31+1351-0x1310),(0x346+2805-0xdd2),(0x113d+2230-0x1989),(0x20b+8310-0x2216),
314(0x262+1686-0x88c),(0x707+2346-0xfc4),(0x1c06+572-0x1dd4),(0x23e0+570-0x25ab),
315(0x2a1+1943-0x9c8),(0xa12+1016-0xd99),(0x294+5615-0x1811),(0x2ad+7734-0x2070),
316(0x112c+5550-0x2666),(0xdda+1317-0x128a),(0x1074+345-0x1157),
317(0x176b+3258-0x23ae),(0x219d+354-0x2287),(0x1008+4845-0x227c),
318(0xb11+2983-0x163e),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
319NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
320NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
321NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
322(0x1d7d+2222-0x2610),(0x173f+1211-0x1bba),NON_GSM,(0x10d4+1169-0x1564),
323(0x45b+1102-0x885),(0x8e6+2459-0x127e),NON_GSM,(0x1013+3428-0x1d18),NON_GSM,
324NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
325NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
326NON_GSM,NON_GSM,(0x29a+6141-0x1a37),NON_GSM,NON_GSM,NON_GSM,NON_GSM,
327(0x136+2421-0xa50),(0x41b+2613-0xe42),(0x1e83+678-0x210d),(0x76+568-0x2a5),
328NON_GSM,(0xe5b+3525-0x1c01),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
329NON_GSM,(0x17ca+3640-0x25a5),NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x983+5307-0x1de2)
330,NON_GSM,(0x7c6+3002-0x1375),NON_GSM,NON_GSM,NON_GSM,(0xb2a+3660-0x1918),NON_GSM
331,NON_GSM,(0xd95+3959-0x1cee),(0xf8c+5274-0x23a7),NON_GSM,NON_GSM,NON_GSM,
332(0x1268+3827-0x20e0),(0x1b1+7236-0x1de6),(0x9b0+5258-0x1e1d),NON_GSM,
333(0xedd+1506-0x14bb),(0x5da+4344-0x16cd),NON_GSM,NON_GSM,(0xe42+2076-0x1657),
334NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x148+7972-0x1fef),(0x4d5+1496-0xaa5),NON_GSM,
335NON_GSM,NON_GSM,(0x1e98+247-0x1f13),NON_GSM,(0x93d+1326-0xe5f),
336(0x494+7914-0x2378),NON_GSM,NON_GSM,(0xc2c+5402-0x20c8),NON_GSM,NON_GSM,NON_GSM}
337;const unsigned short zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[]={
338(0x15d+9062-0x2483),(0x1b79+1262-0x1fc4),(0x1dec+1805-0x24d5),
339(0x89c+5804-0x1ea3),(0x2ec+8791-0x2459),(0x10e0+679-0x129e),(0x100f+2157-0x1782)
340,(0x708+8052-0x258f),(0x180a+3971-0x269a),(0x43b+3363-0x1077),
341(0x543+7911-0x2420),(0x8e7+5360-0x1d03),(0x1d0a+2229-0x24cb),(0xc82+2356-0x15a9)
342,(0x12e2+5010-0x25b3),(0x1eb8+1728-0x2497),(0x1799+4304-0x24d5),
343(0x394+2243-0xbf8),(0xc6+6197-0x1851),(0x146+8292-0x20e3),(0x9c5+1972-0x10b9),
3448734,(0x1160+2681-0x1b7b),(0x2ca+1491-0x841),(0x246c+3505-0x1171),
345(0x7a0+5670-0x1cf3),(0x64f+5412-0x1af7),(0x129+8291-0x20ec),(0x3af+2193-0xb7e),
346(0x22b1+964-0x2593),(0x487+565-0x5f2),(0xe6c+1992-0x156b),(0x38d+7610-0x2127),
347(0x12d3+573-0x14ef),(0x20cb+1249-0x258a),(0x34a+1754-0xa01),(0x1130+2137-0x18d9)
348,(0x1560+2456-0x1ed3),(0x211+9140-0x259f),(0x607+4562-0x17b2),
349(0x18a7+713-0x1b48),(0x166c+15-0x1652),(0x16f2+3084-0x22d4),(0x291+5748-0x18da),
350(0x153b+1924-0x1c93),(0xe31+5682-0x2436),(0xf6b+1907-0x16b0),(0x872+2093-0x1070)
351,(0x1101+1809-0x17e2),(0xf08+728-0x11af),(0x5f+7052-0x1bb9),(0x1f55+1262-0x2410)
352,(0x20d+1200-0x689),(0x136d+1341-0x1875),(0x1cf1+868-0x201f),
353(0x1365+1301-0x1843),(0x593+712-0x823),(0x76b+726-0xa08),(0x166f+3917-0x2582),
354(0x510+6287-0x1d64),(0x1c57+763-0x1f16),(0x3af+2227-0xc25),(0x612+1053-0x9f1),
355(0xca3+6240-0x24c4),(0x167+1589-0x6cf),(0x176+549-0x35a),(0x1515+1782-0x1bc9),
356(0x2209+1160-0x264e),(0x375+4076-0x131d),(0x1ee4+1874-0x25f1),
357(0xf43+4901-0x2222),(0x13c3+1678-0x1a0a),(0x3aa+7789-0x21cf),
358(0x1154+3691-0x1f76),(0x160d+3834-0x24bd),(0x88+5875-0x1730),(0x749+5966-0x1e4b)
359,(0x870+355-0x986),(0x20e1+104-0x20fb),(0xe06+152-0xe4f),(0x2206+1072-0x25e6),
360(0x1a57+21-0x1a1b),(0x11b8+3206-0x1dec),(0x543+632-0x768),(0x12e8+5111-0x268b),
361(0x38b+50-0x368),(0x8dd+5044-0x1c3b),(0x1846+3015-0x23b6),(0xa17+7170-0x25c1),
362(0x7dc+4271-0x1832),(0xd52+971-0x10c3),(0x2cb+2912-0xd68),(0x2060+927-0x232a),
363(0x11a5+21-0x10e0),(0xa05+2363-0x1264),(0x1164+394-0x1247),(0x909+2879-0x13ca),
364(0x619+3711-0x1437),(0x3f7+8013-0x22e2),(0x17c+6823-0x1bc0),(0xdd5+3792-0x1c41),
365(0x14dd+2311-0x1d7f),(0x3c1+2724-0xdff),(0x18b5+2770-0x2320),(0x2a3+243-0x32e),
366(0x127+2787-0xba1),(0x289+4773-0x14c4),(0x626+5477-0x1b20),(0x1ca5+2534-0x261f),
367(0x1a6b+1521-0x1fef),(0x20c+8336-0x222e),(0x20ff+1028-0x2494),
368(0x17e2+2050-0x1f74),(0x4f9+3926-0x13de),(0x1945+2137-0x212c),
369(0xa20+7163-0x25a8),(0x43c+6074-0x1b82),(0x17f5+1152-0x1c00),(0x2e8+77-0x2bf),
370(0x747+8107-0x267b),(0x7af+5909-0x1e4c),(0x13c0+4904-0x266f),(0x2384+424-0x24b2)
371,(0x71f+3735-0x14d3),(0x2195+1344-0x25e0),(0xada+5736-0x20e2),
372(0x5e7+8678-0x26d1),(0xf2f+1933-0x15dc)};const unsigned short
373zte_sms_GSMDefault_To_UCS2_Table[]={(0xe36+1629-0x1453),(0x1757+209-0x1785),
374(0xa84+4970-0x1dca),(0xc4+5219-0x1482),(0x1298+2434-0x1b32),(0x393+7847-0x2151),
375(0x16d1+3989-0x256d),(0x1457+2326-0x1c81),(0x597+3862-0x13bb),
376(0x3ca+4651-0x152e),(0x7d6+6131-0x1fbf),(0x2179+1094-0x24e7),(0x1150+522-0x1262)
377,(0xb29+6713-0x2555),(0xb25+489-0xc49),(0xd89+5487-0x2213),(0x17a3+423-0x15b6),
378(0x3c7+810-0x692),(0xa6c+4534-0x187c),(0x1645+985-0x168b),(0x120d+2864-0x19a2),
379(0x1e09+1303-0x1f77),(0x1233+5216-0x22f3),(0x1e86+2086-0x2304),
380(0x186d+2668-0x1f36),(0x1e28+1863-0x21d7),(0x1441+3008-0x1c63),
381(0xa3+5211-0x145e),(0x1b50+1984-0x224a),(0x2af+8090-0x2163),(0x18d3+601-0x1a4d),
382(0x282+6351-0x1a88),(0x759+4391-0x1860),(0x93d+1547-0xf27),(0x696+907-0x9ff),
383(0x926+6093-0x20d0),(0x12df+4763-0x24d6),(0x171+3662-0xf9a),(0x98c+31-0x985),
384(0x321+6398-0x1bf8),(0x5ba+147-0x625),(0xa9b+1420-0xffe),(0x5c1+7042-0x2119),
385(0x1079+2439-0x19d5),(0x1bdd+1796-0x22b5),(0x604+1053-0x9f4),
386(0x16e5+2802-0x21a9),(0xe5c+3865-0x1d46),(0x232+1541-0x807),(0xbe1+4368-0x1cc0),
387(0x133d+560-0x153b),(0x481+6651-0x1e49),(0x213a+937-0x24af),(0x193c+1000-0x1cef)
388,(0x139b+3044-0x1f49),(0x1215+2253-0x1aab),(0xec6+2053-0x1693),
389(0x943+3515-0x16c5),(0x6df+3385-0x13de),(0xe10+5226-0x223f),(0x723+3887-0x1616),
390(0x11b5+3279-0x1e47),(0x134f+1287-0x1818),(0x1f49+1173-0x239f),
391(0x17db+3245-0x23e7),(0x1988+346-0x1aa1),(0xb3a+6176-0x2318),
392(0x1074+4847-0x2320),(0x1e84+1689-0x24d9),(0x5cf+688-0x83a),(0x699+2550-0x1049),
393(0xe1+7276-0x1d06),(0x6c0+6298-0x1f12),(0x378+8506-0x2469),(0x1bd0+2465-0x2527),
394(0x1bc+9269-0x25a6),(0xc36+3729-0x1a7b),(0x1bed+1337-0x20d9),(0x7d0+1373-0xcdf),
395(0x16bf+3337-0x2379),(0xcc5+1509-0x125a),(0x7a3+6556-0x20ee),
396(0x1af0+3174-0x2704),(0x1806+48-0x17e3),(0x1b8d+2025-0x2322),
397(0x12ca+4514-0x2417),(0x674+6241-0x1e7f),(0x1106+4854-0x23a5),
398(0x1626+2149-0x1e33),(0x314+7696-0x20cb),(0x556+3456-0x127c),(0x23c7+454-0x24c9)
399,(0x20bc+933-0x238b),(0x13d5+5123-0x2707),(0x1aa0+1139-0x1e37),
400(0xeb+8170-0x202e),(0xaf9+3203-0x16bd),(0x1c5a+1887-0x2358),(0x9a6+5288-0x1dec),
401(0x7e6+2241-0x1044),(0x11dd+246-0x126f),(0x8df+4896-0x1b9a),(0x1d4f+1504-0x22c9)
402,(0x124+7687-0x1ec4),(0x12ac+3789-0x2111),(0x926+6721-0x22fe),
403(0x1210+4474-0x2320),(0x17d9+2599-0x2195),(0x20d+7910-0x2087),
404(0x165b+3432-0x2356),(0x271+381-0x380),(0x95d+2511-0x12bd),(0xa20+5110-0x1da6),
405(0x626+6554-0x1f4f),(0x101a+3869-0x1ec5),(0x649+4737-0x1857),(0xbfb+6055-0x232e)
406,(0x1500+2417-0x1dfc),(0x1265+3887-0x211e),(0x1621+2140-0x1e06),
407(0x3c8+5443-0x1893),(0x10ab+3179-0x1c9d),(0x17c+1101-0x54f),(0x2a0+2682-0xc36),
408(0x1f53+1991-0x2624),(0x14c9+3298-0x20ba),(0xc43+3257-0x1800),
409(0x500+6810-0x1eba)};int Bytes2String(const unsigned char*pSrc,char*pDst,int
410nSrcLength){const char tab[]="0123456789ABCDEF";int i=(0x952+6293-0x21e7);if(
411pSrc==NULL||pDst==NULL||nSrcLength<(0x134f+609-0x15b0)){return-
412(0xdbb+985-0x1193);}for(i=(0x1683+2809-0x217c);i<nSrcLength;i++){*pDst++=tab[*
413pSrc>>(0x1016+3045-0x1bf7)];*pDst++=tab[*pSrc&(0x1671+2637-0x20af)];pSrc++;}*
414pDst='\0';return nSrcLength*(0x8ef+7178-0x24f7);}int String2Bytes(const char*
415pSrc,unsigned char*pDst,int nSrcLength){int i=(0xaf1+3835-0x19ec);if(pSrc==NULL
416||pDst==NULL||nSrcLength<(0x65a+6771-0x20cd)){return-(0x84d+1945-0xfe5);}for(i=
417(0xc64+6487-0x25bb);i<nSrcLength;i+=(0xc24+4373-0x1d37)){if(*pSrc>=
418((char)(0x1112+4523-0x228d))&&*pSrc<=((char)(0x1498+4736-0x26df))){*pDst=(*pSrc-
419((char)(0xe2f+2083-0x1622)))<<(0x6d+4342-0x115f);}else{*pDst=((toupper(*pSrc)-
420((char)(0x1d83+795-0x205d)))+(0x2cc+5104-0x16b2))<<(0x104+6478-0x1a4e);}pSrc++;
421if(*pSrc>=((char)(0xea1+61-0xeae))&&*pSrc<=((char)(0x6ec+2861-0x11e0))){*pDst|=*
422pSrc-((char)(0x1066+2350-0x1964));}else{*pDst|=(toupper(*pSrc)-
423((char)(0x1a7+4219-0x11e1)))+(0xd4f+5753-0x23be);}pSrc++;pDst++;}return
424nSrcLength/(0x97+9082-0x240f);}int EncodeUcs2(const char*pSrc,unsigned char*pDst
425,int nSrcLength){if(pSrc==NULL||pDst==NULL||nSrcLength<(0x94a+4240-0x19da)){
426return-(0x9d+9061-0x2401);}(void)String2Bytes(pSrc,pDst,(int)nSrcLength);return
427nSrcLength/(0xe2d+3542-0x1c01);}int Encode7bit(const char*pSrc,unsigned char*
428pDst,int nSrcLength){int nSrc;int nDst;int nChar;unsigned char nLeft=
429(0x9e8+1598-0x1026);if(pSrc==NULL||pDst==NULL||nSrcLength<(0x6eb+72-0x733)){
430return-(0x1423+3603-0x2235);}nSrc=(0x11f5+4977-0x2566);nDst=(0x854+3009-0x1415);
431while(nSrc<nSrcLength){nChar=nSrc&(0x22d8+278-0x23e7);if(nChar==
432(0x810+6416-0x2120)){nLeft=*pSrc;if((g_zUfiSms_ConcatSms.total_msg>
433(0x1b8+3791-0x1086))&&(nSrc==(nSrcLength-(0xe13+5348-0x22f6)))){nDst++;}}else{*
434pDst=(*pSrc<<((0x94f+2946-0x14c9)-nChar))|nLeft;nLeft=*pSrc>>nChar;pDst++;nDst++
435;}pSrc++;nSrc++;}return nDst;}SINT32 zUfiSms_EncodePdu_DeliverReport(CHAR*pDst,
436UINT8 TP_FCS){SINT32 nLength=(0x22c+6102-0x1a02);SINT32 nDstLength=
437(0x11a3+3187-0x1e16);UINT8 buf[(0xb7a+4419-0x1bbd)]={(0xda5+4913-0x20d6)};if(
438NULL==pDst){return-(0x1356+3917-0x22a2);}if(TP_FCS!=(0x674+3993-0x160d)){buf[
439(0x70b+8067-0x268e)]=(0x3a7+8747-0x25d2);buf[(0x113+3111-0xd39)]=TP_FCS;buf[
440(0x15d2+3479-0x2367)]=(0x1482+2649-0x1edb);nDstLength+=Bytes2String(buf,&pDst[
441nDstLength],(0x1751+4008-0x26f6));}else{buf[(0x1929+1873-0x207a)]=
442(0xa00+3161-0x1659);buf[(0x189+9340-0x2604)]=(0x457+7912-0x233f);nDstLength+=
443Bytes2String(buf,&pDst[nDstLength],(0x1212+904-0x1598));}return nDstLength;}
444unsigned long zUfiSms_ConvertAsciiToGsmDefault(const unsigned char*inputs,
445unsigned char*outputs,unsigned long len){unsigned long i=(0x7fd+446-0x9bb);
446unsigned long j=(0xd34+4016-0x1ce4);unsigned long k=(0x18b9+2773-0x238e);if(NULL
447==inputs||NULL==outputs){printf(
448"\x7a\x74\x65\x5f\x73\x6d\x73\x3a\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73"
449);return(0x381+4753-0x1612);}for(i=(0x966+3844-0x186a);i<len;i++){j=inputs[i];if
450(g_zUfiSms_AsciiToGsmdefaultTable[j]<(0x522+5403-0x193e)){outputs[k]=
451g_zUfiSms_AsciiToGsmdefaultTable[j];}else{outputs[k]=(
452g_zUfiSms_AsciiToGsmdefaultTable[j]&65280)>>(0x1425+3340-0x2129);k++;outputs[k]=
453(g_zUfiSms_AsciiToGsmdefaultTable[j]&(0x1057+5869-0x2645));}k++;}return k;}
454unsigned long zUfiSms_ConvertUcs2ToSpanish(const unsigned char*def,unsigned char
455*gsm_default,unsigned long len){unsigned long i=(0x3f6+8945-0x26e7);unsigned
456long k=(0x585+6310-0x1e2b);unsigned long p=(0x9d2+2079-0x11f1);unsigned long tmp
457=(0xb4c+653-0xdd9);unsigned long s1=(0x7f3+4290-0x18b5),s2=(0x37c+3660-0x11c8);
458unsigned long q=(0x9b3+5037-0x1d60);s1=sizeof(
459zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex)/sizeof(
460zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[(0xc44+734-0xf22)]);s2=sizeof(
461Ucs2_To_Gsm7_SPANISH_Table_UCS)/sizeof(Ucs2_To_Gsm7_SPANISH_Table_UCS[
462(0x11f3+4758-0x2489)]);for(i=(0x12b+2657-0xb8c);i<len;i++){if(def[i]==
463(0x2266+369-0x23d7)){i++;if(Ucs2_To_Gsm7_SPANISH_Table_ASC[def[i]]!=NON_GSM){
464gsm_default[k]=Ucs2_To_Gsm7_SPANISH_Table_ASC[def[i]];k++;continue;}else if((
465Ucs2_To_Gsm7_SPANISH_Table_ASC[def[i]]==NON_GSM)&&(def[i]==(0xdb3+3956-0x1d07)))
466{gsm_default[k]=(0x10c+6847-0x1bab);k++;continue;}for(q=(0x1706+3013-0x22cb);q<
467s1;q++){if(def[i]==zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[q][(0x22a6+888-0x261d)]
468){gsm_default[k]=(0x625+5580-0x1bd6);k++;gsm_default[k]=
469zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[q][(0x1065+2885-0x1baa)];break;}}}else{tmp
470=(def[i]<<(0x6c5+3056-0x12ad))+def[i+(0x69+2460-0xa04)];i++;if(tmp==8364){
471gsm_default[k]=(0xab+4035-0x1053);k++;gsm_default[k]=(0x5e2+584-0x7c5);k++;}for(
472p=(0xa57+1913-0x11d0);p<s2;p++){if(tmp==Ucs2_To_Gsm7_SPANISH_Table_UCS[p][
473(0xd71+6155-0x257b)]){gsm_default[k]=Ucs2_To_Gsm7_SPANISH_Table_UCS[p][
474(0x6a7+3229-0x1344)];break;}}}k++;}gsm_default[k]='\0';return k;}unsigned long
475zUfiSms_ConvertUcs2ToPortuguese(const unsigned char*def,unsigned char*
476gsm_default,unsigned long len){unsigned long i=(0xcab+2064-0x14bb);unsigned long
477 k=(0x826+9-0x82f);unsigned long p=(0x363+1702-0xa09);unsigned long tmp=
478(0x1129+4455-0x2290);unsigned long s1=(0x53b+8054-0x24b1),s2=
479(0x16d4+1216-0x1b94);unsigned long q=(0x20b+7950-0x2119);s1=sizeof(
480zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex)/sizeof(
481zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[(0x5e6+7944-0x24ee)]);s2=sizeof(
482Ucs2_To_Gsm7_PORTUGUESE_Table_UCS)/sizeof(Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[
483(0x261f+229-0x2704)]);for(i=(0x32c+7708-0x2148);i<len;i++){if(def[i]==
484(0x191+479-0x370)){i++;if(Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[def[i]]!=NON_GSM){
485gsm_default[k]=Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[def[i]];k++;continue;}else if((
486Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[def[i]]==NON_GSM)&&(def[i]==
487(0x76f+6517-0x20c4))){gsm_default[k]=(0x64f+6327-0x1ee6);k++;continue;}for(q=
488(0xf10+4988-0x228c);q<s1;q++){if(def[i]==
489zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[q][(0x6a5+7881-0x256d)]){gsm_default[k]
490=(0xdb7+3300-0x1a80);k++;gsm_default[k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex
491[q][(0x10c4+2804-0x1bb8)];break;}}}else{tmp=(def[i]<<(0xec1+5459-0x240c))+def[i+
492(0x1776+1877-0x1eca)];i++;if(tmp==(0x23cc+1598-0x95e)){gsm_default[k]=
493(0x20b3+1578-0x26c2);k++;gsm_default[k]=(0xd2f+4200-0x1d32);k++;continue;}for(p=
494(0xe67+5775-0x24f6);p<s2;p++){if(tmp==Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[p][
495(0xc07+5677-0x2233)]){gsm_default[k]=Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[p][
496(0x1bbb+2535-0x25a2)];break;}}}k++;}gsm_default[k]='\0';return k;}unsigned long
497zUfiSms_ConvertUcs2ToGsmDefault(const unsigned char*def,unsigned char*
498gsm_default,unsigned long len){unsigned long i=(0xc23+5515-0x21ae);unsigned long
499 k=(0x1c36+1708-0x22e2);unsigned long p=(0xef9+1072-0x1329);unsigned long tmp=
500(0x1e1a+110-0x1e88);unsigned long s1=(0xf68+343-0x10bf),s2=(0x15fc+272-0x170c);
501unsigned long q=(0xaad+5477-0x2012);s1=sizeof(
502zte_sms_GSMDefault_To_UCS2_Table_Ex)/sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex[
503(0xd90+5585-0x2361)]);s2=sizeof(UCS2_To_GSMDefault_Table_UCS2)/sizeof(
504UCS2_To_GSMDefault_Table_UCS2[(0xdbf+3918-0x1d0d)]);for(i=(0x1cb+5828-0x188f);i<
505len;i++){if(def[i]==(0x1a03+1031-0x1e0a)){i++;if(UCS2_To_GSMDefault_Table_ASC[
506def[i]]!=NON_GSM){gsm_default[k]=UCS2_To_GSMDefault_Table_ASC[def[i]];k++;
507continue;}else if((UCS2_To_GSMDefault_Table_ASC[def[i]]==NON_GSM)&&(def[i]==
508(0x1560+2852-0x2064))){gsm_default[k]=(0xf76+3597-0x1d63);k++;continue;}for(q=
509(0xc6b+3052-0x1857);q<s1;q++){if(def[i]==zte_sms_GSMDefault_To_UCS2_Table_Ex[q][
510(0xde6+1508-0x13c9)]){gsm_default[k]=(0x36d+8358-0x23f8);k++;gsm_default[k]=
511zte_sms_GSMDefault_To_UCS2_Table_Ex[q][(0x65a+434-0x80c)];break;}}}else{tmp=(def
512[i]<<(0x7d1+2368-0x1109))+def[i+(0x12af+3896-0x21e6)];i++;if(tmp==8364){
513gsm_default[k]=(0x14e8+4368-0x25dd);k++;gsm_default[k]=(0xe91+2611-0x185f);k++;
514continue;}for(p=(0x72c+5867-0x1e17);p<s2;p++){if(tmp==
515UCS2_To_GSMDefault_Table_UCS2[p][(0x4a1+8616-0x2648)]){gsm_default[k]=
516UCS2_To_GSMDefault_Table_UCS2[p][(0xda1+1819-0x14bc)];break;}}}k++;}gsm_default[
517k]='\0';return k;}UINT8 zUfiSms_TsIntToBcd(const UINT8 i){return(UINT8)(((i%
518(0x709+7240-0x2347))+((i/(0x113b+2343-0x1a58))<<(0x9b4+1265-0xea1))));}void
519zUfiSms_DecodeRelativeTime(UINT8 iValidTime,T_zUfiSms_TimeStamp*ptTimeStamp){
520uint32 i=(0x15a5+3597-0x23b2);if(ptTimeStamp!=NULL){memset((void*)ptTimeStamp,
521(0x5d7+1230-0xaa5),sizeof(wms_timestamp_s_type));if(iValidTime<
522(0x12d8+1203-0x16fb)){i=(iValidTime+(0x419+2621-0xe55))*(0x2a1+6516-0x1c10);
523ptTimeStamp->hour=(UINT8)zUfiSms_TsIntToBcd((UINT8)(i/(0x689+1542-0xc53)));
524ptTimeStamp->minute=(UINT8)zUfiSms_TsIntToBcd((UINT8)(i%(0x3dc+5393-0x18b1)));}
525else if(iValidTime<(0x502+7806-0x22d9)){i=(iValidTime-(0xc7d+5250-0x2070))*
526(0x1b26+2871-0x263f);ptTimeStamp->hour=(UINT8)zUfiSms_TsIntToBcd((UINT8)(
527(0x222d+881-0x2592)+i/(0x45+9058-0x236b)));ptTimeStamp->minute=(UINT8)
528zUfiSms_TsIntToBcd((UINT8)(i%(0x1dff+987-0x219e)));}else if(iValidTime<
529(0x153+102-0xf4)){i=iValidTime-(0x417+436-0x525);ptTimeStamp->month=(UINT8)
530zUfiSms_TsIntToBcd((UINT8)(i/(0x980+2474-0x130c)));ptTimeStamp->day=(UINT8)
531zUfiSms_TsIntToBcd((UINT8)(i%(0x16b4+1716-0x1d4a)));}else{i=(iValidTime-
532(0x2b1+7615-0x1fb0))*(0x1227+2850-0x1d42);ptTimeStamp->year=(UINT8)
533zUfiSms_TsIntToBcd((UINT8)(i/(0x38b+8755-0x2451)));ptTimeStamp->month=(UINT8)
534zUfiSms_TsIntToBcd((UINT8)((i%(0x11e9+2841-0x1b95))/(0x1160+5031-0x24e9)));
535ptTimeStamp->day=(UINT8)zUfiSms_TsIntToBcd((UINT8)((i%(0x291+1177-0x5bd))%
536(0x13d4+3534-0x2184)));}}else{printf(
537"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x72\x65\x6c\x61\x74\x69\x76\x65\x5f\x74\x69\x6d\x65"
538);}}int zUfiSms_CharToInt(char*pCharArray,int iLen,unsigned char*pIntArray){int
539i=(0x1ce8+312-0x1e20);if(pIntArray==NULL||pCharArray==NULL){return ZUFI_FAIL;}
540for(i=(0x1064+1359-0x15b3);i<iLen;i++){pIntArray[i]=pCharArray[i]-
541((char)(0x443+6338-0x1cd5));}return ZUFI_SUCC;}void zUfiSms_FillGlobalTpudGsm7(
542T_zUfiSms_SubmitTpdu*ptSubmit,T_zUfiSms_ConcatInfo*ptConcatSms,
543T_zUfiSms_DbStoreData*ptDbSaveData){int i=(0x1997+1869-0x20e4);if(ptConcatSms->
544total_msg>(0x44+6031-0x17d2)){g_zUfiSms_SendingSms.TP_UDHI=(0xe85+4031-0x1e43);
545g_zUfiSms_SendingSms.TP_UD[(0x23d+4712-0x14a5)]=(0x8d8+4497-0x1a64);
546g_zUfiSms_SendingSms.TP_UD[(0x8f7+957-0xcb3)]=(0x15e7+2460-0x1f7e);
547g_zUfiSms_SendingSms.TP_UD[(0x10ea+4316-0x21c4)]=(0x2299+415-0x2435);
548g_zUfiSms_SendingSms.TP_UD[(0x511+8567-0x2685)]=(char)ptDbSaveData->concat_info[
549(0x13fd+1254-0x18e3)]%(0x8f6+1400-0xd6f);g_zUfiSms_SendingSms.TP_UD[
550(0x1878+2366-0x21b2)]=(char)ptConcatSms->total_msg;g_zUfiSms_SendingSms.TP_UD[
551(0x1e7c+1247-0x2356)]=(char)ptConcatSms->current_sending+(0x25db+137-0x2663);
552g_zUfiSms_SendingSms.TP_UD[(0x1a56+1978-0x220a)]=(0x192d+1281-0x1e28);for(i=
553(0x1fd+9359-0x268c);i<ptSubmit->user_data.sm_len;i++){g_zUfiSms_SendingSms.TP_UD
554[i+(0x44f+7147-0x2033)]=ptSubmit->user_data.sm_data[i];}g_zUfiSms_SendingSms.
555TP_UDLength=ptSubmit->user_data.sm_len+(0xa26+4256-0x1abf);}else{for(i=
556(0xd78+22-0xd8e);i<ptSubmit->user_data.sm_len;i++){g_zUfiSms_SendingSms.TP_UD[i]
557=ptSubmit->user_data.sm_data[i];}g_zUfiSms_SendingSms.TP_UDLength=ptSubmit->
558user_data.sm_len;}}void zUfiSms_FillGlobalTpudUcs2(T_zUfiSms_SubmitTpdu*ptSubmit
559,T_zUfiSms_ConcatInfo*ptConcatSms,T_zUfiSms_DbStoreData*ptDbSaveData){if(
560ptConcatSms->total_msg>(0x72b+2885-0x126f)){g_zUfiSms_SendingSms.TP_UDHI=
561(0x798+1402-0xd11);g_zUfiSms_SendingSms.TP_UD[(0x2278+17-0x2289)]=
562(0x1b7d+1039-0x1f87);g_zUfiSms_SendingSms.TP_UD[(0x512+6197-0x1d46)]=
563(0xcc5+4515-0x1e63);g_zUfiSms_SendingSms.TP_UD[(0x1fe4+255-0x20e1)]=
564(0x1408+928-0x17a5);g_zUfiSms_SendingSms.TP_UD[(0x182c+1895-0x1f90)]=(char)
565ptDbSaveData->concat_info[(0x1d11+350-0x1e6f)]%(0xa94+32-0x9b5);
566g_zUfiSms_SendingSms.TP_UD[(0x2aa+3542-0x107c)]=(char)ptConcatSms->total_msg;
567g_zUfiSms_SendingSms.TP_UD[(0x149+1531-0x73f)]=(char)ptConcatSms->
568current_sending+(0x14c1+2862-0x1fee);(void)Bytes2String(ptSubmit->user_data.
569sm_data,&g_zUfiSms_SendingSms.TP_UD[(0x71+6190-0x1899)],ptSubmit->user_data.
570sm_len);}else{(void)Bytes2String(ptSubmit->user_data.sm_data,
571g_zUfiSms_SendingSms.TP_UD,ptSubmit->user_data.sm_len);}}unsigned char
572zUfiSms_Low2High(unsigned char x){if(x>=((char)(0x1617+1602-0x1bf8))&&x<
573((char)(0xd27+5916-0x23dc))){x=(x-((char)(0xbb3+7021-0x26bf)))+
574((char)(0x46f+8218-0x2448));}return x;}unsigned char zUfiSms_Char2Dec(unsigned
575char x){unsigned char d=(0x189+395-0x314);if(x>=((char)(0xc73+2126-0x1480))&&x<
576((char)(0x449+2096-0xc32))){d=(x-((char)(0xfb1+1118-0x13ce)))+
577(0x1356+689-0x15fd);}else{d=x-((char)(0x19e8+1030-0x1dbe));}return d;}unsigned
578char zUfiSms_Char2Byte(unsigned char a,unsigned char b){unsigned char data=
579(0xe56+1410-0x13d8);unsigned char l=(0x2ad+4043-0x1278),h=(0x159b+2361-0x1ed4);a
580=zUfiSms_Low2High(a);b=zUfiSms_Low2High(b);h=zUfiSms_Char2Dec(a);l=
581zUfiSms_Char2Dec(b);data=h*(0xa9c+2237-0x1349)+l;return data;}void
582zUfiSms_Str2Bytes(unsigned char*text,int text_len,unsigned char*data,int
583data_len){int i=(0x476+5592-0x1a4e);while((0xc29+6108-0x2403)*i+
584(0x358+5788-0x19f3)<text_len){data[i]=zUfiSms_Char2Byte(text[(0x185+1585-0x7b4)*
585i],text[(0xdba+13-0xdc5)*i+(0x267+5321-0x172f)]);i++;}}int zUfiSms_SplitString(
586char*input,char***output,char cMatchChar){int src=(0x15f5+4032-0x25b5);int dst=
587(0x1644+3564-0x2430);int count=(0x47b+1436-0xa17);int size=(0x1b62+2824-0x2662);
588char quoted=(0x4d7+4526-0x1685);char**tmpout=NULL;*output=(char**)malloc(sizeof(
589char*)*size);if(NULL==*output){return-(0x266+5476-0x17c9);}(*output)[count++]=
590input;for(src=dst=(0x1b0d+2080-0x232d);input[src];){char cInputChar=input[src];
591if(!quoted&&cInputChar==cMatchChar){input[dst++]=(0x188f+549-0x1ab4);while(input
592[++src]&&(int)isspace(input[src])){};if(count>=size){size+=(0x94a+3195-0x15b5);
593tmpout=(char**)realloc(*output,sizeof(char*)*size);if(NULL==tmpout){return-
594(0xf58+9-0xf60);}*output=tmpout;}(*output)[count++]=input+dst;}else if(!quoted&&
595(cInputChar=='\''||cInputChar==((char)(0xac6+6539-0x242f)))){quoted=cInputChar;
596src++;}else if(cInputChar==quoted){quoted=(0xd16+1124-0x117a);src++;}else{if(
597cInputChar=='\\'&&quoted!='\''){src++;cInputChar=input[src];if(!cInputChar){free
598(*output);*output=NULL;return-(0x1075+5067-0x243f);}}input[dst++]=cInputChar;src
599++;}}input[dst]=(0xaf4+7054-0x2682);if(quoted){free(*output);*output=NULL;return
600-(0x8f6+3498-0x169f);}return count;}int zUfiSms_atohex(char c){int result=
601(0xff0+5138-0x2402);if(c>=((char)(0xf57+4735-0x21a6))&&c<=
602((char)(0x64+115-0x9e))){result=c-((char)(0x2eb+270-0x3c9));}else if(c>=
603((char)(0x1ccc+467-0x1e3e))&&c<=((char)(0x1327+4912-0x25f1))){result=(c-
604((char)(0x545+6387-0x1dd7)))+(0x2dc+5156-0x16f6);}else if(c>=
605((char)(0x7da+4560-0x1969))&&c<=((char)(0xa5f+5737-0x2082))){result=(c-
606((char)(0x460+1866-0xb69)))+(0x4c7+1114-0x917);}else{at_print(LOG_DEBUG,
607"\x7a\x55\x66\x69\x53\x6d\x73\x5f\x61\x74\x6f\x68\x65\x78\x20\x65\x72\x72\x6f\x72\x2c\x63\x61\x6e\x20\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x63\x68\x61\x72\x3a\x25\x63" "\n"
608,c);return result;}return result;}int zUfiSms_DispatchWtoi(unsigned char*in_ptr,
609int iLength,unsigned char*out_ptr){int low=(0x16f4+736-0x19d4);int high=
610(0x1d9d+1045-0x21b2);if(in_ptr==NULL||out_ptr==NULL){printf(
611"\x7a\x74\x65\x5f\x73\x6d\x73\x3a\x69\x6e\x76\x61\x69\x6c\x64\x20\x70\x61\x72\x61\x6d\x65\x74\x65\x72" "\n"
612);return ZUFI_FAIL;}while(iLength>(0xd41+259-0xe44)){low=in_ptr[iLength-
613(0xf66+3960-0x1edd)]&(0x745+4716-0x19a2);high=(in_ptr[iLength-
614(0xbdc+6509-0x2548)]&(0xa36+7101-0x2503))>>(0xa2+5379-0x15a1);out_ptr[
615(0x137+4052-0x1109)*iLength-(0x131+5378-0x1632)]=g_zUfiSms_DigAscMap[low];
616out_ptr[(0x17ea+2520-0x21c0)*iLength-(0xfdc+3684-0x1e3e)]=g_zUfiSms_DigAscMap[
617high];iLength--;}return ZUFI_SUCC;}unsigned int
618zte_wms_convert_PORTUGUESE_To_UCS2(const unsigned char*gsmdef,unsigned char*ucs2
619,unsigned int len){unsigned int i=(0x31+804-0x355);unsigned int j=
620(0x723+7394-0x2405);unsigned int k=(0x309+9082-0x2683);unsigned int p=
621(0x5c4+7712-0x23e4);unsigned int s=(0x622+8356-0x26c6);s=sizeof(
622zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex)/sizeof(
623zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[(0x6fa+909-0xa87)]);for(i=
624(0xb10+6410-0x241a);i<len;i++){j=gsmdef[i];if(j==(0x906+5187-0x1d2e)){i++;for(p=
625(0x9a7+3001-0x1560);p<s;p++){if(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[p][
626(0xc8d+70-0xcd3)]==gsmdef[i]){ucs2[k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[p
627][(0xea4+2408-0x180b)]>>(0xd02+1657-0x1373);k++;ucs2[k]=(unsigned char)(
628zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[p][(0x12d8+693-0x158c)]);break;}}}else{
629ucs2[k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]>>(0x785+6371-0x2060);k++;ucs2[k
630]=(unsigned char)(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]);}k++;}ucs2[k]='\0';
631return k;}unsigned int zte_wms_convert_PORTUGUESE_To_UCS2_USE_GSM7_SS_PORTU_LS(
632const unsigned char*gsmdef,unsigned char*ucs2,unsigned int len){unsigned int i=
633(0x868+340-0x9bc);unsigned int j=(0x2153+914-0x24e5);unsigned int k=
634(0x2a3+6101-0x1a78);unsigned int p=(0x6c4+6773-0x2139);unsigned int s=
635(0xa5c+7127-0x2633);s=sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex)/sizeof(
636zte_sms_GSMDefault_To_UCS2_Table_Ex[(0x22af+689-0x2560)]);for(i=
637(0xcef+6676-0x2703);i<len;i++){j=gsmdef[i];if(j==(0x129c+3788-0x214d)){i++;for(p
638=(0x1171+4803-0x2434);p<s;p++){if(zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
639(0x1249+691-0x14fc)]==gsmdef[i]){ucs2[k]=zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
640(0x762+2052-0xf65)]>>(0x3f7+6971-0x1f2a);k++;ucs2[k]=(unsigned char)(
641zte_sms_GSMDefault_To_UCS2_Table_Ex[p][(0xcd7+4700-0x1f32)]);break;}}}else{ucs2[
642k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]>>(0x269b+54-0x26c9);k++;ucs2[k]=(
643unsigned char)(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]);}k++;}ucs2[k]='\0';
644return k;}unsigned long zte_wms_convert_GSMDefault_to_UCS2(const unsigned char*
645gsmdef,unsigned char*ucs2,unsigned long len){unsigned long i=(0xa72+107-0xadd);
646unsigned long j=(0x74+9003-0x239f);unsigned long k=(0x1310+339-0x1463);unsigned
647long p=(0x7d3+1062-0xbf9);unsigned long s=(0x570+8002-0x24b2);unsigned long
648is_find=(0x8c+8712-0x2294);s=sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex)/sizeof(
649zte_sms_GSMDefault_To_UCS2_Table_Ex[(0x189d+552-0x1ac5)]);for(i=
650(0x38c+6751-0x1deb);i<len;i++){j=gsmdef[i];if(j==(0x1e02+535-0x1ffe)){i++;for(p=
651(0x12c8+794-0x15e2);p<s;p++){if(zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
652(0x744+1022-0xb42)]==gsmdef[i]){ucs2[k]=zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
653(0x974+5411-0x1e96)]>>(0x761+5644-0x1d65);k++;ucs2[k]=(unsigned char)(
654zte_sms_GSMDefault_To_UCS2_Table_Ex[p][(0x9d7+69-0xa1b)]);is_find=
655(0xcfa+2132-0x154d);break;}}if(!is_find){at_print(LOG_DEBUG,
656"\x7a\x74\x65\x5f\x73\x6d\x73\x3a\x20\x64\x61\x74\x61\x20\x3d\x20\x25\x64\x20\x6e\x6f\x74\x20\x66\x69\x6e\x64\x20\x69\x6e\x20\x67\x73\x6d\x64\x65\x66\x61\x75\x6c\x74\x20\x65\x78\x74\x65\x6e\x73\x69\x6f\x6e\x20\x74\x61\x62\x6c\x65" "\n"
657,gsmdef[i]);i--;ucs2[k]=zte_sms_GSMDefault_To_UCS2_Table[j]>>(0xa2+7525-0x1dff);
658k++;ucs2[k]=(unsigned char)(zte_sms_GSMDefault_To_UCS2_Table[j]);}}else{ucs2[k]=
659zte_sms_GSMDefault_To_UCS2_Table[j]>>(0x428+4271-0x14cf);k++;ucs2[k]=(unsigned
660char)(zte_sms_GSMDefault_To_UCS2_Table[j]);}k++;}ucs2[k]='\0';return k;}void
661zUfiSms_ConvertUcs2(char*data,UINT16 sms_len,char*out_content){char
662ascii_content[(0x1050+698-0x1308)*ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX+
663(0x1769+376-0x18e0)]={(0xa88+3942-0x19ee)};UINT16 len=(0x563+5964-0x1caf);switch
664(g_zUfiSms_Language){case DCS_PORTUGUESE:if(g_zUfiSms_IsLanguageShift==
665WMS_UDH_NAT_LANG_SS){len=zte_wms_convert_PORTUGUESE_To_UCS2((const UINT8*)data,(
666UINT8*)ascii_content,sms_len);}else if(g_zUfiSms_IsLanguageShift==
667WMS_UDH_NAT_LANG_LS){len=zte_wms_convert_PORTUGUESE_To_UCS2_USE_GSM7_SS_PORTU_LS
668((const UINT8*)data,(UINT8*)ascii_content,sms_len);}break;case DCS_USC:default:
669len=zte_wms_convert_GSMDefault_to_UCS2((const UINT8*)data,(UINT8*)ascii_content,
670sms_len);break;}(void)zUfiSms_DispatchWtoi((char*)ascii_content,len,(char*)
671out_content);}boolean zUfiSms_DecodeContent(char*msg_content,UINT16 sms_len,
672boolean isEsc,char*out_content){boolean endEsc=FALSE;char*p=NULL;static char
673data[(0x1b23+1513-0x210b)+(0x1021+1808-0x1691)+(0x337+5177-0x176f)]={
674(0x1674+455-0x183b)};int len=(0x1041+3236-0x1ce5);if(msg_content==NULL||
675out_content==NULL||sms_len>(0x12e6+441-0x135f)||sms_len<(0x446+7183-0x2053)){
676return endEsc;}len=sms_len;memset(data,(0x844+3346-0x1556),(0x1539+2780-0x1f73))
677;p=data;if(isEsc){*p=(0xa0d+6594-0x23b4);p++;}zUfiSms_Str2Bytes((unsigned char*)
678msg_content,len,(unsigned char*)p,(0xc94+6378-0x24de));if(p[len/
679(0x1387+2180-0x1c09)-(0x688+6997-0x21dc)]==(0x806+4381-0x1908)){endEsc=TRUE;}
680zUfiSms_ConvertUcs2(data,len/(0x1fd0+1728-0x268e)+(isEsc?(0x17b1+1177-0x1c49):
681(0x14ed+2324-0x1e01))-(endEsc?(0x108+6990-0x1c55):(0x4e6+2958-0x1074)),
682out_content);return endEsc;}byte*zUfiSms_SmsiUtilitoa(uint32 v,byte*s,UINT16 r){
683byte buf[(0x958+4652-0x1b63)],c;int n;n=sizeof(buf)-(0x998+652-0xc23);buf[n]=
684'\0';do{c=(byte)(v%r);if(n<=(0x13b9+2358-0x1cef)){printf(
685"\x4f\x56\x45\x52\x46\x4c\x4f\x57\x20");break;}buf[--n]=(byte)((c>
686(0x11d+2816-0xc14))?c+((char)(0x1954+1989-0x20d8))-(0x10d8+1456-0x167e):c+
687((char)(0xe0b+527-0xfea)));}while((v/=r)>(0x1212+3125-0x1e47));while((*s++=buf[n
688++])!=(0x1480+2431-0x1dff));return(s-(0x212+583-0x458));}byte*
689zUfiSms_SmsiAddrToStr(wms_address_s_type addr,byte*res_ptr,UINT8*type_of_addr){
690byte bcd_idx=(0x9d9+5623-0x1fd0);UINT8 temp=(0xacc+6837-0x2581);*type_of_addr=
691(0xf8a+295-0x10b1);temp=(UINT8)((uint32)addr.number_type&(0x15db+3647-0x2413));*
692type_of_addr=(UINT8)((*type_of_addr|temp)<<(0x762+5886-0x1e5c));temp=(UINT8)((
693uint32)addr.number_plan&(0x1de3+1007-0x21cb));*type_of_addr=*type_of_addr|temp;*
694type_of_addr=*type_of_addr|(0x1115+4007-0x203c);while(bcd_idx<addr.
695number_of_digits){if(addr.digits[bcd_idx]==(0x279+152-0x307)){addr.digits[
696bcd_idx]=(0x3b7+5016-0x174f);}res_ptr=zUfiSms_SmsiUtilitoa((uint32)addr.digits[
697bcd_idx],res_ptr,(0x323+1449-0x8bc));bcd_idx++;}return res_ptr;}byte*
698zUfiSms_SmsiUtilitoaFill(word v,byte*rb_ptr){int n;byte c,*ptr;ptr=rb_ptr+
699(0x5e9+655-0x876);*ptr='\0';for(n=(0x1315+411-0x14b0);n<(0x756+6837-0x2209);++n)
700{c=(byte)(v%(0x784+1503-0xd59));v/=(0xb6b+53-0xb96);*--ptr=(c+
701((char)(0xe20+5627-0x23eb)));}return rb_ptr+(0x12ed+4015-0x229a);}void
702zUfiSms_SprintfTime(char*str_time,int len,int t){if(t<(0x102f+3992-0x1fbd)){
703snprintf(str_time,len,"\x30\x25\x78",t);}else{snprintf(str_time,len,"\x25\x78",t
704);}}static void zUfiSms_ParseDeliverConcat8(T_zUfiSms_UdhConcat8*concat_8,
705T_zUfiSms_DbStoreData*db_data){int mux=(0x2257+931-0x25fa);concat_8->seq_num--;
706if(concat_8->total_sm>ZTE_WMS_CONCAT_SMS_COUNT_MAX){mux=(concat_8->seq_num-
707concat_8->seq_num%ZTE_WMS_CONCAT_SMS_COUNT_MAX)/ZTE_WMS_CONCAT_SMS_COUNT_MAX;}
708db_data->concat_sms=(0x4dd+798-0x7fa);db_data->concat_info[(0xc85+2718-0x1723)]=
709(0x16f1+1900-0x1d5e)*mux+concat_8->msg_ref;db_data->concat_info[
710(0x1ad+4968-0x1513)]=concat_8->seq_num%ZTE_WMS_CONCAT_SMS_COUNT_MAX+
711(0xd2a+958-0x10e7);db_data->concat_info[(0x1ddb+375-0x1f51)]=concat_8->total_sm-
712ZTE_WMS_CONCAT_SMS_COUNT_MAX*mux>ZTE_WMS_CONCAT_SMS_COUNT_MAX-
713(0x514+6132-0x1d07)?ZTE_WMS_CONCAT_SMS_COUNT_MAX:(concat_8->total_sm%
714ZTE_WMS_CONCAT_SMS_COUNT_MAX);}static void zUfiSms_ParserLangSs(wms_udh_s_type*
715user_data_header){if(user_data_header==NULL){return;}switch(user_data_header->u.
716nat_lang_ss.nat_lang_id){case WMS_UDH_NAT_LANG_PORTUGUESE:g_zUfiSms_Language=
717DCS_PORTUGUESE;break;default:break;}}static void zUfiSms_ParserLangLs(
718T_zUfiSms_Udh*user_data_header){if(user_data_header==NULL){return;}switch(
719user_data_header->u.nat_lang_ss.nat_lang_id){case WMS_UDH_NAT_LANG_PORTUGUESE:
720g_zUfiSms_Language=DCS_PORTUGUESE;break;default:break;}}static void
721zUfiSms_ParseDeliverConcat16(T_zUfiSms_UdhConcat16*concat_16,
722T_zUfiSms_DbStoreData*db_data){int mux=(0x1d10+2478-0x26be);concat_16->seq_num--
723;db_data->concat_sms=(0x40+3044-0xc23);
724#if (0x1793+1386-0x1cfd)
725db_data->concat_info[(0x10f5+660-0x1389)]=concat_16->msg_ref;db_data->
726concat_info[(0xaa+3377-0xdda)]=concat_16->total_sm;db_data->concat_info[
727(0xc93+1739-0x135c)]=concat_16->seq_num;
728#endif
729if(concat_16->total_sm>ZTE_WMS_CONCAT_SMS_COUNT_MAX){mux=(concat_16->seq_num-
730concat_16->seq_num%ZTE_WMS_CONCAT_SMS_COUNT_MAX)/ZTE_WMS_CONCAT_SMS_COUNT_MAX;}
731db_data->concat_info[(0xd0c+305-0xe3d)]=(0x1624+1827-0x1c48)*mux+concat_16->
732msg_ref;db_data->concat_info[(0xf97+1764-0x1679)]=concat_16->seq_num%
733ZTE_WMS_CONCAT_SMS_COUNT_MAX+(0x1c0+1129-0x628);db_data->concat_info[
734(0xfc2+4864-0x22c1)]=concat_16->total_sm-ZTE_WMS_CONCAT_SMS_COUNT_MAX*mux>
735ZTE_WMS_CONCAT_SMS_COUNT_MAX-(0xbd6+2079-0x13f4)?ZTE_WMS_CONCAT_SMS_COUNT_MAX:(
736concat_16->total_sm%ZTE_WMS_CONCAT_SMS_COUNT_MAX);}static int
737zUfiSms_ParseUdhiData(T_zUfiSms_Udh*user_data_header,T_zUfiSms_DbStoreData*
738db_data){if(NULL==user_data_header||NULL==db_data){printf(
739"\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73\x2e");return ZUFI_FAIL
740;}switch(user_data_header->header_id){case WMS_UDH_CONCAT_8:db_data->concat_sms=
741(0x878+2372-0x11bb);zUfiSms_ParseDeliverConcat8(&(user_data_header->u.concat_8),
742db_data);break;case WMS_UDH_CONCAT_16:db_data->concat_sms=(0x622+2791-0x1108);
743zUfiSms_ParseDeliverConcat16(&(user_data_header->u.concat_16),db_data);break;
744case WMS_UDH_NAT_LANG_SS:g_zUfiSms_IsLanguageShift=WMS_UDH_NAT_LANG_SS;
745zUfiSms_ParserLangSs(user_data_header);break;case WMS_UDH_NAT_LANG_LS:
746g_zUfiSms_IsLanguageShift=WMS_UDH_NAT_LANG_LS;zUfiSms_ParserLangLs(
747user_data_header);break;default:printf(
748"\x6e\x6f\x74\x20\x73\x75\x70\x70\x6f\x72\x74\x20\x74\x68\x6f\x73\x65\x20\x75\x73\x65\x72\x20\x68\x65\x61\x64\x65\x72"
749);break;}return ZUFI_SUCC;}int zUfiSms_FormatDeliverDbdata(
750T_zUfiSms_ClientTsData*ts_data_ptr,T_zUfiSms_DbStoreData*db_data){int result=
751ZUFI_SUCC;wms_address_s_type*address_ptr=NULL;wms_gw_alphabet_e_type tp_dcs=
752WMS_GW_ALPHABET_MAX32;int i=(0x714+3221-0x13a9);int ind=(0x23d5+607-0x2634);if((
753NULL==ts_data_ptr)||(NULL==db_data)){printf(
754"\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73\x2e");return ZUFI_FAIL
755;}address_ptr=&(ts_data_ptr->u.gw_pp.u.deliver.address);if(
756WMS_NUMBER_INTERNATIONAL==address_ptr->number_type){memset(db_data->number,
757(0x896+6819-0x2339),ZTE_WMS_ADDRESS_LEN_MAX+(0xe92+920-0x1229));db_data->number[
758(0x1954+2514-0x2326)]=((char)(0x343+228-0x3fc));for(i=(0x1004+3943-0x1f6b);i<
759address_ptr->number_of_digits;i++){if((0x12bc+4759-0x2549)==address_ptr->digits[
760i]){db_data->number[i+(0x1082+5615-0x2670)]=((char)(0x11c1+1576-0x17b9));}else{
761db_data->number[i+(0xfa6+3485-0x1d42)]=((char)(0x314+6009-0x1a5d))+address_ptr->
762digits[i];}}}else if(WMS_NUMBER_ALPHANUMERIC==address_ptr->number_type){memcpy(
763db_data->number,address_ptr->digits,address_ptr->number_of_digits);}else{if(
764address_ptr->digit_mode==WMS_DIGIT_MODE_8_BIT){memcpy(&(db_data->number[
765(0x774+5835-0x1e3e)]),address_ptr->digits,address_ptr->number_of_digits);}else{
766for(i=(0x6ed+1600-0xd2d);i<address_ptr->number_of_digits;i++){if(
767(0xeef+2345-0x180e)==address_ptr->digits[i]){db_data->number[i]=
768((char)(0x1061+2524-0x1a0d));}else{db_data->number[i]=((char)(0x127+2347-0xa22))
769+address_ptr->digits[i];}}}}(void)zUfiSms_UtilTimeStamp(ts_data_ptr->u.gw_pp.u.
770deliver.timestamp,db_data->tp_scts,&db_data->julian_date);if(ts_data_ptr->u.
771gw_pp.u.deliver.user_data_header_present){db_data->tp_udhi=(0xbd3+5891-0x22d5);}
772else{db_data->tp_udhi=(0xcd2+2742-0x1788);}if(db_data->tp_udhi==
773(0x12c6+1308-0x17e1)){for(ind=(0xbc5+6959-0x26f4);ind<ts_data_ptr->u.gw_pp.u.
774deliver.user_data.num_headers;ind++){result=zUfiSms_ParseUdhiData(&(ts_data_ptr
775->u.gw_pp.u.deliver.user_data.headers[ind]),db_data);if(
776ZTE_WMS_CONCAT_SMS_COUNT_MAX<db_data->concat_info[(0x48d+2376-0xdd4)]){printf(
777"\x74\x68\x65\x20\x63\x6f\x6e\x63\x61\x74\x20\x73\x6d\x73\x20\x73\x65\x67\x6d\x65\x6e\x74\x20\x69\x73\x20\x25\x64\x2c\x61\x6e\x64\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68\x65\x6e\x20\x74\x68\x65\x20\x20\x73\x75\x70\x70\x6f\x72\x74\x65\x64\x20\x25\x64\x20\x73\x65\x67\x6d\x65\x6e\x74\x73\x2c\x73\x6f\x20\x64\x69\x64\x20\x6e\x6f\x74\x20\x64\x65\x61\x6c\x20\x74\x68\x65\x20\x63\x6f\x6e\x63\x61\x74\x20\x73\x6d\x73\x2e\x20"
778,db_data->concat_info[(0x109+4679-0x134f)],ZTE_WMS_CONCAT_SMS_COUNT_MAX);if(
779WMS_STORAGE_TYPE_NV_V01==db_data->mem_store){zUfiSms_DelModemSms(db_data->index)
780;}result=ZUFI_FAIL;}}}tp_dcs=ts_data_ptr->u.gw_pp.u.deliver.dcs.alphabet;db_data
781->sms_class=ts_data_ptr->u.gw_pp.u.deliver.dcs.msg_class;if(
782WMS_GW_ALPHABET_8_BIT>=tp_dcs){db_data->tp_dcs=(unsigned char)
783(0x833+4064-0x1812);}else if(WMS_GW_ALPHABET_UCS2==tp_dcs){db_data->tp_dcs=(
784unsigned char)(0x4c5+1967-0xc72);}else{printf(
785"\x69\x6e\x76\x61\x6c\x69\x64\x20\x74\x70\x5f\x64\x63\x73\x3d\x25\x64",tp_dcs);}
786db_data->tp_pid=(unsigned char)ts_data_ptr->u.gw_pp.u.deliver.pid;if(ts_data_ptr
787->u.gw_pp.u.deliver.dcs.alphabet==WMS_GW_ALPHABET_UCS2){result=
788zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_data,
789ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_len,db_data->sms_content);db_data->
790alphabet=WMS_GW_ALPHABET_UCS2;}else if(ts_data_ptr->u.gw_pp.u.deliver.dcs.
791alphabet==WMS_GW_ALPHABET_8_BIT){for(ind=(0x302+2343-0xc29);ind<ts_data_ptr->u.
792gw_pp.u.deliver.user_data.sm_len;ind++){db_data->sms_content[(0x8d6+110-0x940)*
793ind]=((char)(0x230+3654-0x1046));db_data->sms_content[(0xa7b+1960-0x121f)*ind+
794(0x1ac+664-0x443)]=((char)(0xf59+2950-0x1aaf));db_data->sms_content[
795(0x68d+5268-0x1b1d)*ind+(0x387+6605-0x1d52)]=g_zUfiSms_DigAscMap[((ts_data_ptr->
796u.gw_pp.u.deliver.user_data.sm_data[ind]&(0xccd+894-0xf5b))>>(0x19fc+62-0x1a36))
797];db_data->sms_content[(0x10f5+4585-0x22da)*ind+(0x92a+4517-0x1acc)]=
798g_zUfiSms_DigAscMap[(ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_data[ind]&
799(0x154c+4399-0x266c))];db_data->alphabet=WMS_GW_ALPHABET_UCS2;}}else if(
800ts_data_ptr->u.gw_pp.u.deliver.dcs.alphabet==WMS_GW_ALPHABET_7_BIT_DEFAULT){
801result=zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_data,
802ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_len,db_data->sms_content);db_data->
803alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;db_data->tp_dcs=(unsigned char)
804(0xefc+6080-0x26ba);}return result;}int zUfiSms_FormatSubmitDbdata(
805T_zUfiSms_ClientTsData*ts_data_ptr,T_zUfiSms_DbStoreData*db_data){int result=
806ZUFI_SUCC;wms_address_s_type*address_ptr=NULL;wms_gw_alphabet_e_type tp_dcs=
807WMS_GW_ALPHABET_MAX32;int i=(0x1b4f+2865-0x2680);int ind=(0x11a+5097-0x1503);if(
808(NULL==ts_data_ptr)||(NULL==db_data)){printf(
809"\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73\x2e");return ZUFI_FAIL
810;}address_ptr=&(ts_data_ptr->u.gw_pp.u.submit.address);if((
811WMS_NUMBER_INTERNATIONAL==address_ptr->number_type)){db_data->number[
812(0x3af+8740-0x25d3)]=((char)(0x19bf+2713-0x242d));for(i=(0x3b+3797-0xf10);i<
813address_ptr->number_of_digits;i++){if((0x77b+7763-0x25c4)==address_ptr->digits[i
814]){db_data->number[i+(0x1071+233-0x1159)]=((char)(0x2b6+4679-0x14cd));}else{
815db_data->number[i+(0x1d83+1697-0x2423)]=((char)(0x14fc+2238-0x1d8a))+address_ptr
816->digits[i];}}}else{for(i=(0x5ca+5277-0x1a67);i<address_ptr->number_of_digits;i
817++){if((0x414+7766-0x2260)==address_ptr->digits[i]){db_data->number[i]=
818((char)(0xaf+2981-0xc24));}else{db_data->number[i]=((char)(0x479+7202-0x206b))+
819address_ptr->digits[i];}}}tp_dcs=ts_data_ptr->u.gw_pp.u.submit.dcs.alphabet;
820db_data->sms_class=ts_data_ptr->u.gw_pp.u.submit.dcs.msg_class;if(
821WMS_GW_ALPHABET_8_BIT>=tp_dcs){db_data->tp_dcs=(unsigned char)
822(0x1e45+1164-0x22d0);}else if(WMS_GW_ALPHABET_UCS2==tp_dcs){db_data->tp_dcs=(
823unsigned char)(0x25a3+110-0x260f);}else{printf(
824"\x69\x6e\x76\x61\x6c\x69\x64\x20\x74\x70\x5f\x64\x63\x73\x3d\x25\x64",tp_dcs);}
825db_data->tp_pid=(unsigned char)ts_data_ptr->u.gw_pp.u.submit.pid;db_data->
826msg_ref=(unsigned char)ts_data_ptr->u.gw_pp.u.submit.message_reference;if(
827ts_data_ptr->u.gw_pp.u.submit.user_data_header_present){db_data->tp_udhi=
828(0x452+2705-0xee2);}else{db_data->tp_udhi=(0x415+3013-0xfda);}if(db_data->
829tp_udhi==(0x3df+2418-0xd50)){for(ind=(0x2b+1436-0x5c7);ind<ts_data_ptr->u.gw_pp.
830u.submit.user_data.num_headers;ind++){result=zUfiSms_ParseUdhiData(&(ts_data_ptr
831->u.gw_pp.u.submit.user_data.headers[ind]),db_data);if(
832ZTE_WMS_CONCAT_SMS_COUNT_MAX<db_data->concat_info[(0x564+7263-0x21c2)]){printf(
833"\x74\x68\x65\x20\x63\x6f\x6e\x63\x61\x74\x20\x73\x6d\x73\x20\x73\x65\x67\x6d\x65\x6e\x74\x20\x69\x73\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68\x65\x6e\x20\x74\x68\x65\x20\x20\x73\x75\x70\x70\x6f\x72\x74\x65\x64\x20\x73\x65\x67\x6d\x65\x6e\x74\x73\x2c\x73\x6f\x20\x64\x69\x64\x20\x6e\x6f\x74\x20\x64\x65\x61\x6c\x20\x74\x68\x65\x20\x63\x6f\x6e\x63\x61\x74\x20\x73\x6d\x73\x2e"
834);if(WMS_STORAGE_TYPE_NV_V01==db_data->mem_store){zUfiSms_DelModemSms(db_data->
835index);}result=ZUFI_FAIL;}}}if(ts_data_ptr->u.gw_pp.u.submit.dcs.alphabet==
836WMS_GW_ALPHABET_UCS2){result=zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.u.submit.
837user_data.sm_data,ts_data_ptr->u.gw_pp.u.submit.user_data.sm_len,db_data->
838sms_content);db_data->alphabet=WMS_GW_ALPHABET_UCS2;}else if(ts_data_ptr->u.
839gw_pp.u.submit.dcs.alphabet==WMS_GW_ALPHABET_8_BIT){for(ind=(0x1bb+8226-0x21dd);
840ind<ts_data_ptr->u.gw_pp.u.submit.user_data.sm_len;ind++){db_data->sms_content[
841(0x9+8457-0x210e)*ind]=((char)(0x525+4088-0x14ed));db_data->sms_content[
842(0xbd7+5785-0x226c)*ind+(0x11f7+4947-0x2549)]=((char)(0x8b+6563-0x19fe));db_data
843->sms_content[(0x182f+479-0x1a0a)*ind+(0x117+1344-0x655)]=g_zUfiSms_DigAscMap[((
844ts_data_ptr->u.gw_pp.u.submit.user_data.sm_data[ind]&(0x627+1920-0xcb7))>>
845(0x5b2+3787-0x1479))];db_data->sms_content[(0x474+9-0x479)*ind+
846(0x1c5b+2220-0x2504)]=g_zUfiSms_DigAscMap[(ts_data_ptr->u.gw_pp.u.submit.
847user_data.sm_data[ind]&(0x10d+2683-0xb79))];db_data->alphabet=
848WMS_GW_ALPHABET_UCS2;}}else if(ts_data_ptr->u.gw_pp.u.submit.dcs.alphabet==
849WMS_GW_ALPHABET_7_BIT_DEFAULT){result=zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.
850u.submit.user_data.sm_data,ts_data_ptr->u.gw_pp.u.submit.user_data.sm_len,
851db_data->sms_content);db_data->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;db_data->
852tp_dcs=(unsigned char)(0x17c9+2899-0x231a);}return result;}int InvertNumbers(
853const char*pSrc,char*pDst,int nSrcLength){int nDstLength;char ch;int i=
854(0x546+3786-0x1410);if(pSrc==NULL||pDst==NULL||nSrcLength<(0x15f0+995-0x19d3)){
855return-(0x2a0+5032-0x1647);}nDstLength=nSrcLength;for(i=(0x15eb+3155-0x223e);i<
856nSrcLength;i+=(0xa30+4257-0x1acf)){ch=*pSrc++;*pDst++=*pSrc++;*pDst++=ch;}if(
857nSrcLength&(0xd32+1671-0x13b8)){*(pDst-(0x434+841-0x77b))=
858((char)(0x2191+922-0x24e5));nDstLength++;}*pDst='\0';return nDstLength;}int
859code_is_gsm7(const SMS_PARAM*pSrc,unsigned char buf[],int nLength){if(pSrc->
860TP_UDHI==(0x8a8+3752-0x174f)){buf[(0xcb1+1043-0x10c1)]=(unsigned char)nLength;
861buf[(0x245+5619-0x1834)]=(unsigned char)pSrc->TP_UD[(0xd73+6547-0x2706)];buf[
862(0x7f8+1817-0xf0c)]=(0xa3f+4800-0x1cff);buf[(0x3a1+4710-0x1601)]=(unsigned char)
863pSrc->TP_UD[(0x1627+1769-0x1d0e)];buf[(0x1ab8+2077-0x22ce)]=(unsigned char)pSrc
864->TP_UD[(0x82f+755-0xb1f)];buf[(0x108c+775-0x138b)]=(unsigned char)pSrc->TP_UD[
865(0xe2f+5855-0x250a)];buf[(0xa7f+7017-0x25df)]=(unsigned char)pSrc->TP_UD[
866(0x1853+384-0x19ce)];buf[(0x13d1+1805-0x1ad4)]=(unsigned char)pSrc->TP_UD[
867(0xa69+2211-0x1305)];buf[(0x1122+2804-0x1c0c)]=(unsigned char)(buf[
868(0x6d6+3371-0x13f7)]<<(0xca4+5569-0x2264));nLength=nLength-(0x14b+6343-0x1a0b);
869nLength=Encode7bit(&(pSrc->TP_UD[(0xc45+1940-0x13d1)]),&buf[(0xb7a+1061-0xf94)],
870nLength+(0xc07+156-0xca2))+(0xdd0+1389-0x1339)+(0x83+2698-0xb07);
871#if (0x14bf+2826-0x1fc9)
872nLength+=(0x69+3454-0xde5);
873#endif
874}else{nLength=pSrc->TP_UDLength;buf[(0x1728+282-0x183f)]=nLength;nLength=
875Encode7bit(pSrc->TP_UD,&buf[(0x196+6242-0x19f4)],nLength+(0x9b4+2683-0x142e))+
876(0x11c+319-0x257);}at_print(LOG_DEBUG,
877"\x62\x75\x66\x20\x69\x73\x20\x25\x73" "\n",buf);return nLength;}int
878code_is_ucs2(const SMS_PARAM*pSrc,unsigned char buf[],int nLength){nLength=
879strlen(pSrc->TP_UD);if(pSrc->TP_UDHI==(0x301+3236-0xfa4)){buf[
880(0x1938+1924-0x20b9)]=(unsigned char)nLength;buf[(0x222a+182-0x22dc)]=(unsigned
881char)pSrc->TP_UD[(0xcdc+3153-0x192d)];buf[(0x192d+2867-0x245b)]=
882(0xba7+2758-0x166d);buf[(0xe66+2183-0x16e7)]=(unsigned char)pSrc->TP_UD[
883(0xa79+2303-0x1376)];buf[(0x15db+4123-0x25ef)]=(unsigned char)pSrc->TP_UD[
884(0xc4c+3715-0x1acc)];buf[(0x1ea9+582-0x20e7)]=(unsigned char)pSrc->TP_UD[
885(0xc43+4304-0x1d0f)];buf[(0x180+5242-0x15f1)]=(unsigned char)pSrc->TP_UD[
886(0x14c0+2847-0x1fda)];buf[(0x339+89-0x38f)]=(unsigned char)(EncodeUcs2(&(pSrc->
887TP_UD[(0x537+6870-0x2007)]),&buf[(0x2061+256-0x2157)],nLength-
888(0x25a+8583-0x23db))+(0x1147+3818-0x202b));nLength=buf[(0xf07+5133-0x2311)]+
889(0xda3+2128-0x15ef);}else{buf[(0x1191+3656-0x1fd6)]=EncodeUcs2(pSrc->TP_UD,&buf[
890(0x670+7483-0x23a7)],nLength);nLength=buf[(0x3ac+7633-0x217a)]+
891(0xe1d+2513-0x17ea);}return nLength;}int Encode8bit(const char*pSrc,unsigned
892char*pDst,int nSrcLength){if(pSrc==NULL||pDst==NULL||nSrcLength<
893(0x3c2+1748-0xa96)){return-(0x132d+2485-0x1ce1);}memcpy(pDst,pSrc,nSrcLength);
894return nSrcLength;}int EncodePdu_Submit(const SMS_PARAM*pSrc,char*pDst){int
895nLength=(0x5b0+3116-0x11dc);int nDstLength=(0x1194+160-0x1234);unsigned char buf
896[(0x125+7543-0x1d9c)]={(0xcd5+3521-0x1a96)};char tmpSCA[(0x1e4c+207-0x1ef7)]={
897(0xc59+6028-0x23e5)};int check_udl=(0x15e1+1466-0x1b9b);memset(tmpSCA,
898(0x18c+4058-0x1166),sizeof(tmpSCA));if(pSrc==NULL||pDst==NULL){return-
899(0x15c3+2490-0x1f7c);}
900#if (0x1dc6+1598-0x2403)
901printf(
902"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x20\x45\x6e\x63\x6f\x64\x65\x50\x64\x75\x5f\x53\x75\x62\x6d\x69\x74\x20\x6d\x61\x6b\x65\x20\x70\x64\x75\x20\x64\x61\x74\x61" "\n"
903);printf(
904"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x74\x70\x75\x64\x3a\x25\x73" "\n",pSrc
905->TP_UD);printf(
906"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x31\x3a\x25\x73" "\n",
907pDst);printf(
908"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x73\x63\x61\x3a\x25\x73" "\n",pSrc->
909SCA);
910#endif
911nLength=strlen(pSrc->SCA);buf[(0x1f02+1417-0x248b)]=(char)(((nLength)&
912(0xbef+3622-0x1a14))==(0x6bb+5094-0x1aa1)?(nLength):nLength+(0x193d+2736-0x23ec)
913)/(0x1c6+4557-0x1391)+(0x15+7014-0x1b7a);buf[(0x40c+4275-0x14be)]=
914(0x148c+2538-0x1df5);strncpy(tmpSCA,pSrc->SCA,sizeof(tmpSCA)-
915(0x1f39+1812-0x264c));if(!(strncmp(pSrc->SCA,"\x30\x30\x38\x36",
916(0x376+3309-0x105f)))){memset(tmpSCA,(0x542+3515-0x12fd),sizeof(tmpSCA));nLength
917=nLength-(0x3ab+6983-0x1ef1);
918#if (0xfd+4599-0x12f3)
919nLength=nLength-(0x16f7+2381-0x2043);strncpy(tmpSCA,&(pSrc->SCA[
920(0x8f5+1060-0xd17)]),sizeof(tmpSCA)-(0x1b75+1510-0x215a));
921#else
922tmpSCA[(0x20b0+837-0x23f5)]=((char)(0x711+1787-0xde1));strcpy(&(tmpSCA[
923(0x142f+3126-0x2064)]),&(pSrc->SCA[(0x21+2136-0x877)]));
924#endif
925buf[(0xc7d+972-0x1049)]=(char)((nLength&(0x141d+2362-0x1d56))==
926(0x9cd+5567-0x1f8c)?nLength:nLength+(0x8a8+2712-0x133f))/(0x1357+327-0x149c)+
927(0x10f4+1927-0x187a);buf[(0x126+6447-0x1a54)]=(0x3e2+4639-0x1570);}else if(
928((char)(0x1506+1331-0x1a0e))==pSrc->SCA[(0x549+4188-0x15a5)]){memset(tmpSCA,
929(0xab+1347-0x5ee),sizeof(tmpSCA));
930#if (0x23+9935-0x26f1)
931nLength=nLength-(0x1ac4+2142-0x2321);strncpy(tmpSCA,&(pSrc->SCA[(0xc47+82-0xc98)
932]),sizeof(tmpSCA)-(0x845+4295-0x190b));
933#else
934strcpy(tmpSCA,pSrc->SCA);
935#endif
936buf[(0x170+6840-0x1c28)]=(char)((nLength&(0x1483+1179-0x191d))==
937(0xe5d+1262-0x134b)?(nLength):nLength+(0x14a7+1093-0x18eb))/(0x634+1212-0xaee)+
938(0x142a+2430-0x1da7);buf[(0x15bf+2181-0x1e43)]=(0xdc+1016-0x443);}
939#if (0x305+2370-0xc46)
940printf(
941"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x32\x3a\x25\x73" "\n",
942pDst);
943#endif
944if(nLength<(0x462+8527-0x25b0)||nLength>=sizeof(tmpSCA))return-
945(0x5e1+5684-0x1c14);nDstLength=Bytes2String(buf,pDst,(0xa2+1381-0x605));
946nDstLength+=InvertNumbers(tmpSCA,&pDst[nDstLength],nLength);
947#if (0xda0+3198-0x1a1d)
948printf(
949"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x33\x3a\x25\x73" "\n",
950pDst);
951#endif
952if(pSrc->TPA[(0x37+7047-0x1bbe)]==((char)(0x55+8201-0x2033))){nLength=strlen(&(
953pSrc->TPA[(0x10a9+194-0x116a)]));}else{nLength=strlen(pSrc->TPA);}if(pSrc->
954TP_UDHI==(0xb3d+6729-0x2586)){if(pSrc->TP_SRR==(0xc04+1215-0x10c3)){buf[
955(0x64d+3998-0x15eb)]=(0x72a+6573-0x20c6);}if(pSrc->TP_SRR==(0x69b+688-0x94a)){
956buf[(0x7e6+334-0x934)]=(0x1d1a+1496-0x22c1);}}if(pSrc->TP_UDHI==
957(0x236+4328-0x131d)){if(pSrc->TP_SRR==(0x6f7+1355-0xc42)){buf[(0x584+914-0x916)]
958=(0xabf+6960-0x259e);}if(pSrc->TP_SRR==(0xfdb+1844-0x170e)){buf[
959(0xaf9+6854-0x25bf)]=(0x1980+1847-0x2046);}}buf[(0x11e3+1817-0x18fb)]=
960(0xa4b+2521-0x1424);buf[(0x139+6250-0x19a1)]=(char)nLength;if(pSrc->TPA[
961(0xa95+1815-0x11ac)]==((char)(0x97a+7053-0x24dc))){buf[(0x138d+4039-0x2351)]=
962(0x1700+2779-0x214a);nDstLength+=Bytes2String(buf,&pDst[nDstLength],
963(0x12b9+2677-0x1d2a));nDstLength+=InvertNumbers(&(pSrc->TPA[(0x8f4+3826-0x17e5)]
964),&pDst[nDstLength],nLength);}else if(!(strncmp(pSrc->TPA,"\x30\x30\x38\x36",
965(0x1438+4720-0x26a4)))){buf[(0x1bdc+2821-0x26df)]=(char)nLength-
966(0xa0c+500-0xbfe);buf[(0x1135+1845-0x1867)]=(0x3c5+8493-0x2461);nDstLength+=
967Bytes2String(buf,&pDst[nDstLength],(0x2f2+7189-0x1f03));nDstLength+=
968InvertNumbers(&(pSrc->TPA[(0x9ab+7361-0x266a)]),&pDst[nDstLength],nLength-
969(0x1da8+404-0x1f3a));}else{buf[(0xc40+3574-0x1a33)]=(0x884+1739-0xece);
970nDstLength+=Bytes2String(buf,&pDst[nDstLength],(0xbfc+6200-0x2430));nDstLength+=
971InvertNumbers(pSrc->TPA,&pDst[nDstLength],nLength);}
972#if (0x1170+4031-0x212e)
973printf(
974"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x34\x3a\x25\x73" "\n",
975pDst);
976#endif
977nLength=(int)pSrc->TP_UDLength;buf[(0x22fa+253-0x23f7)]=pSrc->TP_PID;buf[
978(0x16d1+1162-0x1b5a)]=pSrc->TP_DCS;buf[(0xdc0+4636-0x1fda)]=pSrc->TP_VP;if(pSrc
979->TP_DCS==CODE_GSM7){nLength=code_is_gsm7(pSrc,buf,nLength);}else if(pSrc->
980TP_DCS==CODE_UCS2){nLength=code_is_ucs2(pSrc,buf,nLength);}else{nLength=strlen(
981pSrc->TP_UD);if(pSrc->TP_UDHI==(0x884+3253-0x1538)){buf[(0x671+2451-0x1001)]=(
982unsigned char)nLength;buf[(0x5f9+5778-0x1c87)]=(unsigned char)pSrc->TP_UD[
983(0xc9f+3347-0x19b2)];buf[(0xf7b+2718-0x1a14)]=(0x76b+3939-0x16ce);buf[
984(0xb59+1948-0x12ef)]=(unsigned char)pSrc->TP_UD[(0x1010+1274-0x1508)];buf[
985(0x13eb+2119-0x1c2b)]=(unsigned char)pSrc->TP_UD[(0x9c3+3130-0x15fa)];buf[
986(0x1208+436-0x13b4)]=(unsigned char)pSrc->TP_UD[(0xb52+5807-0x21fd)];buf[
987(0x526+5716-0x1b71)]=(unsigned char)pSrc->TP_UD[(0x3d3+3248-0x107e)];if(nLength-
988(0x1282+2181-0x1b01)<=(0x655+4947-0x19a8)||nLength-(0x1465+3925-0x23b4)>=sizeof(
989buf)-(0x5a0+8327-0x261d))return-(0x1db+8705-0x23db);buf[(0x78+1881-0x7ce)]=(
990unsigned char)(Encode8bit(&(pSrc->TP_UD[(0xcc2+2604-0x16e8)]),&buf[
991(0xa30+5811-0x20d9)],(unsigned short)(nLength-(0x1081+638-0x12f9)))+
992(0x51b+687-0x7c4));nLength=buf[(0x178f+3351-0x24a3)]+(0x877+1565-0xe90);}else{if
993(nLength<=(0x1f2+4610-0x13f4)||nLength>=sizeof(buf)-(0x24f+3602-0x105d))return-
994(0x103d+4882-0x234e);buf[(0x151b+255-0x1617)]=Encode8bit(pSrc->TP_UD,&buf[
995(0x1f8b+1927-0x270e)],nLength);nLength=buf[(0x11fc+1143-0x1670)]+
996(0x445+3421-0x119e);}}check_udl=nLength-(0x236f+434-0x251d);nDstLength+=
997Bytes2String(buf,&pDst[nDstLength],nLength);cfg_set(NV_CHECK_UDL,"");if(
998check_udl>(0xbba+6180-0x2352)){cfg_set(NV_CHECK_UDL,"\x65\x72\x72\x6f\x72");}
999#if (0x1e11+1270-0x2306)
1000printf(
1001"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x20\x45\x6e\x63\x6f\x64\x65\x50\x64\x75\x5f\x53\x75\x62\x6d\x69\x74\x20\x65\x6e\x64\x20\x6d\x61\x6b\x65\x20\x70\x64\x75\x20\x64\x61\x74\x61" "\n"
1002);printf(
1003"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x6c\x65\x6e\x3a\x25\x64\x2c\x20\x74\x70\x75\x64\x3a\x25\x73" "\n"
1004,nDstLength,pSrc->TP_UD);
1005#endif
1006#if (0x16af+3437-0x241b)
1007printf(
1008"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x35\x3a\x25\x73" "\n",
1009pDst);
1010#endif
1011return nDstLength;}int Decode7bit(const unsigned char*pSrc,char*pDst,int
1012nSrcLength){int nSrc;int nDst;int nByte;unsigned char nLeft;if(pSrc==NULL||pDst
1013==NULL||nSrcLength<(0x482+8841-0x270b)){return-(0xfd4+4528-0x2183);}nSrc=
1014(0x688+7239-0x22cf);nDst=(0x1014+4997-0x2399);nByte=(0xa74+5463-0x1fcb);nLeft=
1015(0xe05+5330-0x22d7);while(nSrc<nSrcLength){*pDst=((*pSrc<<nByte)|nLeft)&
1016(0x953+3954-0x1846);nLeft=*pSrc>>((0x789+5610-0x1d6c)-nByte);pDst++;nDst++;nByte
1017++;if(nByte==(0x11b3+3053-0x1d99)){*pDst=nLeft;pDst++;nDst++;nByte=
1018(0xfc1+2540-0x19ad);nLeft=(0x1541+2822-0x2047);}pSrc++;nSrc++;}*pDst='\0';return
1019 nDst;}int DecodePushPdu(const char*pSrcPdu,SMS_PARAM*pDst){int nDstLength=
1020(0x1045+3981-0x1fd2);unsigned char tmp=(0x20d+2507-0xbd8);int ud_length=
1021(0x6d5+3161-0x132e);unsigned char buf[(0x1f47+1365-0x239c)]={
1022(0x1d37+2087-0x255e)};char temp_num[(0x6bd+699-0x914)]={(0x7ed+204-0x8b9)};
1023unsigned char first_octet=(0xe71+3341-0x1b7e);unsigned char udhl=
1024(0x880+2812-0x137c);unsigned int halftmp=(0x94a+5552-0x1efa);char tp_ra[
1025(0x8c8+2361-0x11fe)]={(0xd+8954-0x2307)};int tmplen=(0x164+4977-0x14d5);unsigned
1026 char IEIDL;int pushType=(0x12e4+660-0x1578);const char*pSrc=pSrcPdu;if(pSrcPdu
1027==NULL||pDst==NULL){printf(
1028"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x70\x61\x72\x61\x20\x6e\x75\x6c\x6c\x2e\x20" "\n"
1029);return-(0x450+8770-0x2691);}String2Bytes(pSrc,&tmp,(0x415+3405-0x1160));
1030at_print(LOG_DEBUG,
1031"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x74\x6d\x70\x20\x3d\x20\x25\x64\x2e" "\n"
1032,tmp);if(tmp==(0x377+8288-0x23d7)){pSrc+=(0x343+7512-0x2099);}else{tmp=(tmp-
1033(0x1238+4081-0x2228))*(0xbbf+2785-0x169e);pSrc+=(0x169b+2444-0x2023);if(tmp>
1034(0x875+6875-0x2330)){SerializeNumbers_sms(pSrc,pDst->SCA,(0xab5+1086-0xed3));tmp
1035=(0x7da+6270-0x2038);}else{SerializeNumbers_sms(pSrc,pDst->SCA,tmp);}pSrc+=tmp;}
1036String2Bytes(pSrc,&tmp,(0x198f+629-0x1c02));first_octet=tmp;pSrc+=
1037(0xfd2+2040-0x17c8);String2Bytes(pSrc,&tmp,(0x3d5+1185-0x874));halftmp=tmp;if(
1038tmp&(0x22a+4263-0x12d0))tmp+=(0x22b0+16-0x22bf);pSrc+=(0x91b+6358-0x21ef);memset
1039(tp_ra,(0xa55+1378-0xfb7),sizeof(tp_ra));String2Bytes(pSrc,tp_ra,
1040(0x116b+2434-0x1aeb));pSrc+=(0xa46+5511-0x1fcb);if((tp_ra[(0x1768+2636-0x21b4)]&
1041(0x81+1707-0x6dc))==(0x74d+6012-0x1e79)){char tempra[(0x4c6+5776-0x1ad6)];char
1042acAsc[(0x16c9+1403-0x1bc4)];if(halftmp>=(0x16a0+2594-0x20b4)){halftmp=(tmp/
1043(0x4d5+5419-0x19fe))/(0x1fe5+1274-0x24d8)+(tmp/(0x241+1308-0x75b));}else{halftmp
1044=tmp/(0x1c9c+384-0x1e1a);}memset(tempra,(0x1df0+2322-0x2702),sizeof(tempra));
1045memcpy(tempra,pSrc,tmp);memset(acAsc,(0x123+1481-0x6ec),sizeof(acAsc));
1046nDstLength=String2Bytes(tempra,buf,halftmp&(0x5cb+2083-0xde7)?(int)halftmp*
1047(0x54a+1135-0x9b2)/(0xc5c+206-0xd26)+(0x12c9+354-0x1429):(int)halftmp*
1048(0x7b0+5884-0x1ea5)/(0x80d+5577-0x1dd2));halftmp=Decode7bit(buf,acAsc,nDstLength
1049);memset(pDst->TPA,(0x18b+2104-0x9c3),sizeof(pDst->TPA));if(halftmp>
1050(0x600+4077-0x15cd)){memcpy(pDst->TPA,acAsc,(0x84+8658-0x2236));tmp=
1051(0x490+1426-0xa02);}else{memcpy(pDst->TPA,acAsc,halftmp);}}else{if(tmp>
1052(0x9e7+5695-0x2006)){SerializeNumbers_sms(pSrc,pDst->TPA,(0x73+8359-0x20fa));}
1053else{SerializeNumbers_sms(pSrc,pDst->TPA,tmp);}if((tp_ra[(0x125f+164-0x1303)]&
1054(0x2127+381-0x2213))==(0x1af9+2603-0x2493)){memset(temp_num,(0xcb6+3901-0x1bf3),
1055sizeof(temp_num));if(pDst->TPA[(0x1da6+2181-0x262b)]!=
1056((char)(0x1d43+1458-0x22ca))){snprintf(temp_num,sizeof(temp_num),
1057"\x25\x73\x25\x73","\x2b",pDst->TPA);if(strlen(temp_num)>(0x1130+1744-0x17e0)){
1058snprintf(pDst->TPA,sizeof(pDst->TPA),"\x25\x33\x32\x73",temp_num);}else{snprintf
1059(pDst->TPA,sizeof(pDst->TPA),"\x25\x73",temp_num);}}}}pSrc+=tmp;String2Bytes(
1060pSrc,(unsigned char*)&pDst->TP_PID,(0x953+383-0xad0));pSrc+=(0xc52+1556-0x1264);
1061String2Bytes(pSrc,(unsigned char*)&pDst->TP_DCS,(0x994+6022-0x2118));pSrc+=
1062(0x1042+225-0x1121);SerializeNumbers_sms(pSrc,pDst->TP_SCTS,(0xa23+2681-0x148e))
1063;pSrc+=(0x38f+7173-0x1f86);String2Bytes(pSrc,&tmp,(0x324+7463-0x2049));pSrc+=
1064(0x213a+475-0x2313);memset(pDst->TP_UD,(0x1e6a+683-0x2115),sizeof(pDst->TP_UD));
1065at_print(LOG_DEBUG,
1066"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x66\x69\x72\x73\x74\x5f\x6f\x63\x74\x65\x74\x20\x3d\x20\x30\x78\x25\x30\x32\x78\x2e" "\n"
1067,first_octet);if(first_octet&(0x15d0+3801-0x2469)){const char*temp=pSrc;unsigned
1068 char pduType;unsigned char wspLen;unsigned char udhLen;unsigned char DestPort1;
1069unsigned char DestPort2;unsigned char RefNum1;unsigned char RefNum2;pushType=
1070SMS_NO_PUSH;String2Bytes(temp,&udhl,(0x60b+4979-0x197c));temp+=
1071(0xe86+2195-0x1717);tmplen=String2Bytes(temp,&pDst->TP_IEI,(0x5af+4682-0x17f7));
1072at_print(LOG_DEBUG,
1073"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x54\x50\x5f\x49\x45\x49\x20\x3d\x20\x30\x78\x25\x30\x32\x78\x2e" "\n"
1074,pDst->TP_IEI);if(pDst->TP_IEI==(0xecd+1692-0x1564)){temp+=(0x5d0+2874-0x1108)*
1075tmplen+(0xa53+820-0xd85);tmplen=String2Bytes(temp,&DestPort1,
1076(0x1c8b+2567-0x2690));at_print(LOG_DEBUG,
1077"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x44\x65\x73\x74\x50\x6f\x72\x74\x31\x20\x3d\x20\x30\x78\x25\x30\x32\x78\x2e" "\n"
1078,DestPort1);temp+=(0x1b28+2413-0x2493)*tmplen;tmplen=String2Bytes(temp,&
1079DestPort2,(0x1d8a+1582-0x23b6));at_print(LOG_DEBUG,
1080"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x44\x65\x73\x74\x50\x6f\x72\x74\x32\x20\x3d\x20\x30\x78\x25\x30\x32\x78\x2e" "\n"
1081,DestPort2);if((DestPort1==(0x1c04+2273-0x24da))&&((DestPort2==
1082(0x2e3+2161-0xad0))||(DestPort2==(0x18d7+2867-0x2385)))){pushType=SMS_PUSH;}}if(
1083SMS_PUSH!=pushType){return pushType;}temp=pSrc+udhl*(0x6a3+4082-0x1693)+
1084(0x14a1+3062-0x2093);tmplen=String2Bytes(temp,&pduType,(0x16f+5337-0x1646));if(
1085pduType==(0x1283+3365-0x1fa2)){pushType=SMS_PUSH;temp+=(0xe22+855-0x1175);tmplen
1086=String2Bytes(temp,&pduType,(0x9d5+28-0x9ef));if(pduType==(0x3c2+2981-0xea3)){
1087pushType=SMS_NOTIFICATION;}else{temp+=(0x613+6595-0x1fd2);tmplen=String2Bytes(
1088temp,&pduType,(0x937+5916-0x2051));if((pduType==(0x1eb8+2269-0x26d3))||(pduType
1089==(0xfaa+2289-0x17e5))){pushType=SMS_BOOTSTRAP;}}}if((pDst->TP_IEI==
1090(0x86a+5538-0x1e08))||(pDst->TP_IEI==(0x1097+3693-0x1eff))||(pDst->TP_IEI==
1091(0xb5b+6376-0x243b))){temp=pSrc+(0x166b+2081-0x1e88);tmplen=String2Bytes(temp,&
1092IEIDL,(0x323+4627-0x1534));if(IEIDL==(udhl-(0x32f+1622-0x983))){}else{temp+=
1093(0x1b22+1067-0x1f4b)*(0x110a+5066-0x24ce);tmplen=String2Bytes(temp,&udhLen,
1094(0x5ed+1424-0xb7b));if(udhLen==(0x2fc+5851-0x19d4)){temp+=(0x12e5+393-0x146c)*
1095tmplen;tmplen=String2Bytes(temp,&RefNum1,(0x93b+643-0xbbc));pDst->TP_ReferNum=
1096RefNum1;temp+=(0xebd+2730-0x1965)*tmplen;tmplen=String2Bytes(temp,&pDst->
1097TP_AllPieceNum,(0x4ad+3471-0x123a));temp+=(0x1527+4462-0x2693)*tmplen;tmplen=
1098String2Bytes(temp,&pDst->TP_CurrentPieceNum,(0xe2f+3422-0x1b8b));temp+=
1099(0x166+4156-0x11a0)*tmplen;}else if(udhLen==(0xfb1+2627-0x19f0)){temp+=
1100(0x1363+4104-0x2369)*tmplen;tmplen=String2Bytes(temp,&RefNum1,(0x8b+1673-0x712))
1101;temp+=(0x1151+3351-0x1e66)*tmplen;tmplen=String2Bytes(temp,&RefNum2,
1102(0x7f7+3197-0x1472));int ReferNum=RefNum2+RefNum1*(0x1601+4227-0x2584);pDst->
1103TP_ReferNum=ReferNum;temp+=(0xd08+2810-0x1800)*tmplen;tmplen=String2Bytes(temp,&
1104pDst->TP_AllPieceNum,(0x607+60-0x641));temp+=(0x16dd+1716-0x1d8f)*tmplen;tmplen=
1105String2Bytes(temp,&pDst->TP_CurrentPieceNum,(0x241+1289-0x748));temp+=
1106(0x202a+1026-0x242a)*tmplen;}}}at_print(LOG_DEBUG,
1107"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x52\x65\x66\x65\x72\x4e\x75\x6d\x20\x3d\x20\x25\x64\x2c\x41\x6c\x6c\x4e\x75\x6d\x20\x3d\x25\x64\x2c\x43\x75\x72\x4e\x75\x6d\x20\x3d\x25\x64\x2e" "\n"
1108,pDst->TP_ReferNum,pDst->TP_AllPieceNum,pDst->TP_CurrentPieceNum);if(
1109SMS_NOTIFICATION==pushType){temp=pSrc+udhl*(0x608+6103-0x1ddd)+
1110(0x30a+3283-0xfd7);tmplen=String2Bytes(temp,&wspLen,(0x7a8+3201-0x1427));temp=
1111temp+wspLen*(0x1d1d+2320-0x262b)+(0x40+5440-0x157e);}else{temp=pSrc+udhl*
1112(0x28a+4892-0x15a4)+(0xfe3+1722-0x169b);}nDstLength=((strlen(temp)<sizeof(pDst->
1113TP_UD))?strlen(temp):(sizeof(pDst->TP_UD)-(0x1304+1347-0x1846)));memcpy(pDst->
1114TP_UD,temp,nDstLength);at_print(LOG_DEBUG,
1115"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x70\x44\x73\x74\x2d\x3e\x54\x50\x5f\x55\x44\x20\x3d\x20\x25\x73\x2e" "\n"
1116,pDst->TP_UD);}at_print(LOG_DEBUG,
1117"\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x70\x75\x73\x68\x54\x79\x70\x65\x20\x3d\x20\x25\x64\x2e" "\n"
1118,pushType);return pushType;}static int SerializeNumbers_sms(const char*pSrc,char
1119*pDst,int nSrcLength){int nDstLength;char ch;int i=(0x18e7+689-0x1b98);if(pSrc==
1120NULL||pDst==NULL||nSrcLength<(0x630+1290-0xb3a)){return-(0x2618+214-0x26ed);}
1121nDstLength=nSrcLength;for(i=(0x9ad+3174-0x1613);i<nSrcLength;i+=
1122(0x2e1+8030-0x223d)){ch=*pSrc++;*pDst++=*pSrc++;*pDst++=ch;}if(*(pDst-
1123(0xe0b+1274-0x1304))==((char)(0x1a5+1957-0x904))){pDst--;nDstLength--;}*pDst=
1124'\0';return nDstLength;}UINT16 wms_ts_pack_gw_7_bit_chars(const UINT8*in,UINT16
1125in_len,UINT16 shift,UINT16 out_len_max,UINT8*out){UINT16 i=(0x945+2952-0x14cd);
1126UINT16 pos=(0x392+4736-0x1612);if(in==NULL||out==NULL){at_print(LOG_DEBUG,
1127"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x70\x61\x63\x6b\x5f\x67\x77\x5f\x37\x5f\x62\x69\x74\x5f\x63\x68\x61\x72\x73"
1128);return(0x99c+5148-0x1db8);}shift%=(0x1445+934-0x17e4);if(shift!=
1129(0x1101+5114-0x24fb)){out[pos]|=(UINT8)(in[i]<<shift);shift=((0x20f2+251-0x21e6)
1130-shift)+(0x15f7+924-0x1992);if(shift==(0x74b+2947-0x12c7)){shift=
1131(0x6b+498-0x25d);i++;}pos++;}for(;pos<out_len_max&&i<in_len;pos++,i++){out[pos]=
1132in[i]>>shift;if(i+(0x9cc+2569-0x13d4)<in_len){out[pos]|=(UINT8)(in[i+
1133(0x124b+3176-0x1eb2)]<<((0x6b2+5473-0x1c0c)-shift));shift++;if(shift==
1134(0x158+5780-0x17e5)){shift=(0x1dd3+1657-0x244c);i++;}}}return pos;}UINT8
1135wms_ts_encode_address(const wms_address_s_type*addr,UINT8*data){UINT8 i,pos=
1136(0x6f6+2090-0xf20);if(addr->number_of_digits>WMS_GW_ADDRESS_MAX){at_print(
1137LOG_DEBUG,
1138"\x41\x64\x64\x72\x20\x6c\x65\x6e\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x20\x25\x64"
1139,addr->number_of_digits);return(0x10cf+2834-0x1be1);}if(addr->number_type==
1140WMS_NUMBER_ALPHANUMERIC){data[pos]=(UINT8)((addr->number_of_digits*
1141(0xb4a+6451-0x2476)+(0x11ea+2042-0x19e1))/(0x584+7731-0x23b3));}else{data[pos]=
1142addr->number_of_digits;}pos++;data[pos]=(0x1888+1069-0x1c35);data[pos]|=(UINT8)(
1143(UINT8)addr->number_type<<(0x1b68+2125-0x23b1));data[pos]|=(UINT8)addr->
1144number_plan;pos++;if(addr->number_type==WMS_NUMBER_ALPHANUMERIC){pos+=(UINT8)
1145wms_ts_pack_gw_7_bit_chars(addr->digits,addr->number_of_digits,
1146(0xa67+6630-0x244d),WMS_GW_ADDRESS_MAX,&data[pos]);}else{for(i=
1147(0x1881+2694-0x2307);i<addr->number_of_digits;i++){data[pos]=(UINT8)(addr->
1148digits[i++]&(0x1ba9+381-0x1d17));{data[pos]|=(UINT8)(addr->digits[i]<<
1149(0x133+7334-0x1dd5));}pos++;}}return pos;}UINT8 wms_ts_encode_dcs(const
1150wms_gw_dcs_s_type*dcs,UINT8*data){UINT8 pos=(0x43b+1608-0xa83);if(dcs->
1151msg_waiting==WMS_GW_MSG_WAITING_NONE){data[pos]=dcs->is_compressed?
1152(0x6ab+7654-0x2471):(0x1007+2001-0x17d8);data[pos]|=(dcs->msg_class!=
1153WMS_MESSAGE_CLASS_NONE)?(0x13c+3317-0xe21):(0xaa8+1169-0xf39);data[pos]|=dcs->
1154alphabet<<(0x7dd+5532-0x1d77);data[pos]|=dcs->msg_class&(0x1cf9+636-0x1f72);}
1155else if(dcs->msg_waiting==WMS_GW_MSG_WAITING_NONE_1111){data[pos]=
1156(0xd89+6740-0x26ed);if(dcs->alphabet==WMS_GW_ALPHABET_8_BIT)data[pos]|=
1157(0x135d+187-0x1414);data[pos]|=dcs->msg_class&(0xd8a+5949-0x24c4);}else{if(dcs->
1158msg_waiting==WMS_GW_MSG_WAITING_DISCARD){data[pos]=(0x19ed+688-0x1bdd);}else if(
1159dcs->msg_waiting==WMS_GW_MSG_WAITING_STORE&&dcs->alphabet==
1160WMS_GW_ALPHABET_7_BIT_DEFAULT){data[pos]=(0x1549+2463-0x1e18);}else{data[pos]=
1161(0xe4d+3595-0x1b78);}data[pos]|=(dcs->msg_waiting_active==TRUE)?
1162(0xafa+3258-0x17ac):(0x6d2+7891-0x25a5);data[pos]|=dcs->msg_waiting_kind&
1163(0x1926+2493-0x22e0);}pos++;return pos;}UINT8 wms_ts_bcd_to_int(const UINT8 bcd,
1164UINT8*result){unsigned char low_bit=(bcd&(0x1c90+2499-0x2644));unsigned char
1165high_bit=((bcd&(0x1cbf+2088-0x23f7))>>(0x10fb+3612-0x1f13));if(low_bit>
1166(0x49+9909-0x26f5)||high_bit>(0x15ef+578-0x1828)){at_print(LOG_DEBUG,
1167"\x49\x6e\x76\x61\x6c\x69\x64\x20\x42\x43\x44\x20\x64\x69\x67\x69\x74\x21");*
1168result=(0x133b+356-0x149f);return FALSE;}else{*result=((bcd&(0x3ff+7117-0x1fbd))
1169+(((bcd&(0x1600+3075-0x2113))>>(0x1294+4948-0x25e4))*(0x933+7162-0x2523)));
1170return TRUE;}}UINT8 wms_ts_encode_timestamp(const wms_timestamp_s_type*timestamp
1171,UINT8*data){sint7 i;UINT8 pos=(0x200+297-0x329),j;if(!wms_ts_bcd_to_int(
1172timestamp->year,&j)){return(0x17f6+3200-0x2476);}data[pos]=((timestamp->year&
1173(0x254d+7-0x2545))<<(0x97a+5565-0x1f33))+((timestamp->year&(0x1ae5+2603-0x2420))
1174>>(0x16f6+1499-0x1ccd));pos++;if(wms_ts_bcd_to_int(timestamp->month,&j)){if(j>
1175(0x211c+546-0x2332)||j<(0x1bf+8075-0x2149)){at_print(LOG_DEBUG,
1176"\x4d\x6f\x6e\x74\x68\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
1177,j);return(0xa18+2743-0x14cf);}}else{return(0x80a+566-0xa40);}data[pos]=((
1178timestamp->month&(0x1355+3025-0x1f17))<<(0x14b6+3531-0x227d))+((timestamp->month
1179&(0x14c7+4294-0x249d))>>(0x2a1+9235-0x26b0));pos++;if(wms_ts_bcd_to_int(
1180timestamp->day,&j)){if(j>(0x129b+2982-0x1e22)||j<(0x457+6872-0x1f2e)){at_print(
1181LOG_DEBUG,
1182"\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);
1183return(0x576+3650-0x13b8);}}else{return(0x599+7298-0x221b);}data[pos]=((
1184timestamp->day&(0x17f1+3778-0x26a4))<<(0xde7+1848-0x151b))+((timestamp->day&
1185(0x444+940-0x700))>>(0x50a+7118-0x20d4));pos++;if(wms_ts_bcd_to_int(timestamp->
1186hour,&j)){if(j>(0x1573+1287-0x1a63)){at_print(LOG_DEBUG,
1187"\x48\x6f\x75\x72\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j
1188);return(0xb6b+4971-0x1ed6);}}else{return(0x8a0+2440-0x1228);}data[pos]=((
1189timestamp->hour&(0x7e8+797-0xaf6))<<(0x919+3498-0x16bf))+((timestamp->hour&
1190(0x1307+4888-0x252f))>>(0x1a7+3740-0x103f));pos++;if(wms_ts_bcd_to_int(timestamp
1191->minute,&j)){if(j>(0xba8+6154-0x2377)){at_print(LOG_DEBUG,
1192"\x4d\x69\x6e\x75\x74\x65\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
1193,j);return(0x45+8299-0x20b0);}}else{return(0x5a5+6567-0x1f4c);}data[pos]=((
1194timestamp->minute&(0xa7d+1894-0x11d4))<<(0x261+8410-0x2337))+((timestamp->minute
1195&(0x2a6+5035-0x1561))>>(0x1414+2232-0x1cc8));pos++;if(wms_ts_bcd_to_int(
1196timestamp->second,&j)){if(j>(0x1af+961-0x535)){at_print(LOG_DEBUG,
1197"\x53\x65\x63\x6f\x6e\x64\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
1198,j);return(0x10a6+295-0x11cd);}}else{return(0x1a9+3969-0x112a);}data[pos]=((
1199timestamp->second&(0x70+4809-0x132a))<<(0x940+2876-0x1478))+((timestamp->second&
1200(0x4c5+6467-0x1d18))>>(0x20cb+1602-0x2709));pos++;i=(sint7)timestamp->timezone;
1201if(i>(0x4a5+7946-0x237f)||i<-(0x10f3+3903-0x2002)){at_print(LOG_DEBUG,
1202"\x54\x69\x6d\x65\x7a\x6f\x6e\x65\x20\x69\x73\x20\x6f\x75\x74\x20\x6f\x66\x20\x62\x6f\x75\x6e\x64\x3a\x20\x25\x64"
1203,i);return(0x19b7+2324-0x22cb);}if(i>=(0xe15+5515-0x23a0)){data[pos]=(UINT8)(((
1204UINT8)(i%(0xba2+3101-0x17b5)))<<(0xdfb+6129-0x25e8));data[pos]|=(i/
1205(0xef3+489-0x10d2));}else{i*=(-(0x167+5644-0x1772));data[pos]=(UINT8)(((UINT8)(i
1206%(0x121f+2132-0x1a69)))<<(0x6b1+1808-0xdbd));data[pos]|=(i/(0x34b+3199-0xfc0));
1207data[pos]|=(0xf57+941-0x12fc);}pos++;return pos;}UINT8 wms_ts_get_udh_length(
1208const wms_udh_s_type*udh){UINT8 length=(0x232+7582-0x1fd0);if(udh!=NULL){switch(
1209udh->header_id){case WMS_UDH_CONCAT_8:length=(0x1a6c+1219-0x1f2e)+
1210(0xee1+3480-0x1c78)+WMS_UDH_OCTETS_CONCAT8;break;case WMS_UDH_CONCAT_16:length=
1211(0xe0d+1401-0x1385)+(0x91c+6408-0x2223)+WMS_UDH_OCTETS_CONCAT16;break;case
1212WMS_UDH_SPECIAL_SM:length=(0x72a+2721-0x11ca)+(0x1987+1045-0x1d9b)+
1213WMS_UDH_OCTETS_SPECIAL_SM;break;case WMS_UDH_PORT_8:length=(0x140b+1359-0x1959)+
1214(0x2005+494-0x21f2)+WMS_UDH_OCTETS_PORT8;break;case WMS_UDH_PORT_16:length=
1215(0x719+1988-0xedc)+(0x1602+3231-0x22a0)+WMS_UDH_OCTETS_PORT16;break;case
1216WMS_UDH_SMSC_CONTROL:length=(0x4ef+6906-0x1fe8)+(0xbf5+5468-0x2150)+udh->u.other
1217.header_length;break;case WMS_UDH_SOURCE:length=(0x1647+2317-0x1f53)+
1218(0x10f3+1595-0x172d)+udh->u.other.header_length;break;case WMS_UDH_WCMP:length=
1219(0x11ac+3260-0x1e67)+(0x39+3461-0xdbd)+udh->u.other.header_length;break;case
1220WMS_UDH_TEXT_FORMATING:if(!udh->u.text_formating.is_color_present){length=
1221(0xfad+5313-0x246d)+(0x313+4353-0x1413)+WMS_UDH_OCTETS_TEXT_FORMATTING;}else{
1222length=(0x1448+1119-0x18a6)+(0x1aba+323-0x1bfc)+WMS_UDH_OCTETS_TEXT_FORMATTING+
1223(0x14af+56-0x14e6);}break;case WMS_UDH_PRE_DEF_SOUND:length=(0x37a+5520-0x1909)+
1224(0xb69+1360-0x10b8)+WMS_UDH_OCTETS_PRE_DEF;break;case WMS_UDH_USER_DEF_SOUND:
1225length=(0xc9d+5090-0x207e)+(0x15e4+2531-0x1fc6)+udh->u.user_def_sound.
1226data_length+(0x515+4526-0x16c2);break;case WMS_UDH_PRE_DEF_ANIM:length=
1227(0x66d+326-0x7b2)+(0xdf1+6412-0x26fc)+WMS_UDH_OCTETS_PRE_DEF;break;case
1228WMS_UDH_LARGE_ANIM:length=(0x1045+3859-0x1f57)+(0xc82+3655-0x1ac8)+
1229WMS_UDH_LARGE_BITMAP_SIZE*WMS_UDH_ANIM_NUM_BITMAPS+(0xc0b+1572-0x122e);break;
1230case WMS_UDH_SMALL_ANIM:length=(0xe9+4521-0x1291)+(0x219+697-0x4d1)+
1231WMS_UDH_SMALL_BITMAP_SIZE*WMS_UDH_ANIM_NUM_BITMAPS+(0xf14+3261-0x1bd0);break;
1232case WMS_UDH_LARGE_PICTURE:length=(0x1360+2675-0x1dd2)+(0x1928+351-0x1a86)+
1233WMS_UDH_LARGE_PIC_SIZE+(0x1277+5061-0x263b);break;case WMS_UDH_SMALL_PICTURE:
1234length=(0xedf+2179-0x1761)+(0x1307+1142-0x177c)+WMS_UDH_SMALL_PIC_SIZE+
1235(0x854+5591-0x1e2a);break;case WMS_UDH_VAR_PICTURE:length=(0x167+344-0x2be)+
1236(0x19fc+1301-0x1f10)+(UINT8)(udh->u.var_picture.height*udh->u.var_picture.width/
1237(0x931+4020-0x18dd))+(0x2f1+121-0x367);break;case WMS_UDH_RFC822:length=
1238(0x1e7+9419-0x26b1)+(0x65c+4142-0x1689)+WMS_UDH_OCTETS_RFC822;break;case
1239WMS_UDH_NAT_LANG_SS:length=(0xfcf+4411-0x2109)+(0x20ea+1473-0x26aa)+
1240WMS_UDH_OCTETS_NAT_LANG_SS;break;case WMS_UDH_NAT_LANG_LS:length=
1241(0x1211+2692-0x1c94)+(0x15+5073-0x13e5)+WMS_UDH_OCTETS_NAT_LANG_LS;break;case
1242WMS_UDH_USER_PROMPT:length=(0x55f+5233-0x19cf)+(0x114b+1924-0x18ce)+
1243WMS_UDH_OCTETS_USER_PROMPT;break;case WMS_UDH_EXTENDED_OBJECT:length=
1244(0x1403+34-0x1424)+(0x1393+619-0x15fd)+udh->u.eo.content.length;if(udh->u.eo.
1245first_segment==TRUE){length+=WMS_UDH_OCTETS_EO_HEADER;}break;default:length=
1246(0x969+4080-0x1958)+(0x36f+858-0x6c8)+udh->u.other.header_length;break;}}return
1247length;}uint32 wms_ts_compute_user_data_header_length(const UINT8 num_headers,
1248const wms_udh_s_type*headers){uint32 length=(0xd35+2573-0x1742);uint32 i;if(
1249headers==NULL){at_print(LOG_DEBUG,
1250"\x4e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x63\x6f\x6d\x70\x75\x74\x65\x5f\x75\x73\x65\x72\x5f\x64\x61\x74\x61\x5f\x68\x65\x61\x64\x65\x72\x5f\x6c\x65\x6e\x67\x74\x68\x21"
1251);return(0x5e3+3867-0x14fe);}if(num_headers>(0xfe3+3275-0x1cae)){length+=
1252(0x121a+4873-0x2522);for(i=(0x43c+7489-0x217d);i<num_headers&&i<
1253WMS_MAX_UD_HEADERS;i++){length+=(uint32)wms_ts_get_udh_length(&headers[i]);}}
1254return length;}uint32 wms_ts_compute_gw_user_data_length(const wms_gw_dcs_s_type
1255*dcs,const wms_gw_user_data_s_type*user_data){uint32 length=(0x2006+486-0x21ec);
1256if(dcs==NULL||user_data==NULL){at_print(LOG_DEBUG,
1257"\x4e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x63\x6f\x6d\x70\x75\x74\x65\x5f\x67\x77\x5f\x75\x73\x65\x72\x5f\x64\x61\x74\x61\x5f\x6c\x65\x6e\x67\x74\x68\x21"
1258);return(0x1c9+815-0x4f8);}length+=wms_ts_compute_user_data_header_length(
1259user_data->num_headers,user_data->headers);if(dcs->alphabet==
1260WMS_GW_ALPHABET_7_BIT_DEFAULT){length+=((user_data->sm_len*(0x7f1+4886-0x1b00))+
1261(0x1348+3450-0x20bb))/(0xa80+1380-0xfdc);}else{length+=user_data->sm_len;}return
1262 length;}static int wms_ts_encode_udh_concat_8(UINT8*udh){int pos=
1263(0x4c7+4508-0x1663);if(const_header->u.concat_8.total_sm==(0x159d+2186-0x1e27)||
1264const_header->u.concat_8.seq_num==(0x22c6+125-0x2343)||const_header->u.concat_8.
1265seq_num>const_header->u.concat_8.total_sm){at_print(LOG_DEBUG,
1266"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x69\x64\x20\x25\x64\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x6e\x6f\x20\x44\x61\x74\x61"
1267,const_header->header_id);return(0x454+8860-0x26f0);}udh[pos++]=(UINT8)
1268WMS_UDH_CONCAT_8;udh[pos++]=(UINT8)WMS_UDH_OCTETS_CONCAT8;udh[pos++]=
1269const_header->u.concat_8.msg_ref;udh[pos++]=const_header->u.concat_8.total_sm;
1270udh[pos++]=const_header->u.concat_8.seq_num;return pos;}static int
1271wms_ts_encode_udh_concat16(UINT8*udh){int pos=(0xe94+214-0xf6a);if(const_header
1272->u.concat_16.total_sm==(0xb7b+6154-0x2385)||const_header->u.concat_16.seq_num==
1273(0x1251+5231-0x26c0)||const_header->u.concat_16.seq_num>const_header->u.
1274concat_16.total_sm){at_print(LOG_DEBUG,
1275"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x69\x64\x20\x25\x64\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x6e\x6f\x20\x44\x61\x74\x61"
1276,const_header->header_id);return(0x1133+3516-0x1eef);}udh[pos++]=(UINT8)
1277WMS_UDH_CONCAT_16;udh[pos++]=(UINT8)WMS_UDH_OCTETS_CONCAT16;udh[pos++]=(UINT8)((
1278const_header->u.concat_16.msg_ref&65280)>>(0x8d0+5482-0x1e32));udh[pos++]=(UINT8
1279)(const_header->u.concat_16.msg_ref&(0x64a+2654-0xfa9));udh[pos++]=const_header
1280->u.concat_16.total_sm;udh[pos++]=const_header->u.concat_16.seq_num;return pos;}
1281int wms_ts_encode_udh_nat_lang_ss(UINT8*udh){int pos=(0x35d+8701-0x255a);udh[pos
1282++]=(UINT8)WMS_UDH_NAT_LANG_SS;udh[pos++]=(UINT8)WMS_UDH_OCTETS_NAT_LANG_SS;udh[
1283pos++]=(UINT8)const_header->u.nat_lang_ss.nat_lang_id;return pos;}int
1284wms_ts_encode_udh_nat_lang_ls(UINT8*udh){int pos=(0x10ca+220-0x11a6);udh[pos++]=
1285(UINT8)WMS_UDH_NAT_LANG_LS;udh[pos++]=(UINT8)WMS_UDH_OCTETS_NAT_LANG_LS;udh[pos
1286++]=(UINT8)const_header->u.nat_lang_ls.nat_lang_id;return pos;}int
1287wms_ts_encode_udh_other(UINT8*udh,wms_udh_id_e_type header_id){int i=
1288(0x103a+2251-0x1905);int pos=(0x6ea+6265-0x1f63);udh[pos++]=(UINT8)const_header
1289->u.other.header_id;udh[pos++]=const_header->u.other.header_length;for(i=
1290(0xe66+3219-0x1af9);i<const_header->u.other.header_length;i++){udh[pos++]=
1291const_header->u.other.data[i];}return pos;}UINT8 wms_ts_encode_user_data_header(
1292UINT8 num_headers,const wms_udh_s_type*headers,UINT8*data){int i,pos=
1293(0x153c+4331-0x2627);if(num_headers==(0x2e8+1487-0x8b7))return
1294(0x1f77+249-0x2070);++pos;for(i=(0x1315+3935-0x2274);i<WMS_MAX_UD_HEADERS&&i<
1295num_headers;i++){const_header=&headers[i];switch(const_header->header_id){case
1296WMS_UDH_CONCAT_8:pos+=wms_ts_encode_udh_concat_8(data+pos);break;case
1297WMS_UDH_CONCAT_16:pos+=wms_ts_encode_udh_concat16(data+pos);break;
1298#if (0x1506+948-0x18ba)
1299case WMS_UDH_SPECIAL_SM:pos+=wms_ts_encode_udh_special_sm(data+pos);break;case
1300WMS_UDH_PORT_8:pos+=wms_ts_encode_udh_port_8(data+pos);break;case
1301WMS_UDH_PORT_16:pos+=wms_ts_encode_udh_port16(data+pos);break;case
1302WMS_UDH_TEXT_FORMATING:pos+=wms_ts_encode_udh_text_formatting(data+pos);break;
1303case WMS_UDH_PRE_DEF_SOUND:pos+=wms_ts_encode_udh_pre_def_sound(data+pos);break;
1304case WMS_UDH_USER_DEF_SOUND:pos+=wms_ts_encode_udh_user_def_sound(data+pos);
1305break;case WMS_UDH_PRE_DEF_ANIM:pos+=wms_ts_encode_udh_pre_def_anim(data+pos);
1306break;case WMS_UDH_LARGE_ANIM:pos+=wms_ts_encode_udh_large_anim(data+pos);break;
1307case WMS_UDH_SMALL_ANIM:pos+=wms_ts_encode_udh_small_anim(data+pos);break;case
1308WMS_UDH_LARGE_PICTURE:pos+=wms_ts_encode_udh_large_picture(data+pos);break;case
1309WMS_UDH_SMALL_PICTURE:pos+=wms_ts_encode_udh_small_picture(data+pos);break;case
1310WMS_UDH_VAR_PICTURE:pos+=wms_ts_encode_udh_var_picture(data+pos);break;case
1311WMS_UDH_USER_PROMPT:pos+=wms_ts_encode_udh_user_prompt(data+pos);break;case
1312WMS_UDH_EXTENDED_OBJECT:pos+=wms_ts_encode_udh_eo(data+pos);break;case
1313WMS_UDH_RFC822:pos+=wms_ts_encode_udh_rfc822(data+pos);break;
1314#endif
1315case WMS_UDH_NAT_LANG_SS:pos+=wms_ts_encode_udh_nat_lang_ss(data+pos);break;case
1316 WMS_UDH_NAT_LANG_LS:pos+=wms_ts_encode_udh_nat_lang_ls(data+pos);break;default:
1317pos+=wms_ts_encode_udh_other(data+pos,const_header->header_id);}}data[
1318(0x16+9188-0x23fa)]=(UINT8)(pos-(0xa79+6961-0x25a9));return((UINT8)(pos-
1319(0x1e9+6260-0x1a5c)));}UINT8 wms_ts_encode_gw_user_data(const wms_gw_dcs_s_type*
1320dcs,const wms_gw_user_data_s_type*user_data,UINT8*data){UINT16 i,pos=
1321(0xfd0+818-0x1302);UINT8 fill_bits=(0x1486+1058-0x18a8);UINT16
1322total_bits_occupied;UINT8 user_data_header_length;UINT16 user_data_length;data[
1323pos]=(UINT8)user_data->sm_len;pos++;if(dcs->alphabet==
1324WMS_GW_ALPHABET_7_BIT_DEFAULT){if(user_data->num_headers>(0xa0a+3698-0x187c)){if
1325(wms_ts_compute_user_data_header_length(user_data->num_headers,user_data->
1326headers)<=WMS_SMS_UDL_MAX_8_BIT){user_data_header_length=
1327wms_ts_encode_user_data_header(user_data->num_headers,user_data->headers,data+
1328pos);pos+=user_data_header_length+(0x1a9f+1547-0x20a9);total_bits_occupied=(
1329user_data_header_length+(0xaef+5079-0x1ec5))*(0x195f+1795-0x205a);fill_bits=(
1330total_bits_occupied%(0x470+4254-0x1507));if(fill_bits!=(0xab1+1611-0x10fc)){
1331fill_bits=(0x1729+1040-0x1b32)-fill_bits;}user_data_length=(total_bits_occupied+
1332fill_bits+(user_data->sm_len*(0x306+8424-0x23e7)))/(0xc08+2429-0x157e);data[
1333(0x12f0+3751-0x2197)]=(UINT8)user_data_length;data[(0xcd+2862-0xbfa)]=
1334user_data_header_length;}else{at_print(LOG_DEBUG,
1335"\x45\x6e\x63\x6f\x64\x65\x20\x55\x73\x65\x72\x20\x44\x61\x74\x61\x20\x48\x65\x61\x64\x65\x72\x20\x45\x78\x63\x65\x65\x64\x73\x20\x43\x61\x70\x61\x63\x69\x74\x79\x20\x2d\x20\x53\x6b\x69\x70\x70\x69\x6e\x67\x20\x55\x44\x48"
1336);}}i=wms_ts_pack_gw_7_bit_chars(user_data->sm_data,user_data->sm_len,fill_bits,
1337(UINT16)(WMS_MAX_LEN-pos),&data[pos]);pos+=i;}else{if(user_data->num_headers>
1338(0x1e6+8305-0x2257)){if(wms_ts_compute_user_data_header_length(user_data->
1339num_headers,user_data->headers)<=WMS_SMS_UDL_MAX_8_BIT){user_data_header_length=
1340wms_ts_encode_user_data_header(user_data->num_headers,user_data->headers,data+
1341pos);data[(0x5f1+6558-0x1f8f)]=(UINT8)(user_data->sm_len+user_data_header_length
1342+(0x488+2356-0xdbb));pos+=user_data_header_length+(0x44+9057-0x23a4);}else{
1343at_print(LOG_DEBUG,
1344"\x45\x6e\x63\x6f\x64\x65\x20\x55\x73\x65\x72\x20\x44\x61\x74\x61\x20\x48\x65\x61\x64\x65\x72\x20\x45\x78\x63\x65\x65\x64\x73\x20\x43\x61\x70\x61\x63\x69\x74\x79\x20\x2d\x20\x53\x6b\x69\x70\x70\x69\x6e\x67\x20\x55\x44\x48"
1345);}}memcpy(&data[pos],user_data->sm_data,user_data->sm_len);pos+=user_data->
1346sm_len;}return(UINT8)pos;}wms_status_e_type wms_ts_encode_deliver(const
1347wms_gw_deliver_s_type*deliver,T_zUfiSms_RawTsData*raw_ts_data_ptr){
1348wms_status_e_type st=WMS_OK_S;UINT8*data;UINT8 pos=(0x1fd0+1457-0x2581),i;if(
1349deliver==NULL||raw_ts_data_ptr==NULL){at_print(LOG_DEBUG,
1350"\x4e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x65\x6e\x63\x6f\x64\x65\x5f\x64\x65\x6c\x69\x76\x65\x72\x21"
1351);return WMS_NULL_PTR_S;}data=raw_ts_data_ptr->data;(void)memset(data,
1352(0x21bd+916-0x2551),WMS_MAX_LEN);data[pos]=(0x1767+778-0x1a71);data[pos]|=
1353deliver->more?(0x424+6392-0x1d1c):(0xc3f+5281-0x20dc);data[pos]|=deliver->
1354status_report_enabled?(0x34d+7496-0x2075):(0x18c+1427-0x71f);data[pos]|=deliver
1355->user_data_header_present?(0xe07+2674-0x1839):(0x175+6294-0x1a0b);data[pos]|=
1356deliver->reply_path_present?(0x9e2+1028-0xd66):(0x5e1+6469-0x1f26);pos++;i=
1357wms_ts_encode_address(&deliver->address,&data[pos]);if(i==(0x62a+5302-0x1ae0)){
1358return WMS_INVALID_PARM_SIZE_S;}pos+=i;data[pos]=deliver->pid;pos++;pos+=
1359wms_ts_encode_dcs(&deliver->dcs,data+pos);i=wms_ts_encode_timestamp(&deliver->
1360timestamp,data+pos);if(i==(0xaff+1663-0x117e)){return WMS_INVALID_PARM_VALUE_S;}
1361pos+=i;if(wms_ts_compute_gw_user_data_length(&deliver->dcs,&deliver->user_data)>
1362WMS_SMS_UDL_MAX_8_BIT){at_print(LOG_DEBUG,
1363"\x55\x73\x65\x72\x20\x44\x61\x74\x61\x20\x4c\x65\x6e\x67\x74\x68\x20\x68\x61\x73\x20\x65\x78\x63\x65\x65\x64\x65\x64\x20\x63\x61\x70\x61\x63\x69\x74\x79"
1364);st=WMS_INVALID_USER_DATA_SIZE_S;}else{i=wms_ts_encode_gw_user_data(&deliver->
1365dcs,&deliver->user_data,data+pos);pos+=i;}raw_ts_data_ptr->tpdu_type=
1366WMS_TPDU_DELIVER;raw_ts_data_ptr->len=pos;return st;}UINT8
1367wms_ts_encode_relative_time(const wms_timestamp_s_type*timestamp){uint32 i;UINT8
1368 v=(0x9c5+4635-0x1be0),j;if(timestamp!=NULL){if(!wms_ts_bcd_to_int(timestamp->
1369year,&j)){at_print(LOG_DEBUG,
1370"\x59\x65\x61\x72\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j
1371);}i=j*(0xf52+4799-0x20a4);if(!wms_ts_bcd_to_int(timestamp->month,&j)){at_print(
1372LOG_DEBUG,
1373"\x4d\x6f\x6e\x74\x68\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
1374,j);}i=i+j*(0x640+7011-0x2185);if(!wms_ts_bcd_to_int(timestamp->day,&j)){
1375at_print(LOG_DEBUG,
1376"\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);}i
1377+=j;if(i>(0x57b+6561-0x1efe)){v=(UINT8)((i+(0x465+8417-0x2540))/
1378(0x1357+1291-0x185b)+(0x30f+183-0x306));}else if(i>=(0x858+4454-0x19bd)){v=(
1379UINT8)(i+(0xcaa+437-0xdb9));}else{if(!wms_ts_bcd_to_int(timestamp->day,&j)){
1380at_print(LOG_DEBUG,
1381"\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);}i
1382=j*(0xa51+940-0xde5)*(0xbfc+1256-0x10a8);if(!wms_ts_bcd_to_int(timestamp->hour,&
1383j)){at_print(LOG_DEBUG,
1384"\x48\x6f\x75\x72\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j
1385);}i=i+j*(0x140f+1225-0x189c);if(!wms_ts_bcd_to_int(timestamp->minute,&j)){
1386at_print(LOG_DEBUG,
1387"\x4d\x69\x6e\x75\x74\x65\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
1388,j);}i+=j;if(i>(0xc48+2214-0x14e2)*(0xb92+4319-0x1c35)){v=(UINT8)((i-((
1389(0x108+4152-0x1134)*(0x23bd+93-0x23de))+(0xc03+3825-0x1ad7)))/(0x8a+8919-0x2343)
1390+(0xab2+5060-0x1de7));}else{v=(UINT8)((i+(0x122a+1381-0x178b))/
1391(0x1b85+1032-0x1f88)-(0x815+4089-0x180d));}}}else{at_print(LOG_DEBUG,
1392"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x65\x6e\x63\x6f\x64\x65\x5f\x72\x65\x6c\x61\x74\x69\x76\x65\x5f\x74\x69\x6d\x65"
1393);}return v;}UINT8 wms_ts_encode_gw_validity(const wms_gw_validity_s_type*
1394validity,UINT8*data){UINT8 i,pos=(0x8fd+4575-0x1adc);switch(validity->format){
1395case WMS_GW_VALIDITY_NONE:break;case WMS_GW_VALIDITY_RELATIVE:data[pos]=
1396wms_ts_encode_relative_time(&validity->u.time);pos++;break;case
1397WMS_GW_VALIDITY_ABSOLUTE:i=wms_ts_encode_timestamp(&validity->u.time,data+pos);
1398if(i==(0xd0d+3884-0x1c39)){at_print(LOG_DEBUG,
1399"\x45\x72\x72\x6f\x72\x20\x77\x68\x69\x6c\x65\x20\x44\x65\x63\x6f\x64\x69\x6e\x67\x20\x41\x62\x73\x6f\x6c\x75\x74\x65\x20\x56\x61\x6c\x69\x64\x69\x74\x79\x20\x54\x69\x6d\x65\x73\x74\x61\x6d\x70"
1400);}pos+=i;break;case WMS_GW_VALIDITY_ENHANCED:break;default:break;}return pos;}
1401wms_status_e_type wms_ts_encode_submit(const wms_gw_submit_s_type*submit,
1402T_zUfiSms_RawTsData*raw_ts_data_ptr){wms_status_e_type st=WMS_OK_S;UINT8*data;
1403UINT8 pos=(0xa2b+1046-0xe41),i;if(submit==NULL||raw_ts_data_ptr==NULL){at_print(
1404LOG_DEBUG,
1405"\x4e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x65\x6e\x63\x6f\x64\x65\x5f\x73\x75\x62\x6d\x69\x74\x21"
1406);return WMS_NULL_PTR_S;}data=raw_ts_data_ptr->data;(void)memset(data,
1407(0x592+4759-0x1829),WMS_MAX_LEN);data[pos]=(0xd6a+3358-0x1a87);data[pos]|=submit
1408->reject_duplicates?(0x6f0+6837-0x21a1):(0x32f+7780-0x2193);if(submit->validity.
1409format>(0xb94+6696-0x25b9)){return st=WMS_INVALID_VALIDITY_FORMAT_S;}data[pos]|=
1410submit->validity.format<<(0x8a1+2019-0x1081);data[pos]|=submit->
1411status_report_enabled?(0x82d+4680-0x1a55):(0x72c+998-0xb12);data[pos]|=submit->
1412user_data_header_present?(0x440+4713-0x1669):(0x23c+669-0x4d9);data[pos]|=submit
1413->reply_path_present?(0x152f+1137-0x1920):(0x1fd+946-0x5af);pos++;data[pos]=(
1414UINT8)submit->message_reference;pos++;i=wms_ts_encode_address(&submit->address,&
1415data[pos]);if(i==(0x6bf+7368-0x2387)){return WMS_INVALID_PARM_SIZE_S;}pos+=i;
1416data[pos]=submit->pid;pos++;pos+=wms_ts_encode_dcs(&submit->dcs,data+pos);pos+=
1417wms_ts_encode_gw_validity(&submit->validity,data+pos);if(
1418wms_ts_compute_gw_user_data_length(&submit->dcs,&submit->user_data)>
1419WMS_SMS_UDL_MAX_8_BIT){at_print(LOG_DEBUG,
1420"\x55\x73\x65\x72\x20\x44\x61\x74\x61\x20\x4c\x65\x6e\x67\x74\x68\x20\x68\x61\x73\x20\x65\x78\x63\x65\x65\x64\x65\x64\x20\x63\x61\x70\x61\x63\x69\x74\x79"
1421);st=WMS_INVALID_USER_DATA_SIZE_S;}else{i=wms_ts_encode_gw_user_data(&submit->
1422dcs,&submit->user_data,data+pos);pos+=i;}raw_ts_data_ptr->tpdu_type=
1423WMS_TPDU_SUBMIT;raw_ts_data_ptr->len=pos;return st;}wms_status_e_type
1424wms_ts_encode_status_report(const wms_gw_status_report_s_type*status_report,
1425T_zUfiSms_RawTsData*raw_ts_data_ptr){wms_status_e_type st=WMS_OK_S;UINT8*data;
1426UINT8 pos=(0x253f+295-0x2666),i;if(status_report==NULL||raw_ts_data_ptr==NULL){
1427at_print(LOG_DEBUG,
1428"\x4e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x65\x6e\x63\x6f\x64\x65\x5f\x73\x74\x61\x74\x75\x73\x5f\x72\x65\x70\x6f\x72\x74\x21"
1429);return WMS_NULL_PTR_S;}data=raw_ts_data_ptr->data;(void)memset(data,
1430(0x1aac+2967-0x2643),WMS_MAX_LEN);data[pos]=(0x11ed+2697-0x1c66);data[pos]|=
1431status_report->more?(0xb84+4869-0x1e89):(0x13c5+1517-0x19ae);data[pos]|=
1432status_report->status_report_qualifier?(0x72c+851-0xa5f):(0x462+7768-0x22ba);
1433data[pos]|=status_report->user_data_header_present?(0x2e0+2911-0xdff):
1434(0x79+2885-0xbbe);pos++;data[pos]=(UINT8)status_report->message_reference;pos++;
1435i=wms_ts_encode_address(&status_report->address,&data[pos]);if(i==
1436(0x697+2922-0x1201)){return WMS_INVALID_PARM_SIZE_S;}pos+=i;i=
1437wms_ts_encode_timestamp(&status_report->timestamp,data+pos);if(i==
1438(0x8a6+1431-0xe3d)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;i=
1439wms_ts_encode_timestamp(&status_report->discharge_time,data+pos);if(i==
1440(0x517+6785-0x1f98)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;data[pos]=
1441status_report->tp_status;pos++;data[pos]=(UINT8)status_report->mask;pos++;if(
1442status_report->mask&WMS_TPDU_MASK_PID){data[pos]=status_report->pid;pos++;}if(
1443status_report->mask&WMS_TPDU_MASK_DCS){pos+=wms_ts_encode_dcs(&status_report->
1444dcs,data+pos);}if(status_report->mask&WMS_TPDU_MASK_USER_DATA){if(
1445wms_ts_compute_gw_user_data_length(&status_report->dcs,&status_report->user_data
1446)>WMS_SMS_UDL_MAX_8_BIT){at_print(LOG_DEBUG,
1447"\x55\x73\x65\x72\x20\x44\x61\x74\x61\x20\x4c\x65\x6e\x67\x74\x68\x20\x68\x61\x73\x20\x65\x78\x63\x65\x65\x64\x65\x64\x20\x63\x61\x70\x61\x63\x69\x74\x79"
1448);st=WMS_INVALID_USER_DATA_SIZE_S;}else{i=wms_ts_encode_gw_user_data(&
1449status_report->dcs,&status_report->user_data,data+pos);pos+=i;}}raw_ts_data_ptr
1450->tpdu_type=WMS_TPDU_STATUS_REPORT;raw_ts_data_ptr->len=pos;return st;}
1451wms_status_e_type wms_ts_encode(const T_zUfiSms_ClientTsData*ptClientTsData,
1452T_zUfiSms_RawTsData*ptRawTsData){wms_status_e_type st=WMS_OK_S;const
1453wms_gw_pp_ts_data_s_type*msg;if(ptClientTsData==NULL||ptRawTsData==NULL){return
1454WMS_NULL_PTR_S;}msg=&ptClientTsData->u.gw_pp;switch(ptClientTsData->format){
1455#if (0x17d5+1645-0x1e42)
1456case WMS_FORMAT_CDMA:case WMS_FORMAT_ANALOG_AWISMS:case WMS_FORMAT_ANALOG_CLI:
1457case WMS_FORMAT_ANALOG_VOICE_MAIL:case WMS_FORMAT_ANALOG_SMS:case WMS_FORMAT_MWI
1458:st=wms_ts_encode_bearer_data(&ptClientTsData->u.cdma,ptRawTsData);break;
1459#endif
1460case WMS_FORMAT_GW_PP:ptRawTsData->tpdu_type=msg->tpdu_type;switch(msg->
1461tpdu_type){case WMS_TPDU_DELIVER:st=wms_ts_encode_deliver(&msg->u.deliver,
1462ptRawTsData);break;case WMS_TPDU_SUBMIT:st=wms_ts_encode_submit(&msg->u.submit,
1463ptRawTsData);break;case WMS_TPDU_STATUS_REPORT:st=wms_ts_encode_status_report(&
1464msg->u.status_report,ptRawTsData);break;
1465#if (0x11ad+2324-0x1ac1)
1466case WMS_TPDU_SUBMIT_REPORT_ACK:st=wms_ts_encode_submit_report_ack(&msg->u.
1467submit_report_ack,ptRawTsData);break;case WMS_TPDU_SUBMIT_REPORT_ERROR:st=
1468wms_ts_encode_submit_report_error(&msg->u.submit_report_error,ptRawTsData);break
1469;case WMS_TPDU_COMMAND:st=wms_ts_encode_command(&msg->u.command,ptRawTsData);
1470break;case WMS_TPDU_DELIVER_REPORT_ACK:st=wms_ts_encode_deliver_report_ack(&msg
1471->u.deliver_report_ack,ptRawTsData);break;case WMS_TPDU_DELIVER_REPORT_ERROR:st=
1472wms_ts_encode_deliver_report_error(&msg->u.deliver_report_error,ptRawTsData);
1473break;
1474#endif
1475default:at_print(LOG_DEBUG,
1476"\x49\x6e\x76\x61\x6c\x69\x64\x20\x54\x50\x44\x55\x20\x74\x79\x70\x65\x20\x25\x64"
1477,msg->tpdu_type);st=WMS_INVALID_TPDU_TYPE_S;break;}break;default:st=
1478WMS_INVALID_FORMAT_S;at_print(LOG_DEBUG,
1479"\x49\x6e\x76\x61\x6c\x69\x64\x20\x66\x6f\x72\x6d\x61\x74\x3a\x20\x25\x64",
1480ptClientTsData->format);break;}ptRawTsData->format=ptClientTsData->format;return
1481 st;}UINT8 wms_ts_unpack_gw_7_bit_chars(const UINT8*in,UINT8 in_len,UINT8
1482out_len_max,UINT16 shift,UINT8*out){int i=(0x152+7981-0x207f);UINT16 pos=
1483(0x12e5+253-0x13e2);if(in==NULL||out==NULL){at_print(LOG_DEBUG,
1484"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x75\x6e\x70\x61\x63\x6b\x5f\x67\x77\x5f\x37\x5f\x62\x69\x74\x5f\x63\x68\x61\x72\x73"
1485);return(0x67b+1531-0xc76);}if(shift!=(0x9a9+5177-0x1de2))pos=pos+
1486(0x414+8122-0x23cd);if(shift==(0xac0+3301-0x179e)){out[(0xcbb+3994-0x1c55)]=in[
1487(0x10cc+434-0x127e)]>>(0xd3c+3114-0x1965);shift=(0x264+4975-0x15d3);i=
1488(0xaa1+2274-0x1382);}for(i=i;i<out_len_max&&i<in_len;i++,pos++){out[i]=(in[pos]
1489<<shift)&(0x1bcc+751-0x1e3c);if(pos!=(0x2032+480-0x2212)){
1490#if (0xbcf+3365-0x18f3)
1491if(shift==(0x828+7576-0x25c0)){out[i]|=(0x1e7c+295-0x1fa3);}else{out[i]|=in[pos-
1492(0xe94+5957-0x25d8)]>>((0x12a+8947-0x2415)-shift);}
1493#else
1494out[i]|=in[pos-(0x12f2+3093-0x1f06)]>>((0x1509+2367-0x1e40)-shift);
1495#endif
1496}shift++;if(shift==(0x582+46-0x5a9)){shift=(0x67b+3832-0x1573);i++;if(i>=
1497out_len_max){at_print(LOG_DEBUG,
1498"\x4e\x6f\x74\x20\x65\x6e\x6f\x75\x67\x68\x20\x6f\x75\x74\x70\x75\x74\x20\x62\x75\x66\x66\x65\x72\x20\x66\x6f\x72\x20\x75\x6e\x70\x61\x63\x6b\x69\x6e\x67\x21"
1499);break;}out[i]=in[pos]>>(0xf9b+2994-0x1b4c);}}return(UINT8)(pos);}UINT8
1500wms_ts_decode_address(const UINT8*data,wms_address_s_type*addr){UINT8 i,pos=
1501(0xb32+2468-0x14d6);i=data[pos];if(i>WMS_GW_ADDRESS_MAX){at_print(LOG_DEBUG,
1502"\x41\x64\x64\x72\x20\x6c\x65\x6e\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x20\x25\x64"
1503,i);return(0x1cc3+633-0x1f3c);}addr->number_of_digits=i;pos++;addr->digit_mode=
1504WMS_DIGIT_MODE_4_BIT;addr->number_type=(wms_number_type_e_type)((data[pos]&
1505(0x56f+8455-0x2606))>>(0x1231+2550-0x1c23));addr->number_plan=(
1506wms_number_plan_e_type)(data[pos]&(0xa46+3828-0x192b));pos++;if(addr->
1507number_type==WMS_NUMBER_ALPHANUMERIC){UINT8 bytes_increment=(0x10d9+1932-0x1865)
1508;addr->digit_mode=WMS_DIGIT_MODE_8_BIT;bytes_increment=(addr->number_of_digits+
1509(0x3b5+8357-0x2459))/(0x9ff+2101-0x1232);addr->number_of_digits=(UINT8)(addr->
1510number_of_digits*(0x5c0+5989-0x1d21)/(0xd46+5457-0x2290));(void)
1511wms_ts_unpack_gw_7_bit_chars(&data[pos],addr->number_of_digits,
1512WMS_GW_ADDRESS_MAX,(0x414+2018-0xbf6),addr->digits);pos+=bytes_increment;}else{
1513for(i=(0x452+2629-0xe97);i<addr->number_of_digits;i++){addr->digits[i++]=data[
1514pos]&(0xe63+5808-0x2504);addr->digits[i]=(data[pos]&(0x578+7860-0x233c))>>
1515(0x1567+984-0x193b);pos++;}}return pos;}UINT8 wms_ts_decode_dcs(const UINT8*data
1516,wms_gw_dcs_s_type*dcs){UINT8 pos=(0x116+5921-0x1837);UINT8 i;if(data==NULL||dcs
1517==NULL){at_print(LOG_DEBUG,
1518"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x64\x63\x73"
1519);return(0x1b78+1909-0x22ed);}dcs->msg_class=WMS_MESSAGE_CLASS_NONE;dcs->
1520msg_waiting=WMS_GW_MSG_WAITING_NONE;dcs->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;
1521dcs->is_compressed=FALSE;i=(data[pos]&(0xa44+562-0xbb6))>>(0xc8b+5404-0x21a1);
1522switch(i){case(0x7f+1199-0x52e):dcs->is_compressed=data[pos]&(0x240+4392-0x1348)
1523;if(data[pos]&(0xc54+2282-0x152e)){dcs->msg_class=(wms_message_class_e_type)(
1524data[pos]&(0x72f+4641-0x194d));}else{dcs->msg_class=WMS_MESSAGE_CLASS_NONE;}dcs
1525->alphabet=(wms_gw_alphabet_e_type)((data[pos]&(0x1afa+1705-0x2197))>>
1526(0x731+1581-0xd5c));break;case(0x7e9+3653-0x162b):if((data[pos]&
1527(0x944+1917-0x1091))==(0x770+4917-0x1a75)){dcs->alphabet=(data[pos]&
1528(0x42c+2927-0xf97))?WMS_GW_ALPHABET_8_BIT:WMS_GW_ALPHABET_7_BIT_DEFAULT;dcs->
1529msg_class=(wms_message_class_e_type)(data[pos]&(0x305+7548-0x207e));dcs->
1530is_compressed=FALSE;dcs->msg_waiting=WMS_GW_MSG_WAITING_NONE_1111;}else{dcs->
1531is_compressed=FALSE;dcs->msg_class=WMS_MESSAGE_CLASS_NONE;if((data[pos]&
1532(0x533+453-0x6c8))==(0x10f+6370-0x19f1)){dcs->msg_waiting=
1533WMS_GW_MSG_WAITING_DISCARD;dcs->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;}else if(
1534(data[pos]&(0x9dc+2126-0x11fa))==(0x1742+3584-0x2532)){dcs->msg_waiting=
1535WMS_GW_MSG_WAITING_STORE;dcs->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;}else{dcs->
1536msg_waiting=WMS_GW_MSG_WAITING_STORE;dcs->alphabet=WMS_GW_ALPHABET_UCS2;}dcs->
1537msg_waiting_active=(data[pos]&(0xe6+4014-0x108c))?TRUE:FALSE;dcs->
1538msg_waiting_kind=(wms_gw_msg_waiting_kind_e_type)(data[pos]&(0x72b+1108-0xb7c));
1539}break;default:at_print(LOG_DEBUG,
1540"\x49\x6e\x76\x61\x6c\x69\x64\x20\x44\x43\x53\x3a\x20\x25\x78",data[pos]);dcs->
1541alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;dcs->is_compressed=FALSE;dcs->msg_waiting
1542=WMS_GW_MSG_WAITING_NONE;dcs->msg_class=WMS_MESSAGE_CLASS_NONE;break;}if(dcs->
1543alphabet>WMS_GW_ALPHABET_UCS2){dcs->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;}dcs
1544->raw_dcs_data=data[pos];pos++;return pos;}UINT8 wms_ts_decode_timestamp(const
1545UINT8*data,wms_timestamp_s_type*timestamp){UINT8 pos=(0x122+6716-0x1b5e),i,j;if(
1546data==NULL||timestamp==NULL){at_print(LOG_DEBUG,
1547"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x74\x69\x6d\x65\x73\x74\x61\x6d\x70"
1548);return(0xdf0+5363-0x22e3);}i=((data[pos]&(0x244+9376-0x26d5))<<
1549(0x172b+2709-0x21bc))+((data[pos]&(0xc86+2224-0x1446))>>(0x4c2+7023-0x202d));if(
1550!wms_ts_bcd_to_int(i,&j)){at_print(LOG_DEBUG,
1551"\x49\x6e\x76\x61\x6c\x69\x64\x20\x42\x43\x44\x20\x44\x69\x67\x69\x74\x73\x20\x69\x6e\x20\x45\x6e\x63\x6f\x64\x65\x64\x20\x54\x69\x6d\x65\x73\x74\x61\x6d\x70\x20\x59\x65\x61\x72\x20\x3a\x20\x25\x64"
1552,data[pos]);i=(0x5f1+419-0x794);}timestamp->year=i;pos++;i=((data[pos]&
1553(0x21fa+335-0x233a))<<(0x9e2+2018-0x11c0))+((data[pos]&(0x23cb+263-0x23e2))>>
1554(0xac9+3937-0x1a26));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x19b5+475-0x1b84)||j<
1555(0x1902+3391-0x2640)){at_print(LOG_DEBUG,
1556"\x4d\x6f\x6e\x74\x68\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
1557,j);i=(0xa88+3054-0x1675);}}else{at_print(LOG_DEBUG,
1558"\x49\x6e\x76\x61\x6c\x69\x64\x20\x42\x43\x44\x20\x44\x69\x67\x69\x74\x73\x20\x69\x6e\x20\x45\x6e\x63\x6f\x64\x65\x64\x20\x54\x69\x6d\x65\x73\x74\x61\x6d\x70\x20\x4d\x6f\x6e\x74\x68\x20\x3a\x20\x25\x64"
1559,data[pos]);i=(0x19e1+998-0x1dc6);}timestamp->month=i;pos++;i=((data[pos]&
1560(0x51a+7426-0x220d))<<(0xc11+159-0xcac))+((data[pos]&(0xa76+2988-0x1532))>>
1561(0x1f62+118-0x1fd4));if(wms_ts_bcd_to_int(i,&j)){if(j>(0xf72+4523-0x20fe)||j<
1562(0x15a0+1974-0x1d55)){at_print(LOG_DEBUG,
1563"\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);i=
1564(0x1ae2+1109-0x1f36);}}else{at_print(LOG_DEBUG,
1565"\x49\x6e\x76\x61\x6c\x69\x64\x20\x42\x43\x44\x20\x44\x69\x67\x69\x74\x73\x20\x69\x6e\x20\x45\x6e\x63\x6f\x64\x65\x64\x20\x54\x69\x6d\x65\x73\x74\x61\x6d\x70\x20\x44\x61\x79\x20\x3a\x20\x25\x64"
1566,data[pos]);i=(0xfd+5567-0x16bb);}timestamp->day=i;pos++;i=((data[pos]&
1567(0x12a8+791-0x15b0))<<(0x956+7056-0x24e2))+((data[pos]&(0x2f9+4968-0x1571))>>
1568(0x1fc9+752-0x22b5));if(wms_ts_bcd_to_int(i,&j)){if(j>(0xc60+3534-0x1a17)){
1569at_print(LOG_DEBUG,
1570"\x48\x6f\x75\x72\x20\x69\x73\x20\x74\x6f\x6f\x20\x6c\x61\x72\x67\x65\x3a\x20\x25\x64"
1571,j);i=(0x157d+238-0x166b);}}else{at_print(LOG_DEBUG,
1572"\x49\x6e\x76\x61\x6c\x69\x64\x20\x42\x43\x44\x20\x44\x69\x67\x69\x74\x73\x20\x69\x6e\x20\x45\x6e\x63\x6f\x64\x65\x64\x20\x54\x69\x6d\x65\x73\x74\x61\x6d\x70\x20\x48\x6f\x75\x72\x20\x3a\x20\x25\x64"
1573,data[pos]);i=(0x54b+6585-0x1f04);}timestamp->hour=i;pos++;i=((data[pos]&
1574(0xdaf+906-0x112a))<<(0x92f+3666-0x177d))+((data[pos]&(0x14e1+4282-0x24ab))>>
1575(0x7cc+7119-0x2397));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x6eb+3782-0x1576)){
1576at_print(LOG_DEBUG,
1577"\x4d\x69\x6e\x75\x74\x65\x20\x69\x73\x20\x74\x6f\x6f\x20\x6c\x61\x72\x67\x65\x3a\x20\x25\x64"
1578,j);i=(0x84d+2826-0x1357);}}else{at_print(LOG_DEBUG,
1579"\x49\x6e\x76\x61\x6c\x69\x64\x20\x42\x43\x44\x20\x44\x69\x67\x69\x74\x73\x20\x69\x6e\x20\x45\x6e\x63\x6f\x64\x65\x64\x20\x54\x69\x6d\x65\x73\x74\x61\x6d\x70\x20\x4d\x69\x6e\x75\x74\x65\x20\x3a\x20\x25\x64"
1580,data[pos]);i=(0x1e61+21-0x1e76);}timestamp->minute=i;pos++;i=((data[pos]&
1581(0x10c+671-0x39c))<<(0xd01+6125-0x24ea))+((data[pos]&(0x12f+3769-0xef8))>>
1582(0x117f+4972-0x24e7));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x23a+559-0x42e)){
1583at_print(LOG_DEBUG,
1584"\x53\x65\x63\x6f\x6e\x64\x20\x69\x73\x20\x74\x6f\x6f\x20\x6c\x61\x72\x67\x65\x3a\x20\x25\x64"
1585,i);i=(0x1509+1350-0x1a4f);}}else{at_print(LOG_DEBUG,
1586"\x49\x6e\x76\x61\x6c\x69\x64\x20\x42\x43\x44\x20\x44\x69\x67\x69\x74\x73\x20\x69\x6e\x20\x45\x6e\x63\x6f\x64\x65\x64\x20\x54\x69\x6d\x65\x73\x74\x61\x6d\x70\x20\x53\x65\x63\x6f\x6e\x64\x20\x3a\x20\x25\x64"
1587,data[pos]);i=(0x9bc+514-0xbbe);}timestamp->second=i;pos++;if(data[pos]&
1588(0x13f1+1760-0x1ac9)){timestamp->timezone=(data[pos]&(0x868+6390-0x2157))*
1589(0x192c+2008-0x20fa)+((data[pos]&(0x3f9+572-0x545))>>(0x185b+1356-0x1da3));
1590timestamp->timezone*=(-(0x37d+8317-0x23f9));}else{timestamp->timezone=(sint7)((
1591data[pos]&(0x103d+4696-0x2286))*(0x14d1+1074-0x18f9)+((data[pos]&
1592(0xdb2+6714-0x26fc))>>(0x3f8+1817-0xb0d)));}if(timestamp->timezone>
1593(0x10f9+3338-0x1dd3)||timestamp->timezone<-(0x1292+1653-0x18d7)){at_print(
1594LOG_DEBUG,
1595"\x54\x69\x6d\x65\x7a\x6f\x6e\x65\x20\x69\x73\x20\x6f\x75\x74\x20\x6f\x66\x20\x62\x6f\x75\x6e\x64\x3a\x20\x25\x64"
1596,timestamp->timezone);timestamp->timezone=(0x1ef4+1081-0x232d);}pos++;return pos
1597;}static UINT8 wms_ts_decode_udh_concat_8(const UINT8*udh,wms_udh_s_type*
1598header_ptr){UINT8 pos=(0xe64+575-0x10a3);if(udh==NULL||header_ptr==NULL){
1599at_print(LOG_DEBUG,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return
1600(0x578+2375-0xebf);}if(udh[pos]<(0x1e13+1370-0x236a)){at_print(LOG_DEBUG,
1601"\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x43\x6f\x6e\x63\x61\x74\x20\x38\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1602,udh[pos]);return(0x15d0+1257-0x1ab9);}if(udh[pos+(0x4f3+1802-0xbfb)]==
1603(0x16df+2408-0x2047)||udh[pos+(0x3aa+8339-0x243a)]>udh[pos+(0x349+519-0x54e)]){
1604at_print(LOG_DEBUG,
1605"\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x43\x6f\x6e\x74\x61\x63\x74\x20\x38\x20\x77\x69\x74\x68\x20\x6f\x75\x74\x20\x6f\x66\x20\x62\x6f\x75\x6e\x64\x20\x6d\x61\x78\x20\x6d\x65\x73\x73\x61\x67\x65\x73"
1606);return(0x6a9+2318-0xfb7);}pos++;header_ptr->header_id=WMS_UDH_CONCAT_8;
1607header_ptr->u.concat_8.msg_ref=udh[pos++];header_ptr->u.concat_8.total_sm=udh[
1608pos++];header_ptr->u.concat_8.seq_num=udh[pos++];return(udh[(0x328+9002-0x2652)]
1609+(0x268+9364-0x26fb));}static UINT8 wms_ts_decode_udh_concat16(const UINT8*udh,
1610wms_udh_s_type*header_ptr){UINT8 pos=(0x1252+1920-0x19d2);if(udh==NULL||
1611header_ptr==NULL){at_print(LOG_DEBUG,
1612"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xfea+2308-0x18ee);}if(
1613udh[pos]<(0x227+3631-0x1052)){at_print(LOG_DEBUG,
1614"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x43\x6f\x6e\x63\x61\x74\x31\x36\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1615,udh[pos]);return(0xadf+192-0xb9f);}if(udh[pos+(0x220+5271-0x16b4)]==
1616(0xa1b+4272-0x1acb)||udh[pos+(0x1dd+6488-0x1b31)]==(0x1ed4+265-0x1fdd)||udh[pos+
1617(0x176+9426-0x2644)]>udh[pos+(0x14f6+4397-0x2620)])return(0x8a4+2978-0x1446);
1618header_ptr->header_id=WMS_UDH_CONCAT_16;pos++;header_ptr->u.concat_16.msg_ref=
1619udh[pos++];header_ptr->u.concat_16.msg_ref=(UINT16)(header_ptr->u.concat_16.
1620msg_ref<<(0x595+6620-0x1f69))|udh[pos++];header_ptr->u.concat_16.total_sm=udh[
1621pos++];header_ptr->u.concat_16.seq_num=udh[pos++];return(udh[(0x56a+274-0x67c)]+
1622(0x3a+8640-0x21f9));}static UINT8 wms_ts_udh_decode_first_seg_check(const UINT8
1623len,const UINT8*data,UINT8*is_first_segment_ptr){UINT8 pos=(0x8c+2139-0x8e7);
1624UINT8 num_headers=(0x67a+2843-0x1195);UINT8 udhl=(0x1434+3293-0x2111);UINT8 iedl
1625=(0x2d3+6686-0x1cf1);UINT8 iei=(0xb78+1511-0x115f);*is_first_segment_ptr=TRUE;if
1626(data==NULL||data[pos]==(0x209f+181-0x2154)||len==(0x2299+516-0x249d)){at_print(
1627LOG_DEBUG,
1628"\x6e\x75\x6c\x6c\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x75\x64\x68\x5f\x64\x65\x63\x6f\x64\x65\x5f\x66\x69\x72\x73\x74\x5f\x73\x65\x67\x5f\x63\x68\x65\x63\x6b"
1629);return FALSE;}udhl=data[pos];pos++;while((pos<udhl)&&(num_headers<
1630WMS_MAX_UD_HEADERS)){iei=data[pos];iedl=data[pos+(0x1f03+1341-0x243f)];if(iei==
1631WMS_UDH_CONCAT_16){if(data[pos+(0x8ca+6775-0x233c)]!=(0x665+1817-0xd7d)){
1632at_print(LOG_DEBUG,
1633"\x57\x4d\x53\x5f\x55\x44\x48\x5f\x43\x4f\x4e\x43\x41\x54\x5f\x31\x36\x20\x6e\x6f\x74\x20\x66\x69\x72\x73\x74\x20\x73\x65\x67\x6d\x65\x6e\x74\x21"
1634);*is_first_segment_ptr=FALSE;return TRUE;}else{return TRUE;}}else{num_headers++
1635;pos+=((0x8d3+7583-0x2670)+iedl);}}return TRUE;}static UINT8
1636wms_ts_decode_udh_special_sm(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8
1637pos=(0x334+5759-0x19b3);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
1638"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x6a+7679-0x1e69);}if(udh
1639[pos]<(0x3e4+1090-0x824)){at_print(LOG_DEBUG,
1640"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x53\x70\x65\x63\x69\x61\x6c\x20\x53\x4d\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1641,udh[pos]);return(0xd48+1038-0x1156);}pos++;header_ptr->header_id=
1642WMS_UDH_SPECIAL_SM;header_ptr->u.special_sm.msg_waiting=(
1643wms_gw_msg_waiting_e_type)((udh[pos]>>(0xd37+2851-0x1853)==(0xa41+6143-0x2240))?
1644WMS_GW_MSG_WAITING_DISCARD:WMS_GW_MSG_WAITING_STORE);header_ptr->u.special_sm.
1645msg_waiting_kind=(wms_gw_msg_waiting_kind_e_type)(udh[pos++]&(0x59a+7791-0x238a)
1646);header_ptr->u.special_sm.message_count=udh[pos++];return(udh[
1647(0x1bdc+742-0x1ec2)]+(0x18c1+1596-0x1efc));}static UINT8
1648wms_ts_decode_udh_port_8(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=
1649(0x202c+994-0x240e);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
1650"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x17d6+1071-0x1c05);}if(
1651udh[pos]<(0x3e3+8665-0x25ba)){at_print(LOG_DEBUG,
1652"\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x50\x6f\x72\x74\x20\x38\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1653,udh[pos]);return(0x5fc+4746-0x1886);}pos++;header_ptr->header_id=WMS_UDH_PORT_8
1654;header_ptr->u.wap_8.dest_port=udh[pos++];header_ptr->u.wap_8.orig_port=udh[pos
1655++];return(udh[(0x68f+2762-0x1159)]+(0x401+677-0x6a5));}static UINT8
1656wms_ts_decode_udh_port16(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=
1657(0xde7+1273-0x12e0);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
1658"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x11+756-0x305);}if(udh[
1659pos]<(0x36b+5566-0x1925)){at_print(LOG_DEBUG,
1660"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x50\x6f\x72\x74\x31\x36\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1661,udh[pos]);return(0xb4+8299-0x211f);}header_ptr->header_id=WMS_UDH_PORT_16;pos++
1662;header_ptr->u.wap_16.dest_port=udh[pos++];header_ptr->u.wap_16.dest_port=(
1663UINT16)(header_ptr->u.wap_16.dest_port<<(0x1628+841-0x1969))|udh[pos++];
1664header_ptr->u.wap_16.orig_port=udh[pos++];header_ptr->u.wap_16.orig_port=(UINT16
1665)(header_ptr->u.wap_16.orig_port<<(0x77d+1137-0xbe6))|udh[pos++];return(udh[
1666(0x715+3127-0x134c)]+(0x1c82+698-0x1f3b));}static UINT8
1667wms_ts_decode_udh_text_formatting(const UINT8*udh,wms_udh_s_type*header_ptr){
1668UINT8 pos=(0x1214+4629-0x2429);if(udh==NULL||header_ptr==NULL){at_print(
1669LOG_DEBUG,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return
1670(0xb5+8975-0x23c4);}if(udh[pos]<(0x91d+3899-0x1855)){at_print(LOG_DEBUG,
1671"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x54\x65\x78\x74\x20\x46\x6f\x72\x6d\x61\x74\x74\x69\x6e\x67\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1672,udh[pos]);return(0xe3b+1496-0x1413);}if(udh[pos]>=(0x962+3526-0x1724)){
1673header_ptr->u.text_formating.is_color_present=TRUE;}else{header_ptr->u.
1674text_formating.is_color_present=FALSE;}pos++;header_ptr->header_id=
1675WMS_UDH_TEXT_FORMATING;header_ptr->u.text_formating.start_position=udh[pos++];
1676header_ptr->u.text_formating.text_formatting_length=udh[pos++];header_ptr->u.
1677text_formating.alignment_type=(wms_udh_alignment_e_type)(udh[pos]&
1678(0xd4+2870-0xc07));header_ptr->u.text_formating.font_size=(
1679wms_udh_font_size_e_type)((udh[pos]&(0x129b+5166-0x26bd))>>(0x16a1+528-0x18af));
1680header_ptr->u.text_formating.style_bold=(udh[pos]&(0x470+1870-0xbae))>>
1681(0x11eb+863-0x1546);header_ptr->u.text_formating.style_italic=(udh[pos]&
1682(0x20f3+600-0x232b))>>(0x147c+1145-0x18f0);header_ptr->u.text_formating.
1683style_underlined=(udh[pos]&(0x182b+493-0x19d8))>>(0xa9+6167-0x18ba);header_ptr->
1684u.text_formating.style_strikethrough=(udh[pos]&(0x14b9+1497-0x1a12))>>
1685(0xd58+4996-0x20d5);pos++;if(header_ptr->u.text_formating.is_color_present){
1686header_ptr->u.text_formating.text_color_foreground=(wms_udh_text_color_e_type)(
1687udh[pos]&(0xa74+1525-0x105a));header_ptr->u.text_formating.text_color_background
1688=(wms_udh_text_color_e_type)((udh[pos]&(0x9e0+3675-0x174b))>>
1689(0x1955+1559-0x1f68));pos++;}return(udh[(0x4e0+667-0x77b)]+(0x860+3135-0x149e));
1690}static UINT8 wms_ts_decode_udh_pre_def_sound(const UINT8*udh,wms_udh_s_type*
1691header_ptr){UINT8 pos=(0x4a3+4766-0x1741);if(udh==NULL||header_ptr==NULL){
1692at_print(LOG_DEBUG,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return
1693(0xb4+3188-0xd28);}if(udh[pos]<(0x11f4+4518-0x2398)){at_print(LOG_DEBUG,
1694"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x50\x72\x65\x20\x44\x65\x66\x69\x6e\x65\x64\x20\x53\x6f\x75\x6e\x64\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1695,udh[pos]);return(0x13b9+584-0x1601);}pos++;header_ptr->header_id=
1696WMS_UDH_PRE_DEF_SOUND;header_ptr->u.pre_def_sound.position=udh[pos++];header_ptr
1697->u.pre_def_sound.snd_number=udh[pos++];return(udh[(0x13c1+2790-0x1ea7)]+
1698(0x2c6+7038-0x1e43));}static UINT8 wms_ts_decode_udh_user_def_sound(const UINT8*
1699udh,wms_udh_s_type*header_ptr){UINT8 pos=(0x7e1+449-0x9a2),j;if(udh==NULL||
1700header_ptr==NULL){at_print(LOG_DEBUG,
1701"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x174+5151-0x1593);}if(
1702udh[pos]==(0x668+4450-0x17ca)){at_print(LOG_DEBUG,
1703"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x55\x73\x65\x72\x20\x44\x65\x66\x69\x6e\x65\x64\x20\x53\x6f\x75\x6e\x64\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x6e\x6f\x20\x44\x61\x74\x61"
1704);return(0xbc9+1637-0x122e);}header_ptr->header_id=WMS_UDH_USER_DEF_SOUND;
1705header_ptr->u.user_def_sound.data_length=udh[pos++]-(0x954+2598-0x1379);
1706header_ptr->u.user_def_sound.position=udh[pos++];if(header_ptr->u.user_def_sound
1707.data_length>WMS_UDH_MAX_SND_SIZE){at_print(LOG_DEBUG,
1708"\x4d\x61\x78\x20\x53\x69\x7a\x65\x20\x45\x78\x63\x65\x65\x64\x20\x48\x65\x61\x64\x65\x72\x20\x69\x64\x20\x25\x64\x20"
1709,header_ptr->header_id);return(0xcca+6700-0x26f6);}memset(header_ptr->u.
1710user_def_sound.user_def_sound,(0xc80+4793-0x1e3a),WMS_UDH_MAX_SND_SIZE);for(j=
1711(0xb41+5236-0x1fb5);j<header_ptr->u.user_def_sound.data_length;j++)header_ptr->u
1712.user_def_sound.user_def_sound[j]=udh[pos++];return pos;}static UINT8
1713wms_ts_decode_udh_pre_def_anim(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8
1714pos=(0x545+5046-0x18fb);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
1715"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x107d+4793-0x2336);}if(
1716udh[pos]!=(0xad5+5672-0x20fb)){at_print(LOG_DEBUG,
1717"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x50\x72\x65\x20\x44\x65\x66\x69\x6e\x65\x64\x20\x41\x6e\x69\x6d\x61\x74\x69\x6f\x6e\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1718,udh[pos]);return(0xfd0+2087-0x17f7);}pos++;header_ptr->header_id=
1719WMS_UDH_PRE_DEF_ANIM;header_ptr->u.pre_def_anim.position=udh[pos++];header_ptr->
1720u.pre_def_anim.animation_number=udh[pos++];return pos;}static UINT8
1721wms_ts_decode_udh_large_anim(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8
1722pos=(0xc93+281-0xdac),j,k;if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
1723"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x5e5+7698-0x23f7);}if(
1724udh[pos]!=(WMS_UDH_ANIM_NUM_BITMAPS*WMS_UDH_LARGE_BITMAP_SIZE+
1725(0x23b3+396-0x253e))){at_print(LOG_DEBUG,
1726"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x4c\x61\x72\x67\x65\x20\x44\x65\x66\x69\x6e\x65\x64\x20\x41\x6e\x69\x6d\x61\x74\x69\x6f\x6e\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1727,udh[pos]);return(0x13c3+3661-0x2210);}header_ptr->header_id=WMS_UDH_LARGE_ANIM;
1728pos++;header_ptr->u.large_anim.position=udh[pos++];for(j=(0x15d1+2604-0x1ffd);j<
1729WMS_UDH_ANIM_NUM_BITMAPS;j++)for(k=(0x7f+5456-0x15cf);k<
1730WMS_UDH_LARGE_BITMAP_SIZE;k++)header_ptr->u.large_anim.data[j][k]=udh[pos++];
1731return pos;}static UINT8 wms_ts_decode_udh_small_anim(const UINT8*udh,
1732wms_udh_s_type*header_ptr){UINT8 pos=(0x99c+6476-0x22e8),j,k;if(udh==NULL||
1733header_ptr==NULL){at_print(LOG_DEBUG,
1734"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xb54+1791-0x1253);}if(
1735udh[pos]!=(WMS_UDH_ANIM_NUM_BITMAPS*WMS_UDH_SMALL_BITMAP_SIZE+
1736(0x1017+751-0x1305))){at_print(LOG_DEBUG,
1737"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x4c\x61\x72\x67\x65\x20\x44\x65\x66\x69\x6e\x65\x64\x20\x41\x6e\x69\x6d\x61\x74\x69\x6f\x6e\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1738,udh[pos]);return(0x458+7292-0x20d4);}header_ptr->header_id=WMS_UDH_SMALL_ANIM;
1739pos++;header_ptr->u.small_anim.position=udh[pos++];for(j=(0xe2+4374-0x11f8);j<
1740WMS_UDH_ANIM_NUM_BITMAPS;j++)for(k=(0x6b4+5646-0x1cc2);k<
1741WMS_UDH_SMALL_BITMAP_SIZE;k++)header_ptr->u.small_anim.data[j][k]=udh[pos++];
1742return pos;}static UINT8 wms_ts_decode_udh_large_picture(const UINT8*udh,
1743wms_udh_s_type*header_ptr){UINT8 pos=(0xd42+1365-0x1297),j;if(udh==NULL||
1744header_ptr==NULL){at_print(LOG_DEBUG,
1745"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x1114+4035-0x20d7);}if(
1746udh[pos]!=WMS_UDH_LARGE_PIC_SIZE+(0x54a+6171-0x1d64)){at_print(LOG_DEBUG,
1747"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x4c\x61\x72\x67\x65\x20\x50\x69\x63\x74\x75\x72\x65\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1748,udh[pos]);return(0x1efa+89-0x1f53);}header_ptr->header_id=WMS_UDH_LARGE_PICTURE
1749;pos++;header_ptr->u.large_picture.position=udh[pos++];for(j=(0x472+4269-0x151f)
1750;j<WMS_UDH_LARGE_PIC_SIZE;j++)header_ptr->u.large_picture.data[j]=udh[pos++];
1751return pos;}static UINT8 wms_ts_decode_udh_small_picture(const UINT8*udh,
1752wms_udh_s_type*header_ptr){UINT8 pos=(0x121d+130-0x129f),j;if(udh==NULL||
1753header_ptr==NULL){at_print(LOG_DEBUG,
1754"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x3f0+579-0x633);}if(udh[
1755pos]!=WMS_UDH_SMALL_PIC_SIZE+(0x3c+6648-0x1a33)){at_print(LOG_DEBUG,
1756"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x53\x6d\x61\x6c\x6c\x20\x50\x69\x63\x74\x75\x72\x65\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x67\x6e\x74\x68\x20\x3d\x20\x25\x64"
1757,udh[pos]);return(0x1008+5471-0x2567);}header_ptr->header_id=
1758WMS_UDH_SMALL_PICTURE;pos++;header_ptr->u.small_picture.position=udh[pos++];for(
1759j=(0x1859+504-0x1a51);j<WMS_UDH_SMALL_PIC_SIZE;j++)header_ptr->u.small_picture.
1760data[j]=udh[pos++];return pos;}static UINT8 wms_ts_decode_udh_var_picture(const
1761UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=(0x68f+636-0x90b),j,pic_size;if(
1762udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
1763"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x1397+776-0x169f);}if(
1764udh[pos]>WMS_UDH_VAR_PIC_SIZE+(0x1863+3053-0x244d)){at_print(LOG_DEBUG,
1765"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x56\x61\x72\x20\x50\x69\x63\x74\x75\x72\x65\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1766,udh[pos]);return(0x42a+1065-0x853);}if((udh[pos]-(0x1932+2896-0x247f))!=(udh[
1767pos+(0xc82+3442-0x19f2)]*udh[pos+(0x2ad+7567-0x2039)])){at_print(LOG_DEBUG,
1768"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x56\x61\x72\x20\x50\x69\x63\x74\x75\x72\x65\x2c\x20\x70\x69\x63\x20\x73\x69\x7a\x65\x20\x76\x61\x6c\x75\x65\x20\x6d\x69\x73\x6d\x61\x74\x63\x68\x20\x77\x69\x74\x68\x20\x68\x65\x69\x67\x74\x20\x61\x6e\x64\x20\x77\x65\x69\x67\x68\x74"
1769);return(0xa75+4290-0x1b37);}pic_size=udh[pos++]-(0x1151+738-0x1430);header_ptr
1770->header_id=WMS_UDH_VAR_PICTURE;header_ptr->u.var_picture.position=udh[pos++];
1771header_ptr->u.var_picture.width=(UINT8)(udh[pos++]*(0x640+4237-0x16c5));
1772header_ptr->u.var_picture.height=udh[pos++];for(j=(0x1a01+3203-0x2684);j<
1773pic_size&&j<WMS_UDH_VAR_PIC_SIZE;j++)header_ptr->u.var_picture.data[j]=udh[pos++
1774];return pos;}static UINT8 wms_ts_decode_udh_user_prompt(const UINT8*udh,
1775wms_udh_s_type*header_ptr){UINT8 pos=(0x20cd+1446-0x2673);if(udh==NULL||
1776header_ptr==NULL){at_print(LOG_DEBUG,
1777"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x1713+3831-0x260a);}if(
1778udh[pos]<(0x1af6+2416-0x2465)){at_print(LOG_DEBUG,
1779"\x53\x4d\x53\x20\x55\x44\x48\x20\x55\x73\x65\x72\x20\x50\x72\x6f\x6d\x70\x74\x20\x70\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1780,udh[pos]);return(0x1320+5050-0x26da);}pos++;header_ptr->header_id=
1781WMS_UDH_USER_PROMPT;header_ptr->u.user_prompt.number_of_objects=udh[pos++];
1782return(udh[(0xfe6+2651-0x1a41)]+(0x1c24+2102-0x2459));}static UINT8
1783wms_ts_decode_udh_eo(const UINT8*udh,UINT8 first_segment,wms_udh_s_type*
1784header_ptr){UINT8 pos=(0x3c+4617-0x1245),udh_length;if(udh==NULL||header_ptr==
1785NULL){at_print(LOG_DEBUG,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return
1786(0x2b4+6772-0x1d28);}if(udh[pos]==(0x1f83+1131-0x23ee)){at_print(LOG_DEBUG,
1787"\x53\x4d\x53\x20\x55\x44\x48\x20\x45\x78\x74\x65\x6e\x64\x65\x64\x20\x4f\x62\x6a\x65\x63\x74\x20\x70\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x6e\x6f\x20\x44\x61\x74\x61"
1788);return(0x686+2809-0x117f);}udh_length=udh[pos++];header_ptr->header_id=
1789WMS_UDH_EXTENDED_OBJECT;header_ptr->u.eo.first_segment=first_segment;if(
1790first_segment==TRUE){if(udh_length<WMS_UDH_OCTETS_EO_HEADER){return
1791(0xa14+1151-0xe93);}header_ptr->u.eo.reference=udh[pos++];header_ptr->u.eo.
1792length=udh[pos++]<<(0x270+3263-0xf27);header_ptr->u.eo.length|=udh[pos++];
1793header_ptr->u.eo.control=udh[pos++];header_ptr->u.eo.type=(wms_udh_eo_id_e_type)
1794udh[pos++];header_ptr->u.eo.position=udh[pos++]<<(0x118a+4775-0x2429);header_ptr
1795->u.eo.position|=udh[pos++];}header_ptr->u.eo.content.length=(udh_length-pos)+
1796(0xf6a+2691-0x19ec);memcpy(header_ptr->u.eo.content.data,udh+pos,header_ptr->u.
1797eo.content.length);pos+=header_ptr->u.eo.content.length;return pos;}static UINT8
1798 wms_ts_decode_udh_rfc822(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=
1799(0x475+3504-0x1225);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
1800"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x1499+2645-0x1eee);}if(
1801udh[pos]<(0x3a+955-0x3f4)){at_print(LOG_DEBUG,
1802"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x52\x66\x63\x38\x32\x32\x20\x50\x72\x65\x73\x65\x6e\x74\x20\x77\x69\x74\x68\x20\x69\x6e\x76\x61\x6c\x69\x64\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3d\x20\x25\x64"
1803,udh[pos]);return(0x13e0+425-0x1589);}pos++;header_ptr->header_id=WMS_UDH_RFC822
1804;header_ptr->u.rfc822.header_length=udh[pos++];return(udh[(0x775+4991-0x1af4)]+
1805(0x4d6+3905-0x1416));}static UINT8 wms_ts_decode_udh_nat_lang_ss(const UINT8*udh
1806,wms_udh_s_type*header_ptr){UINT8 pos=(0x792+4048-0x1762);if(udh==NULL||
1807header_ptr==NULL){return(0x291+6724-0x1cd5);}if(udh[pos]!=
1808WMS_UDH_OCTETS_NAT_LANG_SS){return(0xefb+3151-0x1b4a);}pos++;header_ptr->
1809header_id=WMS_UDH_NAT_LANG_SS;if((WMS_UDH_NAT_LANG_TURKISH>udh[pos])||(
1810WMS_UDH_NAT_LANG_PORTUGUESE<udh[pos])){return(0xa08+963-0xdcb);}header_ptr->u.
1811nat_lang_ss.nat_lang_id=(wms_udh_nat_lang_id_e_type)udh[pos++];return(udh[
1812(0x628+3698-0x149a)]+(0x988+4878-0x1c95));}static UINT8
1813wms_ts_decode_udh_nat_lang_ls(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8
1814pos=(0x8cc+4907-0x1bf7);if(udh==NULL||header_ptr==NULL){return(0x26+3653-0xe6b);
1815}if(udh[pos]!=WMS_UDH_OCTETS_NAT_LANG_LS){return(0x970+1319-0xe97);}pos++;
1816header_ptr->header_id=WMS_UDH_NAT_LANG_LS;if((WMS_UDH_NAT_LANG_TURKISH>udh[pos])
1817||(WMS_UDH_NAT_LANG_PORTUGUESE<udh[pos])){return(0x86d+6733-0x22ba);}header_ptr
1818->u.nat_lang_ls.nat_lang_id=(wms_udh_nat_lang_id_e_type)udh[pos++];return(udh[
1819(0x1d68+1564-0x2384)]+(0x6b9+2802-0x11aa));}static UINT8 wms_ts_decode_udh_other
1820(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=(0x1afc+618-0x1d66),i=
1821(0x1d1+5284-0x1675);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
1822"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x46+936-0x3ee);}if(udh[
1823pos+(0x3e9+8196-0x23ec)]>WMS_UDH_OTHER_SIZE){at_print(LOG_DEBUG,
1824"\x53\x4d\x53\x20\x55\x44\x48\x20\x48\x65\x61\x64\x65\x72\x20\x4f\x74\x68\x65\x72\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x65\x78\x63\x65\x65\x64\x69\x6e\x67\x20\x32\x32\x36"
1825);return(0xfbc+4874-0x22c6);}header_ptr->header_id=(wms_udh_id_e_type)udh[pos];
1826header_ptr->u.other.header_id=(wms_udh_id_e_type)udh[pos++];header_ptr->u.other.
1827header_length=udh[pos++];for(i=(0xbf7+2592-0x1617);i<header_ptr->u.other.
1828header_length;i++){header_ptr->u.other.data[i]=udh[pos++];}return pos;}UINT8
1829wms_ts_decode_user_data_header(const UINT8 len,const UINT8*data,UINT8*
1830num_headers_ptr,wms_udh_s_type*udh_ptr){UINT8 pos=(0x4df+467-0x6b2);UINT8
1831header_length=(0x585+3188-0x11f9),num_headers=(0x1e2c+1386-0x2396);UINT8 udhl;
1832UINT8 first_segment=TRUE;if(data==NULL||len==(0xcda+1913-0x1453)||data[pos]==
1833(0x194+8861-0x2431)||num_headers_ptr==NULL||udh_ptr==NULL){at_print(LOG_DEBUG,
1834"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x75\x73\x65\x72\x5f\x64\x61\x74\x61\x5f\x68\x65\x61\x64\x65\x72"
1835);return(0x1ba+2980-0xd5e);}udhl=data[pos];pos++;while((pos<udhl)&&(num_headers<
1836WMS_MAX_UD_HEADERS)){switch(data[pos++]){case WMS_UDH_CONCAT_8:header_length=
1837wms_ts_decode_udh_concat_8(data+pos,&udh_ptr[num_headers]);break;case
1838WMS_UDH_CONCAT_16:header_length=wms_ts_decode_udh_concat16(data+pos,&udh_ptr[
1839num_headers]);break;case WMS_UDH_SPECIAL_SM:header_length=
1840wms_ts_decode_udh_special_sm(data+pos,&udh_ptr[num_headers]);break;case
1841WMS_UDH_PORT_8:header_length=wms_ts_decode_udh_port_8(data+pos,&udh_ptr[
1842num_headers]);break;case WMS_UDH_PORT_16:header_length=wms_ts_decode_udh_port16(
1843data+pos,&udh_ptr[num_headers]);break;case WMS_UDH_TEXT_FORMATING:header_length=
1844wms_ts_decode_udh_text_formatting(data+pos,&udh_ptr[num_headers]);break;case
1845WMS_UDH_PRE_DEF_SOUND:header_length=wms_ts_decode_udh_pre_def_sound(data+pos,&
1846udh_ptr[num_headers]);break;case WMS_UDH_USER_DEF_SOUND:header_length=
1847wms_ts_decode_udh_user_def_sound(data+pos,&udh_ptr[num_headers]);break;case
1848WMS_UDH_PRE_DEF_ANIM:header_length=wms_ts_decode_udh_pre_def_anim(data+pos,&
1849udh_ptr[num_headers]);break;case WMS_UDH_LARGE_ANIM:header_length=
1850wms_ts_decode_udh_large_anim(data+pos,&udh_ptr[num_headers]);break;case
1851WMS_UDH_SMALL_ANIM:header_length=wms_ts_decode_udh_small_anim(data+pos,&udh_ptr[
1852num_headers]);break;case WMS_UDH_LARGE_PICTURE:header_length=
1853wms_ts_decode_udh_large_picture(data+pos,&udh_ptr[num_headers]);break;case
1854WMS_UDH_SMALL_PICTURE:header_length=wms_ts_decode_udh_small_picture(data+pos,&
1855udh_ptr[num_headers]);break;case WMS_UDH_VAR_PICTURE:header_length=
1856wms_ts_decode_udh_var_picture(data+pos,&udh_ptr[num_headers]);break;case
1857WMS_UDH_USER_PROMPT:header_length=wms_ts_decode_udh_user_prompt(data+pos,&
1858udh_ptr[num_headers]);break;case WMS_UDH_EXTENDED_OBJECT:
1859wms_ts_udh_decode_first_seg_check(len,data,&first_segment);header_length=
1860wms_ts_decode_udh_eo(data+pos,first_segment,&udh_ptr[num_headers]);break;case
1861WMS_UDH_RFC822:header_length=wms_ts_decode_udh_rfc822(data+pos,&udh_ptr[
1862num_headers]);break;case WMS_UDH_NAT_LANG_SS:header_length=
1863wms_ts_decode_udh_nat_lang_ss(data+pos,&udh_ptr[num_headers]);break;case
1864WMS_UDH_NAT_LANG_LS:header_length=wms_ts_decode_udh_nat_lang_ls(data+pos,&
1865udh_ptr[num_headers]);break;default:pos--;header_length=wms_ts_decode_udh_other(
1866data+pos,&udh_ptr[num_headers]);break;}if((UINT16)pos+(UINT16)header_length>
1867WMS_MAX_LEN){at_print(LOG_DEBUG,
1868"\x6e\x75\x6d\x62\x65\x72\x20\x6f\x66\x20\x62\x79\x74\x65\x73\x20\x64\x65\x63\x6f\x64\x65\x64\x20\x68\x61\x73\x20\x65\x78\x63\x65\x65\x64\x65\x64\x20\x55\x44\x48\x4c\x20\x76\x61\x6c\x75\x65\x20\x6f\x66\x20\x25\x64"
1869,udhl);return(0x5ac+3250-0x125e);}else if(header_length!=(0xeb1+4678-0x20f7)){
1870pos+=header_length;num_headers++;}else{at_print(LOG_DEBUG,
1871"\x42\x61\x64\x20\x55\x44\x48\x3a\x20\x70\x6f\x73\x3d\x25\x64\x2c\x20\x64\x61\x74\x61\x5b\x70\x6f\x73\x5d\x3d\x25\x64"
1872,pos,data[pos]);*num_headers_ptr=(0x1aa7+297-0x1bd0);return(0x1838+2151-0x209f);
1873}}if(num_headers>=WMS_MAX_UD_HEADERS){at_print(LOG_DEBUG,
1874"\x64\x65\x63\x6f\x64\x65\x5f\x75\x64\x68\x3a\x20\x4e\x75\x6d\x20\x48\x65\x61\x64\x65\x72\x73\x20\x68\x61\x73\x20\x65\x78\x63\x65\x65\x64\x65\x64\x20\x57\x4d\x53\x5f\x4d\x41\x58\x5f\x55\x44\x5f\x48\x45\x41\x44\x45\x52\x53"
1875);pos=udhl+(0x78b+5484-0x1cf6);}if(pos!=(udhl+(0x62f+7687-0x2435))){at_print(
1876LOG_DEBUG,
1877"\x53\x4d\x53\x20\x55\x44\x48\x20\x63\x6f\x75\x6c\x64\x20\x6e\x6f\x74\x20\x62\x65\x20\x64\x65\x63\x6f\x64\x65\x64"
1878);num_headers=(0x2359+183-0x2410);udhl=(0x757+4624-0x1967);}if(num_headers>
1879(0x52f+4371-0x1642)){*num_headers_ptr=num_headers;}return udhl;}UINT8
1880wms_ts_decode_gw_user_data(const wms_gw_dcs_s_type*dcs,const UINT8 len,const
1881UINT8*data,const UINT8 user_data_header_present,wms_gw_user_data_s_type*
1882user_data){UINT8 i,pos=(0x234+3061-0xe29);UINT8 fill_bits=(0xa9c+6834-0x254e);
1883UINT8 user_data_length;UINT8 user_data_header_length=(0x943+6428-0x225f);if(dcs
1884==NULL||data==NULL||user_data==NULL){at_print(LOG_DEBUG,
1885"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x67\x77\x5f\x75\x73\x65\x72\x5f\x64\x61\x74\x61"
1886);return(0x1762+745-0x1a4b);}(void)memset(user_data,(0x12+2773-0xae7),sizeof(
1887wms_gw_user_data_s_type));if(len==(0x88b+3329-0x158c)){return(0xe4f+739-0x1132);
1888}if(dcs->alphabet==WMS_GW_ALPHABET_7_BIT_DEFAULT){if(len>WMS_SMS_UDL_MAX_7_BIT){
1889at_print(LOG_DEBUG,
1890"\x75\x73\x65\x72\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3e\x20\x6d\x61\x78\x20\x76\x61\x6c\x75\x65\x20\x66\x6f\x72\x20\x67\x77\x20\x37\x2d\x62\x69\x74\x20\x61\x6c\x70\x68\x61\x62\x65\x74"
1891);return(0x1853+2367-0x2192);}user_data_length=len;if(user_data_header_present){
1892user_data_header_length=wms_ts_decode_user_data_header(data[pos],data+pos,&
1893user_data->num_headers,user_data->headers);}if(user_data_header_length>len){
1894at_print(LOG_DEBUG,
1895"\x75\x73\x65\x72\x20\x64\x61\x74\x61\x20\x68\x65\x61\x64\x65\x72\x20\x6c\x65\x6e\x67\x74\x68\x20\x3e\x20\x74\x6f\x74\x61\x6c\x20\x6c\x65\x6e\x67\x74\x68"
1896);return(0x422+1716-0xad6);}if(user_data_header_length>(0x94c+17-0x95d)){
1897fill_bits=((len*(0x1585+1499-0x1b59))-((user_data_header_length+
1898(0xf02+3382-0x1c37))*(0xe23+6187-0x2646)))%(0xd97+714-0x105a);user_data_length=(
1899UINT8)(((len*(0x1139+2135-0x1989))-((user_data_header_length+
1900(0x153c+4126-0x2559))*(0xfad+4668-0x21e1)))/(0x863+3526-0x1622));pos=
1901user_data_header_length+(0x1f81+478-0x215e);if(fill_bits!=(0x1a66+1660-0x20e2)){
1902fill_bits=(0x602+4614-0x1800)-fill_bits;}}i=wms_ts_unpack_gw_7_bit_chars(&data[
1903pos],user_data_length,WMS_MAX_LEN,fill_bits,user_data->sm_data);user_data->
1904sm_len=user_data_length;}else{if(len>WMS_SMS_UDL_MAX_8_BIT){at_print(LOG_DEBUG,
1905"\x75\x73\x65\x72\x20\x64\x61\x74\x61\x20\x6c\x65\x6e\x67\x74\x68\x20\x3e\x20\x6d\x61\x78\x20\x76\x61\x6c\x75\x65\x20\x66\x6f\x72\x20\x38\x2d\x62\x69\x74\x20\x63\x68\x61\x72\x61\x72\x61\x63\x74\x65\x72\x73"
1906);return(0x1081+1691-0x171c);}user_data_length=len;if(user_data_header_present){
1907user_data_header_length=wms_ts_decode_user_data_header(data[pos],data+pos,&
1908user_data->num_headers,user_data->headers);if(user_data_header_length>len){
1909at_print(LOG_DEBUG,
1910"\x75\x73\x65\x72\x20\x64\x61\x74\x61\x20\x68\x65\x61\x64\x65\x72\x20\x6c\x65\x6e\x67\x74\x68\x20\x3e\x20\x74\x6f\x74\x61\x6c\x20\x6c\x65\x6e\x67\x74\x68"
1911);return(0x468+4453-0x15cd);}pos+=user_data_header_length+(0xdf4+5096-0x21db);
1912user_data_length=(len-user_data_header_length)-(0x963+832-0xca2);}memcpy(
1913user_data->sm_data,data+pos,user_data_length);user_data->sm_len=user_data_length
1914;i=(UINT8)user_data->sm_len;}pos+=i;return pos;}wms_status_e_type
1915wms_ts_decode_deliver(const T_zUfiSms_RawTsData*ptRawTsData,
1916wms_gw_deliver_s_type*deliver){wms_status_e_type st=WMS_OK_S;uint32 pos=
1917(0xa67+4989-0x1de4),i;const UINT8*data=ptRawTsData->data;if(ptRawTsData==NULL||
1918deliver==NULL){printf(
1919"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x64\x65\x6c\x69\x76\x65\x72"
1920);return WMS_NULL_PTR_S;}else if((data[pos]&(0x1a7f+1674-0x2106))!=
1921(0x14f+4871-0x1456)){printf(
1922"\x69\x6e\x76\x61\x6c\x69\x64\x20\x74\x70\x64\x75\x20\x74\x79\x70\x65\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x64\x65\x6c\x69\x76\x65\x72"
1923);return WMS_INVALID_TPDU_TYPE_S;}else{deliver->more=(data[pos]&
1924(0xbd5+2905-0x172a))?FALSE:TRUE;deliver->status_report_enabled=(data[pos]&
1925(0x4b+6089-0x17f4))?TRUE:FALSE;deliver->user_data_header_present=(data[pos]&
1926(0x785+4688-0x1995))?TRUE:FALSE;deliver->reply_path_present=(data[pos]&
1927(0x649+6443-0x1ef4))?TRUE:FALSE;pos++;i=wms_ts_decode_address(&data[pos],&
1928deliver->address);if(i==(0x151d+2884-0x2061)){printf(
1929"\x69\x6e\x76\x61\x6c\x69\x64\x20\x70\x61\x72\x61\x6d\x20\x73\x69\x7a\x65\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x64\x65\x6c\x69\x76\x65\x72"
1930);return WMS_INVALID_PARM_SIZE_S;}pos+=i;deliver->pid=(wms_pid_e_type)data[pos];
1931pos++;pos+=wms_ts_decode_dcs(data+pos,&deliver->dcs);if(deliver->dcs.
1932msg_waiting_kind!=WMS_GW_MSG_WAITING_VOICEMAIL){if(deliver->pid==
1933WMS_PID_RETURN_CALL){deliver->dcs.msg_waiting=WMS_GW_MSG_WAITING_STORE;deliver->
1934dcs.msg_waiting_active=TRUE;deliver->dcs.msg_waiting_kind=
1935WMS_GW_MSG_WAITING_VOICEMAIL;}}i=wms_ts_decode_timestamp(data+pos,&deliver->
1936timestamp);if(i==(0xe47+6033-0x25d8)){printf(
1937"\x69\x6e\x76\x61\x6c\x69\x64\x20\x70\x61\x72\x61\x6d\x20\x76\x61\x6c\x75\x65\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x64\x65\x6c\x69\x76\x65\x72"
1938);return WMS_INVALID_PARM_VALUE_S;}pos+=i;pos++;i=wms_ts_decode_gw_user_data(&
1939deliver->dcs,data[pos-(0x11a+803-0x43c)],data+pos,deliver->
1940user_data_header_present,&deliver->user_data);if(i>WMS_SMS_UDL_MAX_8_BIT){printf
1941(
1942"\x55\x73\x65\x72\x20\x44\x61\x74\x61\x20\x4c\x65\x6e\x67\x74\x68\x20\x68\x61\x73\x20\x65\x78\x63\x65\x65\x64\x65\x64\x20\x63\x61\x70\x61\x63\x69\x74\x79\x3a\x20\x55\x44\x4c\x20\x3d\x20\x25\x6c\x75"
1943,i);st=WMS_INVALID_USER_DATA_SIZE_S;}pos+=i;return st;}}UINT8
1944wms_ts_decode_gw_validity(const UINT8*data,wms_gw_validity_s_type*validity){
1945UINT8 i,pos=(0x37f+7406-0x206d);if(data==NULL||validity==NULL){at_print(
1946LOG_DEBUG,
1947"\x6e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x67\x77\x5f\x76\x61\x6c\x69\x64\x69\x74\x79"
1948);return(0x12f9+2454-0x1c8f);}else{switch(validity->format){case
1949WMS_GW_VALIDITY_NONE:memset(validity,(0xfaf+5412-0x24d3),sizeof(
1950wms_gw_validity_s_type));break;case WMS_GW_VALIDITY_RELATIVE:
1951zUfiSms_DecodeRelativeTime(data[pos],&validity->u.time);pos++;break;case
1952WMS_GW_VALIDITY_ABSOLUTE:i=wms_ts_decode_timestamp(data+pos,&validity->u.time);
1953pos+=i;break;case WMS_GW_VALIDITY_ENHANCED:break;default:break;}return pos;}}
1954wms_status_e_type wms_ts_decode_submit(const T_zUfiSms_RawTsData*ptRawTsData,
1955wms_gw_submit_s_type*submit){wms_status_e_type st=WMS_OK_S;uint32 pos=
1956(0xff4+4954-0x234e),i;const UINT8*data;if(ptRawTsData==NULL||submit==NULL){
1957printf(
1958"\x4e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x73\x75\x62\x6d\x69\x74\x21"
1959);return WMS_NULL_PTR_S;}data=ptRawTsData->data;submit->reject_duplicates=(data[
1960pos]&(0xb2d+3841-0x1a2a))?TRUE:FALSE;submit->validity.format=(
1961wms_gw_validity_format_e_type)((data[pos]&(0xa07+3419-0x174a))>>
1962(0x82+3778-0xf41));submit->status_report_enabled=(data[pos]&(0x133f+1288-0x1827)
1963)?TRUE:FALSE;submit->user_data_header_present=(data[pos]&(0x9c3+7561-0x270c))?
1964TRUE:FALSE;submit->reply_path_present=(data[pos]&(0x88a+7647-0x25e9))?TRUE:FALSE
1965;pos++;submit->message_reference=data[pos];pos++;i=wms_ts_decode_address(&data[
1966pos],&submit->address);if(i==(0x47b+6482-0x1dcd)){return WMS_INVALID_PARM_SIZE_S
1967;}pos+=i;submit->pid=(wms_pid_e_type)data[pos];pos++;pos+=wms_ts_decode_dcs(data
1968+pos,&submit->dcs);i=wms_ts_decode_gw_validity(data+pos,&submit->validity);if((
1969submit->validity.format!=WMS_GW_VALIDITY_NONE)&&(i==(0x1fba+1345-0x24fb))){
1970return WMS_INVALID_PARM_VALUE_S;}pos+=i;pos++;i=wms_ts_decode_gw_user_data(&
1971submit->dcs,data[pos-(0x70d+6067-0x1ebf)],data+pos,submit->
1972user_data_header_present,&submit->user_data);if(i>WMS_SMS_UDL_MAX_8_BIT){printf(
1973"\x55\x73\x65\x72\x20\x44\x61\x74\x61\x20\x4c\x65\x6e\x67\x74\x68\x20\x68\x61\x73\x20\x65\x78\x63\x65\x65\x64\x65\x64\x20\x63\x61\x70\x61\x63\x69\x74\x79\x3a\x20\x55\x44\x4c\x20\x3d\x20\x25\x6c\x75"
1974,i);st=WMS_INVALID_USER_DATA_SIZE_S;}pos+=i;return st;}wms_status_e_type
1975wms_ts_decode_status_report(const T_zUfiSms_RawTsData*ptRawTsData,
1976wms_gw_status_report_s_type*status_report){wms_status_e_type st=WMS_OK_S;uint32
1977pos=(0x13ec+4268-0x2498),i;const UINT8*data;if(ptRawTsData==NULL||status_report
1978==NULL){printf(
1979"\x4e\x75\x6c\x6c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x69\x6e\x20\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x5f\x73\x74\x61\x74\x75\x73\x5f\x72\x65\x70\x6f\x72\x74\x21"
1980);return WMS_NULL_PTR_S;}data=ptRawTsData->data;status_report->more=data[pos]&
1981(0x1383+3543-0x2156)?FALSE:TRUE;status_report->status_report_qualifier=data[pos]
1982&(0x54b+1181-0x9c8)?TRUE:FALSE;status_report->user_data_header_present=(data[pos
1983]&(0x959+2828-0x1425))?TRUE:FALSE;pos++;status_report->message_reference=data[
1984pos];pos++;i=wms_ts_decode_address(&data[pos],&status_report->address);if(i==
1985(0x163f+2733-0x20ec)){return WMS_INVALID_PARM_SIZE_S;}pos+=i;i=
1986wms_ts_decode_timestamp(data+pos,&status_report->timestamp);if(i==
1987(0x24c6+349-0x2623)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;i=
1988wms_ts_decode_timestamp(data+pos,&status_report->discharge_time);if(i==
1989(0x15b9+1868-0x1d05)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;status_report->
1990tp_status=(wms_tp_status_e_type)data[pos];pos++;status_report->mask=data[pos];
1991status_report->pid=(wms_pid_e_type)(0xb1+296-0x1d9);status_report->user_data.
1992sm_len=(0xa53+5303-0x1f0a);status_report->mask&=(0xbc9+5754-0x2144);if((
1993status_report->mask!=(0x1d5+4633-0x12ef))&&(status_report->mask!=
1994(0xa1b+2070-0x1231))){pos++;if(status_report->mask&WMS_TPDU_MASK_PID){
1995status_report->pid=(wms_pid_e_type)data[pos];pos++;}if(status_report->mask&
1996WMS_TPDU_MASK_DCS){pos+=wms_ts_decode_dcs(data+pos,&status_report->dcs);}if(
1997status_report->mask&WMS_TPDU_MASK_USER_DATA){pos++;i=wms_ts_decode_gw_user_data(
1998&status_report->dcs,data[pos-(0x195f+3008-0x251e)],data+pos,status_report->
1999user_data_header_present,&status_report->user_data);if(i>WMS_SMS_UDL_MAX_8_BIT){
2000printf(
2001"\x55\x73\x65\x72\x20\x44\x61\x74\x61\x20\x4c\x65\x6e\x67\x74\x68\x20\x68\x61\x73\x20\x65\x78\x63\x65\x65\x64\x65\x64\x20\x63\x61\x70\x61\x63\x69\x74\x79\x3a\x20\x55\x44\x4c\x20\x3d\x20\x25\x6c\x75"
2002,i);st=WMS_INVALID_USER_DATA_SIZE_S;}pos+=i;}}else{status_report->mask=
2003(0x13ff+4099-0x2402);}return st;}wms_status_e_type wms_ts_decode(const
2004T_zUfiSms_RawTsData*ptRawTsData,T_zUfiSms_ClientTsData*ptClientTsData){
2005wms_status_e_type st=WMS_OK_S;wms_gw_pp_ts_data_s_type*msg;if(ptRawTsData==NULL
2006||ptClientTsData==NULL){return WMS_NULL_PTR_S;}msg=&ptClientTsData->u.gw_pp;
2007switch(ptRawTsData->format){case WMS_FORMAT_CDMA:case WMS_FORMAT_ANALOG_AWISMS:
2008case WMS_FORMAT_ANALOG_CLI:case WMS_FORMAT_ANALOG_VOICE_MAIL:case
2009WMS_FORMAT_ANALOG_SMS:case WMS_FORMAT_MWI:at_print(AT_DEBUG,
2010"\x21\x21\x21\x21\x21\x21\x21\x21\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x20\x45\x72\x72\x6f\x72\x3a\x20\x47\x65\x74\x20\x4f\x6d\x69\x74\x20\x66\x6f\x72\x6d\x61\x74\x21\x21\x21\x20\x46\x6f\x72\x6d\x61\x74\x5b\x25\x64\x5d" "\n"
2011,ptRawTsData->format);break;case WMS_FORMAT_GW_PP:msg->tpdu_type=ptRawTsData->
2012tpdu_type;switch(msg->tpdu_type){case WMS_TPDU_DELIVER:st=wms_ts_decode_deliver(
2013ptRawTsData,&msg->u.deliver);break;case WMS_TPDU_SUBMIT:st=wms_ts_decode_submit(
2014ptRawTsData,&msg->u.submit);break;case WMS_TPDU_STATUS_REPORT:st=
2015wms_ts_decode_status_report(ptRawTsData,&msg->u.status_report);break;case
2016WMS_TPDU_DELIVER_REPORT_ACK:case WMS_TPDU_DELIVER_REPORT_ERROR:case
2017WMS_TPDU_SUBMIT_REPORT_ACK:case WMS_TPDU_SUBMIT_REPORT_ERROR:case
2018WMS_TPDU_COMMAND:at_print(AT_DEBUG,
2019"\x21\x21\x21\x21\x21\x21\x21\x21\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x20\x45\x72\x72\x6f\x72\x3a\x20\x47\x65\x74\x20\x4f\x6d\x69\x74\x20\x62\x72\x61\x6e\x63\x68\x21\x21\x21\x20\x74\x70\x64\x75\x5f\x74\x79\x70\x65\x5b\x25\x64\x5d" "\n"
2020,msg->tpdu_type);break;default:at_print(LOG_DEBUG,
2021"\x49\x6e\x76\x61\x6c\x69\x64\x20\x54\x50\x44\x55\x20\x74\x79\x70\x65\x20\x25\x64"
2022,msg->tpdu_type);st=WMS_INVALID_TPDU_TYPE_S;break;}break;case WMS_FORMAT_GW_CB:
2023at_print(AT_DEBUG,
2024"\x21\x21\x21\x21\x21\x21\x21\x21\x77\x6d\x73\x5f\x74\x73\x5f\x64\x65\x63\x6f\x64\x65\x20\x45\x72\x72\x6f\x72\x3a\x20\x47\x65\x74\x20\x4f\x6d\x69\x74\x20\x66\x6f\x72\x6d\x61\x74\x21\x21\x21\x20\x46\x6f\x72\x6d\x61\x74\x5b\x25\x64\x5d" "\n"
2025,ptRawTsData->format);break;default:st=WMS_INVALID_FORMAT_S;at_print(AT_DEBUG,
2026"\x49\x6e\x76\x61\x6c\x69\x64\x20\x66\x6f\x72\x6d\x61\x74\x3a\x20\x25\x64",
2027ptRawTsData->format);break;}ptClientTsData->format=ptRawTsData->format;return st
2028;}