[Feature][ZXW-237]merge P54U03 version

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: Id39ef8b992af691eab09c01d4ea26da89e5f4049
diff --git a/ap/app/Script/scripts/wan_ipv4.sh b/ap/app/Script/scripts/wan_ipv4.sh
index 95b5203..0473738 100755
--- a/ap/app/Script/scripts/wan_ipv4.sh
+++ b/ap/app/Script/scripts/wan_ipv4.sh
@@ -233,9 +233,9 @@
 	udhcpc_kill
 	pppoe_kill
 	
-	if [ "-$c_id" == "-0" -o "-$c_id" == "-$def_cid" ]; then
-		echo 0 > /proc/sys/net/ipv4/ip_forward
-	fi
+	#if [ "-$c_id" == "-0" -o "-$c_id" == "-$def_cid" ]; then
+		#echo 0 > /proc/sys/net/ipv4/ip_forward
+	#fi
 	
 	ifconfig $wan_if 0.0.0.0 2>>$test_log
 	if [ $? -ne 0 ];then
diff --git a/ap/app/Script/scripts/wan_ipv6.sh b/ap/app/Script/scripts/wan_ipv6.sh
index d1c1708..e1e60d1 100755
--- a/ap/app/Script/scripts/wan_ipv6.sh
+++ b/ap/app/Script/scripts/wan_ipv6.sh
@@ -142,7 +142,7 @@
             fi
 			
 			killall -9 clatd
-			clatd -i $wan_if -p 1:1:1:123:: &
+			#clatd -i $wan_if -p 1:1:1:123:: &
 			
 			if [ "-$c_id" != "-$def_cid" ]; then
 				wan_pri=`nv get $1"_priority"`
@@ -237,7 +237,7 @@
                 fi
 				
 				killall -9 clatd
-				clatd -i $wan_if -p 1:1:1:123:: &
+				#clatd -i $wan_if -p 1:1:1:123:: &
 			else
 				echo "the zte_ipv6_slaac fail"
 				nv set $wan_if"_ipv6_state"="dead"
@@ -297,6 +297,9 @@
 	if [ "-$c_id" == "-0" -o "-$c_id" == "-$def_cid" ]; then
 		echo 0 > /proc/sys/net/ipv6/conf/all/forwarding  
 		ip -6 route del default
+		ip route del default
+		killall clatd
+		iptables -t nat -D POSTROUTING -o v4-$wan_if -j MASQUERADE
 		#if [ $? -ne 0 ];then
 	        #echo "Error: ip -6 route del default failed." >> $test_log
         #fi
diff --git a/ap/app/Script/scripts/wan_ipv6_config.sh b/ap/app/Script/scripts/wan_ipv6_config.sh
index 1c1e278..9098fab 100755
--- a/ap/app/Script/scripts/wan_ipv6_config.sh
+++ b/ap/app/Script/scripts/wan_ipv6_config.sh
@@ -264,7 +264,23 @@
     
     ndp_kill
     zte_ndp -a -s br0 -d "$wan_if" -l $ndp_log &
-
+    xlat_enable=`nv get xlat_enable`
+    if [ "-$xlat_enable" == "-1" ];then
+	route_info=`route|grep default`
+	if [ "$route_info" == "" ];then
+		xlat_prefix=`nv get xlat_prefix`
+		#chmod 777 /dev/net/tun
+		if [ "$xlat_prefix" == "" ];then
+			clatd -i $defwan6_if &
+		else
+			clatd -i $defwan6_if -p $xlat_prefix &
+		fi		
+		echo 1 > /proc/sys/net/ipv4/ip_forward
+		iptables -t nat -A POSTROUTING -o v4-$defwan6_if -j MASQUERADE
+		sleep 1
+		ip route add default dev v4-$defwan6_if
+	fi
+    fi
 }
 
 ############ipv6 shell entry#################
diff --git a/ap/app/clatd/Android.mk b/ap/app/clatd/Android.mk
new file mode 100755
index 0000000..cae37fc
--- /dev/null
+++ b/ap/app/clatd/Android.mk
@@ -0,0 +1,52 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:=clatd.c dump.c checksum.c translate.c icmp.c ipv4.c ipv6.c config.c dns64.c logging.c getaddr.c netlink_callbacks.c netlink_msg.c setif.c mtu.c tun.c ring.c
+
+LOCAL_CFLAGS := -Wall -Werror -Wunused-parameter
+# Bug: http://b/33566695
+LOCAL_CFLAGS += -Wno-address-of-packed-member
+LOCAL_C_INCLUDES := external/libnl/include bionic/libc/dns/include system/netd/include
+LOCAL_STATIC_LIBRARIES := libnl
+LOCAL_SHARED_LIBRARIES := libcutils liblog libnetutils
+
+# The clat daemon.
+LOCAL_MODULE := clatd
+
+include $(BUILD_EXECUTABLE)
+
+
+# The configuration file.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := clatd.conf
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT)/etc
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+
+include $(BUILD_PREBUILT)
+
+
+# Unit tests.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := clatd_test
+LOCAL_CFLAGS := -Wall -Werror -Wunused-parameter
+# Bug: http://b/33566695
+LOCAL_CFLAGS += -Wno-address-of-packed-member
+LOCAL_SRC_FILES := clatd_test.cpp checksum.c translate.c icmp.c ipv4.c ipv6.c logging.c config.c tun.c
+LOCAL_MODULE_TAGS := eng tests
+LOCAL_SHARED_LIBRARIES := liblog libnetutils
+
+include $(BUILD_NATIVE_TEST)
+
+# Microbenchmark.
+include $(CLEAR_VARS)
+
+LOCAL_CLANG := true
+LOCAL_MODULE := clatd_microbenchmark
+LOCAL_CFLAGS := -Wall -Werror -Wunused-parameter
+LOCAL_SRC_FILES := clatd_microbenchmark.c checksum.c tun.c
+LOCAL_MODULE_TAGS := eng tests
+
+include $(BUILD_NATIVE_TEST)
diff --git a/ap/app/clatd/BUGS b/ap/app/clatd/BUGS
new file mode 100755
index 0000000..70aeb9f
--- /dev/null
+++ b/ap/app/clatd/BUGS
@@ -0,0 +1,5 @@
+known problems/assumptions:
+ - does not handle protocols other than ICMP, UDP, TCP and GRE
+ - assumes the handset has its own (routed) /64 ipv6 subnet
+ - assumes the /128 ipv6 subnet it generates can use the nat64 gateway
+ - assumes the nat64 gateway has the ipv4 address in the last 32 bits of the ipv6 address (that it uses a /96 plat subnet)
diff --git a/ap/app/clatd/LICENSE b/ap/app/clatd/LICENSE
new file mode 100755
index 0000000..261eeb9
--- /dev/null
+++ b/ap/app/clatd/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/ap/app/clatd/MODULE_LICENSE_APACHE2 b/ap/app/clatd/MODULE_LICENSE_APACHE2
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/ap/app/clatd/MODULE_LICENSE_APACHE2
diff --git a/ap/app/clatd/Makefile b/ap/app/clatd/Makefile
new file mode 100755
index 0000000..326c0be
--- /dev/null
+++ b/ap/app/clatd/Makefile
@@ -0,0 +1,73 @@
+#*******************************************************************************

+# include ZXIC application makefile

+#*******************************************************************************

+include $(COMMON_MK)

+

+#*******************************************************************************

+# execute

+#*******************************************************************************

+EXEC = clatd

+

+#*******************************************************************************

+# objects

+#*******************************************************************************

+OBJS = clatd.o \

+       dump.o \

+	   checksum.o \

+	   translate.o \

+	   icmp.o \

+	   ipv4.o \

+	   ipv6.o \

+	   config.o \

+	   dns64.o \

+	   logging.o \

+	   getaddr.o \

+	   netlink_callbacks.o \

+	   netlink_msg.o \

+	   setif.o \

+	   mtu.o \

+	   tun.o \

+	   ring.o \

+	   config_utils.o \

+	   ifc_utils.o \

+	   arc4random.o \

+	   load_file.o \

+	   getentropy.o

+

+

+#*******************************************************************************

+# include path

+#*******************************************************************************

+EXCFLAGS = -I$(zte_lib_path)/libnl/install/include/libnl3 -I$(zte_lib_path)/libnl/install

+CFLAGS += -DKEYSTREAM_ONLY -g

+CFLAGS += -I. $(EXCFLAGS)

+

+#*******************************************************************************

+# library

+#*******************************************************************************

+EXLDFLAGS = -L$(zte_lib_path)/libnl/install/lib

+LDLIBS += -lpthread

+LDLIBS += -lnl-3 $(EXLDFLAGS)

+

+

+#*******************************************************************************

+# library path

+#*******************************************************************************

+#LDLIBS  += -L$(LIB_DIR)/libnvram

+

+#*******************************************************************************

+# targets

+#*******************************************************************************

+all: $(EXEC)

+

+$(EXEC): $(OBJS)

+	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS$(LDLIBS_$@))

+

+romfs:

+	cp $(EXEC) $(EXEC).elf

+	$(ROMFSINST) $(EXEC) /bin/$(EXEC)

+	$(ROMFSINST) ./clatd.conf /etc/clatd.conf

+

+clean:

+	-rm -f $(EXEC) *.elf *.gdb *.o

+

diff --git a/ap/app/clatd/NOTICE b/ap/app/clatd/NOTICE
new file mode 100755
index 0000000..5943b54
--- /dev/null
+++ b/ap/app/clatd/NOTICE
@@ -0,0 +1,189 @@
+   Copyright (c) 2010-2012, Daniel Drown
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/ap/app/clatd/OWNERS b/ap/app/clatd/OWNERS
new file mode 100755
index 0000000..8f0a28b
--- /dev/null
+++ b/ap/app/clatd/OWNERS
@@ -0,0 +1,2 @@
+lorenzo@google.com
+ek@google.com
diff --git a/ap/app/clatd/arc4random.c b/ap/app/clatd/arc4random.c
new file mode 100755
index 0000000..10e5fe9
--- /dev/null
+++ b/ap/app/clatd/arc4random.c
@@ -0,0 +1,193 @@
+/*	$OpenBSD: arc4random.c,v 1.54 2015/09/13 08:31:47 guenther Exp $	*/
+
+/*
+ * Copyright (c) 1996, David Mazieres <dm@uun.org>
+ * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
+ * Copyright (c) 2013, Markus Friedl <markus@openbsd.org>
+ * Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * ChaCha based random number generator for OpenBSD.
+ */
+
+#include <fcntl.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+//#define KEYSTREAM_ONLY
+#include "chacha_private.h"
+
+#define minimum(a, b) ((a) < (b) ? (a) : (b))
+#define explicit_bzero(p, s) memset(p, 0, s)
+
+#if defined(__GNUC__) || defined(_MSC_VER)
+#define inline __inline
+#else				/* __GNUC__ || _MSC_VER */
+#define inline
+#endif				/* !__GNUC__ && !_MSC_VER */
+
+#define KEYSZ	32
+#define IVSZ	8
+#define BLOCKSZ	64
+#define RSBUFSZ	(16*BLOCKSZ)
+
+/* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
+static struct _rs {
+	size_t		rs_have;	/* valid bytes at end of rs_buf */
+	size_t		rs_count;	/* bytes till reseed */
+} *rs;
+
+/* Maybe be preserved in fork children, if _rs_allocate() decides. */
+static struct _rsx {
+	chacha_ctx	rs_chacha;	/* chacha context for random keystream */
+	u_char		rs_buf[RSBUFSZ];	/* keystream blocks */
+} *rsx;
+
+int getentropy(void* buffer, size_t buffer_size);
+
+static inline int _rs_allocate(struct _rs **, struct _rsx **);
+static inline void _rs_forkdetect(void);
+
+#include "arc4random.h"
+
+static inline void _rs_rekey(u_char *dat, size_t datlen);
+
+static inline void _rs_init(u_char *buf, size_t n)
+{
+	if (n < KEYSZ + IVSZ)
+		return;
+
+	if (rs == NULL) {
+		if (_rs_allocate(&rs, &rsx) == -1)
+			abort();
+	}
+
+	chacha_keysetup(&rsx->rs_chacha, buf, KEYSZ * 8, 0);
+	chacha_ivsetup(&rsx->rs_chacha, buf + KEYSZ);
+}
+
+static void _rs_stir(void)
+{
+	u_char rnd[KEYSZ + IVSZ];
+
+	if (getentropy(rnd, sizeof rnd) == -1)
+		_getentropy_fail();
+
+	if (!rs)
+		_rs_init(rnd, sizeof(rnd));
+	else
+		_rs_rekey(rnd, sizeof(rnd));
+	explicit_bzero(rnd, sizeof(rnd));	/* discard source seed */
+
+	/* invalidate rs_buf */
+	rs->rs_have = 0;
+	memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));
+
+	rs->rs_count = 1600000;
+}
+
+static inline void _rs_stir_if_needed(size_t len)
+{
+	_rs_forkdetect();
+	if (!rs || rs->rs_count <= len)
+		_rs_stir();
+	if (rs->rs_count <= len)
+		rs->rs_count = 0;
+	else
+		rs->rs_count -= len;
+}
+
+static inline void _rs_rekey(u_char *dat, size_t datlen)
+{
+#ifndef KEYSTREAM_ONLY
+	memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));
+#endif
+	/* fill rs_buf with the keystream */
+	chacha_encrypt_bytes(&rsx->rs_chacha, rsx->rs_buf,
+	    rsx->rs_buf, sizeof(rsx->rs_buf));
+	/* mix in optional user provided data */
+	if (dat) {
+		size_t i, m;
+
+		m = minimum(datlen, KEYSZ + IVSZ);
+		for (i = 0; i < m; i++)
+			rsx->rs_buf[i] ^= dat[i];
+	}
+	/* immediately reinit for backtracking resistance */
+	_rs_init(rsx->rs_buf, KEYSZ + IVSZ);
+	memset(rsx->rs_buf, 0, KEYSZ + IVSZ);
+	rs->rs_have = sizeof(rsx->rs_buf) - KEYSZ - IVSZ;
+}
+
+static inline void _rs_random_buf(void *_buf, size_t n)
+{
+	u_char *buf = (u_char *)_buf;
+	u_char *keystream;
+	size_t m;
+
+	_rs_stir_if_needed(n);
+	while (n > 0) {
+		if (rs->rs_have > 0) {
+			m = minimum(n, rs->rs_have);
+			keystream = rsx->rs_buf + sizeof(rsx->rs_buf)
+			    - rs->rs_have;
+			memcpy(buf, keystream, m);
+			memset(keystream, 0, m);
+			buf += m;
+			n -= m;
+			rs->rs_have -= m;
+		}
+		if (rs->rs_have == 0)
+			_rs_rekey(NULL, 0);
+	}
+}
+
+static inline void _rs_random_u32(uint32_t *val)
+{
+	u_char *keystream;
+
+	_rs_stir_if_needed(sizeof(*val));
+	if (rs->rs_have < sizeof(*val))
+		_rs_rekey(NULL, 0);
+	keystream = rsx->rs_buf + sizeof(rsx->rs_buf) - rs->rs_have;
+	memcpy(val, keystream, sizeof(*val));
+	memset(keystream, 0, sizeof(*val));
+	rs->rs_have -= sizeof(*val);
+}
+
+uint32_t arc4random(void)
+{
+	uint32_t val;
+
+	_ARC4_LOCK();
+	_rs_random_u32(&val);
+	_ARC4_UNLOCK();
+	return val;
+}
+
+void arc4random_buf(void *buf, size_t n)
+{
+	_ARC4_LOCK();
+	_rs_random_buf(buf, n);
+	_ARC4_UNLOCK();
+}
+
diff --git a/ap/app/clatd/arc4random.h b/ap/app/clatd/arc4random.h
new file mode 100755
index 0000000..2435c0d
--- /dev/null
+++ b/ap/app/clatd/arc4random.h
@@ -0,0 +1,105 @@
+/*	$OpenBSD: arc4random_linux.h,v 1.7 2014/07/20 20:51:13 bcook Exp $	*/
+
+/*
+ * Copyright (c) 1996, David Mazieres <dm@uun.org>
+ * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
+ * Copyright (c) 2013, Markus Friedl <markus@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Stub functions for portability.
+ */
+
+#include <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <stdio.h>
+
+//#include <async_safe/log.h>
+
+//#include "bionic_prctl.h"
+#include <sys/prctl.h>
+
+// This is only supported by Android kernels, so it's not in the uapi headers.
+#define PR_SET_VMA   0x53564d41
+#define PR_SET_VMA_ANON_NAME    0
+
+
+// Android gets these from "thread_private.h".
+//#include "thread_private.h"
+static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
+#define _ARC4_LOCK()   pthread_mutex_lock(&arc4random_mtx)
+#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
+
+#ifdef __GLIBC__
+extern void *__dso_handle;
+extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
+#define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle)
+#else
+#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
+#endif
+
+// Formats a message to the log (priority 'fatal'), then aborts.
+// Implemented as a macro so that async_safe_fatal isn't on the stack when we crash:
+// we appear to go straight from the caller to abort, saving an uninteresting stack
+// frame.
+#define async_safe_fatal(...) \
+  do { \
+    printf(__VA_ARGS__); \
+    abort(); \
+  } while (0) \
+
+static inline void _getentropy_fail(void) {
+    async_safe_fatal("getentropy failed: %s", strerror(errno));
+}
+
+volatile sig_atomic_t _rs_forked;
+
+static inline void
+_rs_forkdetect(void)
+{
+	static pid_t _rs_pid = 0;
+	pid_t pid = getpid();
+
+	if (_rs_pid == 0 || _rs_pid != pid || _rs_forked) {
+		_rs_pid = pid;
+		_rs_forked = 0;
+		if (rs)
+			memset(rs, 0, sizeof(*rs));
+	}
+}
+
+static inline int
+_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
+{
+	// OpenBSD's arc4random_linux.h allocates two separate mappings, but for
+	// themselves they just allocate both structs into one mapping like this.
+	struct {
+		struct _rs rs;
+		struct _rsx rsx;
+	} *p;
+
+	if ((p = mmap(NULL, sizeof(*p), PROT_READ|PROT_WRITE,
+	    MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
+		return (-1);
+
+	prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, sizeof(*p), "arc4random data");
+
+	*rsp = &p->rs;
+	*rsxp = &p->rsx;
+
+	return (0);
+}
diff --git a/ap/app/clatd/chacha_private.h b/ap/app/clatd/chacha_private.h
new file mode 100755
index 0000000..7c3680f
--- /dev/null
+++ b/ap/app/clatd/chacha_private.h
@@ -0,0 +1,222 @@
+/*
+chacha-merged.c version 20080118
+D. J. Bernstein
+Public domain.
+*/
+
+/* $OpenBSD: chacha_private.h,v 1.2 2013/10/04 07:02:27 djm Exp $ */
+
+typedef unsigned char u8;
+typedef unsigned int u32;
+
+typedef struct
+{
+  u32 input[16]; /* could be compressed */
+} chacha_ctx;
+
+#define U8C(v) (v##U)
+#define U32C(v) (v##U)
+
+#define U8V(v) ((u8)(v) & U8C(0xFF))
+#define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF))
+
+#define ROTL32(v, n) \
+  (U32V((v) << (n)) | ((v) >> (32 - (n))))
+
+#define U8TO32_LITTLE(p) \
+  (((u32)((p)[0])      ) | \
+   ((u32)((p)[1]) <<  8) | \
+   ((u32)((p)[2]) << 16) | \
+   ((u32)((p)[3]) << 24))
+
+#define U32TO8_LITTLE(p, v) \
+  do { \
+    (p)[0] = U8V((v)      ); \
+    (p)[1] = U8V((v) >>  8); \
+    (p)[2] = U8V((v) >> 16); \
+    (p)[3] = U8V((v) >> 24); \
+  } while (0)
+
+#define ROTATE(v,c) (ROTL32(v,c))
+#define XOR(v,w) ((v) ^ (w))
+#define PLUS(v,w) (U32V((v) + (w)))
+#define PLUSONE(v) (PLUS((v),1))
+
+#define QUARTERROUND(a,b,c,d) \
+  a = PLUS(a,b); d = ROTATE(XOR(d,a),16); \
+  c = PLUS(c,d); b = ROTATE(XOR(b,c),12); \
+  a = PLUS(a,b); d = ROTATE(XOR(d,a), 8); \
+  c = PLUS(c,d); b = ROTATE(XOR(b,c), 7);
+
+static const char sigma[16] = "expand 32-byte k";
+static const char tau[16] = "expand 16-byte k";
+
+static void
+chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits,u32 ivbits)
+{
+  const char *constants;
+
+  x->input[4] = U8TO32_LITTLE(k + 0);
+  x->input[5] = U8TO32_LITTLE(k + 4);
+  x->input[6] = U8TO32_LITTLE(k + 8);
+  x->input[7] = U8TO32_LITTLE(k + 12);
+  if (kbits == 256) { /* recommended */
+    k += 16;
+    constants = sigma;
+  } else { /* kbits == 128 */
+    constants = tau;
+  }
+  x->input[8] = U8TO32_LITTLE(k + 0);
+  x->input[9] = U8TO32_LITTLE(k + 4);
+  x->input[10] = U8TO32_LITTLE(k + 8);
+  x->input[11] = U8TO32_LITTLE(k + 12);
+  x->input[0] = U8TO32_LITTLE(constants + 0);
+  x->input[1] = U8TO32_LITTLE(constants + 4);
+  x->input[2] = U8TO32_LITTLE(constants + 8);
+  x->input[3] = U8TO32_LITTLE(constants + 12);
+}
+
+static void
+chacha_ivsetup(chacha_ctx *x,const u8 *iv)
+{
+  x->input[12] = 0;
+  x->input[13] = 0;
+  x->input[14] = U8TO32_LITTLE(iv + 0);
+  x->input[15] = U8TO32_LITTLE(iv + 4);
+}
+
+static void
+chacha_encrypt_bytes(chacha_ctx *x,const u8 *m,u8 *c,u32 bytes)
+{
+  u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
+  u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
+  u8 *ctarget = NULL;
+  u8 tmp[64];
+  u_int i;
+
+  if (!bytes) return;
+
+  j0 = x->input[0];
+  j1 = x->input[1];
+  j2 = x->input[2];
+  j3 = x->input[3];
+  j4 = x->input[4];
+  j5 = x->input[5];
+  j6 = x->input[6];
+  j7 = x->input[7];
+  j8 = x->input[8];
+  j9 = x->input[9];
+  j10 = x->input[10];
+  j11 = x->input[11];
+  j12 = x->input[12];
+  j13 = x->input[13];
+  j14 = x->input[14];
+  j15 = x->input[15];
+
+  for (;;) {
+    if (bytes < 64) {
+      for (i = 0;i < bytes;++i) tmp[i] = m[i];
+      m = tmp;
+      ctarget = c;
+      c = tmp;
+    }
+    x0 = j0;
+    x1 = j1;
+    x2 = j2;
+    x3 = j3;
+    x4 = j4;
+    x5 = j5;
+    x6 = j6;
+    x7 = j7;
+    x8 = j8;
+    x9 = j9;
+    x10 = j10;
+    x11 = j11;
+    x12 = j12;
+    x13 = j13;
+    x14 = j14;
+    x15 = j15;
+    for (i = 20;i > 0;i -= 2) {
+      QUARTERROUND( x0, x4, x8,x12)
+      QUARTERROUND( x1, x5, x9,x13)
+      QUARTERROUND( x2, x6,x10,x14)
+      QUARTERROUND( x3, x7,x11,x15)
+      QUARTERROUND( x0, x5,x10,x15)
+      QUARTERROUND( x1, x6,x11,x12)
+      QUARTERROUND( x2, x7, x8,x13)
+      QUARTERROUND( x3, x4, x9,x14)
+    }
+    x0 = PLUS(x0,j0);
+    x1 = PLUS(x1,j1);
+    x2 = PLUS(x2,j2);
+    x3 = PLUS(x3,j3);
+    x4 = PLUS(x4,j4);
+    x5 = PLUS(x5,j5);
+    x6 = PLUS(x6,j6);
+    x7 = PLUS(x7,j7);
+    x8 = PLUS(x8,j8);
+    x9 = PLUS(x9,j9);
+    x10 = PLUS(x10,j10);
+    x11 = PLUS(x11,j11);
+    x12 = PLUS(x12,j12);
+    x13 = PLUS(x13,j13);
+    x14 = PLUS(x14,j14);
+    x15 = PLUS(x15,j15);
+
+#ifndef KEYSTREAM_ONLY
+    x0 = XOR(x0,U8TO32_LITTLE(m + 0));
+    x1 = XOR(x1,U8TO32_LITTLE(m + 4));
+    x2 = XOR(x2,U8TO32_LITTLE(m + 8));
+    x3 = XOR(x3,U8TO32_LITTLE(m + 12));
+    x4 = XOR(x4,U8TO32_LITTLE(m + 16));
+    x5 = XOR(x5,U8TO32_LITTLE(m + 20));
+    x6 = XOR(x6,U8TO32_LITTLE(m + 24));
+    x7 = XOR(x7,U8TO32_LITTLE(m + 28));
+    x8 = XOR(x8,U8TO32_LITTLE(m + 32));
+    x9 = XOR(x9,U8TO32_LITTLE(m + 36));
+    x10 = XOR(x10,U8TO32_LITTLE(m + 40));
+    x11 = XOR(x11,U8TO32_LITTLE(m + 44));
+    x12 = XOR(x12,U8TO32_LITTLE(m + 48));
+    x13 = XOR(x13,U8TO32_LITTLE(m + 52));
+    x14 = XOR(x14,U8TO32_LITTLE(m + 56));
+    x15 = XOR(x15,U8TO32_LITTLE(m + 60));
+#endif
+
+    j12 = PLUSONE(j12);
+    if (!j12) {
+      j13 = PLUSONE(j13);
+      /* stopping at 2^70 bytes per nonce is user's responsibility */
+    }
+
+    U32TO8_LITTLE(c + 0,x0);
+    U32TO8_LITTLE(c + 4,x1);
+    U32TO8_LITTLE(c + 8,x2);
+    U32TO8_LITTLE(c + 12,x3);
+    U32TO8_LITTLE(c + 16,x4);
+    U32TO8_LITTLE(c + 20,x5);
+    U32TO8_LITTLE(c + 24,x6);
+    U32TO8_LITTLE(c + 28,x7);
+    U32TO8_LITTLE(c + 32,x8);
+    U32TO8_LITTLE(c + 36,x9);
+    U32TO8_LITTLE(c + 40,x10);
+    U32TO8_LITTLE(c + 44,x11);
+    U32TO8_LITTLE(c + 48,x12);
+    U32TO8_LITTLE(c + 52,x13);
+    U32TO8_LITTLE(c + 56,x14);
+    U32TO8_LITTLE(c + 60,x15);
+
+    if (bytes <= 64) {
+      if (bytes < 64) {
+        for (i = 0;i < bytes;++i) ctarget[i] = c[i];
+      }
+      x->input[12] = j12;
+      x->input[13] = j13;
+      return;
+    }
+    bytes -= 64;
+    c += 64;
+#ifndef KEYSTREAM_ONLY
+    m += 64;
+#endif
+  }
+}
diff --git a/ap/app/clatd/checksum.c b/ap/app/clatd/checksum.c
new file mode 100755
index 0000000..23a7c02
--- /dev/null
+++ b/ap/app/clatd/checksum.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * checksum.c - ipv4/ipv6 checksum calculation
+ */
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/udp.h>
+#include <netinet/tcp.h>
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
+
+#include "checksum.h"
+
+/* function: ip_checksum_add
+ * adds data to a checksum
+ * current - the current checksum (or 0 to start a new checksum)
+ * data        - the data to add to the checksum
+ * len         - length of data
+ */
+uint32_t ip_checksum_add(uint32_t current, const void *data, int len) {
+  uint32_t checksum = current;
+  int left = len;
+  const uint16_t *data_16 = data;
+
+  while(left > 1) {
+    checksum += *data_16;
+    data_16++;
+    left -= 2;
+  }
+  if(left) {
+    checksum += *(uint8_t *)data_16;
+  }
+
+  return checksum;
+}
+
+/* function: ip_checksum_fold
+ * folds a 32-bit partial checksum into 16 bits
+ * temp_sum - sum from ip_checksum_add
+ * returns: the folded checksum in network byte order
+ */
+uint16_t ip_checksum_fold(uint32_t temp_sum) {
+  while(temp_sum > 0xffff)
+    temp_sum = (temp_sum >> 16) + (temp_sum & 0xFFFF);
+
+  return temp_sum;
+}
+
+/* function: ip_checksum_finish
+ * folds and closes the checksum
+ * temp_sum - sum from ip_checksum_add
+ * returns: a header checksum value in network byte order
+ */
+uint16_t ip_checksum_finish(uint32_t temp_sum) {
+  return ~ip_checksum_fold(temp_sum);
+}
+
+/* function: ip_checksum
+ * combined ip_checksum_add and ip_checksum_finish
+ * data - data to checksum
+ * len  - length of data
+ */
+uint16_t ip_checksum(const void *data, int len) {
+  uint32_t temp_sum;
+
+  temp_sum = ip_checksum_add(0,data,len);
+  return ip_checksum_finish(temp_sum);
+}
+
+/* function: ipv6_pseudo_header_checksum
+ * calculate the pseudo header checksum for use in tcp/udp/icmp headers
+ * ip6      - the ipv6 header
+ * len      - the transport length (transport header + payload)
+ * protocol - the transport layer protocol, can be different from ip6->ip6_nxt for fragments
+ */
+uint32_t ipv6_pseudo_header_checksum(const struct ip6_hdr *ip6, uint16_t len, uint8_t protocol) {
+  uint32_t checksum_len, checksum_next;
+  checksum_len = htonl((uint32_t) len);
+  checksum_next = htonl(protocol);
+
+  uint32_t current = 0;
+  current = ip_checksum_add(current, &(ip6->ip6_src), sizeof(struct in6_addr));
+  current = ip_checksum_add(current, &(ip6->ip6_dst), sizeof(struct in6_addr));
+  current = ip_checksum_add(current, &checksum_len, sizeof(checksum_len));
+  current = ip_checksum_add(current, &checksum_next, sizeof(checksum_next));
+
+  return current;
+}
+
+/* function: ipv4_pseudo_header_checksum
+ * calculate the pseudo header checksum for use in tcp/udp headers
+ * ip      - the ipv4 header
+ * len     - the transport length (transport header + payload)
+ */
+uint32_t ipv4_pseudo_header_checksum(const struct iphdr *ip, uint16_t len) {
+  uint16_t temp_protocol, temp_length;
+
+  temp_protocol = htons(ip->protocol);
+  temp_length = htons(len);
+
+  uint32_t current = 0;
+  current = ip_checksum_add(current, &(ip->saddr), sizeof(uint32_t));
+  current = ip_checksum_add(current, &(ip->daddr), sizeof(uint32_t));
+  current = ip_checksum_add(current, &temp_protocol, sizeof(uint16_t));
+  current = ip_checksum_add(current, &temp_length, sizeof(uint16_t));
+
+  return current;
+}
+
+/* function: ip_checksum_adjust
+ * calculates a new checksum given a previous checksum and the old and new pseudo-header checksums
+ * checksum    - the header checksum in the original packet in network byte order
+ * old_hdr_sum - the pseudo-header checksum of the original packet
+ * new_hdr_sum - the pseudo-header checksum of the translated packet
+ * returns: the new header checksum in network byte order
+ */
+uint16_t ip_checksum_adjust(uint16_t checksum, uint32_t old_hdr_sum, uint32_t new_hdr_sum) {
+  // Algorithm suggested in RFC 1624.
+  // http://tools.ietf.org/html/rfc1624#section-3
+  checksum = ~checksum;
+  uint16_t folded_sum = ip_checksum_fold(checksum + new_hdr_sum);
+  uint16_t folded_old = ip_checksum_fold(old_hdr_sum);
+  if (folded_sum > folded_old) {
+    return ~(folded_sum - folded_old);
+  } else {
+    return ~(folded_sum - folded_old - 1);  // end-around borrow
+  }
+}
diff --git a/ap/app/clatd/checksum.h b/ap/app/clatd/checksum.h
new file mode 100755
index 0000000..d0af88e
--- /dev/null
+++ b/ap/app/clatd/checksum.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * checksum.h - checksum functions
+ */
+#ifndef __CHECKSUM_H__
+#define __CHECKSUM_H__
+
+#include <stdint.h>
+#include <netinet/ip.h>
+#include <netinet/ip6.h>
+
+uint32_t ip_checksum_add(uint32_t current, const void *data, int len);
+uint16_t ip_checksum_finish(uint32_t temp_sum);
+uint16_t ip_checksum(const void *data, int len);
+
+uint32_t ipv6_pseudo_header_checksum(const struct ip6_hdr *ip6, uint16_t len, uint8_t protocol);
+uint32_t ipv4_pseudo_header_checksum(const struct iphdr *ip, uint16_t len);
+
+uint16_t ip_checksum_adjust(uint16_t checksum, uint32_t old_hdr_sum, uint32_t new_hdr_sum);
+
+#endif /* __CHECKSUM_H__ */
diff --git a/ap/app/clatd/clatd b/ap/app/clatd/clatd
new file mode 100755
index 0000000..0106af5
--- /dev/null
+++ b/ap/app/clatd/clatd
Binary files differ
diff --git a/ap/app/clatd/clatd.c b/ap/app/clatd/clatd.c
new file mode 100755
index 0000000..a1552d2
--- /dev/null
+++ b/ap/app/clatd/clatd.c
@@ -0,0 +1,545 @@
+/*
+ * Copyright 2012 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * clatd.c - tun interface setup and main event loop
+ */
+#include <poll.h>
+#include <signal.h>
+#include <time.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <fcntl.h>
+
+#include <linux/capability.h>
+#include <sys/uio.h>
+#include <linux/filter.h>
+#include <linux/if.h>
+#include <linux/if_tun.h>
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
+//#include <net/if.h>
+
+#include <grp.h>
+
+#include "translate.h"
+#include "clatd.h"
+#include "config.h"
+#include "logging.h"
+//#include "resolv_netid.h"
+#include "setif.h"
+#include "mtu.h"
+#include "getaddr.h"
+#include "dump.h"
+#include "tun.h"
+#include "ring.h"
+#include <asm/unistd.h>
+#include "my_header.h"
+
+#define DEVICEPREFIX "v4-"
+
+/* 40 bytes IPv6 header - 20 bytes IPv4 header + 8 bytes fragment header */
+#define MTU_DELTA 28
+
+volatile sig_atomic_t running = 1;
+
+/* function: stop_loop
+ * signal handler: stop the event loop
+ */
+void stop_loop() {
+  running = 0;
+}
+
+/* function: configure_packet_socket
+ * Binds the packet socket and attaches the receive filter to it.
+ * sock - the socket to configure
+ */
+int configure_packet_socket(int sock) {
+  struct sockaddr_ll sll = {
+    .sll_family   = AF_PACKET,
+    .sll_protocol = htons(ETH_P_IPV6),
+    .sll_ifindex  = if_nametoindex(Global_Clatd_Config.default_pdp_interface),
+    .sll_pkttype  = PACKET_OTHERHOST,  // The 464xlat IPv6 address is not assigned to the kernel.
+  };
+  if (bind(sock, (struct sockaddr *) &sll, sizeof(sll))) {
+    logmsg(ANDROID_LOG_FATAL, "binding packet socket: %s", strerror(errno));
+    return 0;
+  }
+
+  uint32_t *ipv6 = Global_Clatd_Config.ipv6_local_subnet.s6_addr32;
+  struct sock_filter filter_code[] = {
+    // Load the first four bytes of the IPv6 destination address (starts 24 bytes in).
+    // Compare it against the first four bytes of our IPv6 address, in host byte order (BPF loads
+    // are always in host byte order). If it matches, continue with next instruction (JMP 0). If it
+    // doesn't match, jump ahead to statement that returns 0 (ignore packet). Repeat for the other
+    // three words of the IPv6 address, and if they all match, return PACKETLEN (accept packet).
+    BPF_STMT(BPF_LD  | BPF_W   | BPF_ABS,  24),
+    BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,    htonl(ipv6[0]), 0, 7),
+    BPF_STMT(BPF_LD  | BPF_W   | BPF_ABS,  28),
+    BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,    htonl(ipv6[1]), 0, 5),
+    BPF_STMT(BPF_LD  | BPF_W   | BPF_ABS,  32),
+    BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,    htonl(ipv6[2]), 0, 3),
+    BPF_STMT(BPF_LD  | BPF_W   | BPF_ABS,  36),
+    BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,    htonl(ipv6[3]), 0, 1),
+    BPF_STMT(BPF_RET | BPF_K,              PACKETLEN),
+    BPF_STMT(BPF_RET | BPF_K, 0)
+  };
+  struct sock_fprog filter = {
+    sizeof(filter_code) / sizeof(filter_code[0]),
+    filter_code
+  };
+
+  if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter))) {
+    logmsg(ANDROID_LOG_FATAL, "attach packet filter failed: %s", strerror(errno));
+    return 0;
+  }
+
+  return 1;
+}
+
+/* function: configure_tun_ip
+ * configures the ipv4 and ipv6 addresses on the tunnel interface
+ * tunnel - tun device data
+ */
+void configure_tun_ip(const struct tun_data *tunnel) {
+  int status;
+
+  // Pick an IPv4 address to use by finding a free address in the configured prefix. Technically,
+  // there is a race here - if another clatd calls config_select_ipv4_address after we do, but
+  // before we call add_address, it can end up having the same IP address as we do. But the time
+  // window in which this can happen is extremely small, and even if we end up with a duplicate
+  // address, the only damage is that IPv4 TCP connections won't be reset until both interfaces go
+  // down.
+  in_addr_t localaddr = config_select_ipv4_address(&Global_Clatd_Config.ipv4_local_subnet,
+                                                   Global_Clatd_Config.ipv4_local_prefixlen);
+  if (localaddr == INADDR_NONE) {
+    logmsg(ANDROID_LOG_FATAL,"No free IPv4 address in %s/%d",
+           inet_ntoa(Global_Clatd_Config.ipv4_local_subnet),
+           Global_Clatd_Config.ipv4_local_prefixlen);
+    exit(1);
+  }
+  Global_Clatd_Config.ipv4_local_subnet.s_addr = localaddr;
+
+  // Configure the interface before bringing it up. As soon as we bring the interface up, the
+  // framework will be notified and will assume the interface's configuration has been finalized.
+  status = add_address(tunnel->device4, AF_INET, &Global_Clatd_Config.ipv4_local_subnet,
+      32, &Global_Clatd_Config.ipv4_local_subnet);
+  if(status < 0) {
+    logmsg(ANDROID_LOG_FATAL,"configure_tun_ip/if_address(4) failed: %s",strerror(-status));
+    exit(1);
+  }
+
+  char addrstr[INET_ADDRSTRLEN];
+  inet_ntop(AF_INET, &Global_Clatd_Config.ipv4_local_subnet, addrstr, sizeof(addrstr));
+  logmsg(ANDROID_LOG_INFO, "Using IPv4 address %s on %s", addrstr, tunnel->device4);
+
+  if((status = if_up(tunnel->device4, Global_Clatd_Config.ipv4mtu)) < 0) {
+    logmsg(ANDROID_LOG_FATAL,"configure_tun_ip/if_up(4) failed: %s",strerror(-status));
+    exit(1);
+  }
+}
+
+/* function: drop_root
+ * drops root privs but keeps the needed capability
+ */
+void drop_root() {
+  gid_t groups[] = { AID_INET, AID_VPN };
+  if(setgroups(sizeof(groups)/sizeof(groups[0]), groups) < 0) {
+    logmsg(ANDROID_LOG_FATAL,"drop_root/setgroups failed: %s",strerror(errno));
+    exit(1);
+  }
+
+  prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
+
+  if(setgid(AID_CLAT) < 0) {
+    logmsg(ANDROID_LOG_FATAL,"drop_root/setgid failed: %s",strerror(errno));
+    exit(1);
+  }
+  if(setuid(AID_CLAT) < 0) {
+    logmsg(ANDROID_LOG_FATAL,"drop_root/setuid failed: %s",strerror(errno));
+    exit(1);
+  }
+
+  struct __user_cap_header_struct header;
+  struct __user_cap_data_struct cap;
+  memset(&header, 0, sizeof(header));
+  memset(&cap, 0, sizeof(cap));
+
+  header.version = _LINUX_CAPABILITY_VERSION;
+  header.pid = 0; // 0 = change myself
+  cap.effective = cap.permitted = (1 << CAP_NET_ADMIN);
+
+  if(capset(&header, &cap) < 0) {
+    logmsg(ANDROID_LOG_FATAL,"drop_root/capset failed: %s",strerror(errno));
+    exit(1);
+  }
+}
+
+/* function: open_sockets
+ * opens a packet socket to receive IPv6 packets and a raw socket to send them
+ * tunnel - tun device data
+ * mark - the socket mark to use for the sending raw socket
+ */
+void open_sockets(struct tun_data *tunnel, uint32_t mark) {
+  int rawsock = socket(AF_INET6, SOCK_RAW | SOCK_NONBLOCK, IPPROTO_RAW);
+  if (rawsock < 0) {
+    logmsg(ANDROID_LOG_FATAL, "raw socket failed: %s", strerror(errno));
+    exit(1);
+  }
+
+  int off = 0;
+  if (setsockopt(rawsock, SOL_IPV6, IPV6_CHECKSUM, &off, sizeof(off)) < 0) {
+    logmsg(ANDROID_LOG_WARN, "could not disable checksum on raw socket: %s", strerror(errno));
+  }
+  if (mark != MARK_UNSET && setsockopt(rawsock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) < 0) {
+    logmsg(ANDROID_LOG_ERROR, "could not set mark on raw socket: %s", strerror(errno));
+  }
+
+  tunnel->write_fd6 = rawsock;
+
+  tunnel->read_fd6 = ring_create(tunnel);
+  if (tunnel->read_fd6 < 0) {
+    exit(1);
+  }
+}
+
+/* function: update_clat_ipv6_address
+ * picks the clat IPv6 address and configures packet translation to use it.
+ * tunnel - tun device data
+ * interface - uplink interface name
+ * returns: 1 on success, 0 on failure
+ */
+int update_clat_ipv6_address(const struct tun_data *tunnel, const char *interface) {
+  union anyip *interface_ip;
+  char addrstr[INET6_ADDRSTRLEN];
+
+  // TODO: check that the prefix length is /64.
+  interface_ip = getinterface_ip(interface, AF_INET6);
+  if (!interface_ip) {
+    logmsg(ANDROID_LOG_ERROR, "Unable to find an IPv6 address on interface %s", interface);
+    return 0;
+  }
+
+  // If our prefix hasn't changed, do nothing. (If this is the first time we configure an IPv6
+  // address, Global_Clatd_Config.ipv6_local_subnet will be ::, which won't match our new prefix.)
+  if (ipv6_prefix_equal(&interface_ip->ip6, &Global_Clatd_Config.ipv6_local_subnet)) {
+    free(interface_ip);
+    return 1;
+  }
+
+  // Generate an interface ID.
+  config_generate_local_ipv6_subnet(&interface_ip->ip6);
+  inet_ntop(AF_INET6, &interface_ip->ip6, addrstr, sizeof(addrstr));
+
+  if (IN6_IS_ADDR_UNSPECIFIED(&Global_Clatd_Config.ipv6_local_subnet)) {
+    // Startup.
+    logmsg(ANDROID_LOG_INFO, "Using IPv6 address %s on %s", addrstr, interface);
+  } else {
+    // Prefix change.
+    char from_addr[INET6_ADDRSTRLEN];
+    inet_ntop(AF_INET6, &Global_Clatd_Config.ipv6_local_subnet, from_addr, sizeof(from_addr));
+    logmsg(ANDROID_LOG_INFO, "clat IPv6 address changed from %s to %s", from_addr, addrstr);
+    del_anycast_address(tunnel->write_fd6, &Global_Clatd_Config.ipv6_local_subnet);
+  }
+
+  // Start translating packets to the new prefix.
+  Global_Clatd_Config.ipv6_local_subnet = interface_ip->ip6;
+  add_anycast_address(tunnel->write_fd6, &Global_Clatd_Config.ipv6_local_subnet, interface);
+  free(interface_ip);
+
+  // Update our packet socket filter to reflect the new 464xlat IP address.
+  if (!configure_packet_socket(tunnel->read_fd6)) {
+      // Things aren't going to work. Bail out and hope we have better luck next time.
+      // We don't log an error here because configure_packet_socket has already done so.
+      exit(1);
+  }
+  unsigned char info[40] = {0};
+  unsigned char *pinfo = info;
+  memcpy(pinfo, &Global_Clatd_Config.plat_subnet, sizeof(struct in6_addr));
+  pinfo = pinfo + sizeof(struct in6_addr);
+  memcpy(pinfo, &Global_Clatd_Config.ipv6_local_subnet, sizeof(struct in6_addr));
+  pinfo = pinfo + sizeof(struct in6_addr);
+  memcpy(pinfo, &Global_Clatd_Config.ipv4_local_subnet, sizeof(struct in_addr));
+  syscall(__NR_set_xlat, (char *)info, Global_Clatd_Config.default_pdp_interface);
+  return 1;
+}
+
+/* function: configure_interface
+ * reads the configuration and applies it to the interface
+ * uplink_interface - network interface to use to reach the ipv6 internet
+ * plat_prefix      - PLAT prefix to use
+ * tunnel           - tun device data
+ * net_id           - NetID to use, NETID_UNSET indicates use of default network
+ */
+void configure_interface(const char *uplink_interface, const char *plat_prefix, struct tun_data *tunnel, unsigned net_id) {
+  int error;
+
+  if(!read_config("/etc/clatd.conf", uplink_interface, plat_prefix, net_id)) {
+    logmsg(ANDROID_LOG_FATAL,"read_config failed");
+    exit(1);
+  }
+
+  if(Global_Clatd_Config.mtu > MAXMTU) {
+    logmsg(ANDROID_LOG_WARN,"Max MTU is %d, requested %d", MAXMTU, Global_Clatd_Config.mtu);
+    Global_Clatd_Config.mtu = MAXMTU;
+  }
+  if(Global_Clatd_Config.mtu <= 0) {
+    Global_Clatd_Config.mtu = getifmtu(Global_Clatd_Config.default_pdp_interface);
+    logmsg(ANDROID_LOG_WARN,"ifmtu=%d",Global_Clatd_Config.mtu);
+  }
+  if(Global_Clatd_Config.mtu < 1280) {
+    logmsg(ANDROID_LOG_WARN,"mtu too small = %d", Global_Clatd_Config.mtu);
+    Global_Clatd_Config.mtu = 1280;
+  }
+
+  if(Global_Clatd_Config.ipv4mtu <= 0 ||
+     Global_Clatd_Config.ipv4mtu > Global_Clatd_Config.mtu - MTU_DELTA) {
+    Global_Clatd_Config.ipv4mtu = Global_Clatd_Config.mtu - MTU_DELTA;
+    logmsg(ANDROID_LOG_WARN,"ipv4mtu now set to = %d",Global_Clatd_Config.ipv4mtu);
+  }
+
+  error = tun_alloc(tunnel->device4, tunnel->fd4);
+  if(error < 0) {
+    logmsg(ANDROID_LOG_FATAL,"tun_alloc/4 failed: %s",strerror(errno));
+    exit(1);
+  }
+
+  error = set_nonblocking(tunnel->fd4);
+  if (error < 0) {
+    logmsg(ANDROID_LOG_FATAL, "set_nonblocking failed: %s", strerror(errno));
+    exit(1);
+  }
+
+  configure_tun_ip(tunnel);
+}
+
+/* function: read_packet
+ * reads a packet from the tunnel fd and translates it
+ * read_fd  - file descriptor to read original packet from
+ * write_fd - file descriptor to write translated packet to
+ * to_ipv6  - whether the packet is to be translated to ipv6 or ipv4
+ */
+void read_packet(int read_fd, int write_fd, int to_ipv6) {
+  ssize_t readlen;
+  uint8_t buf[PACKETLEN], *packet;
+
+  readlen = read(read_fd, buf, PACKETLEN);
+
+  if(readlen < 0) {
+    if (errno != EAGAIN) {
+      logmsg(ANDROID_LOG_WARN,"read_packet/read error: %s", strerror(errno));
+    }
+    return;
+  } else if(readlen == 0) {
+    logmsg(ANDROID_LOG_WARN,"read_packet/tun interface removed");
+    running = 0;
+    return;
+  }
+
+  struct tun_pi *tun_header = (struct tun_pi *) buf;
+  if (readlen < (ssize_t) sizeof(*tun_header)) {
+    logmsg(ANDROID_LOG_WARN,"read_packet/short read: got %ld bytes", readlen);
+    return;
+  }
+
+  uint16_t proto = ntohs(tun_header->proto);
+  if (proto != ETH_P_IP) {
+    logmsg(ANDROID_LOG_WARN, "%s: unknown packet type = 0x%x", __func__, proto);
+    return;
+  }
+
+  if(tun_header->flags != 0) {
+    logmsg(ANDROID_LOG_WARN, "%s: unexpected flags = %d", __func__, tun_header->flags);
+  }
+
+  packet = (uint8_t *) (tun_header + 1);
+  readlen -= sizeof(*tun_header);
+  translate_packet(write_fd, to_ipv6, packet, readlen);
+}
+
+/* function: event_loop
+ * reads packets from the tun network interface and passes them down the stack
+ * tunnel - tun device data
+ */
+void event_loop(struct tun_data *tunnel) {
+  time_t last_interface_poll;
+  struct pollfd wait_fd[] = {
+    { tunnel->read_fd6, POLLIN, 0 },
+    { tunnel->fd4, POLLIN, 0 },
+  };
+
+  // start the poll timer
+  last_interface_poll = time(NULL);
+
+  while(running) {
+    if (poll(wait_fd, ARRAY_SIZE(wait_fd),
+             NO_TRAFFIC_INTERFACE_POLL_FREQUENCY * 1000) == -1) {
+      if (errno != EINTR) {
+        logmsg(ANDROID_LOG_WARN,"event_loop/poll returned an error: %s", strerror(errno));
+      }
+    } else {
+      if (wait_fd[0].revents & POLLIN) {
+        ring_read(&tunnel->ring, tunnel->fd4, 0 /* to_ipv6 */);
+      }
+      // If any other bit is set, assume it's due to an error (i.e. POLLERR).
+      if (wait_fd[0].revents & ~POLLIN) {
+        // ring_read doesn't clear the error indication on the socket.
+        recv(tunnel->read_fd6, NULL, 0, MSG_PEEK);
+        logmsg(ANDROID_LOG_WARN, "event_loop: clearing error on read_fd6: %s",
+               strerror(errno));
+      }
+
+      // Call read_packet if the socket has data to be read, but also if an
+      // error is waiting. If we don't call read() after getting POLLERR, a
+      // subsequent poll() will return immediately with POLLERR again,
+      // causing this code to spin in a loop. Calling read() will clear the
+      // socket error flag instead.
+      if (wait_fd[1].revents) {
+        read_packet(tunnel->fd4, tunnel->write_fd6, 1 /* to_ipv6 */);
+      }
+    }
+
+    time_t now = time(NULL);
+    if(last_interface_poll < (now - INTERFACE_POLL_FREQUENCY)) {
+      update_clat_ipv6_address(tunnel, Global_Clatd_Config.default_pdp_interface);
+      last_interface_poll = now;
+    }
+  }
+}
+
+/* function: print_help
+ * in case the user is running this on the command line
+ */
+void print_help() {
+  printf("clat arguments:\n");
+  printf("-i [uplink interface]\n");
+  printf("-p [plat prefix]\n");
+  printf("-n [NetId]\n");
+  printf("-m [socket mark]\n");
+}
+
+/* function: parse_unsigned
+ * parses a string as a decimal/hex/octal unsigned integer
+ * str - the string to parse
+ * out - the unsigned integer to write to, gets clobbered on failure
+ */
+int parse_unsigned(const char *str, unsigned *out) {
+    char *end_ptr;
+    *out = strtoul(str, &end_ptr, 0);
+    return *str && !*end_ptr;
+}
+
+/* function: main
+ * allocate and setup the tun device, then run the event loop
+ */
+int main(int argc, char **argv) {
+  struct tun_data tunnel;
+  int opt;
+  char *uplink_interface = NULL, *plat_prefix = NULL, *net_id_str = NULL, *mark_str = NULL;
+  unsigned net_id = NETID_UNSET;
+  uint32_t mark = MARK_UNSET;
+  unsigned len;
+
+  while((opt = getopt(argc, argv, "i:p:n:m:h")) != -1) {
+    switch(opt) {
+      case 'i':
+        uplink_interface = optarg;
+        break;
+      case 'p':
+        plat_prefix = optarg;
+        break;
+      case 'n':
+        net_id_str = optarg;
+        break;
+      case 'm':
+        mark_str = optarg;
+        break;
+      case 'h':
+        print_help();
+        exit(0);
+      default:
+        logmsg(ANDROID_LOG_FATAL, "Unknown option -%c. Exiting.", (char) optopt);
+        exit(1);
+    }
+  }
+
+  if(uplink_interface == NULL) {
+    logmsg(ANDROID_LOG_FATAL, "clatd called without an interface");
+    exit(1);
+  }
+
+  if (net_id_str != NULL && !parse_unsigned(net_id_str, &net_id)) {
+    logmsg(ANDROID_LOG_FATAL, "invalid NetID %s", net_id_str);
+    exit(1);
+  }
+
+  if (mark_str != NULL && !parse_unsigned(mark_str, &mark)) {
+    logmsg(ANDROID_LOG_FATAL, "invalid mark %s", mark_str);
+    exit(1);
+  }
+
+  len = snprintf(tunnel.device4, sizeof(tunnel.device4), "%s%s", DEVICEPREFIX, uplink_interface);
+  if (len >= sizeof(tunnel.device4)) {
+    logmsg(ANDROID_LOG_FATAL, "interface name too long '%s'", tunnel.device4);
+    exit(1);
+  }
+
+  logmsg(ANDROID_LOG_INFO, "Starting clat version %s on %s netid=%s mark=%s",
+         CLATD_VERSION, uplink_interface,
+         net_id_str ? net_id_str : "(none)",
+         mark_str ? mark_str : "(none)");
+
+  // open our raw sockets before dropping privs
+  open_sockets(&tunnel, mark);
+
+  // run under a regular user
+  //drop_root();
+
+  // we can create tun devices as non-root because we're in the VPN group.
+  tunnel.fd4 = tun_open();
+  if(tunnel.fd4 < 0) {
+    logmsg(ANDROID_LOG_FATAL, "tun_open4 failed: %s", strerror(errno));
+    exit(1);
+  }
+
+  // When run from netd, the environment variable ANDROID_DNS_MODE is set to
+  // "local", but that only works for the netd process itself. Removing the
+  // following line causes XLAT failure in permissive mode.
+  //unsetenv("ANDROID_DNS_MODE");
+
+  configure_interface(uplink_interface, plat_prefix, &tunnel, net_id);
+
+  update_clat_ipv6_address(&tunnel, uplink_interface);
+
+  // Loop until someone sends us a signal or brings down the tun interface.
+  if(signal(SIGTERM, stop_loop) == SIG_ERR) {
+    logmsg(ANDROID_LOG_FATAL, "sigterm handler failed: %s", strerror(errno));
+    exit(1);
+  }
+
+  event_loop(&tunnel);
+
+  logmsg(ANDROID_LOG_INFO,"Shutting down clat on %s", uplink_interface);
+  del_anycast_address(tunnel.write_fd6, &Global_Clatd_Config.ipv6_local_subnet);
+
+  return 0;
+}
diff --git a/ap/app/clatd/clatd.conf b/ap/app/clatd/clatd.conf
new file mode 100755
index 0000000..1e1bf84
--- /dev/null
+++ b/ap/app/clatd/clatd.conf
@@ -0,0 +1,15 @@
+# host ID to use as the source of CLAT traffic
+# this is a /128 taken out of the /64 routed to the phone
+ipv6_host_id ::464
+
+# ipv4 subnet for the local traffic to use.  This is a /32 host address
+ipv4_local_subnet 192.190.0.1
+
+# get the plat_subnet from dns lookups (requires DNS64)
+plat_from_dns64 yes
+# hostname to use to lookup plat subnet. must contain only A records
+plat_from_dns64_hostname ipv4only.arpa
+
+# plat subnet to send ipv4 traffic to. This is a /96 subnet.
+# This setting only makes sense with: plat_from_dns64 no
+#plat_subnet 2001:db8:1:2:3:4::
diff --git a/ap/app/clatd/clatd.elf b/ap/app/clatd/clatd.elf
new file mode 100755
index 0000000..0106af5
--- /dev/null
+++ b/ap/app/clatd/clatd.elf
Binary files differ
diff --git a/ap/app/clatd/clatd.h b/ap/app/clatd/clatd.h
new file mode 100755
index 0000000..036f3e8
--- /dev/null
+++ b/ap/app/clatd/clatd.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * clatd.h - main system definitions
+ */
+#ifndef __CLATD_H__
+#define __CLATD_H__
+
+#include <sys/uio.h>
+
+#define MAXMTU 1500
+#define PACKETLEN (MAXMTU+sizeof(struct tun_pi))
+#define CLATD_VERSION "1.4"
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+// how frequently (in seconds) to poll for an address change while traffic is passing
+#define INTERFACE_POLL_FREQUENCY 30
+
+// how frequently (in seconds) to poll for an address change while there is no traffic
+#define NO_TRAFFIC_INTERFACE_POLL_FREQUENCY 90
+
+// A clat_packet is an array of iovec structures representing a packet that we are translating.
+// The CLAT_POS_XXX constants represent the array indices within the clat_packet that contain
+// specific parts of the packet. The packet_* functions operate on all the packet segments past a
+// given position.
+typedef enum {
+    CLAT_POS_TUNHDR, CLAT_POS_IPHDR, CLAT_POS_FRAGHDR, CLAT_POS_TRANSPORTHDR,
+    CLAT_POS_ICMPERR_IPHDR, CLAT_POS_ICMPERR_FRAGHDR, CLAT_POS_ICMPERR_TRANSPORTHDR,
+    CLAT_POS_PAYLOAD, CLAT_POS_MAX
+} clat_packet_index;
+typedef struct iovec clat_packet[CLAT_POS_MAX];
+
+struct clat_icmp_frag
+{
+	time_t time;
+	clat_packet data;
+	int iov_len;
+	unsigned short ip_id;
+	unsigned short ip_len;
+	int flag;//0-unused 1-first 2-last
+};
+
+#endif /* __CLATD_H__ */
diff --git a/ap/app/clatd/clatd_microbenchmark.c b/ap/app/clatd/clatd_microbenchmark.c
new file mode 100755
index 0000000..fed3100
--- /dev/null
+++ b/ap/app/clatd/clatd_microbenchmark.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * clatd_microbenchmark.c - micro-benchmark for clatd tun send path
+ *
+ * Run with:
+ *
+ * adb push {$ANDROID_PRODUCT_OUT,}/data/nativetest/clatd_microbenchmark/clatd_microbenchmark
+ * adb shell /data/nativetest/clatd_microbenchmark/clatd_microbenchmark
+ *
+ */
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/ip6.h>
+#include <netinet/udp.h>
+#include <arpa/inet.h>
+#include <linux/if.h>
+#include <linux/if_tun.h>
+
+#include "checksum.h"
+#include "tun.h"
+
+#define DEVICENAME "clat4"
+
+#define PORT 51339
+#define PAYLOADSIZE (1280 - sizeof(struct iphdr) - sizeof(struct udphdr))
+#define NUMPACKETS 1000000
+#define SEC_TO_NANOSEC (1000 * 1000 * 1000)
+
+void init_sockaddr_in(struct sockaddr_in *sin, const char *addr) {
+    sin->sin_family = AF_INET;
+    sin->sin_port = 0;
+    sin->sin_addr.s_addr = inet_addr(addr);
+}
+
+void die(const char *str) {
+    perror(str);
+    exit(1);
+}
+
+int setup_tun() {
+    int fd = tun_open();
+    if (fd == -1) die("tun_open");
+
+    char dev[IFNAMSIZ] = DEVICENAME;
+    int ret = tun_alloc(dev, fd);
+    if (ret == -1) die("tun_alloc");
+    struct ifreq ifr = {
+        .ifr_name = DEVICENAME,
+    };
+
+    int s = socket(AF_INET, SOCK_DGRAM, 0);
+    init_sockaddr_in((struct sockaddr_in *) &ifr.ifr_addr, "192.0.0.4");
+    if (ioctl(s, SIOCSIFADDR, &ifr) < 0) die("SIOCSIFADDR");
+    init_sockaddr_in((struct sockaddr_in *) &ifr.ifr_addr, "255.255.255.248");
+    if (ioctl(s, SIOCSIFNETMASK, &ifr) < 0) die("SIOCSIFNETMASK");
+    if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) die("SIOCGIFFLAGS");
+    ifr.ifr_flags |= (IFF_UP | IFF_RUNNING);
+    if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) die("SIOCSIFFLAGS");
+    return fd;
+}
+
+int send_packet(int fd, uint8_t payload[], int len, uint32_t payload_checksum) {
+    struct tun_pi tun = { 0, htons(ETH_P_IP) };
+    struct udphdr udp = {
+        .source = htons(1234),
+        .dest = htons(PORT),
+        .len = htons(len + sizeof(udp)),
+        .check = 0,
+    };
+    struct iphdr ip = {
+        .version = 4,
+        .ihl = 5,
+        .tot_len = htons(len + sizeof(ip) + sizeof(udp)),
+        .frag_off = htons(IP_DF),
+        .ttl = 55,
+        .protocol = IPPROTO_UDP,
+        .saddr = htonl(0xc0000006),  // 192.0.0.6
+        .daddr = htonl(0xc0000004),  // 192.0.0.4
+    };
+    clat_packet out = {
+        { &tun, sizeof(tun) },  // tun header
+        { &ip, sizeof(ip) },    // IP header
+        { NULL, 0 },            // Fragment header
+        { &udp, sizeof(udp) },  // Transport header
+        { NULL, 0 },            // ICMP error IP header
+        { NULL, 0 },            // ICMP error fragment header
+        { NULL, 0 },            // ICMP error transport header
+        { payload, len },       // Payload
+    };
+
+    ip.check = ip_checksum(&ip, sizeof(ip));
+
+    uint32_t sum;
+    sum = ipv4_pseudo_header_checksum(&ip, ntohs(udp.len));
+    sum = ip_checksum_add(sum, &udp, sizeof(udp));
+    sum += payload_checksum;
+    udp.check = ip_checksum_finish(sum);
+
+    return send_tun(fd, out, sizeof(out) / sizeof(out[0]));
+}
+
+double timedelta(const struct timespec tv1, const struct timespec tv2) {
+    struct timespec end = tv2;
+    if (end.tv_nsec < tv1.tv_nsec) {
+        end.tv_sec -= 1;
+        end.tv_nsec += SEC_TO_NANOSEC;
+    }
+    double seconds = (end.tv_sec - tv1.tv_sec);
+    seconds += (((double) (end.tv_nsec - tv1.tv_nsec)) / SEC_TO_NANOSEC);
+    return seconds;
+}
+
+void benchmark(const char *name, int fd, int s, int num, int do_read,
+               uint8_t payload[], int len, uint32_t payload_sum) {
+    int i;
+    char buf[4096];
+    struct timespec tv1, tv2;
+    int write_err = 0, read_err = 0;
+    clock_gettime(CLOCK_MONOTONIC, &tv1);
+    for (i = 0; i < num; i++) {
+        if (send_packet(fd, payload, len, payload_sum) == -1) write_err++;
+        if (do_read && recvfrom(s, buf, sizeof(buf), 0, NULL, NULL) == -1) {
+            read_err++;
+            if (errno == ETIMEDOUT) {
+                printf("Timed out after %d packets!\n", i);
+                break;
+            }
+        }
+    }
+    clock_gettime(CLOCK_MONOTONIC, &tv2);
+    double seconds = timedelta(tv1, tv2);
+    int pps = (int) (i / seconds);
+    double mbps = (i * PAYLOADSIZE / 1000000 * 8 / seconds);
+    printf("%s: %d packets in %.2fs (%d pps, %.2f Mbps), ", name, i, seconds, pps, mbps);
+    printf("read err %d (%.2f%%), write err %d (%.2f%%)\n",
+           read_err, (float) read_err / i * 100,
+           write_err, (float) write_err / i * 100);
+}
+
+int open_socket() {
+    int sock = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP);
+
+    int on = 1;
+    if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) die("SO_REUSEADDR");
+
+    struct timeval tv = { 1, 0 };
+    if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) die("SO_RCVTIMEO");
+
+    struct sockaddr_in addr = {
+        .sin_family = AF_INET,
+        .sin_port = ntohs(PORT),
+        .sin_addr = { INADDR_ANY }
+    };
+    if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) == -1) die ("bind");
+
+   return sock;
+}
+
+int main() {
+    int fd = setup_tun();
+    int sock = open_socket();
+
+    int i;
+    uint8_t payload[PAYLOADSIZE];
+    for (i = 0; i < (int) sizeof(payload); i++) {
+        payload[i] = (uint8_t) i;
+    }
+    uint32_t payload_sum = ip_checksum_add(0, payload, sizeof(payload));
+
+    // Check things are working.
+    char buf[4096];
+    if (send_packet(fd, payload, sizeof(payload), payload_sum) == -1) die("send_packet");
+    if (recvfrom(sock, buf, sizeof(buf), 0, NULL, NULL) == -1) die("recvfrom");
+
+    benchmark("Blocking", fd, sock, NUMPACKETS, 1, payload, sizeof(payload), payload_sum);
+    close(fd);
+
+    fd = setup_tun();
+    set_nonblocking(fd);
+    benchmark("No read", fd, sock, NUMPACKETS, 0, payload, sizeof(payload), payload_sum);
+    close(fd);
+
+    fd = setup_tun();
+    set_nonblocking(fd);
+    benchmark("Nonblocking", fd, sock, NUMPACKETS, 1, payload, sizeof(payload), payload_sum);
+    close(fd);
+
+    return 0;
+}
diff --git a/ap/app/clatd/clatd_test.cpp b/ap/app/clatd/clatd_test.cpp
new file mode 100755
index 0000000..b901c30
--- /dev/null
+++ b/ap/app/clatd/clatd_test.cpp
@@ -0,0 +1,936 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * clatd_test.cpp - unit tests for clatd
+ */
+
+#include <iostream>
+
+#include <stdio.h>
+#include <arpa/inet.h>
+#include <netinet/in6.h>
+#include <sys/uio.h>
+
+#include <gtest/gtest.h>
+
+extern "C" {
+#include "checksum.h"
+#include "translate.h"
+#include "config.h"
+#include "clatd.h"
+}
+
+// For convenience.
+#define ARRAYSIZE(x) sizeof((x)) / sizeof((x)[0])
+
+// Default translation parameters.
+static const char kIPv4LocalAddr[] = "192.0.0.4";
+static const char kIPv6LocalAddr[] = "2001:db8:0:b11::464";
+static const char kIPv6PlatSubnet[] = "64:ff9b::";
+
+// Test packet portions. Defined as macros because it's easy to concatenate them to make packets.
+#define IPV4_HEADER(p, c1, c2) \
+    0x45, 0x00,    0,   41,  /* Version=4, IHL=5, ToS=0x80, len=41 */     \
+    0x00, 0x00, 0x40, 0x00,  /* ID=0x0000, flags=IP_DF, offset=0 */       \
+      55,  (p), (c1), (c2),  /* TTL=55, protocol=p, checksum=c1,c2 */     \
+     192,    0,    0,    4,  /* Src=192.0.0.4 */                          \
+       8,    8,    8,    8,  /* Dst=8.8.8.8 */
+#define IPV4_UDP_HEADER IPV4_HEADER(IPPROTO_UDP, 0x73, 0xb0)
+#define IPV4_ICMP_HEADER IPV4_HEADER(IPPROTO_ICMP, 0x73, 0xc0)
+
+#define IPV6_HEADER(p) \
+    0x60, 0x00,    0,    0,  /* Version=6, tclass=0x00, flowlabel=0 */    \
+       0,   21,  (p),   55,  /* plen=11, nxthdr=p, hlim=55 */             \
+    0x20, 0x01, 0x0d, 0xb8,  /* Src=2001:db8:0:b11::464 */                \
+    0x00, 0x00, 0x0b, 0x11,                                               \
+    0x00, 0x00, 0x00, 0x00,                                               \
+    0x00, 0x00, 0x04, 0x64,                                               \
+    0x00, 0x64, 0xff, 0x9b,  /* Dst=64:ff9b::8.8.8.8 */                   \
+    0x00, 0x00, 0x00, 0x00,                                               \
+    0x00, 0x00, 0x00, 0x00,                                               \
+    0x08, 0x08, 0x08, 0x08,
+#define IPV6_UDP_HEADER IPV6_HEADER(IPPROTO_UDP)
+#define IPV6_ICMPV6_HEADER IPV6_HEADER(IPPROTO_ICMPV6)
+
+#define UDP_LEN 21
+#define UDP_HEADER \
+    0xc8, 0x8b,    0,   53,  /* Port 51339->53 */                         \
+    0x00, UDP_LEN, 0,    0,  /* Length 21, checksum empty for now */
+
+#define PAYLOAD 'H', 'e', 'l', 'l', 'o', ' ', 0x4e, 0xb8, 0x96, 0xe7, 0x95, 0x8c, 0x00
+
+#define IPV4_PING \
+    0x08, 0x00, 0x88, 0xd0,  /* Type 8, code 0, checksum 0x88d0 */        \
+    0xd0, 0x0d, 0x00, 0x03,  /* ID=0xd00d, seq=3 */
+
+#define IPV6_PING \
+    0x80, 0x00, 0xc3, 0x42,  /* Type 128, code 0, checksum 0xc342 */      \
+    0xd0, 0x0d, 0x00, 0x03,  /* ID=0xd00d, seq=3 */
+
+// Macros to return pseudo-headers from packets.
+#define IPV4_PSEUDOHEADER(ip, tlen)                                  \
+  ip[12], ip[13], ip[14], ip[15],        /* Source address      */   \
+  ip[16], ip[17], ip[18], ip[19],        /* Destination address */   \
+  0, ip[9],                              /* 0, protocol         */   \
+  ((tlen) >> 16) & 0xff, (tlen) & 0xff,  /* Transport length */
+
+#define IPV6_PSEUDOHEADER(ip6, protocol, tlen)                       \
+  ip6[8],  ip6[9],  ip6[10], ip6[11],  /* Source address */          \
+  ip6[12], ip6[13], ip6[14], ip6[15],                                \
+  ip6[16], ip6[17], ip6[18], ip6[19],                                \
+  ip6[20], ip6[21], ip6[22], ip6[23],                                \
+  ip6[24], ip6[25], ip6[26], ip6[27],  /* Destination address */     \
+  ip6[28], ip6[29], ip6[30], ip6[31],                                \
+  ip6[32], ip6[33], ip6[34], ip6[35],                                \
+  ip6[36], ip6[37], ip6[38], ip6[39],                                \
+  ((tlen) >> 24) & 0xff,               /* Transport length */        \
+  ((tlen) >> 16) & 0xff,                                             \
+  ((tlen) >> 8) & 0xff,                                              \
+  (tlen) & 0xff,                                                     \
+  0, 0, 0, (protocol),
+
+// A fragmented DNS request.
+static const uint8_t kIPv4Frag1[] = {
+    0x45, 0x00, 0x00, 0x24, 0xfe, 0x47, 0x20, 0x00, 0x40, 0x11,
+    0x8c, 0x6d, 0xc0, 0x00, 0x00, 0x04, 0x08, 0x08, 0x08, 0x08,
+    0x14, 0x5d, 0x00, 0x35, 0x00, 0x29, 0x68, 0xbb, 0x50, 0x47,
+    0x01, 0x00, 0x00, 0x01, 0x00, 0x00
+};
+static const uint8_t kIPv4Frag2[] = {
+    0x45, 0x00, 0x00, 0x24, 0xfe, 0x47, 0x20, 0x02, 0x40, 0x11,
+    0x8c, 0x6b, 0xc0, 0x00, 0x00, 0x04, 0x08, 0x08, 0x08, 0x08,
+    0x00, 0x00, 0x00, 0x00, 0x04, 0x69, 0x70, 0x76, 0x34, 0x06,
+    0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65
+};
+static const uint8_t kIPv4Frag3[] = {
+    0x45, 0x00, 0x00, 0x1d, 0xfe, 0x47, 0x00, 0x04, 0x40, 0x11,
+    0xac, 0x70, 0xc0, 0x00, 0x00, 0x04, 0x08, 0x08, 0x08, 0x08,
+    0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01
+};
+static const uint8_t *kIPv4Fragments[] = { kIPv4Frag1, kIPv4Frag2, kIPv4Frag3 };
+static const size_t kIPv4FragLengths[] = { sizeof(kIPv4Frag1), sizeof(kIPv4Frag2),
+                                           sizeof(kIPv4Frag3) };
+
+static const uint8_t kIPv6Frag1[] = {
+    0x60, 0x00, 0x00, 0x00, 0x00, 0x18, 0x2c, 0x40, 0x20, 0x01,
+    0x0d, 0xb8, 0x00, 0x00, 0x0b, 0x11, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x04, 0x64, 0x00, 0x64, 0xff, 0x9b, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08,
+    0x11, 0x00, 0x00, 0x01, 0x00, 0x00, 0xfe, 0x47, 0x14, 0x5d,
+    0x00, 0x35, 0x00, 0x29, 0xeb, 0x91, 0x50, 0x47, 0x01, 0x00,
+    0x00, 0x01, 0x00, 0x00
+};
+
+static const uint8_t kIPv6Frag2[] = {
+    0x60, 0x00, 0x00, 0x00, 0x00, 0x18, 0x2c, 0x40, 0x20, 0x01,
+    0x0d, 0xb8, 0x00, 0x00, 0x0b, 0x11, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x04, 0x64, 0x00, 0x64, 0xff, 0x9b, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08,
+    0x11, 0x00, 0x00, 0x11, 0x00, 0x00, 0xfe, 0x47, 0x00, 0x00,
+    0x00, 0x00, 0x04, 0x69, 0x70, 0x76, 0x34, 0x06, 0x67, 0x6f,
+    0x6f, 0x67, 0x6c, 0x65
+};
+
+static const uint8_t kIPv6Frag3[] = {
+    0x60, 0x00, 0x00, 0x00, 0x00, 0x11, 0x2c, 0x40, 0x20, 0x01,
+    0x0d, 0xb8, 0x00, 0x00, 0x0b, 0x11, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x04, 0x64, 0x00, 0x64, 0xff, 0x9b, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08,
+    0x11, 0x00, 0x00, 0x20, 0x00, 0x00, 0xfe, 0x47, 0x03, 0x63,
+    0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01
+};
+static const uint8_t *kIPv6Fragments[] = { kIPv6Frag1, kIPv6Frag2, kIPv6Frag3 };
+static const size_t kIPv6FragLengths[] = { sizeof(kIPv6Frag1), sizeof(kIPv6Frag2),
+                                           sizeof(kIPv6Frag3) };
+
+static const uint8_t kReassembledIPv4[] = {
+    0x45, 0x00, 0x00, 0x3d, 0xfe, 0x47, 0x00, 0x00, 0x40, 0x11,
+    0xac, 0x54, 0xc0, 0x00, 0x00, 0x04, 0x08, 0x08, 0x08, 0x08,
+    0x14, 0x5d, 0x00, 0x35, 0x00, 0x29, 0x68, 0xbb, 0x50, 0x47,
+    0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x04, 0x69, 0x70, 0x76, 0x34, 0x06, 0x67, 0x6f, 0x6f, 0x67,
+    0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00,
+    0x01
+};
+
+// Expected checksums.
+static const uint32_t kUdpPartialChecksum     = 0xd5c8;
+static const uint32_t kPayloadPartialChecksum = 0x31e9c;
+static const uint16_t kUdpV4Checksum          = 0xd0c7;
+static const uint16_t kUdpV6Checksum          = 0xa74a;
+
+uint8_t ip_version(const uint8_t *packet) {
+  uint8_t version = packet[0] >> 4;
+  return version;
+}
+
+int is_ipv4_fragment(struct iphdr *ip) {
+  // A packet is a fragment if its fragment offset is nonzero or if the MF flag is set.
+  return ntohs(ip->frag_off) & (IP_OFFMASK | IP_MF);
+}
+
+int is_ipv6_fragment(struct ip6_hdr *ip6, size_t len) {
+  if (ip6->ip6_nxt != IPPROTO_FRAGMENT) {
+    return 0;
+  }
+  struct ip6_frag *frag = (struct ip6_frag *) (ip6 + 1);
+  return len >= sizeof(*ip6) + sizeof(*frag) &&
+          (frag->ip6f_offlg & (IP6F_OFF_MASK | IP6F_MORE_FRAG));
+}
+
+int ipv4_fragment_offset(struct iphdr *ip) {
+  return ntohs(ip->frag_off) & IP_OFFMASK;
+}
+
+int ipv6_fragment_offset(struct ip6_frag *frag) {
+  return ntohs((frag->ip6f_offlg & IP6F_OFF_MASK) >> 3);
+}
+
+void check_packet(const uint8_t *packet, size_t len, const char *msg) {
+  void *payload;
+  size_t payload_length = 0;
+  uint32_t pseudo_checksum = 0;
+  uint8_t protocol = 0;
+  int version = ip_version(packet);
+  switch (version) {
+    case 4: {
+      struct iphdr *ip = (struct iphdr *) packet;
+      ASSERT_GE(len, sizeof(*ip)) << msg << ": IPv4 packet shorter than IPv4 header\n";
+      EXPECT_EQ(5, ip->ihl) << msg << ": Unsupported IP header length\n";
+      EXPECT_EQ(len, ntohs(ip->tot_len)) << msg << ": Incorrect IPv4 length\n";
+      EXPECT_EQ(0, ip_checksum(ip, sizeof(*ip))) << msg << ": Incorrect IP checksum\n";
+      protocol = ip->protocol;
+      payload = ip + 1;
+      if (!is_ipv4_fragment(ip)) {
+        payload_length = len - sizeof(*ip);
+        pseudo_checksum = ipv4_pseudo_header_checksum(ip, payload_length);
+      }
+      ASSERT_TRUE(protocol == IPPROTO_TCP || protocol == IPPROTO_UDP || protocol == IPPROTO_ICMP)
+          << msg << ": Unsupported IPv4 protocol " << protocol << "\n";
+      break;
+    }
+    case 6: {
+      struct ip6_hdr *ip6 = (struct ip6_hdr *) packet;
+      ASSERT_GE(len, sizeof(*ip6)) << msg << ": IPv6 packet shorter than IPv6 header\n";
+      EXPECT_EQ(len - sizeof(*ip6), htons(ip6->ip6_plen)) << msg << ": Incorrect IPv6 length\n";
+
+      if (ip6->ip6_nxt == IPPROTO_FRAGMENT) {
+        struct ip6_frag *frag = (struct ip6_frag *) (ip6 + 1);
+        ASSERT_GE(len, sizeof(*ip6) + sizeof(*frag))
+            << msg << ": IPv6 fragment: short fragment header\n";
+        protocol = frag->ip6f_nxt;
+        payload = frag + 1;
+        // Even though the packet has a Fragment header, it might not be a fragment.
+        if (!is_ipv6_fragment(ip6, len)) {
+          payload_length = len - sizeof(*ip6) - sizeof(*frag);
+        }
+      } else {
+        // Since there are no extension headers except Fragment, this must be the payload.
+        protocol = ip6->ip6_nxt;
+        payload = ip6 + 1;
+        payload_length = len - sizeof(*ip6);
+      }
+      ASSERT_TRUE(protocol == IPPROTO_TCP || protocol == IPPROTO_UDP || protocol == IPPROTO_ICMPV6)
+          << msg << ": Unsupported IPv6 next header " << protocol;
+      if (payload_length) {
+        pseudo_checksum = ipv6_pseudo_header_checksum(ip6, payload_length, protocol);
+      }
+      break;
+    }
+    default:
+      FAIL() << msg << ": Unsupported IP version " << version << "\n";
+      return;
+  }
+
+  // If we understand the payload, verify the checksum.
+  if (payload_length) {
+    uint16_t checksum;
+    switch(protocol) {
+      case IPPROTO_UDP:
+      case IPPROTO_TCP:
+      case IPPROTO_ICMPV6:
+        checksum = ip_checksum_finish(ip_checksum_add(pseudo_checksum, payload, payload_length));
+        break;
+      case IPPROTO_ICMP:
+        checksum = ip_checksum(payload, payload_length);
+        break;
+      default:
+        checksum = 0;  // Don't check.
+        break;
+    }
+    EXPECT_EQ(0, checksum) << msg << ": Incorrect transport checksum\n";
+  }
+
+  if (protocol == IPPROTO_UDP) {
+    struct udphdr *udp = (struct udphdr *) payload;
+    EXPECT_NE(0, udp->check) << msg << ": UDP checksum 0 should be 0xffff";
+    // If this is not a fragment, check the UDP length field.
+    if (payload_length) {
+      EXPECT_EQ(payload_length, ntohs(udp->len)) << msg << ": Incorrect UDP length\n";
+    }
+  }
+}
+
+void reassemble_packet(const uint8_t **fragments, const size_t lengths[], int numpackets,
+                       uint8_t *reassembled, size_t *reassembled_len, const char *msg) {
+  struct iphdr *ip = NULL;
+  struct ip6_hdr *ip6 = NULL;
+  size_t  total_length, pos = 0;
+  uint8_t protocol = 0;
+  uint8_t version = ip_version(fragments[0]);
+
+  for (int i = 0; i < numpackets; i++) {
+    const uint8_t *packet = fragments[i];
+    int len = lengths[i];
+    int headersize, payload_offset;
+
+    ASSERT_EQ(ip_version(packet), version) << msg << ": Inconsistent fragment versions\n";
+    check_packet(packet, len, "Fragment sanity check");
+
+    switch (version) {
+      case 4: {
+        struct iphdr *ip_orig = (struct iphdr *) packet;
+        headersize = sizeof(*ip_orig);
+        ASSERT_TRUE(is_ipv4_fragment(ip_orig))
+            << msg << ": IPv4 fragment #" << i + 1 << " not a fragment\n";
+        ASSERT_EQ(pos, ipv4_fragment_offset(ip_orig) * 8 + ((i != 0) ? sizeof(*ip): 0))
+            << msg << ": IPv4 fragment #" << i + 1 << ": inconsistent offset\n";
+
+        headersize = sizeof(*ip_orig);
+        payload_offset = headersize;
+        if (pos == 0) {
+          ip = (struct iphdr *) reassembled;
+        }
+        break;
+      }
+      case 6: {
+        struct ip6_hdr *ip6_orig = (struct ip6_hdr *) packet;
+        struct ip6_frag *frag = (struct ip6_frag *) (ip6_orig + 1);
+        ASSERT_TRUE(is_ipv6_fragment(ip6_orig, len))
+            << msg << ": IPv6 fragment #" << i + 1 << " not a fragment\n";
+        ASSERT_EQ(pos, ipv6_fragment_offset(frag) * 8 + ((i != 0) ? sizeof(*ip6): 0))
+            << msg << ": IPv6 fragment #" << i + 1 << ": inconsistent offset\n";
+
+        headersize = sizeof(*ip6_orig);
+        payload_offset = sizeof(*ip6_orig) + sizeof(*frag);
+        if (pos == 0) {
+          ip6 = (struct ip6_hdr *) reassembled;
+          protocol = frag->ip6f_nxt;
+        }
+        break;
+      }
+      default:
+        FAIL() << msg << ": Invalid IP version << " << version;
+    }
+
+    // If this is the first fragment, copy the header.
+    if (pos == 0) {
+      ASSERT_LT(headersize, (int) *reassembled_len) << msg << ": Reassembly buffer too small\n";
+      memcpy(reassembled, packet, headersize);
+      total_length = headersize;
+      pos += headersize;
+    }
+
+    // Copy the payload.
+    int payload_length = len - payload_offset;
+    total_length += payload_length;
+    ASSERT_LT(total_length, *reassembled_len) << msg << ": Reassembly buffer too small\n";
+    memcpy(reassembled + pos, packet + payload_offset, payload_length);
+    pos += payload_length;
+  }
+
+
+  // Fix up the reassembled headers to reflect fragmentation and length (and IPv4 checksum).
+  ASSERT_EQ(total_length, pos) << msg << ": Reassembled packet length incorrect\n";
+  if (ip) {
+    ip->frag_off &= ~htons(IP_MF);
+    ip->tot_len = htons(total_length);
+    ip->check = 0;
+    ip->check = ip_checksum(ip, sizeof(*ip));
+    ASSERT_FALSE(is_ipv4_fragment(ip)) << msg << ": reassembled IPv4 packet is a fragment!\n";
+  }
+  if (ip6) {
+    ip6->ip6_nxt = protocol;
+    ip6->ip6_plen = htons(total_length - sizeof(*ip6));
+    ASSERT_FALSE(is_ipv6_fragment(ip6, ip6->ip6_plen))
+        << msg << ": reassembled IPv6 packet is a fragment!\n";
+  }
+
+  *reassembled_len = total_length;
+}
+
+void check_data_matches(const void *expected, const void *actual, size_t len, const char *msg) {
+  if (memcmp(expected, actual, len)) {
+    // Hex dump, 20 bytes per line, one space between bytes (1 byte = 3 chars), indented by 4.
+    int hexdump_len = len * 3 + (len / 20 + 1) * 5;
+    char expected_hexdump[hexdump_len], actual_hexdump[hexdump_len];
+    unsigned pos = 0;
+    for (unsigned i = 0; i < len; i++) {
+      if (i % 20 == 0) {
+        snprintf(expected_hexdump + pos, hexdump_len - pos, "\n   ");
+        snprintf(actual_hexdump + pos, hexdump_len - pos, "\n   ");
+        pos += 4;
+      }
+      snprintf(expected_hexdump + pos, hexdump_len - pos, " %02x", ((uint8_t *) expected)[i]);
+      snprintf(actual_hexdump + pos, hexdump_len - pos, " %02x", ((uint8_t *) actual)[i]);
+      pos += 3;
+    }
+    FAIL() << msg << ": Data doesn't match"
+           << "\n  Expected:" << (char *) expected_hexdump
+           << "\n  Actual:" << (char *) actual_hexdump << "\n";
+  }
+}
+
+void fix_udp_checksum(uint8_t* packet) {
+  uint32_t pseudo_checksum;
+  uint8_t version = ip_version(packet);
+  struct udphdr *udp;
+  switch (version) {
+    case 4: {
+      struct iphdr *ip = (struct iphdr *) packet;
+      udp = (struct udphdr *) (ip + 1);
+      pseudo_checksum = ipv4_pseudo_header_checksum(ip, ntohs(udp->len));
+      break;
+    }
+    case 6: {
+      struct ip6_hdr *ip6 = (struct ip6_hdr *) packet;
+      udp = (struct udphdr *) (ip6 + 1);
+      pseudo_checksum = ipv6_pseudo_header_checksum(ip6, ntohs(udp->len), IPPROTO_UDP);
+      break;
+    }
+    default:
+      FAIL() << "unsupported IP version" << version << "\n";
+      return;
+    }
+
+  udp->check = 0;
+  udp->check = ip_checksum_finish(ip_checksum_add(pseudo_checksum, udp, ntohs(udp->len)));
+}
+
+// Testing stub for send_rawv6. The real version uses sendmsg() with a
+// destination IPv6 address, and attempting to call that on our test socketpair
+// fd results in EINVAL.
+extern "C" void send_rawv6(int fd, clat_packet out, int iov_len) {
+    writev(fd, out, iov_len);
+}
+
+void do_translate_packet(const uint8_t *original, size_t original_len, uint8_t *out, size_t *outlen,
+                         const char *msg) {
+  int fds[2];
+  if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, fds)) {
+    abort();
+  }
+
+  char foo[512];
+  snprintf(foo, sizeof(foo), "%s: Invalid original packet", msg);
+  check_packet(original, original_len, foo);
+
+  int read_fd, write_fd;
+  uint16_t expected_proto;
+  int version = ip_version(original);
+  switch (version) {
+    case 4:
+      expected_proto = htons(ETH_P_IPV6);
+      read_fd = fds[1];
+      write_fd = fds[0];
+      break;
+    case 6:
+      expected_proto = htons(ETH_P_IP);
+      read_fd = fds[0];
+      write_fd = fds[1];
+      break;
+    default:
+      FAIL() << msg << ": Unsupported IP version " << version << "\n";
+      break;
+  }
+
+  translate_packet(write_fd, (version == 4), original, original_len);
+
+  snprintf(foo, sizeof(foo), "%s: Invalid translated packet", msg);
+  if (version == 6) {
+    // Translating to IPv4. Expect a tun header.
+    struct tun_pi new_tun_header;
+    struct iovec iov[] = {
+      { &new_tun_header, sizeof(new_tun_header) },
+      { out, *outlen }
+    };
+    int len = readv(read_fd, iov, 2);
+    if (len > (int) sizeof(new_tun_header)) {
+      ASSERT_LT((size_t) len, *outlen) << msg << ": Translated packet buffer too small\n";
+      EXPECT_EQ(expected_proto, new_tun_header.proto) << msg << "Unexpected tun proto\n";
+      *outlen = len - sizeof(new_tun_header);
+      check_packet(out, *outlen, msg);
+    } else {
+      FAIL() << msg << ": Packet was not translated: len=" << len;
+      *outlen = 0;
+    }
+  } else {
+    // Translating to IPv6. Expect raw packet.
+    *outlen = read(read_fd, out, *outlen);
+    check_packet(out, *outlen, msg);
+  }
+}
+
+void check_translated_packet(const uint8_t *original, size_t original_len,
+                             const uint8_t *expected, size_t expected_len, const char *msg) {
+  uint8_t translated[MAXMTU];
+  size_t translated_len = sizeof(translated);
+  do_translate_packet(original, original_len, translated, &translated_len, msg);
+  EXPECT_EQ(expected_len, translated_len) << msg << ": Translated packet length incorrect\n";
+  check_data_matches(expected, translated, translated_len, msg);
+}
+
+void check_fragment_translation(const uint8_t *original[], const size_t original_lengths[],
+                                const uint8_t *expected[], const size_t expected_lengths[],
+                                int numfragments, const char *msg) {
+  for (int i = 0; i < numfragments; i++) {
+    // Check that each of the fragments translates as expected.
+    char frag_msg[512];
+    snprintf(frag_msg, sizeof(frag_msg), "%s: fragment #%d", msg, i + 1);
+    check_translated_packet(original[i], original_lengths[i],
+                            expected[i], expected_lengths[i], frag_msg);
+  }
+
+  // Sanity check that reassembling the original and translated fragments produces valid packets.
+  uint8_t reassembled[MAXMTU];
+  size_t reassembled_len = sizeof(reassembled);
+  reassemble_packet(original, original_lengths, numfragments, reassembled, &reassembled_len, msg);
+  check_packet(reassembled, reassembled_len, msg);
+
+  uint8_t translated[MAXMTU];
+  size_t translated_len = sizeof(translated);
+  do_translate_packet(reassembled, reassembled_len, translated, &translated_len, msg);
+  check_packet(translated, translated_len, msg);
+}
+
+int get_transport_checksum(const uint8_t *packet) {
+  struct iphdr *ip;
+  struct ip6_hdr *ip6;
+  uint8_t protocol;
+  const void *payload;
+
+  int version = ip_version(packet);
+  switch (version) {
+    case 4:
+      ip = (struct iphdr *) packet;
+      if (is_ipv4_fragment(ip)) {
+          return -1;
+      }
+      protocol = ip->protocol;
+      payload = ip + 1;
+      break;
+    case 6:
+      ip6 = (struct ip6_hdr *) packet;
+      protocol = ip6->ip6_nxt;
+      payload = ip6 + 1;
+      break;
+    default:
+      return -1;
+  }
+
+  switch (protocol) {
+    case IPPROTO_UDP:
+      return ((struct udphdr *) payload)->check;
+
+    case IPPROTO_TCP:
+      return ((struct tcphdr *) payload)->check;
+
+    case IPPROTO_FRAGMENT:
+    default:
+      return -1;
+  }
+}
+
+struct clat_config Global_Clatd_Config;
+
+class ClatdTest : public ::testing::Test {
+ protected:
+  virtual void SetUp() {
+    inet_pton(AF_INET, kIPv4LocalAddr, &Global_Clatd_Config.ipv4_local_subnet);
+    inet_pton(AF_INET6, kIPv6PlatSubnet, &Global_Clatd_Config.plat_subnet);
+    inet_pton(AF_INET6, kIPv6LocalAddr, &Global_Clatd_Config.ipv6_local_subnet);
+    Global_Clatd_Config.ipv6_host_id = in6addr_any;
+    Global_Clatd_Config.use_dynamic_iid = 1;
+  }
+};
+
+void expect_ipv6_addr_equal(struct in6_addr *expected, struct in6_addr *actual) {
+  if (!IN6_ARE_ADDR_EQUAL(expected, actual)) {
+    char expected_str[INET6_ADDRSTRLEN], actual_str[INET6_ADDRSTRLEN];
+    inet_ntop(AF_INET6, expected, expected_str, sizeof(expected_str));
+    inet_ntop(AF_INET6, actual, actual_str, sizeof(actual_str));
+    FAIL()
+        << "Unexpected IPv6 address:: "
+        << "\n  Expected: " << expected_str
+        << "\n  Actual:   " << actual_str
+        << "\n";
+  }
+}
+
+TEST_F(ClatdTest, TestIPv6PrefixEqual) {
+  EXPECT_TRUE(ipv6_prefix_equal(&Global_Clatd_Config.plat_subnet,
+                                &Global_Clatd_Config.plat_subnet));
+  EXPECT_FALSE(ipv6_prefix_equal(&Global_Clatd_Config.plat_subnet,
+                                 &Global_Clatd_Config.ipv6_local_subnet));
+
+  struct in6_addr subnet2 = Global_Clatd_Config.ipv6_local_subnet;
+  EXPECT_TRUE(ipv6_prefix_equal(&Global_Clatd_Config.ipv6_local_subnet, &subnet2));
+  EXPECT_TRUE(ipv6_prefix_equal(&subnet2, &Global_Clatd_Config.ipv6_local_subnet));
+
+  subnet2.s6_addr[6] = 0xff;
+  EXPECT_FALSE(ipv6_prefix_equal(&Global_Clatd_Config.ipv6_local_subnet, &subnet2));
+  EXPECT_FALSE(ipv6_prefix_equal(&subnet2, &Global_Clatd_Config.ipv6_local_subnet));
+}
+
+int count_onebits(const void *data, size_t size) {
+  int onebits = 0;
+  for (size_t pos = 0; pos < size; pos++) {
+    uint8_t *byte = ((uint8_t*) data) + pos;
+    for (int shift = 0; shift < 8; shift++) {
+      onebits += (*byte >> shift) & 1;
+    }
+  }
+  return onebits;
+}
+
+TEST_F(ClatdTest, TestCountOnebits) {
+  uint64_t i;
+  i = 1;
+  ASSERT_EQ(1, count_onebits(&i, sizeof(i)));
+  i <<= 61;
+  ASSERT_EQ(1, count_onebits(&i, sizeof(i)));
+  i |= ((uint64_t) 1 << 33);
+  ASSERT_EQ(2, count_onebits(&i, sizeof(i)));
+  i = 0xf1000202020000f0;
+  ASSERT_EQ(5 + 1 + 1 + 1 + 4, count_onebits(&i, sizeof(i)));
+}
+
+TEST_F(ClatdTest, TestGenIIDConfigured) {
+  struct in6_addr myaddr, expected;
+  Global_Clatd_Config.use_dynamic_iid = 0;
+  ASSERT_TRUE(inet_pton(AF_INET6, "::bad:ace:d00d", &Global_Clatd_Config.ipv6_host_id));
+  ASSERT_TRUE(inet_pton(AF_INET6, "2001:db8:1:2:0:bad:ace:d00d", &expected));
+  ASSERT_TRUE(inet_pton(AF_INET6, "2001:db8:1:2:f076:ae99:124e:aa54", &myaddr));
+  config_generate_local_ipv6_subnet(&myaddr);
+  expect_ipv6_addr_equal(&expected, &myaddr);
+
+  Global_Clatd_Config.use_dynamic_iid = 1;
+  config_generate_local_ipv6_subnet(&myaddr);
+  EXPECT_FALSE(IN6_ARE_ADDR_EQUAL(&expected, &myaddr));
+}
+
+TEST_F(ClatdTest, TestGenIIDRandom) {
+  struct in6_addr interface_ipv6;
+  ASSERT_TRUE(inet_pton(AF_INET6, "2001:db8:1:2:f076:ae99:124e:aa54", &interface_ipv6));
+  Global_Clatd_Config.ipv6_host_id = in6addr_any;
+
+  // Generate a boatload of random IIDs.
+  int onebits = 0;
+  uint64_t prev_iid = 0;
+  for (int i = 0; i < 100000; i++) {
+    struct in6_addr myaddr =  interface_ipv6;
+
+    config_generate_local_ipv6_subnet(&myaddr);
+
+    // Check the generated IP address is in the same prefix as the interface IPv6 address.
+    EXPECT_TRUE(ipv6_prefix_equal(&interface_ipv6, &myaddr));
+
+    // Check that consecutive IIDs are not the same.
+    uint64_t iid = * (uint64_t*) (&myaddr.s6_addr[8]);
+    ASSERT_TRUE(iid != prev_iid)
+        << "Two consecutive random IIDs are the same: "
+        << std::showbase << std::hex
+        << iid << "\n";
+    prev_iid = iid;
+
+    // Check that the IID is checksum-neutral with the NAT64 prefix and the
+    // local prefix.
+    struct in_addr *ipv4addr = &Global_Clatd_Config.ipv4_local_subnet;
+    struct in6_addr *plat_subnet = &Global_Clatd_Config.plat_subnet;
+
+    uint16_t c1 = ip_checksum_finish(ip_checksum_add(0, ipv4addr, sizeof(*ipv4addr)));
+    uint16_t c2 = ip_checksum_finish(ip_checksum_add(0, plat_subnet, sizeof(*plat_subnet)) +
+                                     ip_checksum_add(0, &myaddr, sizeof(myaddr)));
+
+    if (c1 != c2) {
+      char myaddr_str[INET6_ADDRSTRLEN], plat_str[INET6_ADDRSTRLEN], ipv4_str[INET6_ADDRSTRLEN];
+      inet_ntop(AF_INET6, &myaddr, myaddr_str, sizeof(myaddr_str));
+      inet_ntop(AF_INET6, plat_subnet, plat_str, sizeof(plat_str));
+      inet_ntop(AF_INET, ipv4addr, ipv4_str, sizeof(ipv4_str));
+      FAIL()
+          << "Bad IID: " << myaddr_str
+          << " not checksum-neutral with " << ipv4_str << " and " << plat_str
+          << std::showbase << std::hex
+          << "\n  IPv4 checksum: " << c1
+          << "\n  IPv6 checksum: " << c2
+          << "\n";
+    }
+
+    // Check that IIDs are roughly random and use all the bits by counting the
+    // total number of bits set to 1 in a random sample of 100000 generated IIDs.
+    onebits += count_onebits(&iid, sizeof(iid));
+  }
+  EXPECT_LE(3190000, onebits);
+  EXPECT_GE(3210000, onebits);
+}
+
+extern "C" addr_free_func config_is_ipv4_address_free;
+int never_free(in_addr_t /* addr */) { return 0; }
+int always_free(in_addr_t /* addr */) { return 1; }
+int only2_free(in_addr_t addr) { return (ntohl(addr) & 0xff) == 2; }
+int over6_free(in_addr_t addr) { return (ntohl(addr) & 0xff) >= 6; }
+int only10_free(in_addr_t addr) { return (ntohl(addr) & 0xff) == 10; }
+
+TEST_F(ClatdTest, SelectIPv4Address) {
+  struct in_addr addr;
+
+  inet_pton(AF_INET, kIPv4LocalAddr, &addr);
+
+  addr_free_func orig_config_is_ipv4_address_free = config_is_ipv4_address_free;
+
+  // If no addresses are free, return INADDR_NONE.
+  config_is_ipv4_address_free = never_free;
+  EXPECT_EQ(INADDR_NONE, config_select_ipv4_address(&addr, 29));
+  EXPECT_EQ(INADDR_NONE, config_select_ipv4_address(&addr, 16));
+
+  // If the configured address is free, pick that. But a prefix that's too big is invalid.
+  config_is_ipv4_address_free = always_free;
+  EXPECT_EQ(inet_addr(kIPv4LocalAddr), config_select_ipv4_address(&addr, 29));
+  EXPECT_EQ(inet_addr(kIPv4LocalAddr), config_select_ipv4_address(&addr, 20));
+  EXPECT_EQ(INADDR_NONE, config_select_ipv4_address(&addr, 15));
+
+  // A prefix length of 32 works, but anything above it is invalid.
+  EXPECT_EQ(inet_addr(kIPv4LocalAddr), config_select_ipv4_address(&addr, 32));
+  EXPECT_EQ(INADDR_NONE, config_select_ipv4_address(&addr, 33));
+
+  // If another address is free, pick it.
+  config_is_ipv4_address_free = over6_free;
+  EXPECT_EQ(inet_addr("192.0.0.6"), config_select_ipv4_address(&addr, 29));
+
+  // Check that we wrap around to addresses that are lower than the first address.
+  config_is_ipv4_address_free = only2_free;
+  EXPECT_EQ(inet_addr("192.0.0.2"), config_select_ipv4_address(&addr, 29));
+  EXPECT_EQ(INADDR_NONE, config_select_ipv4_address(&addr, 30));
+
+  // If a free address exists outside the prefix, we don't pick it.
+  config_is_ipv4_address_free = only10_free;
+  EXPECT_EQ(INADDR_NONE, config_select_ipv4_address(&addr, 29));
+  EXPECT_EQ(inet_addr("192.0.0.10"), config_select_ipv4_address(&addr, 24));
+
+  // Now try using the real function which sees if IP addresses are free using bind().
+  // Assume that the machine running the test has the address 127.0.0.1, but not 8.8.8.8.
+  config_is_ipv4_address_free = orig_config_is_ipv4_address_free;
+  addr.s_addr = inet_addr("8.8.8.8");
+  EXPECT_EQ(inet_addr("8.8.8.8"), config_select_ipv4_address(&addr, 29));
+
+  addr.s_addr = inet_addr("127.0.0.1");
+  EXPECT_EQ(inet_addr("127.0.0.2"), config_select_ipv4_address(&addr, 29));
+}
+
+TEST_F(ClatdTest, DataSanitycheck) {
+  // Sanity checks the data.
+  uint8_t v4_header[] = { IPV4_UDP_HEADER };
+  ASSERT_EQ(sizeof(struct iphdr), sizeof(v4_header)) << "Test IPv4 header: incorrect length\n";
+
+  uint8_t v6_header[] = { IPV6_UDP_HEADER };
+  ASSERT_EQ(sizeof(struct ip6_hdr), sizeof(v6_header)) << "Test IPv6 header: incorrect length\n";
+
+  uint8_t udp_header[] = { UDP_HEADER };
+  ASSERT_EQ(sizeof(struct udphdr), sizeof(udp_header)) << "Test UDP header: incorrect length\n";
+
+  // Sanity checks check_packet.
+  struct udphdr *udp;
+  uint8_t v4_udp_packet[] = { IPV4_UDP_HEADER UDP_HEADER PAYLOAD };
+  udp = (struct udphdr *) (v4_udp_packet + sizeof(struct iphdr));
+  fix_udp_checksum(v4_udp_packet);
+  ASSERT_EQ(kUdpV4Checksum, udp->check) << "UDP/IPv4 packet checksum sanity check\n";
+  check_packet(v4_udp_packet, sizeof(v4_udp_packet), "UDP/IPv4 packet sanity check");
+
+  uint8_t v6_udp_packet[] = { IPV6_UDP_HEADER UDP_HEADER PAYLOAD };
+  udp = (struct udphdr *) (v6_udp_packet + sizeof(struct ip6_hdr));
+  fix_udp_checksum(v6_udp_packet);
+  ASSERT_EQ(kUdpV6Checksum, udp->check) << "UDP/IPv6 packet checksum sanity check\n";
+  check_packet(v6_udp_packet, sizeof(v6_udp_packet), "UDP/IPv6 packet sanity check");
+
+  uint8_t ipv4_ping[] = { IPV4_ICMP_HEADER IPV4_PING PAYLOAD };
+  check_packet(ipv4_ping, sizeof(ipv4_ping), "IPv4 ping sanity check");
+
+  uint8_t ipv6_ping[] = { IPV6_ICMPV6_HEADER IPV6_PING PAYLOAD };
+  check_packet(ipv6_ping, sizeof(ipv6_ping), "IPv6 ping sanity check");
+
+  // Sanity checks reassemble_packet.
+  uint8_t reassembled[MAXMTU];
+  size_t total_length = sizeof(reassembled);
+  reassemble_packet(kIPv4Fragments, kIPv4FragLengths, ARRAYSIZE(kIPv4Fragments),
+                    reassembled, &total_length, "Reassembly sanity check");
+  check_packet(reassembled, total_length, "IPv4 Reassembled packet is valid");
+  ASSERT_EQ(sizeof(kReassembledIPv4), total_length) << "IPv4 reassembly sanity check: length\n";
+  ASSERT_TRUE(!is_ipv4_fragment((struct iphdr *) reassembled))
+      << "Sanity check: reassembled packet is a fragment!\n";
+  check_data_matches(kReassembledIPv4, reassembled, total_length, "IPv4 reassembly sanity check");
+
+  total_length = sizeof(reassembled);
+  reassemble_packet(kIPv6Fragments, kIPv6FragLengths, ARRAYSIZE(kIPv6Fragments),
+                    reassembled, &total_length, "IPv6 reassembly sanity check");
+  ASSERT_TRUE(!is_ipv6_fragment((struct ip6_hdr *) reassembled, total_length))
+      << "Sanity check: reassembled packet is a fragment!\n";
+  check_packet(reassembled, total_length, "IPv6 Reassembled packet is valid");
+}
+
+TEST_F(ClatdTest, PseudoChecksum) {
+  uint32_t pseudo_checksum;
+
+  uint8_t v4_header[] = { IPV4_UDP_HEADER };
+  uint8_t v4_pseudo_header[] = { IPV4_PSEUDOHEADER(v4_header, UDP_LEN) };
+  pseudo_checksum = ipv4_pseudo_header_checksum((struct iphdr *) v4_header, UDP_LEN);
+  EXPECT_EQ(ip_checksum_finish(pseudo_checksum),
+            ip_checksum(v4_pseudo_header, sizeof(v4_pseudo_header)))
+            << "ipv4_pseudo_header_checksum incorrect\n";
+
+  uint8_t v6_header[] = { IPV6_UDP_HEADER };
+  uint8_t v6_pseudo_header[] = { IPV6_PSEUDOHEADER(v6_header, IPPROTO_UDP, UDP_LEN) };
+  pseudo_checksum = ipv6_pseudo_header_checksum((struct ip6_hdr *) v6_header, UDP_LEN, IPPROTO_UDP);
+  EXPECT_EQ(ip_checksum_finish(pseudo_checksum),
+            ip_checksum(v6_pseudo_header, sizeof(v6_pseudo_header)))
+            << "ipv6_pseudo_header_checksum incorrect\n";
+}
+
+TEST_F(ClatdTest, TransportChecksum) {
+  uint8_t udphdr[] = { UDP_HEADER };
+  uint8_t payload[] = { PAYLOAD };
+  EXPECT_EQ(kUdpPartialChecksum, ip_checksum_add(0, udphdr, sizeof(udphdr)))
+            << "UDP partial checksum\n";
+  EXPECT_EQ(kPayloadPartialChecksum, ip_checksum_add(0, payload, sizeof(payload)))
+            << "Payload partial checksum\n";
+
+  uint8_t ip[] = { IPV4_UDP_HEADER };
+  uint8_t ip6[] = { IPV6_UDP_HEADER };
+  uint32_t ipv4_pseudo_sum = ipv4_pseudo_header_checksum((struct iphdr *) ip, UDP_LEN);
+  uint32_t ipv6_pseudo_sum = ipv6_pseudo_header_checksum((struct ip6_hdr *) ip6, UDP_LEN,
+                                                         IPPROTO_UDP);
+
+  EXPECT_EQ(0x3ad0U, ipv4_pseudo_sum) << "IPv4 pseudo-checksum sanity check\n";
+  EXPECT_EQ(0x2644bU, ipv6_pseudo_sum) << "IPv6 pseudo-checksum sanity check\n";
+  EXPECT_EQ(
+      kUdpV4Checksum,
+      ip_checksum_finish(ipv4_pseudo_sum + kUdpPartialChecksum + kPayloadPartialChecksum))
+      << "Unexpected UDP/IPv4 checksum\n";
+  EXPECT_EQ(
+      kUdpV6Checksum,
+      ip_checksum_finish(ipv6_pseudo_sum + kUdpPartialChecksum + kPayloadPartialChecksum))
+      << "Unexpected UDP/IPv6 checksum\n";
+
+  EXPECT_EQ(kUdpV6Checksum,
+      ip_checksum_adjust(kUdpV4Checksum, ipv4_pseudo_sum, ipv6_pseudo_sum))
+      << "Adjust IPv4/UDP checksum to IPv6\n";
+  EXPECT_EQ(kUdpV4Checksum,
+      ip_checksum_adjust(kUdpV6Checksum, ipv6_pseudo_sum, ipv4_pseudo_sum))
+      << "Adjust IPv6/UDP checksum to IPv4\n";
+}
+
+TEST_F(ClatdTest, AdjustChecksum) {
+  struct checksum_data {
+    uint16_t checksum;
+    uint32_t old_hdr_sum;
+    uint32_t new_hdr_sum;
+    uint16_t result;
+  } DATA[] = {
+    { 0x1423, 0xb8ec, 0x2d757, 0xf5b5 },
+    { 0xf5b5, 0x2d757, 0xb8ec, 0x1423 },
+    { 0xdd2f, 0x5555, 0x3285, 0x0000 },
+    { 0x1215, 0x5560, 0x15560 + 20, 0x1200 },
+    { 0xd0c7, 0x3ad0, 0x2644b, 0xa74a },
+  };
+  unsigned i = 0;
+
+  for (i = 0; i < ARRAYSIZE(DATA); i++) {
+    struct checksum_data *data = DATA + i;
+    uint16_t result = ip_checksum_adjust(data->checksum, data->old_hdr_sum, data->new_hdr_sum);
+    EXPECT_EQ(result, data->result)
+        << "Incorrect checksum" << std::showbase << std::hex
+        << "\n  Expected: " << data->result
+        << "\n  Actual:   " << result
+        << "\n    checksum=" << data->checksum
+        << " old_sum=" << data->old_hdr_sum << " new_sum=" << data->new_hdr_sum << "\n";
+  }
+}
+
+TEST_F(ClatdTest, Translate) {
+  uint8_t udp_ipv4[] = { IPV4_UDP_HEADER UDP_HEADER PAYLOAD };
+  uint8_t udp_ipv6[] = { IPV6_UDP_HEADER UDP_HEADER PAYLOAD };
+  fix_udp_checksum(udp_ipv4);
+  fix_udp_checksum(udp_ipv6);
+  check_translated_packet(udp_ipv4, sizeof(udp_ipv4), udp_ipv6, sizeof(udp_ipv6),
+                          "UDP/IPv4 -> UDP/IPv6 translation");
+  check_translated_packet(udp_ipv6, sizeof(udp_ipv6), udp_ipv4, sizeof(udp_ipv4),
+                          "UDP/IPv6 -> UDP/IPv4 translation");
+
+  uint8_t ipv4_ping[] = { IPV4_ICMP_HEADER IPV4_PING PAYLOAD };
+  uint8_t ipv6_ping[] = { IPV6_ICMPV6_HEADER IPV6_PING PAYLOAD };
+  check_translated_packet(ipv4_ping, sizeof(ipv4_ping), ipv6_ping, sizeof(ipv6_ping),
+                          "ICMP->ICMPv6 translation");
+  check_translated_packet(ipv6_ping, sizeof(ipv6_ping), ipv4_ping, sizeof(ipv4_ping),
+                          "ICMPv6->ICMP translation");
+}
+
+TEST_F(ClatdTest, Fragmentation) {
+  check_fragment_translation(kIPv4Fragments, kIPv4FragLengths,
+                             kIPv6Fragments, kIPv6FragLengths,
+                             ARRAYSIZE(kIPv4Fragments), "IPv4->IPv6 fragment translation");
+
+  check_fragment_translation(kIPv6Fragments, kIPv6FragLengths,
+                             kIPv4Fragments, kIPv4FragLengths,
+                             ARRAYSIZE(kIPv6Fragments), "IPv6->IPv4 fragment translation");
+}
+
+void check_translate_checksum_neutral(const uint8_t *original, size_t original_len,
+                                      size_t expected_len, const char *msg) {
+  uint8_t translated[MAXMTU];
+  size_t translated_len = sizeof(translated);
+  do_translate_packet(original, original_len, translated, &translated_len, msg);
+  EXPECT_EQ(expected_len, translated_len) << msg << ": Translated packet length incorrect\n";
+  // do_translate_packet already checks packets for validity and verifies the checksum.
+  int original_check = get_transport_checksum(original);
+  int translated_check = get_transport_checksum(translated);
+  ASSERT_NE(-1, original_check);
+  ASSERT_NE(-1, translated_check);
+  ASSERT_EQ(original_check, translated_check)
+      << "Not checksum neutral: original and translated checksums differ\n";
+}
+
+TEST_F(ClatdTest, TranslateChecksumNeutral) {
+  // Generate a random clat IPv6 address and check that translation is checksum-neutral.
+  Global_Clatd_Config.ipv6_host_id = in6addr_any;
+  ASSERT_TRUE(inet_pton(AF_INET6, "2001:db8:1:2:f076:ae99:124e:aa54",
+                        &Global_Clatd_Config.ipv6_local_subnet));
+  config_generate_local_ipv6_subnet(&Global_Clatd_Config.ipv6_local_subnet);
+  ASSERT_NE((uint32_t) 0x00000464, Global_Clatd_Config.ipv6_local_subnet.s6_addr32[3]);
+  ASSERT_NE((uint32_t) 0, Global_Clatd_Config.ipv6_local_subnet.s6_addr32[3]);
+
+  // Check that translating UDP packets is checksum-neutral. First, IPv4.
+  uint8_t udp_ipv4[] = { IPV4_UDP_HEADER UDP_HEADER PAYLOAD };
+  fix_udp_checksum(udp_ipv4);
+  check_translate_checksum_neutral(udp_ipv4, sizeof(udp_ipv4), sizeof(udp_ipv4) + 20,
+                                   "UDP/IPv4 -> UDP/IPv6 checksum neutral");
+
+  // Now try IPv6.
+  uint8_t udp_ipv6[] = { IPV6_UDP_HEADER UDP_HEADER PAYLOAD };
+  // The test packet uses the static IID, not the random IID. Fix up the source address.
+  struct ip6_hdr *ip6 = (struct ip6_hdr *) udp_ipv6;
+  memcpy(&ip6->ip6_src, &Global_Clatd_Config.ipv6_local_subnet, sizeof(ip6->ip6_src));
+  fix_udp_checksum(udp_ipv6);
+  check_translate_checksum_neutral(udp_ipv4, sizeof(udp_ipv4), sizeof(udp_ipv4) + 20,
+                                   "UDP/IPv4 -> UDP/IPv6 checksum neutral");
+}
diff --git a/ap/app/clatd/config.c b/ap/app/clatd/config.c
new file mode 100755
index 0000000..552e9ab
--- /dev/null
+++ b/ap/app/clatd/config.c
@@ -0,0 +1,402 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * config.c - configuration settings
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <limits.h>
+#include <errno.h>
+#include <unistd.h>
+
+//#include <cutils/config_utils.h>
+#include "ifc.h"
+#include "config_utils.h"
+
+#include "config.h"
+#include "dns64.h"
+#include "logging.h"
+#include "getaddr.h"
+#include "clatd.h"
+#include "checksum.h"
+
+void arc4random_buf(void *buf, size_t n);
+
+struct clat_config Global_Clatd_Config;
+
+/* function: config_item_str
+ * locates the config item and returns the pointer to a string, or NULL on failure.  Caller frees pointer
+ * root       - parsed configuration
+ * item_name  - name of config item to locate
+ * defaultvar - value to use if config item isn't present
+ */
+char *config_item_str(cnode *root, const char *item_name, const char *defaultvar) {
+  const char *tmp;
+
+  if(!(tmp = config_str(root, item_name, defaultvar))) {
+    logmsg(ANDROID_LOG_FATAL,"%s config item needed",item_name);
+    return NULL;
+  }
+  return strdup(tmp);
+}
+
+/* function: config_item_int16_t
+ * locates the config item, parses the integer, and returns the pointer ret_val_ptr, or NULL on failure
+ * root        - parsed configuration
+ * item_name   - name of config item to locate
+ * defaultvar  - value to use if config item isn't present
+ * ret_val_ptr - pointer for return value storage
+ */
+int16_t *config_item_int16_t(cnode *root, const char *item_name, const char *defaultvar, int16_t *ret_val_ptr) {
+  const char *tmp;
+  char *endptr;
+  long int conf_int;
+
+  if(!(tmp = config_str(root, item_name, defaultvar))) {
+    logmsg(ANDROID_LOG_FATAL,"%s config item needed",item_name);
+    return NULL;
+  }
+
+  errno = 0;
+  conf_int = strtol(tmp,&endptr,10);
+  if(errno > 0) {
+    logmsg(ANDROID_LOG_FATAL,"%s config item is not numeric: %s (error=%s)",item_name,tmp,strerror(errno));
+    return NULL;
+  }
+  if(endptr == tmp || *tmp == '\0') {
+    logmsg(ANDROID_LOG_FATAL,"%s config item is not numeric: %s",item_name,tmp);
+    return NULL;
+  }
+  if(*endptr != '\0') {
+    logmsg(ANDROID_LOG_FATAL,"%s config item contains non-numeric characters: %s",item_name,endptr);
+    return NULL;
+  }
+  if(conf_int > INT16_MAX || conf_int < INT16_MIN) {
+    logmsg(ANDROID_LOG_FATAL,"%s config item is too big/small: %d",item_name,conf_int);
+    return NULL;
+  }
+  *ret_val_ptr = conf_int;
+  return ret_val_ptr;
+}
+
+/* function: config_item_ip
+ * locates the config item, parses the ipv4 address, and returns the pointer ret_val_ptr, or NULL on failure
+ * root        - parsed configuration
+ * item_name   - name of config item to locate
+ * defaultvar  - value to use if config item isn't present
+ * ret_val_ptr - pointer for return value storage
+ */
+struct in_addr *config_item_ip(cnode *root, const char *item_name, const char *defaultvar, struct in_addr *ret_val_ptr) {
+  const char *tmp;
+  int status;
+
+  if(!(tmp = config_str(root, item_name, defaultvar))) {
+    logmsg(ANDROID_LOG_FATAL,"%s config item needed",item_name);
+    return NULL;
+  }
+
+  status = inet_pton(AF_INET, tmp, ret_val_ptr);
+  if(status <= 0) {
+    logmsg(ANDROID_LOG_FATAL,"invalid IPv4 address specified for %s: %s", item_name, tmp);
+    return NULL;
+  }
+
+  return ret_val_ptr;
+}
+
+/* function: config_item_ip6
+ * locates the config item, parses the ipv6 address, and returns the pointer ret_val_ptr, or NULL on failure
+ * root        - parsed configuration
+ * item_name   - name of config item to locate
+ * defaultvar  - value to use if config item isn't present
+ * ret_val_ptr - pointer for return value storage
+ */
+struct in6_addr *config_item_ip6(cnode *root, const char *item_name, const char *defaultvar, struct in6_addr *ret_val_ptr) {
+  const char *tmp;
+  int status;
+
+  if(!(tmp = config_str(root, item_name, defaultvar))) {
+    logmsg(ANDROID_LOG_FATAL,"%s config item needed",item_name);
+    return NULL;
+  }
+
+  status = inet_pton(AF_INET6, tmp, ret_val_ptr);
+  if(status <= 0) {
+    logmsg(ANDROID_LOG_FATAL,"invalid IPv6 address specified for %s: %s", item_name, tmp);
+    return NULL;
+  }
+
+  return ret_val_ptr;
+}
+
+/* function: free_config
+ * frees the memory used by the global config variable
+ */
+void free_config() {
+  if(Global_Clatd_Config.plat_from_dns64_hostname) {
+    free(Global_Clatd_Config.plat_from_dns64_hostname);
+    Global_Clatd_Config.plat_from_dns64_hostname = NULL;
+  }
+}
+
+/* function: ipv6_prefix_equal
+ * compares the prefixes two ipv6 addresses. assumes the prefix lengths are both /64.
+ * a1 - first address
+ * a2 - second address
+ * returns: 0 if the subnets are different, 1 if they are the same.
+ */
+int ipv6_prefix_equal(struct in6_addr *a1, struct in6_addr *a2) {
+    return !memcmp(a1, a2, 8);
+}
+
+/* function: dns64_detection
+ * does dns lookups to set the plat subnet or exits on failure, waits forever for a dns response with a query backoff timer
+ * net_id - (optional) netId to use, NETID_UNSET indicates use of default network
+ */
+void dns64_detection(unsigned net_id) {
+  int backoff_sleep, status;
+  struct in6_addr tmp_ptr;
+
+  backoff_sleep = 1;
+
+  while(1) {
+    status = plat_prefix(Global_Clatd_Config.plat_from_dns64_hostname,net_id,&tmp_ptr);
+    if(status > 0) {
+      memcpy(&Global_Clatd_Config.plat_subnet, &tmp_ptr, sizeof(struct in6_addr));
+      return;
+    }
+    logmsg(ANDROID_LOG_WARN, "dns64_detection -- error, sleeping for %d seconds", backoff_sleep);
+    sleep(backoff_sleep);
+    backoff_sleep *= 2;
+    if(backoff_sleep >= 1800) {
+      // Scale down to one DNS query per half hour. Unnecessary DNS queries waste power, and the
+      // benefit is minimal (basically, only limited to the case where a network goes from IPv6-only
+      // to IPv6 with NAT64).
+      backoff_sleep = 1800;
+    }
+  }
+}
+
+/* function: gen_random_iid
+ * picks a random interface ID that is checksum neutral with the IPv4 address and the NAT64 prefix
+ * myaddr            - IPv6 address to write to
+ * ipv4_local_subnet - clat IPv4 address
+ * plat_subnet       - NAT64 prefix
+ */
+void gen_random_iid(struct in6_addr *myaddr, struct in_addr *ipv4_local_subnet,
+                    struct in6_addr *plat_subnet) {
+  // Fill last 8 bytes of IPv6 address with random bits.
+  arc4random_buf(&myaddr->s6_addr[8], 8);
+  //arc4random_addrandom(&myaddr->s6_addr[8], 8);
+
+  // Make the IID checksum-neutral. That is, make it so that:
+  //   checksum(Local IPv4 | Remote IPv4) = checksum(Local IPv6 | Remote IPv6)
+  // in other words (because remote IPv6 = NAT64 prefix | Remote IPv4):
+  //   checksum(Local IPv4) = checksum(Local IPv6 | NAT64 prefix)
+  // Do this by adjusting the two bytes in the middle of the IID.
+
+  uint16_t middlebytes = (myaddr->s6_addr[11] << 8) + myaddr->s6_addr[12];
+
+  uint32_t c1 = ip_checksum_add(0, ipv4_local_subnet, sizeof(*ipv4_local_subnet));
+  uint32_t c2 = ip_checksum_add(0, plat_subnet, sizeof(*plat_subnet)) +
+                ip_checksum_add(0, myaddr, sizeof(*myaddr));
+
+  uint16_t delta = ip_checksum_adjust(middlebytes, c1, c2);
+  myaddr->s6_addr[11] = delta >> 8;
+  myaddr->s6_addr[12] = delta & 0xff;
+}
+
+// Factored out to a separate function for testability.
+int connect_is_ipv4_address_free(in_addr_t addr) {
+  int s = socket(AF_INET, SOCK_DGRAM, 0);
+  if (s == -1) {
+    return 0;
+  }
+
+  // Attempt to connect to the address. If the connection succeeds and getsockname returns the same
+  // the address then the address is already assigned to the system and we can't use it.
+  struct sockaddr_in sin = { .sin_family = AF_INET, .sin_addr = { addr }, .sin_port = 53 };
+  socklen_t len = sizeof(sin);
+  int inuse = connect(s, (struct sockaddr *) &sin, sizeof(sin)) == 0 &&
+              getsockname(s, (struct sockaddr *) &sin, &len) == 0 &&
+              (size_t) len >= sizeof(sin) &&
+              sin.sin_addr.s_addr == addr;
+
+  close(s);
+  return !inuse;
+}
+
+addr_free_func config_is_ipv4_address_free = connect_is_ipv4_address_free;
+
+/* function: config_select_ipv4_address
+ * picks a free IPv4 address, starting from ip and trying all addresses in the prefix in order
+ * ip        - the IP address from the configuration file
+ * prefixlen - the length of the prefix from which addresses may be selected.
+ * returns: the IPv4 address, or INADDR_NONE if no addresses were available
+ */
+in_addr_t config_select_ipv4_address(const struct in_addr *ip, int16_t prefixlen) {
+  in_addr_t chosen = INADDR_NONE;
+
+  // Don't accept prefixes that are too large because we scan addresses one by one.
+  if (prefixlen < 16 || prefixlen > 32) {
+      return chosen;
+  }
+
+  // All these are in host byte order.
+  in_addr_t mask = 0xffffffff >> (32 - prefixlen) << (32 - prefixlen);
+  in_addr_t ipv4 = ntohl(ip->s_addr);
+  in_addr_t first_ipv4 = ipv4;
+  in_addr_t prefix = ipv4 & mask;
+
+  // Pick the first IPv4 address in the pool, wrapping around if necessary.
+  // So, for example, 192.0.0.4 -> 192.0.0.5 -> 192.0.0.6 -> 192.0.0.7 -> 192.0.0.0.
+  do {
+     if (config_is_ipv4_address_free(htonl(ipv4))) {
+       chosen = htonl(ipv4);
+       break;
+     }
+     ipv4 = prefix | ((ipv4 + 1) & ~mask);
+  } while (ipv4 != first_ipv4);
+
+  return chosen;
+}
+
+/* function: config_generate_local_ipv6_subnet
+ * generates the local ipv6 subnet when given the interface ip
+ * requires config.ipv6_host_id
+ * interface_ip - in: interface ip, out: local ipv6 host address
+ */
+void config_generate_local_ipv6_subnet(struct in6_addr *interface_ip) {
+  int i;
+
+  if (Global_Clatd_Config.use_dynamic_iid) {
+    /* Generate a random interface ID. */
+    gen_random_iid(interface_ip,
+                   &Global_Clatd_Config.ipv4_local_subnet,
+                   &Global_Clatd_Config.plat_subnet);
+  } else {
+    /* Use the specified interface ID. */
+    for(i = 2; i < 4; i++) {
+      interface_ip->s6_addr32[i] = Global_Clatd_Config.ipv6_host_id.s6_addr32[i];
+    }
+  }
+}
+
+/* function: read_config
+ * reads the config file and parses it into the global variable Global_Clatd_Config. returns 0 on failure, 1 on success
+ * file             - filename to parse
+ * uplink_interface - interface to use to reach the internet and supplier of address space
+ * plat_prefix      - (optional) plat prefix to use, otherwise follow config file
+ * net_id           - (optional) netId to use, NETID_UNSET indicates use of default network
+ */
+int read_config(const char *file, const char *uplink_interface, const char *plat_prefix,
+        unsigned net_id) {
+  cnode *root = config_node("", "");
+  void *tmp_ptr = NULL;
+  unsigned flags;
+
+  if(!root) {
+    logmsg(ANDROID_LOG_FATAL,"out of memory");
+    return 0;
+  }
+
+  memset(&Global_Clatd_Config, '\0', sizeof(Global_Clatd_Config));
+
+  config_load_file(root, file);
+  if(root->first_child == NULL) {
+    logmsg(ANDROID_LOG_FATAL,"Could not read config file %s", file);
+    goto failed;
+  }
+
+  Global_Clatd_Config.default_pdp_interface = strdup(uplink_interface);
+  if (!Global_Clatd_Config.default_pdp_interface)
+    goto failed;
+
+  if(!config_item_int16_t(root, "mtu", "-1", &Global_Clatd_Config.mtu))
+    goto failed;
+
+  if(!config_item_int16_t(root, "ipv4mtu", "-1", &Global_Clatd_Config.ipv4mtu))
+    goto failed;
+
+  if(!config_item_ip(root, "ipv4_local_subnet", DEFAULT_IPV4_LOCAL_SUBNET,
+                     &Global_Clatd_Config.ipv4_local_subnet))
+    goto failed;
+
+  if(!config_item_int16_t(root, "ipv4_local_prefixlen", DEFAULT_IPV4_LOCAL_PREFIXLEN,
+                          &Global_Clatd_Config.ipv4_local_prefixlen))
+    goto failed;
+
+  if(plat_prefix) { // plat subnet is coming from the command line
+    if(inet_pton(AF_INET6, plat_prefix, &Global_Clatd_Config.plat_subnet) <= 0) {
+      logmsg(ANDROID_LOG_FATAL,"invalid IPv6 address specified for plat prefix: %s", plat_prefix);
+      goto failed;
+    }
+  } else {
+    tmp_ptr = (void *)config_item_str(root, "plat_from_dns64", "yes");
+    if(!tmp_ptr || strcmp(tmp_ptr, "no") == 0) {
+      free(tmp_ptr);
+
+      if(!config_item_ip6(root, "plat_subnet", NULL, &Global_Clatd_Config.plat_subnet)) {
+        logmsg(ANDROID_LOG_FATAL, "plat_from_dns64 disabled, but no plat_subnet specified");
+        goto failed;
+      }
+    } else {
+      free(tmp_ptr);
+
+      if(!(Global_Clatd_Config.plat_from_dns64_hostname = config_item_str(root, "plat_from_dns64_hostname", DEFAULT_DNS64_DETECTION_HOSTNAME)))
+        goto failed;
+      dns64_detection(net_id);
+    }
+  }
+
+  if (!config_item_ip6(root, "ipv6_host_id", "::", &Global_Clatd_Config.ipv6_host_id))
+    goto failed;
+
+  /* In order to prevent multiple devices attempting to use the same clat address, never use a
+     statically-configured interface ID on a broadcast interface such as wifi. */
+  if (!IN6_IS_ADDR_UNSPECIFIED(&Global_Clatd_Config.ipv6_host_id)) {
+    ifc_init();
+    ifc_get_info(Global_Clatd_Config.default_pdp_interface, NULL, NULL, &flags);
+    ifc_close();
+    Global_Clatd_Config.use_dynamic_iid = (flags & IFF_BROADCAST) != 0;
+  } else {
+    Global_Clatd_Config.use_dynamic_iid = 1;
+  }
+
+  return 1;
+
+failed:
+  free(root);
+  free_config();
+  return 0;
+}
+
+/* function; dump_config
+ * prints the current config
+ */
+void dump_config() {
+  char charbuffer[INET6_ADDRSTRLEN];
+
+  logmsg(ANDROID_LOG_DEBUG,"mtu = %d",Global_Clatd_Config.mtu);
+  logmsg(ANDROID_LOG_DEBUG,"ipv4mtu = %d",Global_Clatd_Config.ipv4mtu);
+  logmsg(ANDROID_LOG_DEBUG,"ipv6_local_subnet = %s",inet_ntop(AF_INET6, &Global_Clatd_Config.ipv6_local_subnet, charbuffer, sizeof(charbuffer)));
+  logmsg(ANDROID_LOG_DEBUG,"ipv4_local_subnet = %s",inet_ntop(AF_INET, &Global_Clatd_Config.ipv4_local_subnet, charbuffer, sizeof(charbuffer)));
+  logmsg(ANDROID_LOG_DEBUG,"ipv4_local_prefixlen = %d", Global_Clatd_Config.ipv4_local_prefixlen);
+  logmsg(ANDROID_LOG_DEBUG,"plat_subnet = %s",inet_ntop(AF_INET6, &Global_Clatd_Config.plat_subnet, charbuffer, sizeof(charbuffer)));
+  logmsg(ANDROID_LOG_DEBUG,"default_pdp_interface = %s",Global_Clatd_Config.default_pdp_interface);
+}
diff --git a/ap/app/clatd/config.h b/ap/app/clatd/config.h
new file mode 100755
index 0000000..e31a81d
--- /dev/null
+++ b/ap/app/clatd/config.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * config.h - configuration settings
+ */
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#include <netinet/in.h>
+#include <linux/if.h>
+
+#define DEFAULT_IPV4_LOCAL_SUBNET "192.0.0.4"
+#define DEFAULT_IPV4_LOCAL_PREFIXLEN "29"
+#define DEFAULT_DNS64_DETECTION_HOSTNAME "ipv4only.arpa"
+
+struct clat_config {
+  int16_t mtu, ipv4mtu;
+  struct in6_addr ipv6_local_subnet;
+  struct in6_addr ipv6_host_id;
+  struct in_addr ipv4_local_subnet;
+  int16_t ipv4_local_prefixlen;
+  struct in6_addr plat_subnet;
+  char *default_pdp_interface;
+  char *plat_from_dns64_hostname;
+  int use_dynamic_iid;
+};
+
+extern struct clat_config Global_Clatd_Config;
+
+int read_config(const char *file, const char *uplink_interface, const char *plat_prefix,
+        unsigned net_id);
+void config_generate_local_ipv6_subnet(struct in6_addr *interface_ip);
+in_addr_t config_select_ipv4_address(const struct in_addr *ip, int16_t prefixlen);
+int ipv6_prefix_equal(struct in6_addr *a1, struct in6_addr *a2);
+
+typedef int (*addr_free_func)(in_addr_t addr);
+
+#endif /* __CONFIG_H__ */
diff --git a/ap/app/clatd/config_utils.c b/ap/app/clatd/config_utils.c
new file mode 100755
index 0000000..284b32a
--- /dev/null
+++ b/ap/app/clatd/config_utils.c
@@ -0,0 +1,325 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <config_utils.h>
+
+cnode* config_node(const char *name, const char *value)
+{
+    cnode* node = calloc(sizeof(cnode), 1);
+    if(node) {
+        node->name = name ? name : "";
+        node->value = value ? value : "";
+    }
+
+    return node;
+}
+
+cnode* config_find(cnode *root, const char *name)
+{
+    cnode *node, *match = NULL;
+
+    /* we walk the whole list, as we need to return the last (newest) entry */
+    for(node = root->first_child; node; node = node->next)
+        if(!strcmp(node->name, name))
+            match = node;
+
+    return match;
+}
+
+static cnode* _config_create(cnode *root, const char *name)
+{
+    cnode *node;
+
+    node = config_node(name, NULL);
+
+    if(root->last_child)
+        root->last_child->next = node;
+    else
+        root->first_child = node;
+
+    root->last_child = node;
+
+    return node;
+}
+
+int config_bool(cnode *root, const char *name, int _default)
+{
+    cnode *node;
+        
+    node = config_find(root, name);
+    if(!node)
+        return _default;
+
+    switch(node->value[0]) {
+    case 'y':
+    case 'Y':
+    case '1':
+        return 1;
+    default:
+        return 0;
+    }
+}
+
+const char* config_str(cnode *root, const char *name, const char *_default)
+{
+    cnode *node;
+
+    node = config_find(root, name);
+    if(!node)
+        return _default;
+    return node->value;
+}
+
+void config_set(cnode *root, const char *name, const char *value)
+{
+    cnode *node;
+
+    node = config_find(root, name);
+    if(node)
+        node->value = value;
+    else {
+        node = _config_create(root, name);
+        node->value = value;
+    }
+}
+
+#define T_EOF 0
+#define T_TEXT 1
+#define T_DOT 2
+#define T_OBRACE 3
+#define T_CBRACE 4
+
+typedef struct
+{
+    char *data;
+    char *text;
+    int len;
+    char next;
+} cstate;
+
+static int _lex(cstate *cs, int value)
+{
+    char c;
+    char *s;
+    char *data;
+
+    data = cs->data;
+
+    if(cs->next != 0) {
+        c = cs->next;
+        cs->next = 0;
+        goto got_c;
+    }
+
+restart:
+    for(;;) {
+        c = *data++;
+    got_c:
+        if(isspace(c))
+            continue;
+
+        switch(c) {
+        case 0:
+            return T_EOF;
+
+        case '#':
+            for(;;) {
+                switch(*data) {
+                case 0:
+                    cs->data = data;
+                    return T_EOF;
+                case '\n':
+                    cs->data = data + 1;
+                    goto restart;
+                default:
+                    data++;
+                }
+            }
+            break;
+            
+        case '.':
+            cs->data = data;
+            return T_DOT;
+
+        case '{':
+            cs->data = data;
+            return T_OBRACE;
+
+        case '}':
+            cs->data = data;
+            return T_CBRACE;
+
+        default:
+            s = data - 1;
+
+            if(value) {
+                for(;;) {
+                    if(*data == 0) {
+                        cs->data = data;
+                        break;
+                    }
+                    if(*data == '\n') {
+                        cs->data = data + 1;
+                        *data-- = 0;
+                        break;
+                    }
+                    data++;
+                }
+
+                    /* strip trailing whitespace */
+                while(data > s){
+                    if(!isspace(*data)) break;
+                    *data-- = 0;
+                }
+
+                goto got_text;                
+            } else {
+                for(;;) {
+                    if(isspace(*data)) {
+                        *data = 0;
+                        cs->data = data + 1;
+                        goto got_text;
+                    }
+                    switch(*data) {
+                    case 0:
+                        cs->data = data;
+                        goto got_text;
+                    case '.':
+                    case '{':
+                    case '}':
+                        cs->next = *data;
+                        *data = 0;
+                        cs->data = data + 1;
+                        goto got_text;
+                    default:
+                        data++;
+                    }
+                }
+            }
+        }
+    }
+
+got_text:
+    cs->text = s;
+    return T_TEXT;
+}
+
+#if 0
+char *TOKENNAMES[] = { "EOF", "TEXT", "DOT", "OBRACE", "CBRACE" };
+
+static int lex(cstate *cs, int value)
+{
+    int tok = _lex(cs, value);
+    printf("TOKEN(%d) %s %s\n", value, TOKENNAMES[tok],
+           tok == T_TEXT ? cs->text : "");
+    return tok;
+}
+#else
+#define lex(cs,v) _lex(cs,v)
+#endif
+
+static int parse_expr(cstate *cs, cnode *node);
+
+static int parse_block(cstate *cs, cnode *node)
+{
+    for(;;){
+        switch(lex(cs, 0)){
+        case T_TEXT:
+            if(parse_expr(cs, node)) return -1;
+            continue;
+
+        case T_CBRACE:
+            return 0;
+
+        default:
+            return -1;
+        }
+    }
+}
+
+static int parse_expr(cstate *cs, cnode *root)
+{
+    cnode *node;
+
+        /* last token was T_TEXT */
+    node = config_find(root, cs->text);
+    if(!node || *node->value)
+        node = _config_create(root, cs->text);
+
+    for(;;) {
+        switch(lex(cs, 1)) {
+        case T_DOT:
+            if(lex(cs, 0) != T_TEXT)
+                return -1;
+            node = _config_create(node, cs->text);
+            continue;
+
+        case T_TEXT:
+            node->value = cs->text;
+            return 0;
+
+        case T_OBRACE:
+            return parse_block(cs, node);
+
+        default:
+            return -1;
+        }
+    }
+}
+
+void config_load(cnode *root, char *data)
+{
+    if(data != 0) {
+        cstate cs;
+        cs.data = data;
+        cs.next = 0;
+
+        for(;;) {
+            switch(lex(&cs, 0)) {
+            case T_TEXT:
+                if(parse_expr(&cs, root))
+                    return;
+                break;
+            default:
+                return;
+            }
+        }
+    }
+}
+
+void config_load_file(cnode *root, const char *fn)
+{
+    char* data = load_file(fn, 0);
+    config_load(root, data);
+    // TODO: deliberate leak :-/
+}
+
+void config_free(cnode *root)
+{
+    cnode *cur = root->first_child;
+
+    while (cur) {
+        cnode *prev = cur;
+        config_free(cur);
+        cur = cur->next;
+        free(prev);
+    }
+}
diff --git a/ap/app/clatd/config_utils.h b/ap/app/clatd/config_utils.h
new file mode 100755
index 0000000..68431eb
--- /dev/null
+++ b/ap/app/clatd/config_utils.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CUTILS_CONFIG_UTILS_H
+#define __CUTILS_CONFIG_UTILS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+    
+typedef struct cnode cnode;
+
+
+struct cnode
+{
+    cnode *next;
+    cnode *first_child;
+    cnode *last_child;
+    const char *name;
+    const char *value;
+};
+
+/* parse a text string into a config node tree */
+void config_load(cnode *root, char *data);
+
+/* parse a file into a config node tree */
+void config_load_file(cnode *root, const char *fn);
+
+/* create a single config node */
+cnode* config_node(const char *name, const char *value);
+
+/* locate a named child of a config node */
+cnode* config_find(cnode *root, const char *name);
+
+/* look up a child by name and return the boolean value */
+int config_bool(cnode *root, const char *name, int _default);
+
+/* look up a child by name and return the string value */
+const char* config_str(cnode *root, const char *name, const char *_default);
+
+/* add a named child to a config node (or modify it if it already exists) */
+void config_set(cnode *root, const char *name, const char *value);
+
+/* free a config node tree */
+void config_free(cnode *root);
+
+void *load_file(const char *fn, unsigned *_sz);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ap/app/clatd/debug.h b/ap/app/clatd/debug.h
new file mode 100755
index 0000000..8e09672
--- /dev/null
+++ b/ap/app/clatd/debug.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * debug.h - debug settings
+ */
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+// set to 1 to enable debug logging and packet dumping.
+#define CLAT_DEBUG 0
+
+#endif /* __DEBUG_H__ */
diff --git a/ap/app/clatd/dns64.c b/ap/app/clatd/dns64.c
new file mode 100755
index 0000000..3a287cf
--- /dev/null
+++ b/ap/app/clatd/dns64.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * dns64.c - find the nat64 prefix with a dns64 lookup
+ */
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <strings.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "dns64.h"
+#include "logging.h"
+//#include "NetdClient.h"
+//#include "resolv_netid.h"
+#include "my_header.h"
+
+/* function: plat_prefix
+ * looks up an ipv4-only hostname and looks for a nat64 /96 prefix, returns 1 on success, 0 on failure
+ * ipv4_name  - name to lookup
+ * net_id     - (optional) netId to use, NETID_UNSET indicates use of default network
+ * prefix     - the plat /96 prefix
+ */
+int plat_prefix(const char *ipv4_name, unsigned net_id, struct in6_addr *prefix) {
+  const struct addrinfo hints = {
+    .ai_family = AF_INET6,
+  };
+  int status;
+  struct addrinfo *result = NULL;
+  struct in6_addr plat_addr;
+  char plat_addr_str[INET6_ADDRSTRLEN];
+
+  logmsg(ANDROID_LOG_INFO, "Detecting NAT64 prefix from DNS...");
+
+  // Be sure to query local DNS64 servers, bypassing Private DNS (if enabled).
+  if (net_id != NETID_UNSET) {
+    net_id |= NETID_USE_LOCAL_NAMESERVERS;
+  }
+
+  //status = android_getaddrinfofornet(ipv4_name, NULL, &hints, net_id, MARK_UNSET, &result);
+  status = getaddrinfo(ipv4_name, NULL, &hints, &result);
+
+  if (status != 0 || result == NULL) {
+    logmsg(ANDROID_LOG_ERROR, "plat_prefix/dns(%s) status = %d/%s",
+           ipv4_name, status, gai_strerror(status));
+    return 0;
+  }
+
+  // Use only the first result.  If other records are present, possibly with
+  // differing DNS64 prefixes they are ignored (there is very little sensible
+  // that could be done with them at this time anyway).
+
+  if (result->ai_family != AF_INET6) {
+    logmsg(ANDROID_LOG_WARN, "plat_prefix/unexpected address family: %d", result->ai_family);
+    return 0;
+  }
+  plat_addr = ((struct sockaddr_in6 *)result->ai_addr)->sin6_addr;
+  // Only /96 DNS64 prefixes are supported at this time.
+  plat_addr.s6_addr32[3] = 0;
+  freeaddrinfo(result);
+
+  logmsg(ANDROID_LOG_INFO, "Detected NAT64 prefix %s/96",
+         inet_ntop(AF_INET6, &plat_addr, plat_addr_str, sizeof(plat_addr_str)));
+  *prefix = plat_addr;
+  return 1;
+}
diff --git a/ap/app/clatd/dns64.h b/ap/app/clatd/dns64.h
new file mode 100755
index 0000000..f5eaea8
--- /dev/null
+++ b/ap/app/clatd/dns64.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * dns64.h - find the nat64 prefix with a dns64 lookup
+ */
+#ifndef __DNS64_H__
+#define __DNS64_H__
+
+int plat_prefix(const char *ipv4_name, unsigned net_id, struct in6_addr *prefix);
+
+#endif
diff --git a/ap/app/clatd/dump.c b/ap/app/clatd/dump.c
new file mode 100755
index 0000000..b8e1efe
--- /dev/null
+++ b/ap/app/clatd/dump.c
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * dump.c - print various headers for debugging
+ */
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+//#include <netinet/ip_icmp.h>
+#include <netinet/udp.h>
+#include <netinet/tcp.h>
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
+#include <linux/icmp.h>
+
+#include "debug.h"
+#include "checksum.h"
+#include "clatd.h"
+#include "logging.h"
+
+#if CLAT_DEBUG
+
+/* print ip header */
+void dump_ip(struct iphdr *header) {
+  u_int16_t frag_flags;
+  char addrstr[INET6_ADDRSTRLEN];
+
+  frag_flags = ntohs(header->frag_off);
+
+  printf("IP packet\n");
+  printf("header_len = %x\n",header->ihl);
+  printf("version = %x\n",header->version);
+  printf("tos = %x\n",header->tos);
+  printf("tot_len = %x\n",ntohs(header->tot_len));
+  printf("id = %x\n",ntohs(header->id));
+  printf("frag: ");
+  if(frag_flags & IP_RF) {
+    printf("(RF) ");
+  }
+  if(frag_flags & IP_DF) {
+    printf("DF ");
+  }
+  if(frag_flags & IP_MF) {
+    printf("MF ");
+  }
+  printf("offset = %x\n",frag_flags & IP_OFFMASK);
+  printf("ttl = %x\n",header->ttl);
+  printf("protocol = %x\n",header->protocol);
+  printf("checksum = %x\n",ntohs(header->check));
+  inet_ntop(AF_INET, &header->saddr, addrstr, sizeof(addrstr));
+  printf("saddr = %s\n",addrstr);
+  inet_ntop(AF_INET, &header->daddr, addrstr, sizeof(addrstr));
+  printf("daddr = %s\n",addrstr);
+}
+
+/* print ip6 header */
+void dump_ip6(struct ip6_hdr *header) {
+  char addrstr[INET6_ADDRSTRLEN];
+
+  printf("ipv6\n");
+  printf("version = %x\n",header->ip6_vfc >> 4);
+  printf("traffic class = %x\n",header->ip6_flow >> 20);
+  printf("flow label = %x\n",ntohl(header->ip6_flow & 0x000fffff));
+  printf("payload len = %x\n",ntohs(header->ip6_plen));
+  printf("next header = %x\n",header->ip6_nxt);
+  printf("hop limit = %x\n",header->ip6_hlim);
+
+  inet_ntop(AF_INET6, &header->ip6_src, addrstr, sizeof(addrstr));
+  printf("source = %s\n",addrstr);
+
+  inet_ntop(AF_INET6, &header->ip6_dst, addrstr, sizeof(addrstr));
+  printf("dest = %s\n",addrstr);
+}
+
+/* print icmp header */
+void dump_icmp(struct icmphdr *icmp) {
+  printf("ICMP\n");
+
+  printf("icmp.type = %x ",icmp->type);
+  if(icmp->type == ICMP_ECHOREPLY) {
+    printf("echo reply");
+  } else if(icmp->type == ICMP_ECHO) {
+    printf("echo request");
+  } else {
+    printf("other");
+  }
+  printf("\n");
+  printf("icmp.code = %x\n",icmp->code);
+  printf("icmp.checksum = %x\n",ntohs(icmp->checksum));
+  if(icmp->type == ICMP_ECHOREPLY || icmp->type == ICMP_ECHO) {
+    printf("icmp.un.echo.id = %x\n",ntohs(icmp->un.echo.id));
+    printf("icmp.un.echo.sequence = %x\n",ntohs(icmp->un.echo.sequence));
+  }
+}
+
+/* print icmp6 header */
+void dump_icmp6(struct icmp6_hdr *icmp6) {
+  printf("ICMP6\n");
+  printf("type = %x",icmp6->icmp6_type);
+  if(icmp6->icmp6_type == ICMP6_ECHO_REQUEST) {
+    printf("(echo request)");
+  } else if(icmp6->icmp6_type == ICMP6_ECHO_REPLY) {
+    printf("(echo reply)");
+  }
+  printf("\n");
+  printf("code = %x\n",icmp6->icmp6_code);
+
+  printf("checksum = %x\n",icmp6->icmp6_cksum);
+
+  if((icmp6->icmp6_type == ICMP6_ECHO_REQUEST) || (icmp6->icmp6_type == ICMP6_ECHO_REPLY)) {
+    printf("icmp6_id = %x\n",icmp6->icmp6_id);
+    printf("icmp6_seq = %x\n",icmp6->icmp6_seq);
+  }
+}
+
+/* print udp header */
+void dump_udp_generic(const struct udphdr *udp, uint32_t temp_checksum,
+                      const uint8_t *payload, size_t payload_size) {
+  uint16_t my_checksum;
+
+  temp_checksum = ip_checksum_add(temp_checksum, udp, sizeof(struct udphdr));
+  temp_checksum = ip_checksum_add(temp_checksum, payload, payload_size);
+  my_checksum = ip_checksum_finish(temp_checksum);
+
+  printf("UDP\n");
+  printf("source = %x\n",ntohs(udp->source));
+  printf("dest = %x\n",ntohs(udp->dest));
+  printf("len = %x\n",ntohs(udp->len));
+  printf("check = %x (mine %x)\n",udp->check,my_checksum);
+}
+
+/* print ipv4/udp header */
+void dump_udp(const struct udphdr *udp, const struct iphdr *ip,
+              const uint8_t *payload, size_t payload_size) {
+  uint32_t temp_checksum;
+  temp_checksum = ipv4_pseudo_header_checksum(ip, sizeof(*udp) + payload_size);
+  dump_udp_generic(udp, temp_checksum, payload, payload_size);
+}
+
+/* print ipv6/udp header */
+void dump_udp6(const struct udphdr *udp, const struct ip6_hdr *ip6,
+               const uint8_t *payload, size_t payload_size) {
+  uint32_t temp_checksum;
+  temp_checksum = ipv6_pseudo_header_checksum(ip6, sizeof(*udp) + payload_size, IPPROTO_UDP);
+  dump_udp_generic(udp, temp_checksum, payload, payload_size);
+}
+
+/* print tcp header */
+void dump_tcp_generic(const struct tcphdr *tcp, const uint8_t *options, size_t options_size, uint32_t temp_checksum, const uint8_t *payload, size_t payload_size) {
+  uint16_t my_checksum;
+
+  temp_checksum = ip_checksum_add(temp_checksum, tcp, sizeof(struct tcphdr));
+  if(options) {
+    temp_checksum = ip_checksum_add(temp_checksum, options, options_size);
+  }
+  temp_checksum = ip_checksum_add(temp_checksum, payload, payload_size);
+  my_checksum = ip_checksum_finish(temp_checksum);
+
+  printf("TCP\n");
+  printf("source = %x\n",ntohs(tcp->source));
+  printf("dest = %x\n",ntohs(tcp->dest));
+  printf("seq = %x\n",ntohl(tcp->seq));
+  printf("ack = %x\n",ntohl(tcp->ack_seq));
+  printf("d_off = %x\n",tcp->doff);
+  printf("res1 = %x\n",tcp->res1);
+#ifdef __BIONIC__
+  printf("CWR = %x\n",tcp->cwr);
+  printf("ECE = %x\n",tcp->ece);
+#else
+  printf("CWR/ECE = %x\n",tcp->res2);
+#endif
+  printf("urg = %x  ack = %x  psh = %x  rst = %x  syn = %x  fin = %x\n",
+      tcp->urg, tcp->ack, tcp->psh, tcp->rst, tcp->syn, tcp->fin);
+  printf("window = %x\n",ntohs(tcp->window));
+  printf("check = %x [mine %x]\n",tcp->check,my_checksum);
+  printf("urgent = %x\n",tcp->urg_ptr);
+
+  if(options) {
+    size_t i;
+
+    printf("options: ");
+    for(i=0; i<options_size; i++) {
+      printf("%x ",*(options+i));
+    }
+    printf("\n");
+  }
+}
+
+/* print ipv4/tcp header */
+void dump_tcp(const struct tcphdr *tcp, const struct iphdr *ip,
+              const uint8_t *payload, size_t payload_size,
+              const uint8_t *options, size_t options_size) {
+  uint32_t temp_checksum;
+
+  temp_checksum = ipv4_pseudo_header_checksum(ip, sizeof(*tcp) + options_size + payload_size);
+  dump_tcp_generic(tcp, options, options_size, temp_checksum, payload, payload_size);
+}
+
+/* print ipv6/tcp header */
+void dump_tcp6(const struct tcphdr *tcp, const struct ip6_hdr *ip6,
+               const uint8_t *payload, size_t payload_size,
+               const uint8_t *options, size_t options_size) {
+  uint32_t temp_checksum;
+
+  temp_checksum = ipv6_pseudo_header_checksum(ip6, sizeof(*tcp) + options_size + payload_size, IPPROTO_TCP);
+  dump_tcp_generic(tcp, options, options_size, temp_checksum, payload, payload_size);
+}
+
+/* generic hex dump */
+void logcat_hexdump(const char *info, const uint8_t *data, size_t len) {
+  char output[PACKETLEN*3+2];
+  size_t i;
+
+  output[0] = '\0';
+  for(i = 0; i < len && i < PACKETLEN; i++) {
+    snprintf(output + i*3, 4, " %02x", data[i]);
+  }
+  output[len*3+3] = '\0';
+
+  logmsg(ANDROID_LOG_WARN,"info %s len %d data%s", info, len, output);
+}
+
+void dump_iovec(const struct iovec *iov, int iov_len) {
+  int i;
+  char *str;
+  for (i = 0; i < iov_len; i++) {
+    asprintf(&str, "iov[%d]: ", i);
+    logcat_hexdump(str, iov[i].iov_base, iov[i].iov_len);
+    free(str);
+  }
+}
+#endif  // CLAT_DEBUG
diff --git a/ap/app/clatd/dump.h b/ap/app/clatd/dump.h
new file mode 100755
index 0000000..bb41b3b
--- /dev/null
+++ b/ap/app/clatd/dump.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * dump.h - debug functions
+ */
+#ifndef __DUMP_H__
+#define __DUMP_H__
+
+void dump_ip(struct iphdr *header);
+void dump_icmp(struct icmphdr *icmp);
+void dump_udp(const struct udphdr *udp, const struct iphdr *ip,
+              const uint8_t *payload, size_t payload_size);
+void dump_tcp(const struct tcphdr *tcp, const struct iphdr *ip,
+              const uint8_t *payload, size_t payload_size,
+              const char *options, size_t options_size);
+
+void dump_ip6(struct ip6_hdr *header);
+void dump_icmp6(struct icmp6_hdr *icmp6);
+void dump_udp6(const struct udphdr *udp, const struct ip6_hdr *ip6,
+               const uint8_t *payload, size_t payload_size);
+void dump_tcp6(const struct tcphdr *tcp, const struct ip6_hdr *ip6,
+               const uint8_t *payload, size_t payload_size,
+               const char *options, size_t options_size);
+
+void logcat_hexdump(const char *info, const uint8_t *data, size_t len);
+void dump_iovec(const struct iovec *iov, int iov_len);
+
+#endif /* __DUMP_H__ */
diff --git a/ap/app/clatd/getaddr.c b/ap/app/clatd/getaddr.c
new file mode 100755
index 0000000..e0478cf
--- /dev/null
+++ b/ap/app/clatd/getaddr.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2012 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * getaddr.c - get a locally configured address
+ */
+#include <netinet/in.h>
+#include <strings.h>
+#include <string.h>
+#include <net/if.h>
+
+#include <linux/if_addr.h>
+#include <linux/rtnetlink.h>
+#include <netlink/handlers.h>
+#include <netlink/msg.h>
+
+#include "getaddr.h"
+#include "netlink_msg.h"
+#include "logging.h"
+
+// shared state between getinterface_ip and getaddr_cb
+struct target {
+  int family;
+  unsigned int ifindex;
+  union anyip ip;
+  int foundip;
+};
+
+/* function: getaddr_cb
+ * callback for getinterface_ip
+ * msg  - netlink message
+ * data - (struct target) info for which address we're looking for
+ */
+static int getaddr_cb(struct nl_msg *msg, void *data) {
+  struct ifaddrmsg *ifa_p;
+  struct rtattr *rta_p;
+  int rta_len;
+  struct target *targ_p = (struct target *)data;
+
+  ifa_p = (struct ifaddrmsg *)nlmsg_data(nlmsg_hdr(msg));
+  rta_p = (struct rtattr *)IFA_RTA(ifa_p);
+
+  if(ifa_p->ifa_index != targ_p->ifindex)
+    return NL_OK;
+
+  if(ifa_p->ifa_scope != RT_SCOPE_UNIVERSE)
+    return NL_OK;
+
+  rta_len = RTM_PAYLOAD(nlmsg_hdr(msg));
+  for (; RTA_OK(rta_p, rta_len); rta_p = RTA_NEXT(rta_p, rta_len)) {
+    switch(rta_p->rta_type) {
+      case IFA_ADDRESS:
+        if((targ_p->family == AF_INET6) && !(ifa_p->ifa_flags & IFA_F_SECONDARY)) {
+          memcpy(&targ_p->ip.ip6, RTA_DATA(rta_p), rta_p->rta_len - sizeof(struct rtattr));
+          targ_p->foundip = 1;
+          return NL_OK;
+        }
+        break;
+      case IFA_LOCAL:
+        if(targ_p->family == AF_INET) {
+          memcpy(&targ_p->ip.ip4, RTA_DATA(rta_p), rta_p->rta_len - sizeof(struct rtattr));
+          targ_p->foundip = 1;
+          return NL_OK;
+        }
+        break;
+    }
+  }
+
+  return NL_OK;
+}
+
+/* function: error_handler
+ * error callback for getinterface_ip
+ * nla  - source of the error message
+ * err  - netlink message
+ * arg  - (struct target) info for which address we're looking for
+ */
+static int error_handler(__attribute__((unused)) struct sockaddr_nl *nla,
+                         __attribute__((unused)) struct nlmsgerr *err,
+                         __attribute__((unused)) void *arg) {
+  return NL_OK;
+}
+
+/* function: getinterface_ip
+ * finds the first global non-privacy IP of the given family for the given interface, or returns NULL.  caller frees pointer
+ * interface - interface to look for
+ * family    - family
+ */
+union anyip *getinterface_ip(const char *interface, int family) {
+  struct ifaddrmsg ifa;
+  struct nl_cb *callbacks = NULL;
+  struct target targ;
+  union anyip *retval = NULL;
+
+  targ.family = family;
+  targ.foundip = 0;
+  targ.ifindex = if_nametoindex(interface);
+  if(targ.ifindex == 0) {
+    return NULL; // interface not found
+  }
+
+  memset(&ifa, 0, sizeof(ifa));
+  ifa.ifa_family = targ.family;
+
+  callbacks = nl_cb_alloc(NL_CB_DEFAULT);
+  if(!callbacks) {
+    goto cleanup;
+  }
+  nl_cb_set(callbacks, NL_CB_VALID, NL_CB_CUSTOM, getaddr_cb, &targ);
+  nl_cb_err(callbacks, NL_CB_CUSTOM, error_handler, &targ);
+
+  // sends message and waits for a response
+  send_ifaddrmsg(RTM_GETADDR, NLM_F_REQUEST | NLM_F_ROOT, &ifa, callbacks);
+
+  if(targ.foundip) {
+    retval = malloc(sizeof(union anyip));
+    if(!retval) {
+      logmsg(ANDROID_LOG_FATAL,"getinterface_ip/out of memory");
+      goto cleanup;
+    }
+    memcpy(retval, &targ.ip, sizeof(union anyip));
+  }
+
+cleanup:
+  if(callbacks)
+    nl_cb_put(callbacks);
+
+  return retval;
+}
diff --git a/ap/app/clatd/getaddr.h b/ap/app/clatd/getaddr.h
new file mode 100755
index 0000000..5718e62
--- /dev/null
+++ b/ap/app/clatd/getaddr.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * getaddr.h - get a locally configured address
+ */
+#ifndef __GETADDR_H__
+#define __GETADDR_H__
+
+union anyip {
+  struct in6_addr ip6;
+  struct in_addr ip4;
+};
+
+union anyip *getinterface_ip(const char *interface, int family);
+
+#endif
diff --git a/ap/app/clatd/getentropy.c b/ap/app/clatd/getentropy.c
new file mode 100755
index 0000000..04bf81a
--- /dev/null
+++ b/ap/app/clatd/getentropy.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/random.h>
+#include <unistd.h>
+
+#ifndef O_NOFOLLOW
+#define O_NOFOLLOW 00400000
+#endif
+
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 02000000
+#endif
+
+/* Used to retry syscalls that can return EINTR. */
+#define TEMP_FAILURE_RETRY(exp) ({         \
+    typeof(exp) _rc;                   \
+    do {                                   \
+        _rc = (exp);                       \
+    } while (_rc == -1 && errno == EINTR); \
+    _rc; })
+
+static int getentropy_urandom(void* buffer, size_t buffer_size, int saved_errno) {
+  int fd = TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY | O_NOFOLLOW | O_CLOEXEC, 0));
+  if (fd == -1) return -1;
+
+  size_t collected = 0;
+  while (collected < buffer_size) {
+    ssize_t count = TEMP_FAILURE_RETRY(read(fd, (char*)buffer + collected, buffer_size - collected));
+    if (count == -1) {
+      close(fd);
+      return -1;
+    }
+    collected += count;
+  }
+
+  close(fd);
+  errno = saved_errno;
+  return 0;
+}
+
+int getentropy(void* buffer, size_t buffer_size) {
+  if (buffer_size > 256) {
+    errno = EIO;
+    return -1;
+  }
+
+  int saved_errno = errno;
+
+  size_t collected = 0;
+  while (collected < buffer_size) {
+#if 0 //No ""getrandom on Linux-3.4.5
+    long count = TEMP_FAILURE_RETRY(getrandom((char*)buffer + collected,
+                                              buffer_size - collected, GRND_NONBLOCK));
+#else
+    long count = -1;
+#endif
+    if (count == -1) {
+      // EAGAIN: there isn't enough entropy right now.
+      // ENOSYS/EINVAL: getrandom(2) or GRND_NONBLOCK isn't supported.
+      // EFAULT: `buffer` is invalid.
+      // Try /dev/urandom regardless because it can't hurt,
+      // and we don't need to optimize the EFAULT case.
+      // See http://b/33059407 and http://b/67015565.
+      return getentropy_urandom(buffer, buffer_size, saved_errno);
+    }
+    collected += count;
+  }
+
+  errno = saved_errno;
+  return 0;
+}
diff --git a/ap/app/clatd/icmp.c b/ap/app/clatd/icmp.c
new file mode 100755
index 0000000..936958c
--- /dev/null
+++ b/ap/app/clatd/icmp.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * icmp.c - convenience functions for translating ICMP and ICMPv6 packets.
+ */
+
+#include <netinet/in.h>
+//#include <netinet/ip_icmp.h>
+#include <netinet/icmp6.h>
+#include <linux/icmp.h>
+
+#include "logging.h"
+#include "icmp.h"
+
+#include "my_header.h"
+
+/* function: icmp_guess_ttl
+ * Guesses the number of hops a received packet has traversed based on its TTL.
+ * ttl - the ttl of the received packet.
+ */
+uint8_t icmp_guess_ttl(uint8_t ttl) {
+  if (ttl > 128) {
+    return 255 - ttl;
+  } else if (ttl > 64) {
+    return 128 - ttl;
+  } else if (ttl > 32) {
+    return 64 - ttl;
+  } else {
+    return 32 - ttl;
+  }
+}
+
+/* function: is_icmp_error
+ * Determines whether an ICMP type is an error message.
+ * type: the ICMP type
+ */
+int is_icmp_error(uint8_t type) {
+  return type == 3 || type == 11 || type == 12;
+}
+
+/* function: is_icmp6_error
+ * Determines whether an ICMPv6 type is an error message.
+ * type: the ICMPv6 type
+ */
+int is_icmp6_error(uint8_t type) {
+  return type < 128;
+}
+
+/* function: icmp_to_icmp6_type
+ * Maps ICMP types to ICMPv6 types. Partial implementation of RFC 6145, section 4.2.
+ * type - the ICMPv6 type
+ */
+uint8_t icmp_to_icmp6_type(uint8_t type, uint8_t code) {
+  switch (type) {
+    case ICMP_ECHO:
+      return ICMP6_ECHO_REQUEST;
+
+    case ICMP_ECHOREPLY:
+      return ICMP6_ECHO_REPLY;
+
+    case ICMP_TIME_EXCEEDED:
+      return ICMP6_TIME_EXCEEDED;
+
+    case ICMP_DEST_UNREACH:
+      // These two types need special translation which we don't support yet.
+      if (code != ICMP_UNREACH_PROTOCOL && code != ICMP_UNREACH_NEEDFRAG) {
+        return ICMP6_DST_UNREACH;
+      }
+  }
+
+  // We don't understand this ICMP type. Return parameter problem so the caller will bail out.
+  logmsg_dbg(ANDROID_LOG_DEBUG, "icmp_to_icmp6_type: unhandled ICMP type %d", type);
+  return ICMP6_PARAM_PROB;
+}
+
+/* function: icmp_to_icmp6_code
+ * Maps ICMP codes to ICMPv6 codes. Partial implementation of RFC 6145, section 4.2.
+ * type - the ICMP type
+ * code - the ICMP code
+ */
+uint8_t icmp_to_icmp6_code(uint8_t type, uint8_t code) {
+  switch (type) {
+    case ICMP_ECHO:
+    case ICMP_ECHOREPLY:
+      return 0;
+
+    case ICMP_TIME_EXCEEDED:
+      return code;
+
+    case ICMP_DEST_UNREACH:
+      switch (code) {
+        case ICMP_UNREACH_NET:
+        case ICMP_UNREACH_HOST:
+          return ICMP6_DST_UNREACH_NOROUTE;
+
+        case ICMP_UNREACH_PORT:
+          return ICMP6_DST_UNREACH_NOPORT;
+
+        case ICMP_UNREACH_NET_PROHIB:
+        case ICMP_UNREACH_HOST_PROHIB:
+        case ICMP_UNREACH_FILTER_PROHIB:
+        case ICMP_UNREACH_PRECEDENCE_CUTOFF:
+          return ICMP6_DST_UNREACH_ADMIN;
+
+        // Otherwise, we don't understand this ICMP type/code combination. Fall through.
+      }
+  }
+  logmsg_dbg(ANDROID_LOG_DEBUG, "icmp_to_icmp6_code: unhandled ICMP type/code %d/%d", type, code);
+  return 0;
+}
+
+/* function: icmp6_to_icmp_type
+ * Maps ICMPv6 types to ICMP types. Partial implementation of RFC 6145, section 5.2.
+ * type - the ICMP type
+ */
+uint8_t icmp6_to_icmp_type(uint8_t type, uint8_t code) {
+  switch (type) {
+    case ICMP6_ECHO_REQUEST:
+      return ICMP_ECHO;
+
+    case ICMP6_ECHO_REPLY:
+      return ICMP_ECHOREPLY;
+
+    case ICMP6_DST_UNREACH:
+      return ICMP_DEST_UNREACH;
+
+    case ICMP6_TIME_EXCEEDED:
+      return ICMP_TIME_EXCEEDED;
+  }
+
+  // We don't understand this ICMP type. Return parameter problem so the caller will bail out.
+  logmsg_dbg(ANDROID_LOG_DEBUG, "icmp6_to_icmp_type: unhandled ICMP type/code %d/%d", type, code);
+  return ICMP_PARAMETERPROB;
+}
+
+/* function: icmp6_to_icmp_code
+ * Maps ICMPv6 codes to ICMP codes. Partial implementation of RFC 6145, section 5.2.
+ * type - the ICMPv6 type
+ * code - the ICMPv6 code
+ */
+uint8_t icmp6_to_icmp_code(uint8_t type, uint8_t code) {
+  switch (type) {
+    case ICMP6_ECHO_REQUEST:
+    case ICMP6_ECHO_REPLY:
+    case ICMP6_TIME_EXCEEDED:
+      return code;
+
+    case ICMP6_DST_UNREACH:
+      switch (code) {
+        case ICMP6_DST_UNREACH_NOROUTE:
+          return ICMP_UNREACH_HOST;
+
+        case ICMP6_DST_UNREACH_ADMIN:
+          return ICMP_UNREACH_HOST_PROHIB;
+
+        case ICMP6_DST_UNREACH_BEYONDSCOPE:
+          return ICMP_UNREACH_HOST;
+
+        case ICMP6_DST_UNREACH_ADDR:
+          return ICMP_HOST_UNREACH;
+
+        case ICMP6_DST_UNREACH_NOPORT:
+          return ICMP_UNREACH_PORT;
+
+        // Otherwise, we don't understand this ICMPv6 type/code combination. Fall through.
+      }
+  }
+
+  logmsg_dbg(ANDROID_LOG_DEBUG, "icmp6_to_icmp_code: unhandled ICMP type/code %d/%d", type, code);
+  return 0;
+}
diff --git a/ap/app/clatd/icmp.h b/ap/app/clatd/icmp.h
new file mode 100755
index 0000000..632e92d
--- /dev/null
+++ b/ap/app/clatd/icmp.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * icmp.c - convenience functions for translating ICMP and ICMPv6 packets.
+ */
+
+#ifndef __ICMP_H__
+#define __ICMP_H__
+
+#include <stdint.h>
+
+// Guesses the number of hops a received packet has traversed based on its TTL.
+uint8_t icmp_guess_ttl(uint8_t ttl);
+
+// Determines whether an ICMP type is an error message.
+int is_icmp_error(uint8_t type);
+
+// Determines whether an ICMPv6 type is an error message.
+int is_icmp6_error(uint8_t type);
+
+// Maps ICMP types to ICMPv6 types. Partial implementation of RFC 6145, section 4.2.
+uint8_t icmp_to_icmp6_type(uint8_t type, uint8_t code);
+
+// Maps ICMP codes to ICMPv6 codes. Partial implementation of RFC 6145, section 4.2.
+uint8_t icmp_to_icmp6_code(uint8_t type, uint8_t code);
+
+// Maps ICMPv6 types to ICMP types. Partial implementation of RFC 6145, section 5.2.
+uint8_t icmp6_to_icmp_type(uint8_t type, uint8_t code);
+
+// Maps ICMPv6 codes to ICMP codes. Partial implementation of RFC 6145, section 5.2.
+uint8_t icmp6_to_icmp_code(uint8_t type, uint8_t code);
+
+#endif /* __ICMP_H__ */
diff --git a/ap/app/clatd/ifc.h b/ap/app/clatd/ifc.h
new file mode 100755
index 0000000..3b27234
--- /dev/null
+++ b/ap/app/clatd/ifc.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ *
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+#ifndef _NETUTILS_IFC_H_
+#define _NETUTILS_IFC_H_
+
+#include <sys/cdefs.h>
+#include <arpa/inet.h>
+
+__BEGIN_DECLS
+
+extern int ifc_init(void);
+extern void ifc_close(void);
+
+extern int ifc_get_ifindex(const char *name, int *if_indexp);
+extern int ifc_get_hwaddr(const char *name, void *ptr);
+
+extern int ifc_up(const char *name);
+extern int ifc_down(const char *name);
+
+extern int ifc_enable(const char *ifname);
+extern int ifc_disable(const char *ifname);
+
+#define RESET_IPV4_ADDRESSES 0x01
+#define RESET_IPV6_ADDRESSES 0x02
+#define RESET_IGNORE_INTERFACE_ADDRESS 0x04
+#define RESET_ALL_ADDRESSES  (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
+extern int ifc_reset_connections(const char *ifname, const int reset_mask);
+
+extern int ifc_get_addr(const char *name, in_addr_t *addr);
+extern int ifc_set_addr(const char *name, in_addr_t addr);
+extern int ifc_add_address(const char *name, const char *address,
+                           int prefixlen);
+extern int ifc_del_address(const char *name, const char *address,
+                           int prefixlen);
+extern int ifc_set_prefixLength(const char *name, int prefixLength);
+extern int ifc_set_hwaddr(const char *name, const void *ptr);
+extern int ifc_clear_addresses(const char *name);
+
+extern int ifc_create_default_route(const char *name, in_addr_t addr);
+extern int ifc_remove_default_route(const char *ifname);
+extern int ifc_get_info(const char *name, in_addr_t *addr, int *prefixLength,
+                        unsigned *flags);
+
+extern int ifc_configure(const char *ifname, in_addr_t address,
+                         uint32_t prefixLength, in_addr_t gateway,
+                         in_addr_t dns1, in_addr_t dns2);
+
+extern in_addr_t prefixLengthToIpv4Netmask(int prefix_length);
+
+__END_DECLS
+
+#endif /* _NETUTILS_IFC_H_ */
diff --git a/ap/app/clatd/ifc_utils.c b/ap/app/clatd/ifc_utils.c
new file mode 100755
index 0000000..02304e5
--- /dev/null
+++ b/ap/app/clatd/ifc_utils.c
@@ -0,0 +1,759 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <linux/if.h>
+#include <linux/if_ether.h>
+#include <linux/if_arp.h>
+#include <linux/netlink.h>
+#include <linux/route.h>
+#include <linux/ipv6_route.h>
+#include <linux/rtnetlink.h>
+#include <linux/sockios.h>
+//#include <net/if.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <sys/ioctl.h>
+
+#ifdef ANDROID
+#define LOG_TAG "NetUtils"
+#include <cutils/properties.h>
+#include <log/log.h>
+#else
+#define ALOGD printf
+#define ALOGW printf
+#endif
+
+#include "ifc.h"
+
+/* Deprecated. In Android O and above, there's no limit on property name length. */
+#define PROP_NAME_MAX   32
+
+/* System properties are *small* name value pairs managed by the
+** property service.  If your data doesn't fit in the provided
+** space it is not appropriate for a system property.
+**
+** WARNING: system/bionic/include/sys/system_properties.h also defines
+**          these, but with different names.  (TODO: fix that)
+*/
+#define PROPERTY_KEY_MAX   PROP_NAME_MAX
+#define PROPERTY_VALUE_MAX  PROP_VALUE_MAX
+
+int property_set(const char *key, const char *value) {
+    return 0;
+}
+
+void printerr(char *fmt, ...)
+{
+    va_list ap;
+    char tmp_buf[256] = {0};
+    va_start(ap, fmt);
+    vsnprintf(tmp_buf, sizeof(tmp_buf), fmt, ap);
+    va_end(ap);
+
+    printf("%s\n", tmp_buf);
+}
+
+#if defined(__ANDROID__)
+/* SIOCKILLADDR is an Android extension. */
+#define SIOCKILLADDR 0x8939
+#endif
+
+static int ifc_ctl_sock = -1;
+static int ifc_ctl_sock6 = -1;
+//static pthread_mutex_t ifc_sock_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+//static pthread_mutex_t ifc_sock6_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_mutex_t ifc_sock_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t ifc_sock6_mutex = PTHREAD_MUTEX_INITIALIZER;
+void printerr(char *fmt, ...);
+
+#define DBG 0
+#define INET_ADDRLEN 4
+#define INET6_ADDRLEN 16
+
+in_addr_t prefixLengthToIpv4Netmask(int prefix_length)
+{
+    in_addr_t mask = 0;
+
+    // C99 (6.5.7): shifts of 32 bits have undefined results
+    if (prefix_length <= 0 || prefix_length > 32) {
+        return 0;
+    }
+
+    mask = ~mask << (32 - prefix_length);
+    mask = htonl(mask);
+
+    return mask;
+}
+
+int ipv4NetmaskToPrefixLength(in_addr_t mask)
+{
+    int prefixLength = 0;
+    uint32_t m = (uint32_t)ntohl(mask);
+    while (m & 0x80000000) {
+        prefixLength++;
+        m = m << 1;
+    }
+    return prefixLength;
+}
+
+static const char *ipaddr_to_string(in_addr_t addr)
+{
+    struct in_addr in_addr;
+
+    in_addr.s_addr = addr;
+    return inet_ntoa(in_addr);
+}
+
+int string_to_ip(const char *string, struct sockaddr_storage *ss) {
+    struct addrinfo hints, *ai;
+    int ret;
+
+    if (ss == NULL) {
+        return -EFAULT;
+    }
+
+    memset(&hints, 0, sizeof(hints));
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_flags = AI_NUMERICHOST;
+    hints.ai_socktype = SOCK_DGRAM;
+
+    ret = getaddrinfo(string, NULL, &hints, &ai);
+    if (ret == 0) {
+        memcpy(ss, ai->ai_addr, ai->ai_addrlen);
+        freeaddrinfo(ai);
+    }
+
+    return ret;
+}
+
+int ifc_init(void)
+{
+    int ret;
+
+    pthread_mutex_lock(&ifc_sock_mutex);
+    if (ifc_ctl_sock == -1) {
+        ifc_ctl_sock = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+        if (ifc_ctl_sock < 0) {
+            printerr("socket() failed: %s\n", strerror(errno));
+        }
+    }
+
+    ret = ifc_ctl_sock < 0 ? -1 : 0;
+    if (DBG) printerr("ifc_init_returning %d", ret);
+    return ret;
+}
+
+int ifc_init6(void)
+{
+    pthread_mutex_lock(&ifc_sock6_mutex);
+    if (ifc_ctl_sock6 == -1) {
+        ifc_ctl_sock6 = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+        if (ifc_ctl_sock6 < 0) {
+            printerr("socket() failed: %s\n", strerror(errno));
+        }
+    }
+    return ifc_ctl_sock6 < 0 ? -1 : 0;
+}
+
+void ifc_close(void)
+{
+    if (DBG) printerr("ifc_close");
+    if (ifc_ctl_sock != -1) {
+        (void)close(ifc_ctl_sock);
+        ifc_ctl_sock = -1;
+    }
+    pthread_mutex_unlock(&ifc_sock_mutex);
+}
+
+void ifc_close6(void)
+{
+    if (ifc_ctl_sock6 != -1) {
+        (void)close(ifc_ctl_sock6);
+        ifc_ctl_sock6 = -1;
+    }
+    pthread_mutex_unlock(&ifc_sock6_mutex);
+}
+
+static void ifc_init_ifr(const char *name, struct ifreq *ifr)
+{
+    memset(ifr, 0, sizeof(struct ifreq));
+    strncpy(ifr->ifr_name, name, IFNAMSIZ);
+    ifr->ifr_name[IFNAMSIZ - 1] = 0;
+}
+
+int ifc_get_hwaddr(const char *name, void *ptr)
+{
+    int r;
+    struct ifreq ifr;
+    ifc_init_ifr(name, &ifr);
+
+    r = ioctl(ifc_ctl_sock, SIOCGIFHWADDR, &ifr);
+    if(r < 0) return -1;
+
+    memcpy(ptr, &ifr.ifr_hwaddr.sa_data, ETH_ALEN);
+    return 0;
+}
+
+int ifc_get_ifindex(const char *name, int *if_indexp)
+{
+    int r;
+    struct ifreq ifr;
+    ifc_init_ifr(name, &ifr);
+
+    r = ioctl(ifc_ctl_sock, SIOCGIFINDEX, &ifr);
+    if(r < 0) return -1;
+
+    *if_indexp = ifr.ifr_ifindex;
+    return 0;
+}
+
+static int ifc_set_flags(const char *name, unsigned set, unsigned clr)
+{
+    struct ifreq ifr;
+    ifc_init_ifr(name, &ifr);
+
+    if(ioctl(ifc_ctl_sock, SIOCGIFFLAGS, &ifr) < 0) return -1;
+    ifr.ifr_flags = (ifr.ifr_flags & (~clr)) | set;
+    return ioctl(ifc_ctl_sock, SIOCSIFFLAGS, &ifr);
+}
+
+int ifc_up(const char *name)
+{
+    int ret = ifc_set_flags(name, IFF_UP, 0);
+    if (DBG) printerr("ifc_up(%s) = %d", name, ret);
+    return ret;
+}
+
+int ifc_down(const char *name)
+{
+    int ret = ifc_set_flags(name, 0, IFF_UP);
+    if (DBG) printerr("ifc_down(%s) = %d", name, ret);
+    return ret;
+}
+
+static void init_sockaddr_in(struct sockaddr *sa, in_addr_t addr)
+{
+    struct sockaddr_in *sin = (struct sockaddr_in *) sa;
+    sin->sin_family = AF_INET;
+    sin->sin_port = 0;
+    sin->sin_addr.s_addr = addr;
+}
+
+int ifc_set_addr(const char *name, in_addr_t addr)
+{
+    struct ifreq ifr;
+    int ret;
+
+    ifc_init_ifr(name, &ifr);
+    init_sockaddr_in(&ifr.ifr_addr, addr);
+
+    ret = ioctl(ifc_ctl_sock, SIOCSIFADDR, &ifr);
+    if (DBG) printerr("ifc_set_addr(%s, xx) = %d", name, ret);
+    return ret;
+}
+
+/*
+ * Adds or deletes an IP address on an interface.
+ *
+ * Action is one of:
+ * - RTM_NEWADDR (to add a new address)
+ * - RTM_DELADDR (to delete an existing address)
+ *
+ * Returns zero on success and negative errno on failure.
+ */
+int ifc_act_on_address(int action, const char *name, const char *address,
+                       int prefixlen) {
+    int ifindex, s, len, ret;
+    struct sockaddr_storage ss;
+    int saved_errno;
+    void *addr;
+    size_t addrlen;
+    struct {
+        struct nlmsghdr n;
+        struct ifaddrmsg r;
+        // Allow for IPv6 address, headers, IPv4 broadcast addr and padding.
+        char attrbuf[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
+                     NLMSG_ALIGN(sizeof(struct rtattr)) +
+                     NLMSG_ALIGN(INET6_ADDRLEN) +
+                     NLMSG_ALIGN(sizeof(struct rtattr)) +
+                     NLMSG_ALIGN(INET_ADDRLEN)];
+    } req;
+    struct rtattr *rta;
+    struct nlmsghdr *nh;
+    struct nlmsgerr *err;
+    char buf[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
+             NLMSG_ALIGN(sizeof(struct nlmsgerr)) +
+             NLMSG_ALIGN(sizeof(struct nlmsghdr))];
+
+    // Get interface ID.
+    ifindex = if_nametoindex(name);
+    if (ifindex == 0) {
+        return -errno;
+    }
+
+    // Convert string representation to sockaddr_storage.
+    ret = string_to_ip(address, &ss);
+    if (ret) {
+        return ret;
+    }
+
+    // Determine address type and length.
+    if (ss.ss_family == AF_INET) {
+        struct sockaddr_in *sin = (struct sockaddr_in *) &ss;
+        addr = &sin->sin_addr;
+        addrlen = INET_ADDRLEN;
+    } else if (ss.ss_family == AF_INET6) {
+        struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) &ss;
+        addr = &sin6->sin6_addr;
+        addrlen = INET6_ADDRLEN;
+    } else {
+        return -EAFNOSUPPORT;
+    }
+
+    // Fill in netlink structures.
+    memset(&req, 0, sizeof(req));
+
+    // Netlink message header.
+    req.n.nlmsg_len = NLMSG_LENGTH(sizeof(req.r));
+    req.n.nlmsg_type = action;
+    req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
+    req.n.nlmsg_pid = getpid();
+
+    // Interface address message header.
+    req.r.ifa_family = ss.ss_family;
+    req.r.ifa_prefixlen = prefixlen;
+    req.r.ifa_index = ifindex;
+
+    // Routing attribute. Contains the actual IP address.
+    rta = (struct rtattr *) (((char *) &req) + NLMSG_ALIGN(req.n.nlmsg_len));
+    rta->rta_type = IFA_LOCAL;
+    rta->rta_len = RTA_LENGTH(addrlen);
+    req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + RTA_LENGTH(addrlen);
+    memcpy(RTA_DATA(rta), addr, addrlen);
+
+    // Add an explicit IFA_BROADCAST for IPv4 RTM_NEWADDRs.
+    if (ss.ss_family == AF_INET && action == RTM_NEWADDR) {
+        rta = (struct rtattr *) (((char *) &req) + NLMSG_ALIGN(req.n.nlmsg_len));
+        rta->rta_type = IFA_BROADCAST;
+        rta->rta_len = RTA_LENGTH(addrlen);
+        req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + RTA_LENGTH(addrlen);
+        ((struct in_addr *)addr)->s_addr |= htonl((1<<(32-prefixlen))-1);
+        memcpy(RTA_DATA(rta), addr, addrlen);
+    }
+
+    s = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
+    if (s < 0) {
+        return -errno;
+    }
+
+    if (send(s, &req, req.n.nlmsg_len, 0) < 0) {
+        saved_errno = errno;
+        close(s);
+        return -saved_errno;
+    }
+
+    len = recv(s, buf, sizeof(buf), 0);
+    saved_errno = errno;
+    close(s);
+    if (len < 0) {
+        return -saved_errno;
+    }
+
+    // Parse the acknowledgement to find the return code.
+    nh = (struct nlmsghdr *) buf;
+    if (!NLMSG_OK(nh, (unsigned) len) || nh->nlmsg_type != NLMSG_ERROR) {
+        return -EINVAL;
+    }
+    err = NLMSG_DATA(nh);
+
+    // Return code is negative errno.
+    return err->error;
+}
+
+int ifc_add_address(const char *name, const char *address, int prefixlen) {
+    return ifc_act_on_address(RTM_NEWADDR, name, address, prefixlen);
+}
+
+int ifc_del_address(const char *name, const char * address, int prefixlen) {
+    return ifc_act_on_address(RTM_DELADDR, name, address, prefixlen);
+}
+
+/*
+ * Clears IPv6 addresses on the specified interface.
+ */
+int ifc_clear_ipv6_addresses(const char *name) {
+    char rawaddrstr[INET6_ADDRSTRLEN], addrstr[INET6_ADDRSTRLEN];
+    unsigned int prefixlen;
+    int lasterror = 0, i, j, ret;
+    char ifname[64];  // Currently, IFNAMSIZ = 16.
+    FILE *f = fopen("/proc/net/if_inet6", "r");
+    if (!f) {
+        return -errno;
+    }
+
+    // Format:
+    // 20010db8000a0001fc446aa4b5b347ed 03 40 00 01    wlan0
+    while (fscanf(f, "%32s %*02x %02x %*02x %*02x %63s\n",
+                  rawaddrstr, &prefixlen, ifname) == 3) {
+        // Is this the interface we're looking for?
+        if (strcmp(name, ifname)) {
+            continue;
+        }
+
+        // Put the colons back into the address.
+        for (i = 0, j = 0; i < 32; i++, j++) {
+            addrstr[j] = rawaddrstr[i];
+            if (i % 4 == 3) {
+                addrstr[++j] = ':';
+            }
+        }
+        addrstr[j - 1] = '\0';
+
+        // Don't delete the link-local address as well, or it will disable IPv6
+        // on the interface.
+        if (strncmp(addrstr, "fe80:", 5) == 0) {
+            continue;
+        }
+
+        ret = ifc_del_address(ifname, addrstr, prefixlen);
+        if (ret) {
+            printf("Deleting address %s/%d on %s: %s", addrstr, prefixlen, ifname,
+                 strerror(-ret));
+            lasterror = ret;
+        }
+    }
+
+    fclose(f);
+    return lasterror;
+}
+
+/*
+ * Clears IPv4 addresses on the specified interface.
+ */
+void ifc_clear_ipv4_addresses(const char *name) {
+    unsigned count, addr;
+    ifc_init();
+    for (count=0, addr=1;((addr != 0) && (count < 255)); count++) {
+        if (ifc_get_addr(name, &addr) < 0)
+            break;
+        if (addr)
+            ifc_set_addr(name, 0);
+    }
+    ifc_close();
+}
+
+/*
+ * Clears all IP addresses on the specified interface.
+ */
+int ifc_clear_addresses(const char *name) {
+    ifc_clear_ipv4_addresses(name);
+    return ifc_clear_ipv6_addresses(name);
+}
+
+int ifc_set_hwaddr(const char *name, const void *ptr)
+{
+    struct ifreq ifr;
+    ifc_init_ifr(name, &ifr);
+
+    ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
+    memcpy(&ifr.ifr_hwaddr.sa_data, ptr, ETH_ALEN);
+    return ioctl(ifc_ctl_sock, SIOCSIFHWADDR, &ifr);
+}
+
+int ifc_set_mask(const char *name, in_addr_t mask)
+{
+    struct ifreq ifr;
+    int ret;
+
+    ifc_init_ifr(name, &ifr);
+    init_sockaddr_in(&ifr.ifr_addr, mask);
+
+    ret = ioctl(ifc_ctl_sock, SIOCSIFNETMASK, &ifr);
+    if (DBG) printerr("ifc_set_mask(%s, xx) = %d", name, ret);
+    return ret;
+}
+
+int ifc_set_prefixLength(const char *name, int prefixLength)
+{
+    struct ifreq ifr;
+    // TODO - support ipv6
+    if (prefixLength > 32 || prefixLength < 0) return -1;
+
+    in_addr_t mask = prefixLengthToIpv4Netmask(prefixLength);
+    ifc_init_ifr(name, &ifr);
+    init_sockaddr_in(&ifr.ifr_addr, mask);
+
+    return ioctl(ifc_ctl_sock, SIOCSIFNETMASK, &ifr);
+}
+
+int ifc_get_addr(const char *name, in_addr_t *addr)
+{
+    struct ifreq ifr;
+    int ret = 0;
+
+    ifc_init_ifr(name, &ifr);
+    if (addr != NULL) {
+        ret = ioctl(ifc_ctl_sock, SIOCGIFADDR, &ifr);
+        if (ret < 0) {
+            *addr = 0;
+        } else {
+            *addr = ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr;
+        }
+    }
+    return ret;
+}
+
+int ifc_get_info(const char *name, in_addr_t *addr, int *prefixLength, unsigned *flags)
+{
+    struct ifreq ifr;
+    ifc_init_ifr(name, &ifr);
+
+    if (addr != NULL) {
+        if(ioctl(ifc_ctl_sock, SIOCGIFADDR, &ifr) < 0) {
+            *addr = 0;
+        } else {
+            *addr = ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr;
+        }
+    }
+
+    if (prefixLength != NULL) {
+        if(ioctl(ifc_ctl_sock, SIOCGIFNETMASK, &ifr) < 0) {
+            *prefixLength = 0;
+        } else {
+            *prefixLength = ipv4NetmaskToPrefixLength(
+                    ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr);
+        }
+    }
+
+    if (flags != NULL) {
+        if(ioctl(ifc_ctl_sock, SIOCGIFFLAGS, &ifr) < 0) {
+            *flags = 0;
+        } else {
+            *flags = ifr.ifr_flags;
+        }
+    }
+
+    return 0;
+}
+
+int ifc_act_on_ipv4_route(int action, const char *ifname, struct in_addr dst, int prefix_length,
+      struct in_addr gw)
+{
+    struct rtentry rt;
+    int result;
+    in_addr_t netmask;
+
+    memset(&rt, 0, sizeof(rt));
+
+    rt.rt_dst.sa_family = AF_INET;
+    rt.rt_dev = (void*) ifname;
+
+    netmask = prefixLengthToIpv4Netmask(prefix_length);
+    init_sockaddr_in(&rt.rt_genmask, netmask);
+    init_sockaddr_in(&rt.rt_dst, dst.s_addr);
+    rt.rt_flags = RTF_UP;
+
+    if (prefix_length == 32) {
+        rt.rt_flags |= RTF_HOST;
+    }
+
+    if (gw.s_addr != 0) {
+        rt.rt_flags |= RTF_GATEWAY;
+        init_sockaddr_in(&rt.rt_gateway, gw.s_addr);
+    }
+
+    ifc_init();
+
+    if (ifc_ctl_sock < 0) {
+        ifc_close();
+        return -errno;
+    }
+
+    result = ioctl(ifc_ctl_sock, action, &rt);
+    if (result < 0) {
+        if (errno == EEXIST) {
+            result = 0;
+        } else {
+            result = -errno;
+        }
+    }
+    ifc_close();
+    return result;
+}
+
+/* deprecated - v4 only */
+int ifc_create_default_route(const char *name, in_addr_t gw)
+{
+    struct in_addr in_dst, in_gw;
+
+    in_dst.s_addr = 0;
+    in_gw.s_addr = gw;
+
+    int ret = ifc_act_on_ipv4_route(SIOCADDRT, name, in_dst, 0, in_gw);
+    if (DBG) printerr("ifc_create_default_route(%s, %d) = %d", name, gw, ret);
+    return ret;
+}
+
+// Needed by code in hidden partner repositories / branches, so don't delete.
+int ifc_enable(const char *ifname)
+{
+    int result;
+
+    ifc_init();
+    result = ifc_up(ifname);
+    ifc_close();
+    return result;
+}
+
+// Needed by code in hidden partner repositories / branches, so don't delete.
+int ifc_disable(const char *ifname)
+{
+    unsigned addr, count;
+    int result;
+
+    ifc_init();
+    result = ifc_down(ifname);
+
+    ifc_set_addr(ifname, 0);
+    for (count=0, addr=1;((addr != 0) && (count < 255)); count++) {
+       if (ifc_get_addr(ifname, &addr) < 0)
+            break;
+       if (addr)
+          ifc_set_addr(ifname, 0);
+    }
+
+    ifc_close();
+    return result;
+}
+
+int ifc_reset_connections(const char *ifname, const int reset_mask)
+{
+#if defined(__ANDROID__)
+    int result, success;
+    in_addr_t myaddr = 0;
+    struct ifreq ifr;
+    struct in6_ifreq ifr6;
+
+    if (reset_mask & RESET_IPV4_ADDRESSES) {
+        /* IPv4. Clear connections on the IP address. */
+        ifc_init();
+        if (!(reset_mask & RESET_IGNORE_INTERFACE_ADDRESS)) {
+            ifc_get_info(ifname, &myaddr, NULL, NULL);
+        }
+        ifc_init_ifr(ifname, &ifr);
+        init_sockaddr_in(&ifr.ifr_addr, myaddr);
+        result = ioctl(ifc_ctl_sock, SIOCKILLADDR,  &ifr);
+        ifc_close();
+    } else {
+        result = 0;
+    }
+
+    if (reset_mask & RESET_IPV6_ADDRESSES) {
+        /*
+         * IPv6. On Linux, when an interface goes down it loses all its IPv6
+         * addresses, so we don't know which connections belonged to that interface
+         * So we clear all unused IPv6 connections on the device by specifying an
+         * empty IPv6 address.
+         */
+        ifc_init6();
+        // This implicitly specifies an address of ::, i.e., kill all IPv6 sockets.
+        memset(&ifr6, 0, sizeof(ifr6));
+        success = ioctl(ifc_ctl_sock6, SIOCKILLADDR,  &ifr6);
+        if (result == 0) {
+            result = success;
+        }
+        ifc_close6();
+    }
+
+    return result;
+#else
+    return 0;
+#endif
+}
+
+/*
+ * Removes the default route for the named interface.
+ */
+int ifc_remove_default_route(const char *ifname)
+{
+    struct rtentry rt;
+    int result;
+
+    ifc_init();
+    memset(&rt, 0, sizeof(rt));
+    rt.rt_dev = (void *)ifname;
+    rt.rt_flags = RTF_UP|RTF_GATEWAY;
+    init_sockaddr_in(&rt.rt_dst, 0);
+    if ((result = ioctl(ifc_ctl_sock, SIOCDELRT, &rt)) < 0) {
+        ALOGD("failed to remove default route for %s: %s", ifname, strerror(errno));
+    }
+    ifc_close();
+    return result;
+}
+
+int
+ifc_configure(const char *ifname,
+        in_addr_t address,
+        uint32_t prefixLength,
+        in_addr_t gateway,
+        in_addr_t dns1,
+        in_addr_t dns2) {
+
+    char dns_prop_name[PROPERTY_KEY_MAX];
+
+    ifc_init();
+
+    if (ifc_up(ifname)) {
+        printerr("failed to turn on interface %s: %s\n", ifname, strerror(errno));
+        ifc_close();
+        return -1;
+    }
+    if (ifc_set_addr(ifname, address)) {
+        printerr("failed to set ipaddr %s: %s\n", ipaddr_to_string(address), strerror(errno));
+        ifc_close();
+        return -1;
+    }
+    if (ifc_set_prefixLength(ifname, prefixLength)) {
+        printerr("failed to set prefixLength %d: %s\n", prefixLength, strerror(errno));
+        ifc_close();
+        return -1;
+    }
+    if (ifc_create_default_route(ifname, gateway)) {
+        printerr("failed to set default route %s: %s\n", ipaddr_to_string(gateway), strerror(errno));
+        ifc_close();
+        return -1;
+    }
+
+    ifc_close();
+
+    snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns1", ifname);
+    property_set(dns_prop_name, dns1 ? ipaddr_to_string(dns1) : "");
+    snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns2", ifname);
+    property_set(dns_prop_name, dns2 ? ipaddr_to_string(dns2) : "");
+
+    return 0;
+}
diff --git a/ap/app/clatd/ipv4.c b/ap/app/clatd/ipv4.c
new file mode 100755
index 0000000..406cc42
--- /dev/null
+++ b/ap/app/clatd/ipv4.c
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ipv4.c - takes ipv4 packets, finds their headers, and then calls translation functions on them
+ */
+#include <string.h>
+
+#include "translate.h"
+#include "checksum.h"
+#include "logging.h"
+#include "debug.h"
+#include "dump.h"
+
+/* function: icmp_packet
+ * translates an icmp packet
+ * out      - output packet
+ * icmp     - pointer to icmp header in packet
+ * checksum - pseudo-header checksum
+ * len      - size of ip payload
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int icmp_packet(clat_packet out, clat_packet_index pos, const struct icmphdr *icmp,
+                uint32_t checksum, size_t len) {
+  const uint8_t *payload;
+  size_t payload_size;
+
+  if(len < sizeof(struct icmphdr)) {
+    logmsg_dbg(ANDROID_LOG_ERROR, "icmp_packet/(too small)");
+    return 0;
+  }
+
+  payload = (const uint8_t *) (icmp + 1);
+  payload_size = len - sizeof(struct icmphdr);
+
+  return icmp_to_icmp6(out, pos, icmp, checksum, payload, payload_size);
+}
+
+/* function: ipv4_packet
+ * translates an ipv4 packet
+ * out    - output packet
+ * packet - packet data
+ * len    - size of packet
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int ipv4_packet(clat_packet out, clat_packet_index pos, const uint8_t *packet, size_t len, struct clat_icmp_frag *icmp_frag) {
+  const struct iphdr *header = (struct iphdr *) packet;
+  struct ip6_hdr *ip6_targ = (struct ip6_hdr *) out[pos].iov_base;
+  struct ip6_frag *frag_hdr;
+  size_t frag_hdr_len;
+  uint8_t nxthdr;
+  const uint8_t *next_header;
+  size_t len_left;
+  uint32_t old_sum, new_sum;
+  int iov_len;
+
+  if(len < sizeof(struct iphdr)) {
+    logmsg_dbg(ANDROID_LOG_ERROR, "ip_packet/too short for an ip header");
+    return 0;
+  }
+
+  if(header->ihl < 5) {
+    logmsg_dbg(ANDROID_LOG_ERROR, "ip_packet/ip header length set to less than 5: %x", header->ihl);
+    return 0;
+  }
+
+  if((size_t) header->ihl * 4 > len) { // ip header length larger than entire packet
+    logmsg_dbg(ANDROID_LOG_ERROR, "ip_packet/ip header length set too large: %x", header->ihl);
+    return 0;
+  }
+
+  if(header->version != 4) {
+    logmsg_dbg(ANDROID_LOG_ERROR, "ip_packet/ip header version not 4: %x", header->version);
+    return 0;
+  }
+
+  /* rfc6145 - If any IPv4 options are present in the IPv4 packet, they MUST be
+   * ignored and the packet translated normally; there is no attempt to
+   * translate the options.
+   */
+
+  next_header = packet + header->ihl*4;
+  len_left = len - header->ihl * 4;
+
+  nxthdr = header->protocol;
+  if (nxthdr == IPPROTO_ICMP) {
+    // ICMP and ICMPv6 have different protocol numbers.
+    nxthdr = IPPROTO_ICMPV6;
+  }
+
+  /* Fill in the IPv6 header. We need to do this before we translate the packet because TCP and
+   * UDP include parts of the IP header in the checksum. Set the length to zero because we don't
+   * know it yet.
+   */
+  fill_ip6_header(ip6_targ, 0, nxthdr, header);
+  out[pos].iov_len = sizeof(struct ip6_hdr);
+
+  /* Calculate the pseudo-header checksum.
+   * Technically, the length that is used in the pseudo-header checksum is the transport layer
+   * length, which is not the same as len_left in the case of fragmented packets. But since
+   * translation does not change the transport layer length, the checksum is unaffected.
+   */
+  old_sum = ipv4_pseudo_header_checksum(header, len_left);
+  new_sum = ipv6_pseudo_header_checksum(ip6_targ, len_left, nxthdr);
+
+  // If the IPv4 packet is fragmented, add a Fragment header.
+  frag_hdr = (struct ip6_frag *) out[pos + 1].iov_base;
+  frag_hdr_len = maybe_fill_frag_header(frag_hdr, ip6_targ, header);
+  out[pos + 1].iov_len = frag_hdr_len;
+
+  if (frag_hdr_len && frag_hdr->ip6f_offlg & IP6F_OFF_MASK) {
+	uint16_t frag_len = ((ntohs(header->frag_off))&IP_OFFMASK)<< 3;
+	if(icmp_frag && frag_len > 0 && ((ntohs(header->frag_off)) & IP_MF) == 0 && (nxthdr == IPPROTO_ICMPV6)){
+		icmp_frag->ip_len = len_left + frag_len;
+		icmp_frag->ip_id = header->id;
+		icmp_frag->flag = 2;
+	}
+    // Non-first fragment. Copy the rest of the packet as is.
+    iov_len = generic_packet(out, pos + 2, next_header, len_left);
+  } else if (nxthdr == IPPROTO_ICMPV6) {
+	if(icmp_frag && ((ntohs(header->frag_off)) & (IP_MF|IP_OFFMASK)) == IP_MF){
+		icmp_frag->ip_len = len_left;
+		icmp_frag->ip_id = header->id;
+		icmp_frag->flag = 1;
+	}
+    iov_len = icmp_packet(out, pos + 2, (const struct icmphdr *) next_header, new_sum, len_left);
+  } else if (nxthdr == IPPROTO_TCP) {
+    iov_len = tcp_packet(out, pos + 2, (const struct tcphdr *) next_header, old_sum, new_sum,
+                         len_left);
+  } else if (nxthdr == IPPROTO_UDP) {
+    iov_len = udp_packet(out, pos + 2, (const struct udphdr *) next_header, old_sum, new_sum,
+                         len_left);
+  } else if (nxthdr == IPPROTO_GRE) {
+    iov_len = generic_packet(out, pos + 2, next_header, len_left);
+  } else {
+#if CLAT_DEBUG
+    logmsg_dbg(ANDROID_LOG_ERROR, "ip_packet/unknown protocol: %x",header->protocol);
+    logcat_hexdump("ipv4/protocol", packet, len);
+#endif
+    return 0;
+  }
+
+  // Set the length.
+  ip6_targ->ip6_plen = htons(packet_length(out, pos));
+  return iov_len;
+}
diff --git a/ap/app/clatd/ipv6.c b/ap/app/clatd/ipv6.c
new file mode 100755
index 0000000..69063c4
--- /dev/null
+++ b/ap/app/clatd/ipv6.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ipv6.c - takes ipv6 packets, finds their headers, and then calls translation functions on them
+ */
+#include <string.h>
+
+#include <arpa/inet.h>
+
+#include "translate.h"
+#include "checksum.h"
+#include "logging.h"
+#include "dump.h"
+#include "config.h"
+#include "debug.h"
+
+/* function: icmp6_packet
+ * takes an icmp6 packet and sets it up for translation
+ * out      - output packet
+ * icmp6    - pointer to icmp6 header in packet
+ * checksum - pseudo-header checksum (unused)
+ * len      - size of ip payload
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int icmp6_packet(clat_packet out, clat_packet_index pos, const struct icmp6_hdr *icmp6,
+                 uint32_t checksum, size_t len) {
+  const uint8_t *payload;
+  size_t payload_size;
+
+  if(len < sizeof(struct icmp6_hdr)) {
+    logmsg_dbg(ANDROID_LOG_ERROR, "icmp6_packet/(too small)");
+    return 0;
+  }
+
+  payload = (const uint8_t *) (icmp6 + 1);
+  payload_size = len - sizeof(struct icmp6_hdr);
+
+  return icmp6_to_icmp(out, pos, icmp6, checksum, payload, payload_size);
+}
+
+/* function: log_bad_address
+ * logs a bad address to android's log buffer if debugging is turned on
+ * fmt     - printf-style format, use %s to place the address
+ * badaddr - the bad address in question
+ */
+#if CLAT_DEBUG
+void log_bad_address(const char *fmt, const struct in6_addr *src, const struct in6_addr *dst) {
+  char srcstr[INET6_ADDRSTRLEN];
+  char dststr[INET6_ADDRSTRLEN];
+
+  inet_ntop(AF_INET6, src, srcstr, sizeof(srcstr));
+  inet_ntop(AF_INET6, dst, dststr, sizeof(dststr));
+  logmsg_dbg(ANDROID_LOG_ERROR, fmt, srcstr, dststr);
+}
+#else
+#define log_bad_address(fmt, src, dst)
+#endif
+
+/* function: ipv6_packet
+ * takes an ipv6 packet and hands it off to the layer 4 protocol function
+ * out    - output packet
+ * packet - packet data
+ * len    - size of packet
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int ipv6_packet(clat_packet out, clat_packet_index pos, const uint8_t *packet, size_t len, struct clat_icmp_frag *icmp_frag) {
+  const struct ip6_hdr *ip6 = (struct ip6_hdr *) packet;
+  struct iphdr *ip_targ = (struct iphdr *) out[pos].iov_base;
+  struct ip6_frag *frag_hdr = NULL;
+  uint8_t protocol;
+  const uint8_t *next_header;
+  size_t len_left;
+  uint32_t old_sum, new_sum;
+  int iov_len;
+
+  if(len < sizeof(struct ip6_hdr)) {
+    logmsg_dbg(ANDROID_LOG_ERROR, "ipv6_packet/too short for an ip6 header: %d", len);
+    return 0;
+  }
+
+  if(IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
+    log_bad_address("ipv6_packet/multicast %s->%s", &ip6->ip6_src, &ip6->ip6_dst);
+    return 0; // silently ignore
+  }
+
+  // If the packet is not from the plat subnet to the local subnet, or vice versa, drop it, unless
+  // it's an ICMP packet (which can come from anywhere). We do not send IPv6 packets from the plat
+  // subnet to the local subnet, but these can appear as inner packets in ICMP errors, so we need
+  // to translate them. We accept third-party ICMPv6 errors, even though their source addresses
+  // cannot be translated, so that things like unreachables and traceroute will work. fill_ip_header
+  // takes care of faking a source address for them.
+  if (!(is_in_plat_subnet(&ip6->ip6_src) &&
+        IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &Global_Clatd_Config.ipv6_local_subnet)) &&
+      !(is_in_plat_subnet(&ip6->ip6_dst) &&
+        IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &Global_Clatd_Config.ipv6_local_subnet)) &&
+      ip6->ip6_nxt != IPPROTO_ICMPV6) {
+    log_bad_address("ipv6_packet/wrong source address: %s->%s", &ip6->ip6_src, &ip6->ip6_dst);
+    return 0;
+  }
+
+  next_header = packet + sizeof(struct ip6_hdr);
+  len_left = len - sizeof(struct ip6_hdr);
+
+  protocol = ip6->ip6_nxt;
+
+  /* Fill in the IPv4 header. We need to do this before we translate the packet because TCP and
+   * UDP include parts of the IP header in the checksum. Set the length to zero because we don't
+   * know it yet.
+   */
+  fill_ip_header(ip_targ, 0, protocol, ip6);
+  out[pos].iov_len = sizeof(struct iphdr);
+
+  // If there's a Fragment header, parse it and decide what the next header is.
+  // Do this before calculating the pseudo-header checksum because it updates the next header value.
+  if (protocol == IPPROTO_FRAGMENT) {
+    frag_hdr = (struct ip6_frag *) next_header;
+    if (len_left < sizeof(*frag_hdr)) {
+      logmsg_dbg(ANDROID_LOG_ERROR, "ipv6_packet/too short for fragment header: %d", len);
+      return 0;
+    }
+
+    next_header += sizeof(*frag_hdr);
+    len_left -= sizeof(*frag_hdr);
+
+    protocol = parse_frag_header(frag_hdr, ip_targ);
+  }
+  old_sum = ipv6_pseudo_header_checksum(ip6, len_left, protocol);
+  // ICMP and ICMPv6 have different protocol numbers.
+  if (protocol == IPPROTO_ICMPV6) {
+    protocol = IPPROTO_ICMP;
+    ip_targ->protocol = IPPROTO_ICMP;
+  }
+
+  /* Calculate the pseudo-header checksum.
+   * Technically, the length that is used in the pseudo-header checksum is the transport layer
+   * length, which is not the same as len_left in the case of fragmented packets. But since
+   * translation does not change the transport layer length, the checksum is unaffected.
+   */
+
+  new_sum = ipv4_pseudo_header_checksum(ip_targ, len_left);
+
+  // Does not support IPv6 extension headers except Fragment.
+  if (frag_hdr && (frag_hdr->ip6f_offlg & IP6F_OFF_MASK)) {
+	uint16_t frag_len = ntohs(frag_hdr->ip6f_offlg & IP6F_OFF_MASK);
+	if(icmp_frag && frag_len > 0 && (protocol == IPPROTO_ICMP)){
+		icmp_frag->ip_len = len_left + frag_len;
+		icmp_frag->ip_id = htons(ntohl(frag_hdr->ip6f_ident) & 0xffff);
+		icmp_frag->flag = 2;
+	}
+    iov_len = generic_packet(out, pos + 2, next_header, len_left);
+  } else if (protocol == IPPROTO_ICMP) {
+	if(icmp_frag && frag_hdr){
+		icmp_frag->ip_len = len_left;
+		icmp_frag->ip_id = htons(ntohl(frag_hdr->ip6f_ident) & 0xffff);
+		icmp_frag->flag = 1;
+	}
+    iov_len = icmp6_packet(out, pos + 2, (const struct icmp6_hdr *) next_header, old_sum, len_left);
+  } else if (protocol == IPPROTO_TCP) {
+    iov_len = tcp_packet(out, pos + 2, (const struct tcphdr *) next_header, old_sum, new_sum,
+                         len_left);
+  } else if (protocol == IPPROTO_UDP) {
+    iov_len = udp_packet(out, pos + 2, (const struct udphdr *) next_header, old_sum, new_sum,
+                         len_left);
+  } else if (protocol == IPPROTO_GRE) {
+    iov_len = generic_packet(out, pos + 2, next_header, len_left);
+  } else {
+#if CLAT_DEBUG
+    logmsg(ANDROID_LOG_ERROR, "ipv6_packet/unknown next header type: %x", ip6->ip6_nxt);
+    logcat_hexdump("ipv6/nxthdr", packet, len);
+#endif
+    return 0;
+  }
+
+  // Set the length and calculate the checksum.
+  ip_targ->tot_len = htons(ntohs(ip_targ->tot_len) + packet_length(out, pos));
+  ip_targ->check = ip_checksum(ip_targ, sizeof(struct iphdr));
+  return iov_len;
+}
diff --git a/ap/app/clatd/load_file.c b/ap/app/clatd/load_file.c
new file mode 100755
index 0000000..be84dec
--- /dev/null
+++ b/ap/app/clatd/load_file.c
@@ -0,0 +1,53 @@
+/* libs/cutils/load_file.c
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+//#include <cutils/misc.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+void *load_file(const char *fn, unsigned *_sz)
+{
+    char *data;
+    int sz;
+    int fd;
+
+    data = 0;
+    fd = open(fn, O_RDONLY);
+    if(fd < 0) return 0;
+
+    sz = lseek(fd, 0, SEEK_END);
+    if(sz < 0) goto oops;
+
+    if(lseek(fd, 0, SEEK_SET) != 0) goto oops;
+
+    data = (char*) malloc(sz + 1);
+    if(data == 0) goto oops;
+
+    if(read(fd, data, sz) != sz) goto oops;
+    close(fd);
+    data[sz] = 0;
+
+    if(_sz) *_sz = sz;
+    return data;
+
+oops:
+    close(fd);
+    if(data != 0) free(data);
+    return 0;
+}
diff --git a/ap/app/clatd/logging.c b/ap/app/clatd/logging.c
new file mode 100755
index 0000000..53b2559
--- /dev/null
+++ b/ap/app/clatd/logging.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * logging.c - print a log message
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "logging.h"
+#include "debug.h"
+
+/* function: logmsg
+ * prints a log message to android's log buffer
+ * prio - the log message priority
+ * fmt  - printf format specifier
+ * ...  - printf format arguments
+ */
+void logmsg(int prio, const char *fmt, ...) {
+  va_list ap;
+  char tmp_buf[256] = {0};
+  va_start(ap, fmt);
+  //__android_log_vprint(prio, "clatd", fmt, ap);
+  vsnprintf(tmp_buf, sizeof(tmp_buf), fmt, ap);
+  printf("%s\n", tmp_buf);
+  va_end(ap);
+}
+
+/* function: logmsg_dbg
+ * prints a log message to android's log buffer if CLAT_DEBUG is set
+ * prio - the log message priority
+ * fmt  - printf format specifier
+ * ...  - printf format arguments
+ */
+#if CLAT_DEBUG
+void logmsg_dbg(int prio, const char *fmt, ...) {
+  va_list ap;
+  char tmp_buf[256] = {0};
+  va_start(ap, fmt);
+  //__android_log_vprint(prio, "clatd", fmt, ap);
+  vsnprintf(tmp_buf, sizeof(tmp_buf), fmt, ap);
+  printf("%s\n", tmp_buf);
+  va_end(ap);
+}
+#else
+void logmsg_dbg(__attribute__((unused)) int prio, __attribute__((unused)) const char *fmt, ...) {}
+#endif
diff --git a/ap/app/clatd/logging.h b/ap/app/clatd/logging.h
new file mode 100755
index 0000000..0867e31
--- /dev/null
+++ b/ap/app/clatd/logging.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * logging.h - print a log message
+ */
+
+#ifndef __LOGGING_H__
+#define __LOGGING_H__
+// for the priorities
+//#include <android/log.h>
+
+/**
+ * Android log priority values, in increasing order of priority.
+ */
+typedef enum android_LogPriority {
+  /** For internal use only.  */
+  ANDROID_LOG_UNKNOWN = 0,
+  /** The default priority, for internal use only.  */
+  ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
+  /** Verbose logging. Should typically be disabled for a release apk. */
+  ANDROID_LOG_VERBOSE,
+  /** Debug logging. Should typically be disabled for a release apk. */
+  ANDROID_LOG_DEBUG,
+  /** Informational logging. Should typically be disabled for a release apk. */
+  ANDROID_LOG_INFO,
+  /** Warning logging. For use with recoverable failures. */
+  ANDROID_LOG_WARN,
+  /** Error logging. For use with unrecoverable failures. */
+  ANDROID_LOG_ERROR,
+  /** Fatal logging. For use when aborting. */
+  ANDROID_LOG_FATAL,
+  /** For internal use only.  */
+  ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
+} android_LogPriority;
+
+void logmsg(int prio, const char *fmt, ...);
+void logmsg_dbg(int prio, const char *fmt, ...);
+
+#endif
diff --git a/ap/app/clatd/mtu.c b/ap/app/clatd/mtu.c
new file mode 100755
index 0000000..975bf0e
--- /dev/null
+++ b/ap/app/clatd/mtu.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * mtu.c - get interface mtu
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+
+#include "mtu.h"
+
+/* function: getifmtu
+ * returns the interface mtu or -1 on failure
+ * ifname - interface name
+ */
+int getifmtu(const char *ifname) {
+  int fd;
+  struct ifreq if_mtu;
+
+  fd = socket(AF_INET, SOCK_STREAM, 0);
+  if(fd < 0) {
+    return -1;
+  }
+  strncpy(if_mtu.ifr_name, ifname, IFNAMSIZ);
+  if_mtu.ifr_name[IFNAMSIZ - 1] = '\0';
+  if(ioctl(fd, SIOCGIFMTU, &if_mtu) < 0) {
+    return -1;
+  }
+  return if_mtu.ifr_mtu;
+}
diff --git a/ap/app/clatd/mtu.h b/ap/app/clatd/mtu.h
new file mode 100755
index 0000000..c330c24
--- /dev/null
+++ b/ap/app/clatd/mtu.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * mtu.c - get interface mtu
+ */
+
+#ifndef __MTU_H__
+#define __MTU_H__
+
+int getifmtu(const char *ifname);
+
+#endif
diff --git a/ap/app/clatd/my_header.h b/ap/app/clatd/my_header.h
new file mode 100755
index 0000000..8835b23
--- /dev/null
+++ b/ap/app/clatd/my_header.h
@@ -0,0 +1,48 @@
+#ifndef _MY_HEADER_H_

+#define _MY_HEADER_H_

+

+/*

+ * Passing NETID_UNSET as the netId causes system/netd/server/DnsProxyListener.cpp to

+ * fill in the appropriate default netId for the query.

+ */

+#define NETID_UNSET 0u

+

+/*

+ * MARK_UNSET represents the default (i.e. unset) value for a socket mark.

+ */

+#define MARK_UNSET 0u

+

+

+/*

+ * Definition of type and code field values.

+ *	http://www.iana.org/assignments/icmp-parameters

+ */

+#define	ICMP_ECHOREPLY	0		/* echo reply */

+#define	ICMP_UNREACH	3		/* dest unreachable, codes: */

+#define	ICMP_UNREACH_NET		0	/* bad net */

+#define	ICMP_UNREACH_HOST		1	/* bad host */

+#define	ICMP_UNREACH_PROTOCOL	2	/* bad protocol */

+#define	ICMP_UNREACH_PORT		3	/* bad port */

+#define	ICMP_UNREACH_NEEDFRAG	4	/* IP_DF caused drop */

+#define	ICMP_UNREACH_NET_PROHIB		9	/* for crypto devs */

+#define	ICMP_UNREACH_HOST_PROHIB	10	/* ditto */

+#define	ICMP_UNREACH_FILTER_PROHIB	13	/* prohibited access */

+#define	ICMP_UNREACH_PRECEDENCE_CUTOFF	15	/* precedence cutoff */

+#define	ICMP_SOURCEQUENCH	4		/* packet lost, slow down */

+#define	ICMP_ECHO		   8		/* echo service */

+#define NETID_USE_LOCAL_NAMESERVERS 0x80000000

+

+#if 0

+struct ucred {

+  pid_t pid;

+  uid_t uid;

+  gid_t gid;

+};

+#endif

+

+#define AID_VPN  1016         /* vpn system */

+#define AID_CLAT 1029         /* clat part of nat464 */

+#define AID_INET 3003         /* can create AF_INET and AF_INET6 sockets */

+

+#endif

+

diff --git a/ap/app/clatd/netlink_callbacks.c b/ap/app/clatd/netlink_callbacks.c
new file mode 100755
index 0000000..a79aa76
--- /dev/null
+++ b/ap/app/clatd/netlink_callbacks.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012 Daniel Drown <dan-android@drown.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * netlink_callbacks.c - generic callbacks for netlink responses
+ */
+#include <netinet/in.h>
+#include <net/if.h>
+
+#include <linux/rtnetlink.h>
+#include <netlink/handlers.h>
+#include <netlink/msg.h>
+
+/* function: ack_handler
+ * generic netlink callback for ack messages
+ * msg  - netlink message
+ * data - pointer to an int, stores the success code
+ */
+static int ack_handler(__attribute__((unused)) struct nl_msg *msg, void *data) {
+  int *retval = data;
+  *retval = 0;
+  return NL_OK;
+}
+
+/* function: error_handler
+ * generic netlink callback for error messages
+ * nla  - error source
+ * err  - netlink error message
+ * arg  - pointer to an int, stores the error code
+ */
+static int error_handler(__attribute__((unused)) struct sockaddr_nl *nla,
+                         struct nlmsgerr *err, void *arg) {
+  int *retval = arg;
+  if(err->error < 0) {
+    *retval = err->error;
+  } else {
+    *retval = 0; // NLMSG_ERROR used as reply type on no error
+  }
+  return NL_OK;
+}
+
+/* function: alloc_ack_callbacks
+ * allocates a set of netlink callbacks.  returns NULL on failure.  callbacks will modify retval with <0 meaning failure
+ * retval - shared state between caller and callback functions
+ */
+struct nl_cb *alloc_ack_callbacks(int *retval) {
+  struct nl_cb *callbacks;
+
+  callbacks = nl_cb_alloc(NL_CB_DEFAULT);
+  if(!callbacks) {
+    return NULL;
+  }
+  nl_cb_set(callbacks, NL_CB_ACK, NL_CB_CUSTOM, ack_handler, retval);
+  nl_cb_err(callbacks, NL_CB_CUSTOM, error_handler, retval);
+  return callbacks;
+}
diff --git a/ap/app/clatd/netlink_callbacks.h b/ap/app/clatd/netlink_callbacks.h
new file mode 100755
index 0000000..298ad3e
--- /dev/null
+++ b/ap/app/clatd/netlink_callbacks.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012 Daniel Drown <dan-android@drown.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * netlink_callbacks.h - callbacks for netlink responses
+ */
+
+#ifndef __NETLINK_CALLBACKS_H__
+#define __NETLINK_CALLBACKS_H__
+
+struct nl_cb *alloc_ack_callbacks(int *retval);
+
+#endif
diff --git a/ap/app/clatd/netlink_msg.c b/ap/app/clatd/netlink_msg.c
new file mode 100755
index 0000000..26a8208
--- /dev/null
+++ b/ap/app/clatd/netlink_msg.c
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2012 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * netlink_msg.c - send an ifaddrmsg/ifinfomsg/rtmsg via netlink
+ */
+#define _GNU_SOURCE
+#include <netinet/in.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <string.h>
+#include <errno.h>
+
+//#include <netlink-private/object-api.h>
+//#include <netlink-private/types.h>
+#include "my_header.h"
+#include "netlink-private/object-api.h"
+#include "netlink-private/types.h"
+
+#include <netlink/socket.h>
+#include <netlink/netlink.h>
+#include <netlink/msg.h>
+
+#include "netlink_msg.h"
+#include "netlink_callbacks.h"
+
+/* function: family_size
+ * returns the size of the address structure for the given family, or 0 on error
+ * family - AF_INET or AF_INET6
+ */
+size_t inet_family_size(int family) {
+  if(family == AF_INET) {
+    return sizeof(struct in_addr);
+  } else if(family == AF_INET6) {
+    return sizeof(struct in6_addr);
+  } else {
+    return 0;
+  }
+}
+
+/* function: nlmsg_alloc_generic
+ * allocates a netlink message with the given struct inside of it. returns NULL on failure
+ * type           - netlink message type
+ * flags          - netlink message flags
+ * payload_struct - pointer to a struct to add to netlink message
+ * payload_len    - bytelength of structure
+ */
+struct nl_msg *nlmsg_alloc_generic(uint16_t type, uint16_t flags, void *payload_struct, size_t payload_len) {
+  struct nl_msg *msg;
+
+  msg = nlmsg_alloc();
+  if(!msg) {
+    return NULL;
+  }
+
+  if ((sizeof(struct nl_msg) + payload_len) > msg->nm_size) {
+    nlmsg_free(msg);
+    return NULL;
+  }
+
+  msg->nm_nlh->nlmsg_len = NLMSG_LENGTH(payload_len);
+  msg->nm_nlh->nlmsg_flags = flags;
+  msg->nm_nlh->nlmsg_type = type;
+
+  memcpy(nlmsg_data(msg->nm_nlh), payload_struct, payload_len);
+
+  return msg;
+}
+
+/* function: nlmsg_alloc_ifaddr
+ * allocates a netlink message with a struct ifaddrmsg inside of it. returns NULL on failure
+ * type  - netlink message type
+ * flags - netlink message flags
+ * ifa   - ifaddrmsg to copy into the new netlink message
+ */
+struct nl_msg *nlmsg_alloc_ifaddr(uint16_t type, uint16_t flags, struct ifaddrmsg *ifa) {
+  return nlmsg_alloc_generic(type, flags, ifa, sizeof(*ifa));
+}
+
+/* function: nlmsg_alloc_ifinfo
+ * allocates a netlink message with a struct ifinfomsg inside of it. returns NULL on failure
+ * type  - netlink message type
+ * flags - netlink message flags
+ * ifi   - ifinfomsg to copy into the new netlink message
+ */
+struct nl_msg *nlmsg_alloc_ifinfo(uint16_t type, uint16_t flags, struct ifinfomsg *ifi) {
+  return nlmsg_alloc_generic(type, flags, ifi, sizeof(*ifi));
+}
+
+/* function: nlmsg_alloc_rtmsg
+ * allocates a netlink message with a struct rtmsg inside of it. returns NULL on failure
+ * type  - netlink message type
+ * flags - netlink message flags
+ * rt    - rtmsg to copy into the new netlink message
+ */
+struct nl_msg *nlmsg_alloc_rtmsg(uint16_t type, uint16_t flags, struct rtmsg *rt) {
+  return nlmsg_alloc_generic(type, flags, rt, sizeof(*rt));
+}
+
+/* function: netlink_set_kernel_only
+ * sets a socket to receive messages only from the kernel
+ * sock - socket to connect
+ */
+int netlink_set_kernel_only(struct nl_sock *nl_sk) {
+  struct sockaddr_nl addr = { AF_NETLINK, 0, 0, 0 };
+
+  if (!nl_sk) {
+    return -EFAULT;
+  }
+
+  int sockfd = nl_socket_get_fd(nl_sk);
+  return connect(sockfd, (struct sockaddr *) &addr, sizeof(addr));
+}
+
+/* function: send_netlink_msg
+ * sends a netlink message, reads a response, and hands the response(s) to the callbacks
+ * msg       - netlink message to send
+ * callbacks - callbacks to use on responses
+ */
+void send_netlink_msg(struct nl_msg *msg, struct nl_cb *callbacks) {
+  struct nl_sock *nl_sk;
+
+  nl_sk = nl_socket_alloc();
+  if(!nl_sk)
+    goto cleanup;
+
+  if(nl_connect(nl_sk, NETLINK_ROUTE) != 0)
+    goto cleanup;
+
+  if(nl_send_auto_complete(nl_sk, msg) < 0)
+    goto cleanup;
+
+  if(netlink_set_kernel_only(nl_sk) < 0)
+    goto cleanup;
+
+  nl_recvmsgs(nl_sk, callbacks);
+
+cleanup:
+  if(nl_sk)
+    nl_socket_free(nl_sk);
+}
+
+/* function: send_ifaddrmsg
+ * sends a netlink/ifaddrmsg message and hands the responses to the callbacks
+ * type      - netlink message type
+ * flags     - netlink message flags
+ * ifa       - ifaddrmsg to send
+ * callbacks - callbacks to use with the responses
+ */
+void send_ifaddrmsg(uint16_t type, uint16_t flags, struct ifaddrmsg *ifa, struct nl_cb *callbacks) {
+  struct nl_msg *msg = NULL;
+
+  msg = nlmsg_alloc_ifaddr(type, flags, ifa);
+  if(!msg)
+    return;
+
+  send_netlink_msg(msg, callbacks);
+
+  nlmsg_free(msg);
+}
+
+/* function: netlink_sendrecv
+ * send a nl_msg and return an int status - only supports OK/ERROR responses
+ * msg - msg to send
+ */
+int netlink_sendrecv(struct nl_msg *msg) {
+  struct nl_cb *callbacks = NULL;
+  int retval = -EIO;
+
+  callbacks = alloc_ack_callbacks(&retval);
+  if(!callbacks) {
+    return -ENOMEM;
+  }
+
+  send_netlink_msg(msg, callbacks);
+
+  nl_cb_put(callbacks);
+
+  return retval;
+}
diff --git a/ap/app/clatd/netlink_msg.h b/ap/app/clatd/netlink_msg.h
new file mode 100755
index 0000000..13e1f28
--- /dev/null
+++ b/ap/app/clatd/netlink_msg.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2012 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * netlink_msg.h - send an ifaddrmsg/ifinfomsg via netlink
+ */
+#ifndef __NETLINK_IFMSG_H__
+#define __NETLINK_IFMSG_H__
+
+size_t inet_family_size(int family);
+struct nl_msg *nlmsg_alloc_ifaddr(uint16_t type, uint16_t flags, struct ifaddrmsg *ifa);
+struct nl_msg *nlmsg_alloc_ifinfo(uint16_t type, uint16_t flags, struct ifinfomsg *ifi);
+struct nl_msg *nlmsg_alloc_rtmsg(uint16_t type, uint16_t flags, struct rtmsg *rt);
+void send_netlink_msg(struct nl_msg *msg, struct nl_cb *callbacks);
+void send_ifaddrmsg(uint16_t type, uint16_t flags, struct ifaddrmsg *ifa, struct nl_cb *callbacks);
+int netlink_sendrecv(struct nl_msg *msg);
+int netlink_set_kernel_only(struct nl_sock *nl_sk);
+
+#endif
diff --git a/ap/app/clatd/ring.c b/ap/app/clatd/ring.c
new file mode 100755
index 0000000..5e99fd5
--- /dev/null
+++ b/ap/app/clatd/ring.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ring.c - packet ring buffer functions
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
+#include <sys/mman.h>
+#include <linux/if.h>
+#include <linux/if_packet.h>
+
+#include "logging.h"
+#include "ring.h"
+#include "translate.h"
+#include "tun.h"
+
+int ring_create(struct tun_data *tunnel) {
+  int packetsock = socket(AF_PACKET, SOCK_DGRAM, htons(ETH_P_IPV6));
+  if (packetsock < 0) {
+    logmsg(ANDROID_LOG_FATAL, "packet socket failed: %s", strerror(errno));
+    return -1;
+  }
+
+  int ver = TPACKET_V2;
+  if (setsockopt(packetsock, SOL_PACKET, PACKET_VERSION, (void *) &ver, sizeof(ver))) {
+    logmsg(ANDROID_LOG_FATAL, "setsockopt(PACKET_VERSION, %d) failed: %s", ver, strerror(errno));
+    return -1;
+  }
+
+  int on = 1;
+  if (setsockopt(packetsock, SOL_PACKET, PACKET_LOSS, (void *) &on, sizeof(on))) {
+    logmsg(ANDROID_LOG_WARN, "PACKET_LOSS failed: %s", strerror(errno));
+  }
+
+  struct packet_ring *ring = &tunnel->ring;
+  ring->numblocks = TP_NUM_BLOCKS;
+
+  int total_frames = TP_FRAMES * ring->numblocks;
+
+  struct tpacket_req req = {
+      .tp_frame_size = TP_FRAME_SIZE,  // Frame size.
+      .tp_block_size = TP_BLOCK_SIZE,  // Frames per block.
+      .tp_block_nr = ring->numblocks,  // Number of blocks.
+      .tp_frame_nr = total_frames,     // Total frames.
+  };
+
+  if (setsockopt(packetsock, SOL_PACKET, PACKET_RX_RING, &req, sizeof(req)) < 0) {
+    logmsg(ANDROID_LOG_FATAL, "PACKET_RX_RING failed: %s", strerror(errno));
+    return -1;
+  }
+
+  size_t buflen = TP_BLOCK_SIZE * ring->numblocks;
+  ring->base = mmap(NULL, buflen, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_LOCKED|MAP_POPULATE,
+                    packetsock, 0);
+  if (ring->base == MAP_FAILED) {
+    logmsg(ANDROID_LOG_FATAL, "mmap %lu failed: %s", buflen, strerror(errno));
+    return -1;
+  }
+
+  ring->block = 0;
+  ring->slot = 0;
+  ring->numslots = TP_BLOCK_SIZE / TP_FRAME_SIZE;
+  ring->next = (struct tpacket2_hdr *) ring->base;
+
+  logmsg(ANDROID_LOG_INFO, "Using ring buffer with %d frames (%d bytes) at %p",
+         total_frames, buflen, ring->base);
+
+  return packetsock;
+}
+
+/* function: ring_advance
+ * advances to the next position in the packet ring
+ * ring - packet ring buffer
+ */
+static struct tpacket2_hdr* ring_advance(struct packet_ring *ring) {
+  uint8_t *next = (uint8_t *) ring->next;
+
+  ring->slot++;
+  next += TP_FRAME_SIZE;
+
+  if (ring->slot == ring->numslots) {
+    ring->slot = 0;
+    ring->block++;
+
+    if (ring->block < ring->numblocks) {
+      next += TP_FRAME_GAP;
+    } else {
+      ring->block = 0;
+      next = (uint8_t *) ring->base;
+    }
+  }
+
+  ring->next = (struct tpacket2_hdr *) next;
+  return ring->next;
+}
+
+/* function: ring_read
+ * reads a packet from the ring buffer and translates it
+ * read_fd  - file descriptor to read original packet from
+ * write_fd - file descriptor to write translated packet to
+ * to_ipv6  - whether the packet is to be translated to ipv6 or ipv4
+ */
+void ring_read(struct packet_ring *ring, int write_fd, int to_ipv6) {
+  struct tpacket2_hdr *tp = ring->next;
+  if (tp->tp_status & TP_STATUS_USER) {
+    uint8_t *packet = ((uint8_t *) tp) + tp->tp_net;
+    translate_packet(write_fd, to_ipv6, packet, tp->tp_len);
+    tp->tp_status = TP_STATUS_KERNEL;
+    tp = ring_advance(ring);
+  }
+}
diff --git a/ap/app/clatd/ring.h b/ap/app/clatd/ring.h
new file mode 100755
index 0000000..03ae8c1
--- /dev/null
+++ b/ap/app/clatd/ring.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ring.c - packet ring buffer functions
+ */
+#ifndef __RING_H__
+#define __RING_H__
+
+#include <linux/if.h>
+#include <linux/if_packet.h>
+
+#include "clatd.h"
+
+struct tun_data;
+
+// Frame size. Must be a multiple of TPACKET_ALIGNMENT (=16)
+// Why the 16? http://lxr.free-electrons.com/source/net/packet/af_packet.c?v=3.4#L1764
+#define TP_FRAME_SIZE (TPACKET_ALIGN(MAXMTU) + TPACKET_ALIGN(TPACKET2_HDRLEN) + 16)
+
+// Block size. Must be a multiple of the page size, and a power of two for efficient memory use.
+#define TP_BLOCK_SIZE 8192
+
+// In order to save memory, our frames are not an exact divider of the block size. Therefore, the
+// mmaped region will have gaps corresponding to the empty space at the end of each block.
+#define TP_FRAMES (TP_BLOCK_SIZE / TP_FRAME_SIZE)
+#define TP_FRAME_GAP (TP_BLOCK_SIZE % TP_FRAME_SIZE)
+
+// TODO: Make this configurable. This requires some refactoring because the packet socket is
+// opened before we drop privileges, but the configuration file is read after. A value of 16
+// results in 656 frames (1048576 bytes).
+#define TP_NUM_BLOCKS 16
+
+struct packet_ring {
+  uint8_t *base;
+  struct tpacket2_hdr *next;
+  int slot, numslots;
+  int block, numblocks;
+};
+
+int ring_create(struct tun_data *tunnel);
+void ring_read(struct packet_ring *ring, int write_fd, int to_ipv6);
+
+#endif
diff --git a/ap/app/clatd/setif.c b/ap/app/clatd/setif.c
new file mode 100755
index 0000000..07f5bac
--- /dev/null
+++ b/ap/app/clatd/setif.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2012 Daniel Drown <dan-android@drown.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * setif.c - network interface configuration
+ */
+#include <errno.h>
+#include <netinet/in.h>
+#include <net/if.h>
+
+#include <linux/rtnetlink.h>
+#include <netlink/handlers.h>
+#include <netlink/msg.h>
+
+#include "logging.h"
+#include "netlink_msg.h"
+
+#define DEBUG_OPTNAME(a) case (a): { optname = #a; break; }
+
+/* function: add_address
+ * adds an IP address to/from an interface, returns 0 on success and <0 on failure
+ * ifname    - name of interface to change
+ * family    - address family (AF_INET, AF_INET6)
+ * address   - pointer to a struct in_addr or in6_addr
+ * prefixlen - bitlength of network (example: 24 for AF_INET's 255.255.255.0)
+ * broadcast - broadcast address (only for AF_INET, ignored for AF_INET6)
+ */
+int add_address(const char *ifname, int family, const void *address, int prefixlen, const void *broadcast) {
+  int retval;
+  size_t addr_size;
+  struct ifaddrmsg ifa;
+  struct nl_msg *msg = NULL;
+
+  addr_size = inet_family_size(family);
+  if(addr_size == 0) {
+    retval = -EAFNOSUPPORT;
+    goto cleanup;
+  }
+
+  memset(&ifa, 0, sizeof(ifa));
+  if (!(ifa.ifa_index = if_nametoindex(ifname))) {
+    retval = -ENODEV;
+    goto cleanup;
+  }
+  ifa.ifa_family = family;
+  ifa.ifa_prefixlen = prefixlen;
+  ifa.ifa_scope = RT_SCOPE_UNIVERSE;
+
+  msg = nlmsg_alloc_ifaddr(RTM_NEWADDR, NLM_F_ACK | NLM_F_REQUEST | NLM_F_CREATE | NLM_F_REPLACE, &ifa);
+  if(!msg) {
+    retval = -ENOMEM;
+    goto cleanup;
+  }
+
+  if(nla_put(msg, IFA_LOCAL, addr_size, address) < 0) {
+    retval = -ENOMEM;
+    goto cleanup;
+  }
+  if(family == AF_INET6) {
+    // AF_INET6 gets IFA_LOCAL + IFA_ADDRESS
+    if(nla_put(msg, IFA_ADDRESS, addr_size, address) < 0) {
+      retval = -ENOMEM;
+      goto cleanup;
+    }
+  } else if(family == AF_INET) {
+    // AF_INET gets IFA_LOCAL + IFA_BROADCAST
+    if(nla_put(msg, IFA_BROADCAST, addr_size, broadcast) < 0) {
+      retval = -ENOMEM;
+      goto cleanup;
+    }
+  } else {
+    retval = -EAFNOSUPPORT;
+    goto cleanup;
+  }
+
+  retval = netlink_sendrecv(msg);
+
+cleanup:
+  if(msg)
+    nlmsg_free(msg);
+
+  return retval;
+}
+
+/* function: if_up
+ * sets interface link state to up and sets mtu, returns 0 on success and <0 on failure
+ * ifname - interface name to change
+ * mtu    - new mtu
+ */
+int if_up(const char *ifname, int mtu) {
+  int retval = -1;
+  struct ifinfomsg ifi;
+  struct nl_msg *msg = NULL;
+
+  memset(&ifi, 0, sizeof(ifi));
+  if (!(ifi.ifi_index = if_nametoindex(ifname))) {
+    retval = -ENODEV;
+    goto cleanup;
+  }
+  ifi.ifi_change = IFF_UP;
+  ifi.ifi_flags = IFF_UP;
+
+  msg = nlmsg_alloc_ifinfo(RTM_SETLINK, NLM_F_ACK | NLM_F_REQUEST | NLM_F_ROOT, &ifi);
+  if(!msg) {
+    retval = -ENOMEM;
+    goto cleanup;
+  }
+
+  if(nla_put(msg, IFLA_MTU, 4, &mtu) < 0) {
+    retval = -ENOMEM;
+    goto cleanup;
+  }
+
+  retval = netlink_sendrecv(msg);
+
+cleanup:
+  if(msg)
+    nlmsg_free(msg);
+
+  return retval;
+}
+
+static int do_anycast_setsockopt(int sock, int what, struct in6_addr *addr, int ifindex) {
+  struct ipv6_mreq mreq = { *addr, ifindex };
+  char *optname;
+  int ret;
+
+  switch (what) {
+    DEBUG_OPTNAME(IPV6_JOIN_ANYCAST)
+    DEBUG_OPTNAME(IPV6_LEAVE_ANYCAST)
+    default:
+      optname = "???";
+      break;
+  }
+
+  ret = setsockopt(sock, SOL_IPV6, what, &mreq, sizeof(mreq));
+  if (ret) {
+    logmsg(ANDROID_LOG_ERROR, "%s: setsockopt(%s): %s", __func__, optname, strerror(errno));
+  }
+
+  return ret;
+}
+
+/* function: add_anycast_address
+ * adds an anycast IPv6 address to an interface, returns 0 on success and <0 on failure
+ * sock      - the socket to add the address to
+ * addr      - the IP address to add
+ * ifname    - name of interface to add the address to
+ */
+int add_anycast_address(int sock, struct in6_addr *addr, const char *ifname) {
+  int ifindex;
+
+  ifindex = if_nametoindex(ifname);
+  if (!ifindex) {
+    logmsg(ANDROID_LOG_ERROR, "%s: unknown ifindex for interface %s", __func__, ifname);
+    return -ENODEV;
+  }
+
+  return do_anycast_setsockopt(sock, IPV6_JOIN_ANYCAST, addr, ifindex);
+}
+
+/* function: del_anycast_address
+ * removes an anycast IPv6 address from the system, returns 0 on success and <0 on failure
+ * sock      - the socket to remove from, must have had the address added via add_anycast_address
+ * addr      - the IP address to remove
+ */
+int del_anycast_address(int sock, struct in6_addr *addr) {
+  return do_anycast_setsockopt(sock, IPV6_LEAVE_ANYCAST, addr, 0);
+}
diff --git a/ap/app/clatd/setif.h b/ap/app/clatd/setif.h
new file mode 100755
index 0000000..d31eed5
--- /dev/null
+++ b/ap/app/clatd/setif.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2012 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * setif.h - network interface configuration
+ */
+#ifndef __SETIF_H__
+#define __SETIF_H__
+
+int add_address(const char *ifname, int family, const void *address, int cidr, const void *broadcast);
+int if_up(const char *ifname, int mtu);
+
+int add_anycast_address(int sock, const struct in6_addr *addr, const char *interface);
+int del_anycast_address(int sock, const struct in6_addr *addr);
+
+#endif
diff --git a/ap/app/clatd/translate.c b/ap/app/clatd/translate.c
new file mode 100755
index 0000000..1541cea
--- /dev/null
+++ b/ap/app/clatd/translate.c
@@ -0,0 +1,637 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * translate.c - CLAT functions / partial implementation of rfc6145
+ */
+#include <string.h>
+
+#include "icmp.h"
+#include "translate.h"
+#include "checksum.h"
+#include "clatd.h"
+#include "config.h"
+#include "logging.h"
+#include "debug.h"
+#include "tun.h"
+
+#define CLAT_ICMP_FRAG_MEM_MAX 10
+#define CLAT_ICMP_FRAG_TIMEOUT 300
+
+struct clat_icmp_frag g_clat_icmp_frag[CLAT_ICMP_FRAG_MEM_MAX];
+
+static void clat_packet_copy(clat_packet in, clat_packet out)
+{
+	int i;
+	for(i = 0; i < CLAT_POS_MAX; i++){
+		if(in[i].iov_len > 0 && in[i].iov_base ){
+			out[i].iov_base = malloc(in[i].iov_len);
+			if(out[i].iov_base){
+				memcpy(out[i].iov_base, in[i].iov_base, in[i].iov_len);
+				out[i].iov_len = in[i].iov_len;
+			}else
+				logmsg_dbg(ANDROID_LOG_ERROR,"clat_packet_copy malloc fail");
+		}
+	}
+}
+
+static void clat_packet_free(clat_packet in)
+{
+	int i;
+	for(i = 0; i < CLAT_POS_MAX; i++){
+		if(in[i].iov_base)
+			free(in[i].iov_base);
+	}
+}
+
+static void clat_icmp_frag_add(struct clat_icmp_frag *in){
+	int i = 0;
+	for(i = 0; i < CLAT_ICMP_FRAG_MEM_MAX; i++){
+		if(g_clat_icmp_frag[i].flag != 0 && 
+			(in->time - g_clat_icmp_frag[i].time) > CLAT_ICMP_FRAG_TIMEOUT){
+			logmsg_dbg(ANDROID_LOG_ERROR,"clat_icmp_frag_add timeout %d",i);
+			clat_packet_free(g_clat_icmp_frag[i].data);
+			memset(&g_clat_icmp_frag[i], 0, sizeof(struct clat_icmp_frag));
+		}
+		if(g_clat_icmp_frag[i].flag == 0){
+			memcpy(&g_clat_icmp_frag[i], in, sizeof(struct clat_icmp_frag));
+			return 0;
+		}
+	}
+	logmsg_dbg(ANDROID_LOG_ERROR,"clat_icmp_frag_add noidle fail");
+}
+
+static int clat_icmp_frag_find(struct clat_icmp_frag *in){
+	int i = 0;
+	for(i = 0; i < CLAT_ICMP_FRAG_MEM_MAX; i++){
+		if(g_clat_icmp_frag[i].flag != 0 && 
+			g_clat_icmp_frag[i].ip_id == in->ip_id){
+			memcpy(in, &g_clat_icmp_frag[i], sizeof(struct clat_icmp_frag));
+			memset(&g_clat_icmp_frag[i], 0, sizeof(struct clat_icmp_frag));
+			return 0;
+		}
+	}
+	logmsg_dbg(ANDROID_LOG_ERROR,"clat_icmp_frag_find fail");
+	return -1;
+}
+
+/* function: packet_checksum
+ * calculates the checksum over all the packet components starting from pos
+ * checksum - checksum of packet components before pos
+ * packet   - packet to calculate the checksum of
+ * pos      - position to start counting from
+ * returns  - the completed 16-bit checksum, ready to write into a checksum header field
+ */
+uint16_t packet_checksum(uint32_t checksum, clat_packet packet, clat_packet_index pos) {
+  int i;
+  for (i = pos; i < CLAT_POS_MAX; i++) {
+    if (packet[i].iov_len > 0) {
+      checksum = ip_checksum_add(checksum, packet[i].iov_base, packet[i].iov_len);
+    }
+  }
+  return ip_checksum_finish(checksum);
+}
+
+/* function: packet_length
+ * returns the total length of all the packet components after pos
+ * packet - packet to calculate the length of
+ * pos    - position to start counting after
+ * returns: the total length of the packet components after pos
+ */
+uint16_t packet_length(clat_packet packet, clat_packet_index pos) {
+  size_t len = 0;
+  int i;
+  for (i = pos + 1; i < CLAT_POS_MAX; i++) {
+    len += packet[i].iov_len;
+  }
+  return len;
+}
+
+/* function: is_in_plat_subnet
+ * returns true iff the given IPv6 address is in the plat subnet.
+ * addr - IPv6 address
+ */
+int is_in_plat_subnet(const struct in6_addr *addr6) {
+  // Assumes a /96 plat subnet.
+  return (addr6 != NULL) && (memcmp(addr6, &Global_Clatd_Config.plat_subnet, 12) == 0);
+}
+
+/* function: ipv6_addr_to_ipv4_addr
+ * return the corresponding ipv4 address for the given ipv6 address
+ * addr6 - ipv6 address
+ * returns: the IPv4 address
+ */
+uint32_t ipv6_addr_to_ipv4_addr(const struct in6_addr *addr6) {
+  if (is_in_plat_subnet(addr6)) {
+    // Assumes a /96 plat subnet.
+    return addr6->s6_addr32[3];
+  } else if (IN6_ARE_ADDR_EQUAL(addr6, &Global_Clatd_Config.ipv6_local_subnet)) {
+    // Special-case our own address.
+    return Global_Clatd_Config.ipv4_local_subnet.s_addr;
+  } else {
+    // Third party packet. Let the caller deal with it.
+    return INADDR_NONE;
+  }
+}
+
+/* function: ipv4_addr_to_ipv6_addr
+ * return the corresponding ipv6 address for the given ipv4 address
+ * addr4 - ipv4 address
+ */
+struct in6_addr ipv4_addr_to_ipv6_addr(uint32_t addr4) {
+  struct in6_addr addr6;
+  // Both addresses are in network byte order (addr4 comes from a network packet, and the config
+  // file entry is read using inet_ntop).
+  if (addr4 == Global_Clatd_Config.ipv4_local_subnet.s_addr) {
+    return Global_Clatd_Config.ipv6_local_subnet;
+  } else {
+    // Assumes a /96 plat subnet.
+    addr6 = Global_Clatd_Config.plat_subnet;
+    addr6.s6_addr32[3] = addr4;
+    return addr6;
+  }
+}
+
+/* function: fill_tun_header
+ * fill in the header for the tun fd
+ * tun_header - tunnel header, already allocated
+ * proto      - ethernet protocol id: ETH_P_IP(ipv4) or ETH_P_IPV6(ipv6)
+ */
+void fill_tun_header(struct tun_pi *tun_header, uint16_t proto) {
+  tun_header->flags = 0;
+  tun_header->proto = htons(proto);
+}
+
+/* function: fill_ip_header
+ * generate an ipv4 header from an ipv6 header
+ * ip_targ     - (ipv4) target packet header, source: original ipv4 addr, dest: local subnet addr
+ * payload_len - length of other data inside packet
+ * protocol    - protocol number (tcp, udp, etc)
+ * old_header  - (ipv6) source packet header, source: nat64 prefix, dest: local subnet prefix
+ */
+void fill_ip_header(struct iphdr *ip, uint16_t payload_len, uint8_t protocol,
+                    const struct ip6_hdr *old_header) {
+  int ttl_guess;
+  memset(ip, 0, sizeof(struct iphdr));
+
+  ip->ihl = 5;
+  ip->version = 4;
+  ip->tos = 0;
+  ip->tot_len = htons(sizeof(struct iphdr) + payload_len);
+  ip->id = 0;
+  ip->frag_off = htons(IP_DF);
+  ip->ttl = old_header->ip6_hlim;
+  ip->protocol = protocol;
+  ip->check = 0;
+
+  ip->saddr = ipv6_addr_to_ipv4_addr(&old_header->ip6_src);
+  ip->daddr = ipv6_addr_to_ipv4_addr(&old_header->ip6_dst);
+
+  // Third-party ICMPv6 message. This may have been originated by an native IPv6 address.
+  // In that case, the source IPv6 address can't be translated and we need to make up an IPv4
+  // source address. For now, use 255.0.0.<ttl>, which at least looks useful in traceroute.
+  if ((uint32_t) ip->saddr == INADDR_NONE) {
+    ttl_guess = icmp_guess_ttl(old_header->ip6_hlim);
+    ip->saddr = htonl((0xff << 24) + ttl_guess);
+  }
+}
+
+/* function: fill_ip6_header
+ * generate an ipv6 header from an ipv4 header
+ * ip6         - (ipv6) target packet header, source: local subnet prefix, dest: nat64 prefix
+ * payload_len - length of other data inside packet
+ * protocol    - protocol number (tcp, udp, etc)
+ * old_header  - (ipv4) source packet header, source: local subnet addr, dest: internet's ipv4 addr
+ */
+void fill_ip6_header(struct ip6_hdr *ip6, uint16_t payload_len, uint8_t protocol,
+                     const struct iphdr *old_header) {
+  memset(ip6, 0, sizeof(struct ip6_hdr));
+
+  ip6->ip6_vfc = 6 << 4;
+  ip6->ip6_plen = htons(payload_len);
+  ip6->ip6_nxt = protocol;
+  ip6->ip6_hlim = old_header->ttl;
+
+  ip6->ip6_src = ipv4_addr_to_ipv6_addr(old_header->saddr);
+  ip6->ip6_dst = ipv4_addr_to_ipv6_addr(old_header->daddr);
+}
+
+/* function: maybe_fill_frag_header
+ * fills a fragmentation header
+ * generate an ipv6 fragment header from an ipv4 header
+ * frag_hdr    - target (ipv6) fragmentation header
+ * ip6_targ    - target (ipv6) header
+ * old_header  - (ipv4) source packet header
+ * returns: the length of the fragmentation header if present, or zero if not present
+ */
+size_t maybe_fill_frag_header(struct ip6_frag *frag_hdr, struct ip6_hdr *ip6_targ,
+                              const struct iphdr *old_header) {
+  uint16_t frag_flags = ntohs(old_header->frag_off);
+  uint16_t frag_off = frag_flags & IP_OFFMASK;
+  if (frag_off == 0 && (frag_flags & IP_MF) == 0) {
+    // Not a fragment.
+    return 0;
+  }
+
+  frag_hdr->ip6f_nxt = ip6_targ->ip6_nxt;
+  frag_hdr->ip6f_reserved = 0;
+  // In IPv4, the offset is the bottom 13 bits; in IPv6 it's the top 13 bits.
+  frag_hdr->ip6f_offlg = htons(frag_off << 3);
+  if (frag_flags & IP_MF) {
+    frag_hdr->ip6f_offlg |= IP6F_MORE_FRAG;
+  }
+  frag_hdr->ip6f_ident = htonl(ntohs(old_header->id));
+  ip6_targ->ip6_nxt = IPPROTO_FRAGMENT;
+
+  return sizeof(*frag_hdr);
+}
+
+/* function: parse_frag_header
+ * return the length of the fragmentation header if present, or zero if not present
+ * generate an ipv6 fragment header from an ipv4 header
+ * frag_hdr    - (ipv6) fragmentation header
+ * ip_targ     - target (ipv4) header
+ * returns: the next header value
+ */
+uint8_t parse_frag_header(const struct ip6_frag *frag_hdr, struct iphdr *ip_targ) {
+  uint16_t frag_off = (ntohs(frag_hdr->ip6f_offlg & IP6F_OFF_MASK) >> 3);
+  if (frag_hdr->ip6f_offlg & IP6F_MORE_FRAG) {
+    frag_off |= IP_MF;
+  }
+  ip_targ->frag_off = htons(frag_off);
+  ip_targ->id = htons(ntohl(frag_hdr->ip6f_ident) & 0xffff);
+  ip_targ->protocol = frag_hdr->ip6f_nxt;
+  return frag_hdr->ip6f_nxt;
+}
+
+extern uint32_t ip_checksum_add(uint32_t current, const void *data, int len);
+extern uint16_t ip_checksum_adjust(uint16_t checksum, uint32_t old_hdr_sum, uint32_t new_hdr_sum);
+/* function: icmp_to_icmp6
+ * translate ipv4 icmp to ipv6 icmp
+ * out          - output packet
+ * icmp         - source packet icmp header
+ * checksum     - pseudo-header checksum
+ * payload      - icmp payload
+ * payload_size - size of payload
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int icmp_to_icmp6(clat_packet out, clat_packet_index pos, const struct icmphdr *icmp,
+                  uint32_t checksum, const uint8_t *payload, size_t payload_size) {
+  struct icmp6_hdr *icmp6_targ = out[pos].iov_base;
+  uint8_t icmp6_type;
+  int clat_packet_len;
+
+  memset(icmp6_targ, 0, sizeof(struct icmp6_hdr));
+
+  icmp6_type = icmp_to_icmp6_type(icmp->type, icmp->code);
+  icmp6_targ->icmp6_type = icmp6_type;
+  icmp6_targ->icmp6_code = icmp_to_icmp6_code(icmp->type, icmp->code);
+
+  out[pos].iov_len = sizeof(struct icmp6_hdr);
+
+  if (pos == CLAT_POS_TRANSPORTHDR &&
+      is_icmp_error(icmp->type) &&
+      icmp6_type != ICMP6_PARAM_PROB) {
+    // An ICMP error we understand, one level deep.
+    // Translate the nested packet (the one that caused the error).
+    clat_packet_len = ipv4_packet(out, pos + 1, payload, payload_size, NULL);
+
+    // The pseudo-header checksum was calculated on the transport length of the original IPv4
+    // packet that we were asked to translate. This transport length is 20 bytes smaller than it
+    // needs to be, because the ICMP error contains an IPv4 header, which we will be translating to
+    // an IPv6 header, which is 20 bytes longer. Fix it up here.
+    // We only need to do this for ICMP->ICMPv6, not ICMPv6->ICMP, because ICMP does not use the
+    // pseudo-header when calculating its checksum (as the IPv4 header has its own checksum).
+    checksum = checksum + htons(20);
+	icmp6_targ->icmp6_cksum = 0;  // Checksum field must be 0 when calculating checksum.
+	icmp6_targ->icmp6_cksum = packet_checksum(checksum, out, pos);
+  } else if (icmp6_type == ICMP6_ECHO_REQUEST || icmp6_type == ICMP6_ECHO_REPLY) {
+    // Ping packet.
+    icmp6_targ->icmp6_id = icmp->un.echo.id;
+    icmp6_targ->icmp6_seq = icmp->un.echo.sequence;
+    out[CLAT_POS_PAYLOAD].iov_base = (uint8_t *) payload;
+    out[CLAT_POS_PAYLOAD].iov_len = payload_size;
+    clat_packet_len = CLAT_POS_PAYLOAD + 1;
+	if(icmp6_type == ICMP6_ECHO_REQUEST){
+		icmp6_targ->icmp6_cksum = ip_checksum_adjust(icmp->checksum, ICMP_ECHO, ip_checksum_add(checksum, &icmp6_type, 1));
+	} else {
+		icmp6_targ->icmp6_cksum = ip_checksum_adjust(icmp->checksum, ICMP_ECHOREPLY, ip_checksum_add(checksum, &icmp6_type, 1));
+	}
+  } else {
+    // Unknown type/code. The type/code conversion functions have already logged an error.
+    return 0;
+  }
+
+
+  return clat_packet_len;
+}
+
+/* function: icmp6_to_icmp
+ * translate ipv6 icmp to ipv4 icmp
+ * out          - output packet
+ * icmp6        - source packet icmp6 header
+ * payload      - icmp6 payload
+ * payload_size - size of payload
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int icmp6_to_icmp(clat_packet out, clat_packet_index pos, const struct icmp6_hdr *icmp6,
+                  uint32_t checksum, const uint8_t *payload, size_t payload_size) {
+  struct icmphdr *icmp_targ = out[pos].iov_base;
+  uint8_t icmp_type;
+  int clat_packet_len;
+
+  memset(icmp_targ, 0, sizeof(struct icmphdr));
+
+  icmp_type = icmp6_to_icmp_type(icmp6->icmp6_type, icmp6->icmp6_code);
+  icmp_targ->type = icmp_type;
+  icmp_targ->code = icmp6_to_icmp_code(icmp6->icmp6_type, icmp6->icmp6_code);
+
+  out[pos].iov_len = sizeof(struct icmphdr);
+
+  if (pos == CLAT_POS_TRANSPORTHDR &&
+      is_icmp6_error(icmp6->icmp6_type) &&
+      icmp_type != ICMP_PARAMETERPROB) {
+    // An ICMPv6 error we understand, one level deep.
+    // Translate the nested packet (the one that caused the error).
+    clat_packet_len = ipv6_packet(out, pos + 1, payload, payload_size, NULL);
+	icmp_targ->checksum = 0;  // Checksum field must be 0 when calculating checksum.
+	icmp_targ->checksum = packet_checksum(0, out, pos);
+  } else if (icmp_type == ICMP_ECHO || icmp_type == ICMP_ECHOREPLY) {
+    // Ping packet.
+    icmp_targ->un.echo.id = icmp6->icmp6_id;
+    icmp_targ->un.echo.sequence = icmp6->icmp6_seq;
+    out[CLAT_POS_PAYLOAD].iov_base = (uint8_t *) payload;
+    out[CLAT_POS_PAYLOAD].iov_len = payload_size;
+    clat_packet_len = CLAT_POS_PAYLOAD + 1;
+	if(icmp_type == ICMP_ECHO){
+		uint8_t icmp6_type = ICMP6_ECHO_REQUEST;
+		icmp_targ->checksum = ip_checksum_adjust(icmp6->icmp6_cksum, ip_checksum_add(checksum, &icmp6_type, 1), ICMP_ECHO);
+	} else {
+		uint8_t icmp6_type = ICMP6_ECHO_REPLY;
+		icmp_targ->checksum = ip_checksum_adjust(icmp6->icmp6_cksum, ip_checksum_add(checksum, &icmp6_type, 1), ICMP_ECHOREPLY);
+	}
+  } else {
+      // Unknown type/code. The type/code conversion functions have already logged an error.
+    return 0;
+  }
+
+
+  return clat_packet_len;
+}
+
+/* function: generic_packet
+ * takes a generic IP packet and sets it up for translation
+ * out      - output packet
+ * pos      - position in the output packet of the transport header
+ * payload  - pointer to IP payload
+ * len      - size of ip payload
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int generic_packet(clat_packet out, clat_packet_index pos, const uint8_t *payload, size_t len) {
+  out[pos].iov_len = 0;
+  out[CLAT_POS_PAYLOAD].iov_base = (uint8_t *) payload;
+  out[CLAT_POS_PAYLOAD].iov_len = len;
+
+  return CLAT_POS_PAYLOAD + 1;
+}
+
+/* function: udp_packet
+ * takes a udp packet and sets it up for translation
+ * out      - output packet
+ * udp      - pointer to udp header in packet
+ * old_sum  - pseudo-header checksum of old header
+ * new_sum  - pseudo-header checksum of new header
+ * len      - size of ip payload
+ */
+int udp_packet(clat_packet out, clat_packet_index pos, const struct udphdr *udp,
+               uint32_t old_sum, uint32_t new_sum, size_t len) {
+  const uint8_t *payload;
+  size_t payload_size;
+
+  if(len < sizeof(struct udphdr)) {
+    logmsg_dbg(ANDROID_LOG_ERROR,"udp_packet/(too small)");
+    return 0;
+  }
+
+  payload = (const uint8_t *) (udp + 1);
+  payload_size = len - sizeof(struct udphdr);
+
+  return udp_translate(out, pos, udp, old_sum, new_sum, payload, payload_size);
+}
+
+/* function: tcp_packet
+ * takes a tcp packet and sets it up for translation
+ * out      - output packet
+ * tcp      - pointer to tcp header in packet
+ * checksum - pseudo-header checksum
+ * len      - size of ip payload
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int tcp_packet(clat_packet out, clat_packet_index pos, const struct tcphdr *tcp,
+               uint32_t old_sum, uint32_t new_sum, size_t len) {
+  const uint8_t *payload;
+  size_t payload_size, header_size;
+
+  if(len < sizeof(struct tcphdr)) {
+    logmsg_dbg(ANDROID_LOG_ERROR,"tcp_packet/(too small)");
+    return 0;
+  }
+
+  if(tcp->doff < 5) {
+    logmsg_dbg(ANDROID_LOG_ERROR,"tcp_packet/tcp header length set to less than 5: %x", tcp->doff);
+    return 0;
+  }
+
+  if((size_t) tcp->doff*4 > len) {
+    logmsg_dbg(ANDROID_LOG_ERROR,"tcp_packet/tcp header length set too large: %x", tcp->doff);
+    return 0;
+  }
+
+  header_size = tcp->doff * 4;
+  payload = ((const uint8_t *) tcp) + header_size;
+  payload_size = len - header_size;
+
+  return tcp_translate(out, pos, tcp, header_size, old_sum, new_sum, payload, payload_size);
+}
+
+/* function: udp_translate
+ * common between ipv4/ipv6 - setup checksum and send udp packet
+ * out          - output packet
+ * udp          - udp header
+ * old_sum      - pseudo-header checksum of old header
+ * new_sum      - pseudo-header checksum of new header
+ * payload      - tcp payload
+ * payload_size - size of payload
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int udp_translate(clat_packet out, clat_packet_index pos, const struct udphdr *udp,
+                  uint32_t old_sum, uint32_t new_sum, const uint8_t *payload, size_t payload_size) {
+  struct udphdr *udp_targ = out[pos].iov_base;
+
+  memcpy(udp_targ, udp, sizeof(struct udphdr));
+
+  out[pos].iov_len = sizeof(struct udphdr);
+  out[CLAT_POS_PAYLOAD].iov_base = (uint8_t *) payload;
+  out[CLAT_POS_PAYLOAD].iov_len = payload_size;
+
+  if (udp_targ->check) {
+    udp_targ->check = ip_checksum_adjust(udp->check, old_sum, new_sum);
+  } else {
+    // Zero checksums are special. RFC 768 says, "An all zero transmitted checksum value means that
+    // the transmitter generated no checksum (for debugging or for higher level protocols that
+    // don't care)." However, in IPv6 zero UDP checksums were only permitted by RFC 6935 (2013). So
+    // for safety we recompute it.
+    udp_targ->check = 0;  // Checksum field must be 0 when calculating checksum.
+    udp_targ->check = packet_checksum(new_sum, out, pos);
+  }
+
+  // RFC 768: "If the computed checksum is zero, it is transmitted as all ones (the equivalent
+  // in one's complement arithmetic)."
+  if (!udp_targ->check) {
+    udp_targ->check = 0xffff;
+  }
+
+  return CLAT_POS_PAYLOAD + 1;
+}
+
+/* function: tcp_translate
+ * common between ipv4/ipv6 - setup checksum and send tcp packet
+ * out          - output packet
+ * tcp          - tcp header
+ * header_size  - size of tcp header including options
+ * checksum     - partial checksum covering ipv4/ipv6 header
+ * payload      - tcp payload
+ * payload_size - size of payload
+ * returns: the highest position in the output clat_packet that's filled in
+ */
+int tcp_translate(clat_packet out, clat_packet_index pos, const struct tcphdr *tcp,
+                  size_t header_size, uint32_t old_sum, uint32_t new_sum,
+                  const uint8_t *payload, size_t payload_size) {
+  struct tcphdr *tcp_targ = out[pos].iov_base;
+  out[pos].iov_len = header_size;
+
+  if (header_size > MAX_TCP_HDR) {
+    // A TCP header cannot be more than MAX_TCP_HDR bytes long because it's a 4-bit field that
+    // counts in 4-byte words. So this can never happen unless there is a bug in the caller.
+    logmsg(ANDROID_LOG_ERROR, "tcp_translate: header too long %d > %d, truncating",
+           header_size, MAX_TCP_HDR);
+    header_size = MAX_TCP_HDR;
+  }
+
+  memcpy(tcp_targ, tcp, header_size);
+
+  out[CLAT_POS_PAYLOAD].iov_base = (uint8_t *) payload;
+  out[CLAT_POS_PAYLOAD].iov_len = payload_size;
+
+  tcp_targ->check = ip_checksum_adjust(tcp->check, old_sum, new_sum);
+
+  return CLAT_POS_PAYLOAD + 1;
+}
+
+// Weak symbol so we can override it in the unit test.
+void send_rawv6(int fd, clat_packet out, int iov_len) __attribute__((weak));
+
+void send_rawv6(int fd, clat_packet out, int iov_len) {
+  // A send on a raw socket requires a destination address to be specified even if the socket's
+  // protocol is IPPROTO_RAW. This is the address that will be used in routing lookups; the
+  // destination address in the packet header only affects what appears on the wire, not where the
+  // packet is sent to.
+  static struct sockaddr_in6 sin6 = { AF_INET6, 0, 0, { { { 0, 0, 0, 0 } } }, 0 };
+  static struct msghdr msg = {
+    .msg_name = &sin6,
+    .msg_namelen = sizeof(sin6),
+  };
+
+  msg.msg_iov = out,
+  msg.msg_iovlen = iov_len,
+  sin6.sin6_addr = ((struct ip6_hdr *) out[CLAT_POS_IPHDR].iov_base)->ip6_dst;
+  sendmsg(fd, &msg, 0);
+}
+
+/* function: translate_packet
+ * takes a packet, translates it, and writes it to fd
+ * fd         - fd to write translated packet to
+ * to_ipv6    - true if translating to ipv6, false if translating to ipv4
+ * packet     - packet
+ * packetsize - size of packet
+ */
+void translate_packet(int fd, int to_ipv6, const uint8_t *packet, size_t packetsize) {
+  int iov_len = 0;
+
+  // Allocate buffers for all packet headers.
+  struct clat_icmp_frag icmp_frag = {0};
+  struct tun_pi tun_targ;
+  char iphdr[sizeof(struct ip6_hdr)];
+  char fraghdr[sizeof(struct ip6_frag)];
+  char transporthdr[MAX_TCP_HDR];
+  char icmp_iphdr[sizeof(struct ip6_hdr)];
+  char icmp_fraghdr[sizeof(struct ip6_frag)];
+  char icmp_transporthdr[MAX_TCP_HDR];
+
+  // iovec of the packets we'll send. This gets passed down to the translation functions.
+  clat_packet out = {
+    { &tun_targ, 0 },                 // Tunnel header.
+    { iphdr, 0 },                     // IP header.
+    { fraghdr, 0 },                   // Fragment header.
+    { transporthdr, 0 },              // Transport layer header.
+    { icmp_iphdr, 0 },                // ICMP error inner IP header.
+    { icmp_fraghdr, 0 },              // ICMP error fragmentation header.
+    { icmp_transporthdr, 0 },         // ICMP error transport layer header.
+    { NULL, 0 },                      // Payload. No buffer, it's a pointer to the original payload.
+  };
+
+  if (to_ipv6) {
+    iov_len = ipv4_packet(out, CLAT_POS_IPHDR, packet, packetsize, &icmp_frag);
+    if (iov_len > 0) {
+		if(icmp_frag.flag == 1){
+			clat_packet_copy(out, icmp_frag.data);
+			icmp_frag.iov_len = iov_len;
+			icmp_frag.time = time(NULL);
+			clat_icmp_frag_add(&icmp_frag);
+			return;
+		} else if(icmp_frag.flag == 2){
+			unsigned short total_len = icmp_frag.ip_len;
+			struct icmp6_hdr *icmp6_targ;
+			clat_icmp_frag_find(&icmp_frag);
+			icmp6_targ = icmp_frag.data[CLAT_POS_TRANSPORTHDR].iov_base;
+			icmp6_targ->icmp6_cksum = htons(ip_checksum_adjust(htons(icmp6_targ->icmp6_cksum), icmp_frag.ip_len, total_len));
+			send_rawv6(fd, icmp_frag.data, icmp_frag.iov_len);
+			clat_packet_free(icmp_frag.data);
+		}
+      send_rawv6(fd, out, iov_len);
+    }
+  } else {
+    iov_len = ipv6_packet(out, CLAT_POS_IPHDR, packet, packetsize, &icmp_frag);
+    if (iov_len > 0) {
+      fill_tun_header(&tun_targ, ETH_P_IP);
+      out[CLAT_POS_TUNHDR].iov_len = sizeof(tun_targ);
+		if(icmp_frag.flag == 1){
+			clat_packet_copy(out, icmp_frag.data);
+			icmp_frag.iov_len = iov_len;
+			icmp_frag.time = time(NULL);
+			clat_icmp_frag_add(&icmp_frag);
+			return;
+		} else if(icmp_frag.flag == 2){
+			unsigned short total_len = icmp_frag.ip_len;
+			struct icmphdr *icmp_targ;
+			clat_icmp_frag_find(&icmp_frag);
+			icmp_targ = icmp_frag.data[CLAT_POS_TRANSPORTHDR].iov_base;
+			icmp_targ->checksum = htons(ip_checksum_adjust(htons(icmp_targ->checksum), total_len , icmp_frag.ip_len));
+			send_tun(fd, icmp_frag.data, icmp_frag.iov_len);
+			clat_packet_free(icmp_frag.data);
+		}
+      send_tun(fd, out, iov_len);
+    }
+  }
+}
diff --git a/ap/app/clatd/translate.h b/ap/app/clatd/translate.h
new file mode 100755
index 0000000..e7ee19a
--- /dev/null
+++ b/ap/app/clatd/translate.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2011 Daniel Drown
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * translate.h - translate from one version of ip to another
+ */
+#ifndef __TRANSLATE_H__
+#define __TRANSLATE_H__
+
+#include <netinet/in.h>
+#include <netinet/ip.h>
+//#include <netinet/ip_icmp.h>
+#include <netinet/udp.h>
+#include <netinet/tcp.h>
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
+#include <linux/icmp.h>
+#include <linux/if_tun.h>
+
+#include "clatd.h"
+
+#define MAX_TCP_HDR (15 * 4)   // Data offset field is 4 bits and counts in 32-bit words.
+
+// Calculates the checksum over all the packet components starting from pos.
+uint16_t packet_checksum(uint32_t checksum, clat_packet packet, clat_packet_index pos);
+
+// Returns the total length of the packet components after pos.
+uint16_t packet_length(clat_packet packet, clat_packet_index pos);
+
+// Returns true iff the given IPv6 address is in the plat subnet.
+int is_in_plat_subnet(const struct in6_addr *addr6);
+
+// Functions to create tun, IPv4, and IPv6 headers.
+void fill_tun_header(struct tun_pi *tun_header, uint16_t proto);
+void fill_ip_header(struct iphdr *ip_targ, uint16_t payload_len, uint8_t protocol,
+                    const struct ip6_hdr *old_header);
+void fill_ip6_header(struct ip6_hdr *ip6, uint16_t payload_len, uint8_t protocol,
+                     const struct iphdr *old_header);
+
+// Translate and send packets.
+void translate_packet(int fd, int to_ipv6, const uint8_t *packet, size_t packetsize);
+
+// Translate IPv4 and IPv6 packets.
+int ipv4_packet(clat_packet out, clat_packet_index pos, const uint8_t *packet, size_t len, struct clat_icmp_frag *icmp_frag);
+int ipv6_packet(clat_packet out, clat_packet_index pos, const uint8_t *packet, size_t len, struct clat_icmp_frag *icmp_frag);
+
+// Deal with fragmented packets.
+size_t maybe_fill_frag_header(struct ip6_frag *frag_hdr, struct ip6_hdr *ip6_targ,
+                              const struct iphdr *old_header);
+uint8_t parse_frag_header(const struct ip6_frag *frag_hdr, struct iphdr *ip_targ);
+
+// Deal with fragmented packets.
+size_t maybe_fill_frag_header(struct ip6_frag *frag_hdr, struct ip6_hdr *ip6_targ,
+                              const struct iphdr *old_header);
+uint8_t parse_frag_header(const struct ip6_frag *frag_hdr, struct iphdr *ip_targ);
+
+// Translate ICMP packets.
+int icmp_to_icmp6(clat_packet out, clat_packet_index pos, const struct icmphdr *icmp,
+                  uint32_t checksum, const uint8_t *payload, size_t payload_size);
+int icmp6_to_icmp(clat_packet out, clat_packet_index pos, const struct icmp6_hdr *icmp6,
+                  uint32_t checksum, const uint8_t *payload, size_t payload_size);
+
+// Translate generic IP packets.
+int generic_packet(clat_packet out, clat_packet_index pos, const uint8_t *payload, size_t len);
+
+// Translate TCP and UDP packets.
+int tcp_packet(clat_packet out, clat_packet_index pos, const struct tcphdr *tcp,
+               uint32_t old_sum, uint32_t new_sum, size_t len);
+int udp_packet(clat_packet out, clat_packet_index pos, const struct udphdr *udp,
+               uint32_t old_sum, uint32_t new_sum, size_t len);
+
+int tcp_translate(clat_packet out, clat_packet_index pos, const struct tcphdr *tcp,
+                  size_t header_size, uint32_t old_sum, uint32_t new_sum,
+                  const uint8_t *payload, size_t payload_size);
+int udp_translate(clat_packet out, clat_packet_index pos, const struct udphdr *udp,
+                  uint32_t old_sum, uint32_t new_sum,
+                  const uint8_t *payload, size_t payload_size);
+
+#endif /* __TRANSLATE_H__ */
diff --git a/ap/app/clatd/tun.c b/ap/app/clatd/tun.c
new file mode 100755
index 0000000..7e62e44
--- /dev/null
+++ b/ap/app/clatd/tun.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * tun.c - tun device functions
+ */
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+//#include <linux/if.h>
+#include <net/if.h>
+#include <linux/if_tun.h>
+#include <sys/ioctl.h>
+#include <sys/uio.h>
+
+#include "clatd.h"
+
+/* function: tun_open
+ * tries to open the tunnel device
+ */
+int tun_open() {
+  int fd;
+
+  fd = open("/dev/tun", O_RDWR);
+  if(fd < 0) {
+    fd = open("/dev/net/tun", O_RDWR);
+  }
+
+  return fd;
+}
+
+/* function: tun_alloc
+ * creates a tun interface and names it
+ * dev - the name for the new tun device
+ */
+int tun_alloc(char *dev, int fd) {
+  struct ifreq ifr;
+  int err;
+
+  memset(&ifr, 0, sizeof(ifr));
+
+  ifr.ifr_flags = IFF_TUN;
+  if( *dev ) {
+    strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+    ifr.ifr_name[IFNAMSIZ-1] = '\0';
+  }
+
+  if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
+    close(fd);
+    return err;
+  }
+  strcpy(dev, ifr.ifr_name);
+  return 0;
+}
+
+/* function: set_nonblocking
+ * sets a filedescriptor to non-blocking mode
+ * fd - the filedescriptor
+ * returns: 0 on success, -1 on failure
+ */
+int set_nonblocking(int fd) {
+  int flags = fcntl(fd, F_GETFL);
+  if (flags == -1) {
+    return flags;
+  }
+  return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+}
+
+/* function: send_tun
+ * sends a clat_packet to a tun interface
+ * fd      - the tun filedescriptor
+ * out     - the packet to send
+ * iov_len - the number of entries in the clat_packet
+ * returns: number of bytes read on success, -1 on failure
+ */
+int send_tun(int fd, clat_packet out, int iov_len) {
+  return writev(fd, out, iov_len);
+}
diff --git a/ap/app/clatd/tun.h b/ap/app/clatd/tun.h
new file mode 100755
index 0000000..bcdd10e
--- /dev/null
+++ b/ap/app/clatd/tun.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * tun.h - tun device functions
+ */
+#ifndef __TUN_H__
+#define __TUN_H__
+
+#include <linux/if.h>
+
+#include "clatd.h"
+#include "ring.h"
+
+struct tun_data {
+  char device4[IFNAMSIZ];
+  int read_fd6, write_fd6, fd4;
+  struct packet_ring ring;
+};
+
+int tun_open();
+int tun_alloc(char *dev, int fd);
+int send_tun(int fd, clat_packet out, int iov_len);
+int set_nonblocking(int fd);
+
+#endif
diff --git a/ap/app/hostapd-2.10/hostapd/libwpa_client.a b/ap/app/hostapd-2.10/hostapd/libwpa_client.a
index b664b76..d8e124f 100755
--- a/ap/app/hostapd-2.10/hostapd/libwpa_client.a
+++ b/ap/app/hostapd-2.10/hostapd/libwpa_client.a
Binary files differ
diff --git a/ap/app/include/cfg_api.h b/ap/app/include/cfg_api.h
index 8021365..2adb172 100755
--- a/ap/app/include/cfg_api.h
+++ b/ap/app/include/cfg_api.h
@@ -65,7 +65,7 @@
  * @note
  * @warning
  */
-int sc_cfg_unset(char *name);
+//int sc_cfg_unset(char *name);
 
 /**
  * @brief Çå¿ÕÈ«²¿×ֶδ洢ÐÅÏ¢
@@ -103,7 +103,7 @@
 #ifndef LIBNVRAM_API_NEW
 int cfg_get_item(char *name, char *buf, int bufLen);
 int cfg_set(char *name, char *value);
-int cfg_unset(char *name);
+//int cfg_unset(char *name);
 int cfg_reset(void);
 int cfg_show(void);
 int cfg_save(void);
diff --git a/ap/app/wpa_supplicant-2.10/wpa_supplicant/libwpa_client.a b/ap/app/wpa_supplicant-2.10/wpa_supplicant/libwpa_client.a
index cdb31c7..65054c5 100755
--- a/ap/app/wpa_supplicant-2.10/wpa_supplicant/libwpa_client.a
+++ b/ap/app/wpa_supplicant-2.10/wpa_supplicant/libwpa_client.a
Binary files differ
diff --git a/ap/app/zte_comm/at_ctl/src/atctrl/at_com.c b/ap/app/zte_comm/at_ctl/src/atctrl/at_com.c
index 7811261..ad15adc 100755
--- a/ap/app/zte_comm/at_ctl/src/atctrl/at_com.c
+++ b/ap/app/zte_comm/at_ctl/src/atctrl/at_com.c
@@ -626,15 +626,12 @@
 	struct at_channel_info * at_chan = at_context_find_chn_by_fd(fd);

 	while(left_len > 0)

 	{

-		resendcnt++;

 		written_bytes = write(fd, pstr, left_len);	

 		if(written_bytes <= 0)

 		{

-			if(written_bytes == 0){

-				at_print(AT_ERR,"====>at_sys_write written_bytes=0, fd=%d\n", fd);

-				return 0;

-			}

-			else if(at_chan && at_chan->attribution & (1<<CH_COMM))

+			resendcnt++;

+			//ºË¼äͨµÀдʧ°Ü£¬ÖØ·¢

+			if(at_chan && at_chan->attribution & (1<<CH_COMM))

 			{	

 				if(resendcnt > 10)

 				{

@@ -657,7 +654,11 @@
 		}

 		left_len -=written_bytes;

 		pstr += written_bytes;

-

+		if(resendcnt > 10)

+		{

+			at_print(AT_ERR,"at_sys_write fd=%d len=%d left=%d curr=%d err_no=%d \n", fd, len, left_len, written_bytes, errno);

+			return len - left_len;

+		}

 		if(left_len > 0)

 		{

 			usleep(100 * 1000);

diff --git a/ap/app/zte_comm/nvserver/nvserver.c b/ap/app/zte_comm/nvserver/nvserver.c
index 1e96da1..eb0e6d4 100755
--- a/ap/app/zte_comm/nvserver/nvserver.c
+++ b/ap/app/zte_comm/nvserver/nvserver.c
@@ -31,73 +31,75 @@
 file,char*key,char*value);static int nvunset(char*file,char*key);static int 
 nvclear(char*file);static int nvreset(char*file);static int nvcommit(char*file);
 T_NV_NODE*nv_list;int nvserver_main(int argc,char*argv[]){int msgId=
-(0x18f3+603-0x1b4e);T_NV_MSG_INFO rcvBuf;T_NV_MSG_RESULT sndBuf;struct msqid_ds 
-msgInfo;prctl(PR_SET_NAME,"\x6e\x76\x73\x65\x72\x76\x65\x72",(0x17c+7964-0x2098)
-,(0x1b2+3384-0xeea),(0x1b33+42-0x1b5d));memset(&rcvBuf,(0xfe5+3425-0x1d46),
-sizeof(rcvBuf));memset(&sndBuf,(0x49f+3594-0x12a9),sizeof(sndBuf));memset(&
-msgInfo,(0x596+5416-0x1abe),sizeof(msgInfo));msgId=msgget(MODULE_ID_NV,IPC_CREAT
-|(0xb41+1212-0xe7d));if(-(0xb8b+3681-0x19eb)==msgId){printf(
+(0x168b+107-0x16f6);T_NV_MSG_INFO rcvBuf;T_NV_MSG_RESULT sndBuf;struct msqid_ds 
+msgInfo;prctl(PR_SET_NAME,"\x6e\x76\x73\x65\x72\x76\x65\x72",
+(0x136b+1572-0x198f),(0x48d+6462-0x1dcb),(0xdb2+3219-0x1a45));memset(&rcvBuf,
+(0x831+7846-0x26d7),sizeof(rcvBuf));memset(&sndBuf,(0xfea+4708-0x224e),sizeof(
+sndBuf));memset(&msgInfo,(0x715+3909-0x165a),sizeof(msgInfo));msgId=msgget(
+MODULE_ID_NV,IPC_CREAT|(0x6d7+5925-0x1c7c));if(-(0x1148+4886-0x245d)==msgId){
+printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x6d\x73\x67\x67\x65\x74\x20\x6d\x73\x67\x49\x64\x20\x66\x61\x69\x6c\x2c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
-,errno);return-(0x74c+3721-0x15d4);}if(-(0x1956+1177-0x1dee)!=msgctl(msgId,
-IPC_STAT,&msgInfo)){msgInfo.msg_qbytes=262144;if(-(0x638+2633-0x1080)==msgctl(
+,errno);return-(0x44d+3091-0x105f);}if(-(0x1651+4142-0x267e)!=msgctl(msgId,
+IPC_STAT,&msgInfo)){msgInfo.msg_qbytes=262144;if(-(0xc46+6228-0x2499)==msgctl(
 msgId,IPC_SET,&msgInfo))printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x6d\x73\x67\x63\x74\x6c\x20\x6d\x73\x67\x49\x64\x20\x66\x61\x69\x6c\x2c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
-,errno);}if(nvDirInit()!=(0x922+2462-0x12c0)){printf(
+,errno);}if(nvDirInit()!=(0xcfa+6617-0x26d3)){printf(
 "\x6e\x76\x44\x69\x72\x49\x6e\x69\x74\x20\x66\x61\x69\x6c\x65\x21" "\n");return-
-(0x5ca+6642-0x1fbb);}nvConfig();nvInit();while((0x5ea+2487-0xfa0)){if(-
-(0xb2+4408-0x11e9)==msgrcv(msgId,&rcvBuf,sizeof(T_NV_MSG_INFO)-sizeof(long),
-MSG_TYPE_NV,(0x1879+2826-0x2383))){printf(
+(0x245+6777-0x1cbd);}nvConfig();nvInit();while((0x1e44+1924-0x25c7)){if(-
+(0x91f+1796-0x1022)==msgrcv(msgId,&rcvBuf,sizeof(T_NV_MSG_INFO)-sizeof(long),
+MSG_TYPE_NV,(0x120f+1370-0x1769))){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6d\x73\x67\x72\x63\x76\x20\x66\x61\x69\x6c\x2c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
-,errno);continue;}analyMsg(&rcvBuf,&sndBuf);if(-(0x4c9+939-0x873)==msgsnd(msgId,
-&sndBuf,sizeof(T_NV_MSG_RESULT)-sizeof(long),(0x9c9+5912-0x20e1))){printf(
+,errno);continue;}analyMsg(&rcvBuf,&sndBuf);if(-(0x13fc+1227-0x18c6)==msgsnd(
+msgId,&sndBuf,sizeof(T_NV_MSG_RESULT)-sizeof(long),(0x220f+1085-0x264c))){printf
+(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6d\x73\x67\x73\x6e\x64\x20\x66\x61\x69\x6c\x2c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
-,errno);continue;}}return((0x51d+4365-0x162a));}static void configdir(char*dir){
+,errno);continue;}}return((0xa4f+3064-0x1647));}static void configdir(char*dir){
 DIR*dp;int ret;struct dirent*entry;struct stat statbuf;if((dp=opendir(dir))==
 NULL){fprintf(stderr,
 "\x63\x61\x6e\x6e\x6f\x74\x20\x6f\x70\x65\x6e\x20\x64\x69\x72\x65\x63\x74\x6f\x72\x79\x3a\x20\x25\x73" "\n"
 ,dir);return;}chdir(dir);while((entry=readdir(dp))!=NULL){ret=lstat(entry->
-d_name,&statbuf);if(ret<(0x23b5+574-0x25f3)){fprintf(stderr,
+d_name,&statbuf);if(ret<(0x78d+6564-0x2131)){fprintf(stderr,
 "\x6c\x73\x74\x61\x74\x20\x65\x72\x72\x6f\x72\x3a\x20\x25\x73" "\n",strerror(
 errno));chdir("\x2e\x2e");closedir(dp);return;}if(!S_ISDIR(statbuf.st_mode)){if(
-strcmp("\x2e",entry->d_name)==(0x6a8+3535-0x1477)||strcmp("\x2e\x2e",entry->
-d_name)==(0xbc2+2073-0x13db))continue;if(!isNvConfiged(entry->d_name)){if(
+strcmp("\x2e",entry->d_name)==(0x10d6+165-0x117b)||strcmp("\x2e\x2e",entry->
+d_name)==(0x1e86+1040-0x2296))continue;if(!isNvConfiged(entry->d_name)){if(
 addConfigFile(entry->d_name,NULL)!=RESULT_SUCCESS)printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x63\x6f\x6e\x66\x69\x67\x20\x25\x73\x20\x65\x72\x72\x6f\x72\x21" "\n"
 ,entry->d_name);}}}chdir("\x2e\x2e");closedir(dp);}static void nvConfig(){char*
-val=NULL;FILE*fp=NULL;char buf[NV_MAX_CONFIG_LEN]={(0x71b+4664-0x1953)};fp=fopen
-(NV_CONFIG_FILE,"\x72\x6f");if(!fp){printf(
+val=NULL;FILE*fp=NULL;char buf[NV_MAX_CONFIG_LEN]={(0x4a9+2613-0xede)};fp=fopen(
+NV_CONFIG_FILE,"\x72\x6f");if(!fp){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x6f\x70\x65\x6e\x20\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
 ,NV_CONFIG_FILE,errno);return;}while(fgets(buf,NV_MAX_CONFIG_LEN,fp)){if(buf[
-(0xadc+1540-0x10e0)]=='\n'||buf[(0x237+3452-0xfb3)]==((char)(0xd14+1114-0x114b))
-)continue;val=strchr(buf,((char)(0x69d+6638-0x204e)));if(!val){printf(
+(0x21d7+1286-0x26dd)]=='\n'||buf[(0x3e1+5008-0x1771)]==
+((char)(0x1aa+3373-0xeb4)))continue;val=strchr(buf,((char)(0x7bd+601-0x9d9)));if
+(!val){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x6f\x72\x6d\x61\x74\x20\x65\x72\x72\x6f\x72\x3a\x20\x73\x74\x72\x20\x3d\x20\x25\x73\x21" "\n"
-,NV_CONFIG_FILE,buf);continue;}buf[strlen(buf)-(0x516+6614-0x1eeb)]='\0';*val++=
+,NV_CONFIG_FILE,buf);continue;}buf[strlen(buf)-(0xe7+8054-0x205c)]='\0';*val++=
 '\0';if(!isCfgConfiged(buf)){if(addConfigFile(val,buf)!=RESULT_SUCCESS)printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x63\x6f\x6e\x66\x69\x67\x20\x25\x73\x20\x65\x72\x72\x6f\x72\x21" "\n"
 ,buf);}}fclose(fp);configdir(NV_FS_MAIN_PATH);}static int nvDirInit(){if(access(
-NV_FS_PATH,F_OK)!=(0x862+6253-0x20cf)){if(mkdir(NV_FS_PATH,(0x6da+6986-0x2037))
-!=(0x7a0+2567-0x11a7)){printf(
+NV_FS_PATH,F_OK)!=(0x69a+6955-0x21c5)){if(mkdir(NV_FS_PATH,(0x116d+658-0x1212))
+!=(0xc5b+2260-0x152f)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_PATH,errno);return-(0x116d+2075-0x1987);}if(mkdir(NV_FS_MAIN_PATH,
-(0x989+7455-0x24bb))!=(0x4b5+7496-0x21fd)){printf(
+,NV_FS_PATH,errno);return-(0xbfb+1309-0x1117);}if(mkdir(NV_FS_MAIN_PATH,
+(0x564+8610-0x2519))!=(0x17e5+1992-0x1fad)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_MAIN_PATH,errno);return-(0x19fb+224-0x1ada);}if(mkdir(NV_FS_BACKUP_PATH,
-(0x156c+2000-0x1b4f))!=(0xc4+9751-0x26db)){printf(
+,NV_FS_MAIN_PATH,errno);return-(0x13fb+1266-0x18ec);}if(mkdir(NV_FS_BACKUP_PATH,
+(0x7b5+4152-0x1600))!=(0x7df+956-0xb9b)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_BACKUP_PATH,errno);return-(0xffc+1393-0x156c);}}else{if(access(
-NV_FS_MAIN_PATH,F_OK)!=(0xbf3+4426-0x1d3d)){if(mkdir(NV_FS_MAIN_PATH,
-(0xa28+4-0x83f))!=(0x3ca+3818-0x12b4)){printf(
+,NV_FS_BACKUP_PATH,errno);return-(0x1d38+1078-0x216d);}}else{if(access(
+NV_FS_MAIN_PATH,F_OK)!=(0x161b+1213-0x1ad8)){if(mkdir(NV_FS_MAIN_PATH,
+(0xeb3+77-0xd13))!=(0x110f+4883-0x2422)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_MAIN_PATH,errno);return-(0x3f+2678-0xab4);}}if(access(NV_FS_BACKUP_PATH,
-F_OK)!=(0x2000+1094-0x2446)){if(mkdir(NV_FS_BACKUP_PATH,(0x14b4+1007-0x16b6))!=
-(0xd04+4607-0x1f03)){printf(
+,NV_FS_MAIN_PATH,errno);return-(0x125c+989-0x1638);}}if(access(NV_FS_BACKUP_PATH
+,F_OK)!=(0x317+8741-0x253c)){if(mkdir(NV_FS_BACKUP_PATH,(0x828+6476-0x1f87))!=
+(0x466+2309-0xd6b)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_BACKUP_PATH,errno);return-(0x4cc+7388-0x21a7);}}}return
-(0x126f+2767-0x1d3e);}static void nvInit(){T_NV_NODE*list=NULL;char nvMainFile[
-NV_PATH_LEN]={(0xe69+885-0x11de)};char nvBackupFile[NV_PATH_LEN]={
-(0xa1b+5459-0x1f6e)};
+,NV_FS_BACKUP_PATH,errno);return-(0x4e7+2518-0xebc);}}}return(0x25b9+122-0x2633)
+;}static void nvInit(){T_NV_NODE*list=NULL;char nvMainFile[NV_PATH_LEN]={
+(0x20ab+1529-0x26a4)};char nvBackupFile[NV_PATH_LEN]={(0x13d5+2526-0x1db3)};
 #ifdef FOTA_AB
-T_FLAGS_INFO flags_info={(0x157d+1382-0x1ae3)};int ret=(0xc67+5925-0x238c);
+T_FLAGS_INFO flags_info={(0x1c53+23-0x1c6a)};int ret=(0x32f+7884-0x21fb);
 #endif
 for(list=nv_list;list;list=list->next){snprintf(nvMainFile,NV_PATH_LEN,
 "\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,list->nvFile);snprintf(nvBackupFile,
@@ -105,73 +107,73 @@
 nvMainFile)){if(!checkNvFs(nvBackupFile))restoreNvFs(nvBackupFile,nvMainFile);}
 else if(checkNvFs(nvBackupFile)){restoreNvFs(nvMainFile,nvBackupFile);}else{
 loadFactroyParam(list);nvcommit(list->nvFile);continue;}loadNvFs(list->nvFile);
-if(!strcmp(list->nvFile,NV_CFG)&&get_update_status()==(0x8ad+626-0xb1d)){
+if(!strcmp(list->nvFile,NV_CFG)&&get_update_status()==(0xa6d+5708-0x20b7)){
 reloadFactroyParam(list);delete_not_needed(list);nvcommit(list->nvFile);
 #ifdef FOTA_AB
 ret=flags_get(&flags_info);flags_info.boot_fota_flag.fota_status=
-(0x381+3675-0x11dc);ret=flags_set(&flags_info);
+(0xbfb+1777-0x12ec);ret=flags_set(&flags_info);
 #endif
-}}}uint hash(const char*s){uint hash=(0x4d3+2345-0xdfc);while(*s){hash=
+}}}uint hash(const char*s){uint hash=(0x3ac+3524-0x1170);while(*s){hash=
 NV_HASH_MUL*hash+*s++;}return hash;}static int loadFactroyParam(T_NV_NODE*list){
 char*val=NULL;FILE*fp=NULL;T_NV_CONFIG*config=NULL;char buf[NV_MAX_ITEM_LEN]={
-(0x861+3985-0x17f2)};for(config=list->fileList;config;config=config->next){fp=
+(0x484+2097-0xcb5)};for(config=list->fileList;config;config=config->next){fp=
 fopen(config->configFile,"\x72\x6f");if(!fp){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x6f\x70\x65\x6e\x20\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
 ,config->configFile,errno);return RESULT_FILE_OPEN_FAIL;}while(fgets(buf,
-NV_MAX_ITEM_LEN,fp)){if(buf[(0x14f0+680-0x1798)]=='\n'||buf[(0x1c3+1200-0x673)]
-==((char)(0x345+8945-0x2613)))continue;val=strchr(buf,
-((char)(0x1961+2653-0x2381)));if(!val){printf(
+NV_MAX_ITEM_LEN,fp)){if(buf[(0x94a+127-0x9c9)]=='\n'||buf[(0x16c3+2596-0x20e7)]
+==((char)(0xbd3+5756-0x222c)))continue;val=strchr(buf,
+((char)(0x14f2+3643-0x22f0)));if(!val){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x6f\x72\x6d\x61\x74\x20\x65\x72\x72\x6f\x72\x3a\x73\x74\x72\x69\x6e\x67\x20\x3d\x20\x25\x73" "\n"
-,config->configFile,buf);continue;}if(buf[strlen(buf)-(0xfbb+4254-0x2058)]=='\n'
-)buf[strlen(buf)-(0x46d+7913-0x2355)]='\0';*val++='\0';nvset(list->nvFile,buf,
-val,(0x118c+5421-0x26b8));}printf(
+,config->configFile,buf);continue;}if(buf[strlen(buf)-(0x1ce0+2146-0x2541)]==
+'\n')buf[strlen(buf)-(0xcc8+811-0xff2)]='\0';*val++='\0';nvset(list->nvFile,buf,
+val,(0x550+460-0x71b));}printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x25\x73\x21" "\n"
 ,config->configFile);fclose(fp);}return RESULT_SUCCESS;}static bool checkNvFs(
-char*file){int len=(0xc4c+2991-0x17fb);int cnt=(0x1104+958-0x14c2);FILE*fp=NULL;
-char*buf=NULL;struct stat statbuff={(0x1afc+2002-0x22ce)};if(stat(file,&statbuff
-)<(0x12d1+3330-0x1fd3))return false;len=statbuff.st_size;if(len<NV_CHECK_SIZE)
+char*file){int len=(0xc5b+5377-0x215c);int cnt=(0x1107+3957-0x207c);FILE*fp=NULL
+;char*buf=NULL;struct stat statbuff={(0x94c+4223-0x19cb)};if(stat(file,&statbuff
+)<(0x49d+2653-0xefa))return false;len=statbuff.st_size;if(len<NV_CHECK_SIZE)
 return false;fp=fopen(file,"\x72\x6f");if(!fp)return false;buf=(char*)malloc(len
-);if(!buf){fclose(fp);return false;}cnt=(0x1a8c+2886-0x25d2);while(cnt<len){cnt=
-cnt+fread(buf+cnt,(0x1b96+975-0x1f64),len-cnt,fp);if(ferror(fp)){clearerr(fp);
+);if(!buf){fclose(fp);return false;}cnt=(0x1b4+6081-0x1975);while(cnt<len){cnt=
+cnt+fread(buf+cnt,(0xd00+2097-0x1530),len-cnt,fp);if(ferror(fp)){clearerr(fp);
 free(buf);fclose(fp);return false;}}if(len!=cnt){free(buf);fclose(fp);return 
 false;}if(getSum(buf,len-NV_CHECK_SIZE)+NV_FILE_FLAG!=*(uint*)(buf+len-
 NV_CHECK_SIZE)){free(buf);fclose(fp);return false;}free(buf);fclose(fp);return 
 true;}static int copyfile(const char*from,const char*to){int fd_to;int fd_from;
-char buf[(0x14ba+4601-0x16b3)];ssize_t nread;int ret=-(0x165c+3363-0x237e);
-fd_from=open(from,O_RDONLY);if(fd_from<(0xa9d+1732-0x1161))return-
-(0x688+3633-0x14b7);fd_to=open(to,O_RDWR|O_CREAT|O_TRUNC|O_SYNC,
-(0x1fea+283-0x1f65));if(fd_to<(0xd16+3668-0x1b6a)){ret=-(0x1999+2606-0x23c4);
-goto out_error;}while((0x1308+2090-0x1b31)){char*out_ptr;ssize_t nwritten;nread=
-read(fd_from,buf,sizeof(buf));if(nread==(0x10e8+3398-0x1e2e)){break;}else{if(
-nread<(0x171+2782-0xc4f)){if(errno==EINTR||errno==EAGAIN){continue;}else{ret=-
-(0x7ca+6506-0x2130);goto out_error;}}}out_ptr=buf;do{nwritten=write(fd_to,
-out_ptr,nread);if(nwritten>(0x10a6+2317-0x19b3)){nread-=nwritten;out_ptr+=
-nwritten;}else{if(nwritten<(0x8fb+2056-0x1103)){if(errno==EINTR||errno==EAGAIN){
-continue;}else{ret=-(0x1b64+1017-0x1f58);goto out_error;}}}}while(nread>
-(0x1495+1492-0x1a69));}ret=fsync(fd_to);if(ret<(0x854+2878-0x1392)){printf(
+char buf[(0x146b+3404-0x11b7)];ssize_t nread;int ret=-(0x1722+499-0x1914);
+fd_from=open(from,O_RDONLY);if(fd_from<(0x211d+480-0x22fd))return-
+(0x1a14+2092-0x223e);fd_to=open(to,O_RDWR|O_CREAT|O_TRUNC|O_SYNC,
+(0x1b25+3271-0x264c));if(fd_to<(0x46c+1389-0x9d9)){ret=-(0x1976+3366-0x2699);
+goto out_error;}while((0x573+1183-0xa11)){char*out_ptr;ssize_t nwritten;nread=
+read(fd_from,buf,sizeof(buf));if(nread==(0xd83+3039-0x1962)){break;}else{if(
+nread<(0x1aef+1520-0x20df)){if(errno==EINTR||errno==EAGAIN){continue;}else{ret=-
+(0x1ab6+25-0x1acb);goto out_error;}}}out_ptr=buf;do{nwritten=write(fd_to,out_ptr
+,nread);if(nwritten>(0xcdf+3923-0x1c32)){nread-=nwritten;out_ptr+=nwritten;}else
+{if(nwritten<(0x10df+3459-0x1e62)){if(errno==EINTR||errno==EAGAIN){continue;}
+else{ret=-(0xe6b+3762-0x1d18);goto out_error;}}}}while(nread>(0x1aa5+150-0x1b3b)
+);}ret=fsync(fd_to);if(ret<(0xd91+5772-0x241d)){printf(
 "\x53\x79\x6e\x63\x20\x46\x61\x69\x6c\x65\x64\x3a\x25\x73\x2c\x20\x66\x69\x6c\x65\x20\x70\x61\x74\x68\x3a\x25\x73"
-,strerror(errno),to);goto out_error;}if(close(fd_to)<(0x16a1+3500-0x244d)){fd_to
-=-(0x18cd+1578-0x1ef6);ret=-(0x2330+772-0x262e);goto out_error;}close(fd_from);
-return(0x4b1+1400-0xa29);out_error:printf(
+,strerror(errno),to);goto out_error;}if(close(fd_to)<(0x92f+4689-0x1b80)){fd_to=
+-(0x165+405-0x2f9);ret=-(0xcad+2821-0x17ac);goto out_error;}close(fd_from);
+return(0x165c+3755-0x2507);out_error:printf(
 "\x63\x6f\x70\x79\x66\x69\x6c\x65\x20\x25\x73\x20\x74\x6f\x20\x25\x73\x20\x65\x72\x72\x6f\x72\x3a\x25\x64" "\n"
-,from,to,ret);close(fd_from);if(fd_to>=(0x3e4+1712-0xa94))close(fd_to);return 
-ret;}static int restoreNvFs(char*dstFile,char*srcFile){if(copyfile(srcFile,
-dstFile)!=(0x516+8438-0x260c))return RESULT_FAIL;return RESULT_SUCCESS;}static 
-int loadNvFs(char*file){int len=(0x1d4f+2199-0x25e6);int cnt=(0x811+2087-0x1038)
-;FILE*fp=NULL;char*buf=NULL;char*name=NULL;char*value=NULL;char*eq=NULL;struct 
-stat statbuff={(0x1913+3040-0x24f3)};char nvFile[NV_PATH_LEN]={
-(0x3c5+4050-0x1397)};sprintf(nvFile,"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,file)
-;if(stat(nvFile,&statbuff)<(0x1dcc+46-0x1dfa))return RESULT_FAIL;len=statbuff.
-st_size;if(NV_CHECK_SIZE>len)return RESULT_FAIL;fp=fopen(nvFile,"\x72\x6f");if(!
-fp)return RESULT_FILE_OPEN_FAIL;len=len-NV_CHECK_SIZE;buf=(char*)malloc(len+
-(0x4d5+6495-0x1e33));if(!buf){fclose(fp);return RESULT_MALLOC_FAIL;}memset(buf,
-(0x7aa+4280-0x1862),len+(0x191f+2874-0x2458));cnt=(0x162+8919-0x2439);while(cnt<
-len){cnt=cnt+fread(buf+cnt,(0xfd6+5620-0x25c9),len-cnt,fp);if(ferror(fp)){
+,from,to,ret);close(fd_from);if(fd_to>=(0x485+209-0x556))close(fd_to);return ret
+;}static int restoreNvFs(char*dstFile,char*srcFile){if(copyfile(srcFile,dstFile)
+!=(0xc56+3583-0x1a55))return RESULT_FAIL;return RESULT_SUCCESS;}static int 
+loadNvFs(char*file){int len=(0x1da+2584-0xbf2);int cnt=(0x2e4+6559-0x1c83);FILE*
+fp=NULL;char*buf=NULL;char*name=NULL;char*value=NULL;char*eq=NULL;struct stat 
+statbuff={(0xd39+5310-0x21f7)};char nvFile[NV_PATH_LEN]={(0x1113+410-0x12ad)};
+sprintf(nvFile,"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,file);if(stat(nvFile,&
+statbuff)<(0xf89+4763-0x2224))return RESULT_FAIL;len=statbuff.st_size;if(
+NV_CHECK_SIZE>len)return RESULT_FAIL;fp=fopen(nvFile,"\x72\x6f");if(!fp)return 
+RESULT_FILE_OPEN_FAIL;len=len-NV_CHECK_SIZE;buf=(char*)malloc(len+
+(0x1e1d+1264-0x230c));if(!buf){fclose(fp);return RESULT_MALLOC_FAIL;}memset(buf,
+(0x85d+2864-0x138d),len+(0x239c+101-0x2400));cnt=(0x1e63+1874-0x25b5);while(cnt<
+len){cnt=cnt+fread(buf+cnt,(0x11e5+3948-0x2150),len-cnt,fp);if(ferror(fp)){
 clearerr(fp);fclose(fp);free(buf);return RESULT_FILE_READ_FAIL;}}if(cnt!=len){
 fclose(fp);free(buf);return RESULT_FILE_READ_FAIL;}buf[len]='\0';name=buf;while(
-*name){if(!(eq=strchr(name,((char)(0xa82+1630-0x10a3))))){break;}*eq='\0';value=
-eq+(0x8+2302-0x905);nvset(file,name,value,(0x674+4192-0x16d3));*eq=
-((char)(0x2545+484-0x26ec));name=value+strlen(value)+(0x1054+5776-0x26e3);}free(
+*name){if(!(eq=strchr(name,((char)(0x1425+3660-0x2234))))){break;}*eq='\0';value
+=eq+(0xa69+249-0xb61);nvset(file,name,value,(0xfa8+5632-0x25a7));*eq=
+((char)(0x1997+3144-0x25a2));name=value+strlen(value)+(0x1404+219-0x14de);}free(
 buf);fclose(fp);return RESULT_SUCCESS;}static void analyMsg(T_NV_MSG_INFO*
 msgrecv,T_NV_MSG_RESULT*msgsnd){switch(msgrecv->nvType){case MSG_GET:msgsnd->
 result=nvget(msgrecv->file,msgrecv->key,msgsnd->value);break;case MSG_SET:msgsnd
@@ -187,103 +189,104 @@
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x70\x61\x72\x61\x6d\x20\x69\x6c\x6c\x65\x67\x61\x6c\x21" "\n"
 );return RESULT_INVAL;}if(configFile){newConfig=(T_NV_CONFIG*)malloc(sizeof(
 T_NV_CONFIG));if(!newConfig)return RESULT_MALLOC_FAIL;strncpy(newConfig->
-configFile,configFile,NV_PATH_LEN-(0xd44+42-0xd6d));newConfig->configFile[
-NV_PATH_LEN-(0xedd+6091-0x26a7)]='\0';newConfig->next=NULL;}for(list=nv_list;
-list;list=list->next){if(strcmp(list->nvFile,nvFile)==(0x1659+932-0x19fd))break;
-}if(!list){newList=(T_NV_NODE*)malloc(sizeof(T_NV_NODE));if(!newList){if(
+configFile,configFile,NV_PATH_LEN-(0x792+737-0xa72));newConfig->configFile[
+NV_PATH_LEN-(0x336+4895-0x1654)]='\0';newConfig->next=NULL;}for(list=nv_list;
+list;list=list->next){if(strcmp(list->nvFile,nvFile)==(0x12cf+4172-0x231b))break
+;}if(!list){newList=(T_NV_NODE*)malloc(sizeof(T_NV_NODE));if(!newList){if(
 newConfig)free(newConfig);return RESULT_MALLOC_FAIL;}newList->next=NULL;strncpy(
-newList->nvFile,nvFile,NV_PATH_LEN-(0x184d+2942-0x23ca));newList->nvFile[
-NV_PATH_LEN-(0x167b+2415-0x1fe9)]='\0';memset(newList->nvTable,
-(0x19cd+2692-0x2451),NV_HASH_LEN*(0x19bf+51-0x19ee));newList->fileList=newConfig
-;if(!nv_list)nv_list=newList;else{newList->next=nv_list->next;nv_list->next=
-newList;}}else if(!list->fileList)list->fileList=newConfig;else{if(newConfig==
-NULL)return RESULT_FAIL;newConfig->next=list->fileList->next;list->fileList->
-next=newConfig;}return RESULT_SUCCESS;}static bool isCfgConfiged(char*configFile
-){T_NV_NODE*list=NULL;T_NV_CONFIG*config=NULL;for(list=nv_list;list;list=list->
-next){for(config=list->fileList;config;config=config->next){if(!strcmp(config->
-configFile,configFile))return true;}}return false;}static bool isNvConfiged(char
-*nvFile){T_NV_NODE*list=NULL;for(list=nv_list;list;list=list->next){if(!strcmp(
-list->nvFile,nvFile))return true;}return false;}static uint getSum(const char*s,
-int len){uint sum=(0x16+891-0x391);char*data=(char*)s;while(len-- >
-(0x13b+1801-0x844)){sum+=(*data++);}return sum;}static int saveNvFs(char*nvName,
-char*nvFile){int i=(0x143b+2502-0x1e01);int sum=(0xed1+2051-0x16d4);int bufSize=
-(0xbfd+3993-0x1b96);int itemSize=(0x1ce0+2251-0x25ab);int ret=
-(0x1422+3782-0x22e8);int fp=(0x427+8674-0x2609);char*buf=NULL;T_NV_NODE*list=
-NULL;T_NV_ITEM*item=NULL;for(list=nv_list;list;list=list->next){if(strcmp(list->
-nvFile,nvName))continue;fp=open(nvFile,O_SYNC|O_RDWR|O_CREAT|O_TRUNC,
-(0xe5f+3305-0x19a8));if(fp==-(0x134b+2222-0x1bf8)){printf(
+newList->nvFile,nvFile,NV_PATH_LEN-(0x1e37+1194-0x22e0));newList->nvFile[
+NV_PATH_LEN-(0x5ef+1460-0xba2)]='\0';memset(newList->nvTable,(0x35+4658-0x1267),
+NV_HASH_LEN*(0xdb6+6023-0x2539));newList->fileList=newConfig;if(!nv_list)nv_list
+=newList;else{newList->next=nv_list->next;nv_list->next=newList;}}else if(!list
+->fileList)list->fileList=newConfig;else{if(newConfig==NULL)return RESULT_FAIL;
+newConfig->next=list->fileList->next;list->fileList->next=newConfig;}return 
+RESULT_SUCCESS;}static bool isCfgConfiged(char*configFile){T_NV_NODE*list=NULL;
+T_NV_CONFIG*config=NULL;for(list=nv_list;list;list=list->next){for(config=list->
+fileList;config;config=config->next){if(!strcmp(config->configFile,configFile))
+return true;}}return false;}static bool isNvConfiged(char*nvFile){T_NV_NODE*list
+=NULL;for(list=nv_list;list;list=list->next){if(!strcmp(list->nvFile,nvFile))
+return true;}return false;}static uint getSum(const char*s,int len){uint sum=
+(0xfc+7232-0x1d3c);char*data=(char*)s;while(len-- >(0x1f3c+1003-0x2327)){sum+=(*
+data++);}return sum;}static int saveNvFs(char*nvName,char*nvFile){int i=
+(0x6f5+5849-0x1dce);int sum=(0x6e3+6413-0x1ff0);int bufSize=(0x6ad+5914-0x1dc7);
+int itemSize=(0x1402+763-0x16fd);int ret=(0x9b6+5119-0x1db5);int fp=
+(0x6d+300-0x199);char*buf=NULL;T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;for(list=
+nv_list;list;list=list->next){if(strcmp(list->nvFile,nvName))continue;fp=open(
+nvFile,O_SYNC|O_RDWR|O_CREAT|O_TRUNC,(0x1ea2+261-0x1e07));if(fp==-
+(0x1b18+1300-0x202b)){printf(
 "\x6f\x70\x65\x6e\x20\x25\x73\x20\x66\x61\x69\x6c\x2c\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
 ,nvFile,errno);return RESULT_FILE_OPEN_FAIL;}buf=(char*)malloc(NV_BLOCK_SIZE);if
-(!buf){close(fp);return RESULT_MALLOC_FAIL;}for(i=(0x1469+4354-0x256b);i<
+(!buf){close(fp);return RESULT_MALLOC_FAIL;}for(i=(0x441+8786-0x2693);i<
 NV_HASH_LEN;i++){for(item=list->nvTable[i];item;item=item->next){if(strcmp(
 nvFile,NV_FS_SHOW)&&!item->saveFlag)continue;itemSize=strlen(item->key)+strlen(
-item->value)+(0x16da+469-0x18ad);if(bufSize+itemSize>NV_BLOCK_SIZE){if(write(fp,
-buf,bufSize)<(0x138b+1889-0x1aec)){printf(
+item->value)+(0x112b+4812-0x23f5);if(bufSize+itemSize>NV_BLOCK_SIZE){if(write(fp
+,buf,bufSize)<(0x515+5807-0x1bc4)){printf(
 "\x65\x72\x72\x6f\x72\x20\x25\x73\x20\x25\x64\x3a\x20\x77\x72\x69\x74\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
 ,__FILE__,__LINE__,errno);close(fp);free(buf);return RESULT_FILE_WRITE_FAIL;}sum
-+=getSum(buf,bufSize);bufSize=(0x440+1244-0x91c);}sprintf(buf+bufSize,
++=getSum(buf,bufSize);bufSize=(0x7b1+4312-0x1889);}sprintf(buf+bufSize,
 "\x25\x73\x3d\x25\x73",item->key,item->value);bufSize+=itemSize;}}if(bufSize!=
-(0x4d2+3780-0x1396)){if(write(fp,buf,bufSize)<(0x13c1+1299-0x18d4)){printf(
+(0x750+7750-0x2596)){if(write(fp,buf,bufSize)<(0xc24+3179-0x188f)){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x77\x72\x69\x74\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
 ,errno);close(fp);free(buf);return RESULT_FILE_WRITE_FAIL;}sum+=getSum(buf,
-bufSize);}sum+=NV_FILE_FLAG;if(write(fp,&sum,NV_CHECK_SIZE)<(0x144c+1015-0x1843)
-){printf(
+bufSize);}sum+=NV_FILE_FLAG;if(write(fp,&sum,NV_CHECK_SIZE)<(0xe2d+5002-0x21b7))
+{printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x77\x72\x69\x74\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
 ,errno);close(fp);free(buf);return RESULT_FILE_WRITE_FAIL;}ret=fsync(fp);free(
-buf);close(fp);if(ret<(0x14ea+4419-0x262d)){printf(
+buf);close(fp);if(ret<(0x13b9+637-0x1636)){printf(
 "\x53\x79\x6e\x63\x20\x46\x61\x69\x6c\x65\x64\x3a\x25\x73\x2c\x20\x66\x69\x6c\x65\x20\x70\x61\x74\x68\x3a\x25\x73"
 ,strerror(errno),nvFile);return ret;}return RESULT_SUCCESS;}return 
 RESULT_NO_FILE;}static int nvget(char*file,char*key,char*value){int index=
-(0x84c+255-0x94b);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;for(list=nv_list;list;
-list=list->next){if(strcmp(list->nvFile,file))continue;index=hash(key)%
+(0x8a4+3409-0x15f5);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;for(list=nv_list;
+list;list=list->next){if(strcmp(list->nvFile,file))continue;index=hash(key)%
 NV_HASH_LEN;for(item=list->nvTable[index];item;item=item->next){if(strcmp(item->
-key,key))continue;strncpy(value,item->value,NV_MAX_VAL_LEN-(0x9db+3631-0x1809));
-value[NV_MAX_VAL_LEN-(0x24e7+478-0x26c4)]='\0';return RESULT_SUCCESS;}}return 
+key,key))continue;strncpy(value,item->value,NV_MAX_VAL_LEN-(0x40a+3474-0x119b));
+value[NV_MAX_VAL_LEN-(0x112f+976-0x14fe)]='\0';return RESULT_SUCCESS;}}return 
 RESULT_NO_ITEM;}static int nvset(char*file,const char*key,const char*value,int 
-saveFlag){int index=(0xae3+3051-0x16ce);int ret=(0x1a7+2511-0xb76);int 
-key_buf_len=(0x1b7a+229-0x1c5f);int value_buf_len=(0x1a66+2644-0x24ba);T_NV_NODE
-*list=NULL;T_NV_ITEM*item=NULL;T_NV_ITEM*newItem=NULL;if(NULL==key||NULL==value)
-return RESULT_FAIL;key_buf_len=strlen(key)+(0x2070+190-0x212d);value_buf_len=
-strlen(value)+(0x1f7c+1176-0x2413);for(list=nv_list;list;list=list->next){if(
-strcmp(list->nvFile,file))continue;index=hash(key)%NV_HASH_LEN;for(item=list->
-nvTable[index];item;item=item->next){if(strcmp(item->key,key))continue;if(
-saveFlag)item->saveFlag=saveFlag;if(!strcmp(item->value,value))return 
-RESULT_SUCCESS;free(item->value);item->value=(char*)malloc(value_buf_len);if(!
-item->value)return RESULT_MALLOC_FAIL;strncpy(item->value,value,value_buf_len-
-(0x2f1+8640-0x24b0));item->value[value_buf_len-(0x12d+6454-0x1a62)]='\0';return 
-RESULT_SUCCESS;}newItem=(T_NV_ITEM*)malloc(sizeof(T_NV_ITEM));if(!newItem)return
- RESULT_MALLOC_FAIL;newItem->key=(char*)malloc(key_buf_len);if(!newItem->key){
-free(newItem);return RESULT_MALLOC_FAIL;}newItem->value=(char*)malloc(
-value_buf_len);if(!newItem->value){free(newItem->key);free(newItem);return 
-RESULT_MALLOC_FAIL;}strncpy(newItem->key,key,key_buf_len-(0x6e1+7150-0x22ce));
-newItem->key[key_buf_len-(0x157a+3690-0x23e3)]='\0';strncpy(newItem->value,value
-,value_buf_len-(0x125a+4317-0x2336));newItem->value[value_buf_len-
-(0x2354+343-0x24aa)]='\0';newItem->next=NULL;newItem->saveFlag=saveFlag;newItem
-->update_flag=(0xe45+3698-0x1cb7);if(!list->nvTable[index])list->nvTable[index]=
-newItem;else{newItem->next=list->nvTable[index]->next;list->nvTable[index]->next
-=newItem;}return RESULT_SUCCESS;}ret=addConfigFile(file,NULL);if(ret==
-RESULT_SUCCESS)return nvset(file,key,value,saveFlag);else return ret;}static int
- nvunset(char*file,char*key){int index=(0x1756+584-0x199e);T_NV_NODE*list=NULL;
-T_NV_ITEM*item=NULL;T_NV_ITEM*prev=NULL;for(list=nv_list;list;list=list->next){
-if(strcmp(list->nvFile,file))continue;index=hash(key)%NV_HASH_LEN;for(item=list
-->nvTable[index];item;prev=item,item=item->next){if(strcmp(item->key,key))
-continue;if(!prev)list->nvTable[index]=item->next;else prev->next=item->next;
-free(item->key);free(item->value);free(item);return RESULT_SUCCESS;}}return 
-RESULT_NO_ITEM;}static int nvreset(char*file){int ret=(0xf1a+4235-0x1fa5);
-T_NV_NODE*list=NULL;for(list=nv_list;list;list=list->next){if(strcmp(list->
-nvFile,file))continue;ret=nvclear(file);if(ret!=RESULT_SUCCESS)return ret;if(
-loadFactroyParam(list)!=RESULT_SUCCESS)return RESULT_FAIL;return nvcommit(file);
-}return RESULT_NO_FILE;}static int nvclear(char*file){int i=(0x7ab+1449-0xd54);
-T_NV_NODE*list=NULL;T_NV_ITEM*cur=NULL;T_NV_ITEM*item=NULL;for(list=nv_list;list
-;list=list->next){if(strcmp(list->nvFile,file))continue;for(i=(0x77b+1983-0xf3a)
-;i<NV_HASH_LEN;i++){for(item=list->nvTable[i];item;){cur=item;item=item->next;
-free(cur->key);free(cur->value);free(cur);}list->nvTable[i]=NULL;}return 
-RESULT_SUCCESS;}return RESULT_NO_FILE;}static int nvcommit(char*file){int ret=
-(0x1ffc+1070-0x242a);char nvMainFile[NV_PATH_LEN]={(0x10dd+4579-0x22c0)};char 
-nvBackupFile[NV_PATH_LEN]={(0x16e9+728-0x19c1)};sprintf(nvMainFile,
-"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,file);sprintf(nvBackupFile,
-"\x25\x73\x2f\x25\x73",NV_FS_BACKUP_PATH,file);ret=saveNvFs(file,nvMainFile);if(
-ret!=RESULT_SUCCESS)return ret;return restoreNvFs(nvBackupFile,nvMainFile);}
+saveFlag){int index=(0x93c+3629-0x1769);int ret=(0x846+3321-0x153f);int 
+key_buf_len=(0x12fc+2401-0x1c5d);int value_buf_len=(0x15e8+2955-0x2173);
+T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;T_NV_ITEM*newItem=NULL;if(NULL==key||
+NULL==value)return RESULT_FAIL;key_buf_len=strlen(key)+(0x18e8+421-0x1a8c);
+value_buf_len=strlen(value)+(0x1064+1325-0x1590);for(list=nv_list;list;list=list
+->next){if(strcmp(list->nvFile,file))continue;index=hash(key)%NV_HASH_LEN;for(
+item=list->nvTable[index];item;item=item->next){if(strcmp(item->key,key))
+continue;if(saveFlag)item->saveFlag=saveFlag;if(!strcmp(item->value,value))
+return RESULT_SUCCESS;free(item->value);item->value=(char*)malloc(value_buf_len)
+;if(!item->value)return RESULT_MALLOC_FAIL;strncpy(item->value,value,
+value_buf_len-(0x1152+2977-0x1cf2));item->value[value_buf_len-
+(0x244+5698-0x1885)]='\0';return RESULT_SUCCESS;}newItem=(T_NV_ITEM*)malloc(
+sizeof(T_NV_ITEM));if(!newItem)return RESULT_MALLOC_FAIL;newItem->key=(char*)
+malloc(key_buf_len);if(!newItem->key){free(newItem);return RESULT_MALLOC_FAIL;}
+newItem->value=(char*)malloc(value_buf_len);if(!newItem->value){free(newItem->
+key);free(newItem);return RESULT_MALLOC_FAIL;}strncpy(newItem->key,key,
+key_buf_len-(0xb27+5653-0x213b));newItem->key[key_buf_len-(0x8fa+6926-0x2407)]=
+'\0';strncpy(newItem->value,value,value_buf_len-(0x9e9+4249-0x1a81));newItem->
+value[value_buf_len-(0xecb+4669-0x2107)]='\0';newItem->next=NULL;newItem->
+saveFlag=saveFlag;newItem->update_flag=(0x13f+8511-0x227e);if(!list->nvTable[
+index])list->nvTable[index]=newItem;else{newItem->next=list->nvTable[index]->
+next;list->nvTable[index]->next=newItem;}return RESULT_SUCCESS;}ret=
+addConfigFile(file,NULL);if(ret==RESULT_SUCCESS)return nvset(file,key,value,
+saveFlag);else return ret;}static int nvunset(char*file,char*key){int index=
+(0x32+6702-0x1a60);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;T_NV_ITEM*prev=NULL;
+for(list=nv_list;list;list=list->next){if(strcmp(list->nvFile,file))continue;
+index=hash(key)%NV_HASH_LEN;for(item=list->nvTable[index];item;prev=item,item=
+item->next){if(strcmp(item->key,key))continue;if(!prev)list->nvTable[index]=item
+->next;else prev->next=item->next;free(item->key);free(item->value);free(item);
+return RESULT_SUCCESS;}}return RESULT_NO_ITEM;}static int nvreset(char*file){int
+ ret=(0xbf2+4389-0x1d17);T_NV_NODE*list=NULL;for(list=nv_list;list;list=list->
+next){if(strcmp(list->nvFile,file))continue;ret=nvclear(file);if(ret!=
+RESULT_SUCCESS)return ret;if(loadFactroyParam(list)!=RESULT_SUCCESS)return 
+RESULT_FAIL;return nvcommit(file);}return RESULT_NO_FILE;}static int nvclear(
+char*file){int i=(0x20a3+533-0x22b8);T_NV_NODE*list=NULL;T_NV_ITEM*cur=NULL;
+T_NV_ITEM*item=NULL;for(list=nv_list;list;list=list->next){if(strcmp(list->
+nvFile,file))continue;for(i=(0x110a+3085-0x1d17);i<NV_HASH_LEN;i++){for(item=
+list->nvTable[i];item;){cur=item;item=item->next;free(cur->key);free(cur->value)
+;free(cur);}list->nvTable[i]=NULL;}return RESULT_SUCCESS;}return RESULT_NO_FILE;
+}static int nvcommit(char*file){int ret=(0xc94+3452-0x1a10);char nvMainFile[
+NV_PATH_LEN]={(0x2a6+6844-0x1d62)};char nvBackupFile[NV_PATH_LEN]={
+(0x5a1+3217-0x1232)};sprintf(nvMainFile,"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,
+file);sprintf(nvBackupFile,"\x25\x73\x2f\x25\x73",NV_FS_BACKUP_PATH,file);ret=
+saveNvFs(file,nvMainFile);if(ret!=RESULT_SUCCESS)return ret;return restoreNvFs(
+nvBackupFile,nvMainFile);}
 #ifdef __cplusplus
 }
 #endif
diff --git a/ap/app/zte_comm/nvserver/nvupdate.c b/ap/app/zte_comm/nvserver/nvupdate.c
index 16e1f8c..6873d11 100755
--- a/ap/app/zte_comm/nvserver/nvupdate.c
+++ b/ap/app/zte_comm/nvserver/nvupdate.c
@@ -23,84 +23,84 @@
 #endif
 extern T_NV_NODE*nv_list;
 #ifdef FOTA_AB
-int get_update_status(void){T_FLAGS_INFO flags_info={(0x185f+2980-0x2403)};
-unsigned int status=(0x3fc+3609-0x1215);int ret=(0x91+2852-0xbb5);ret=flags_get(
-&flags_info);status=flags_info.boot_fota_flag.fota_status;if(status==
-(0x3f0+2225-0xca0))return(0x187f+3521-0x263e);else return(0x1165+1927-0x18ec);}
+int get_update_status(void){T_FLAGS_INFO flags_info={(0x7c6+5329-0x1c97)};
+unsigned int status=(0x3db+6933-0x1ef0);int ret=(0x1398+54-0x13ce);ret=flags_get
+(&flags_info);status=flags_info.boot_fota_flag.fota_status;if(status==
+(0x4bd+7488-0x21fc))return(0xfdf+5344-0x24bd);else return(0x368+7058-0x1efa);}
 #else
-int get_update_status(void){int update_status;FILE*fd=(0x818+6764-0x2284);int 
+int get_update_status(void){int update_status;FILE*fd=(0x666+4681-0x18af);int 
 ret;char*filename=NULL;if(access(FOTA_UPDATE_STATUS_FILE_OLD,R_OK)==
-(0x1ab4+103-0x1b1b)){filename=FOTA_UPDATE_STATUS_FILE_OLD;}else{filename=
+(0x15ba+671-0x1859)){filename=FOTA_UPDATE_STATUS_FILE_OLD;}else{filename=
 FOTA_UPDATE_STATUS_FILE;}printf(
 "get_update_status, read_update_status from %s\n",filename);fd=fopen(filename,
 "\x72\x62\x2b");if(fd==NULL){printf(
 "\x5b\x6e\x76\x73\x65\x72\x76\x65\x72\x5d\x75\x70\x64\x61\x74\x65\x5f\x73\x74\x61\x74\x75\x73\x20\x6f\x70\x65\x6e\x20\x20\x65\x72\x72\x6f\x72\x3a\x25\x73" "\n"
 ,strerror(errno));goto error0;}ret=fscanf(fd,"\x25\x64",(int*)&update_status);if
-(ret<(0x13f+2549-0xb34)){printf(
+(ret<(0x2350+862-0x26ae)){printf(
 "\x67\x65\x74\x20\x69\x6e\x66\x6f\x20\x66\x72\x6f\x6d\x20\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72\x3a\x25\x73" "\n"
 ,strerror(errno));fclose(fd);goto error0;}printf(
 "\x75\x70\x64\x61\x74\x65\x5f\x73\x74\x61\x74\x75\x73\x3d\x25\x64" "\n",
-update_status);fclose(fd);return update_status;error0:return-(0x12c+8190-0x2129)
+update_status);fclose(fd);return update_status;error0:return-(0x1ef4+122-0x1f6d)
 ;}
 #endif
 int nvupdate(char*nv_file,char*config_file,const char*key,const char*value,int 
-saveFlag){int index=(0x92a+4682-0x1b74);int key_buf_len=(0x1066+2730-0x1b10);int
- value_buf_len=(0x1df+7839-0x207e);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;
+saveFlag){int index=(0x1642+2936-0x21ba);int key_buf_len=(0xb70+597-0xdc5);int 
+value_buf_len=(0xa26+333-0xb73);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;
 T_NV_ITEM*newItem=NULL;if(NULL==key||NULL==value)return RESULT_FAIL;printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x6e\x76\x5f\x66\x69\x6c\x65\x3a\x25\x73\x20\x6b\x65\x79\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73" "\n"
-,nv_file,key,value);key_buf_len=strlen(key)+(0xb9c+6633-0x2584);value_buf_len=
-strlen(value)+(0x15f8+3817-0x24e0);for(list=nv_list;list;list=list->next){if(
+,nv_file,key,value);key_buf_len=strlen(key)+(0x926+4405-0x1a5a);value_buf_len=
+strlen(value)+(0x166b+2115-0x1ead);for(list=nv_list;list;list=list->next){if(
 strcmp(list->nvFile,nv_file))continue;index=hash(key)%NV_HASH_LEN;for(item=list
 ->nvTable[index];item;item=item->next){if(strcmp(item->key,key))continue;if(
 saveFlag)item->saveFlag=saveFlag;if(!strcmp(item->value,value)){item->
-update_flag=(0x1966+1534-0x1f63);printf(
+update_flag=(0xe5f+2443-0x17e9);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x73\x61\x6d\x65\x73\x6b\x69\x70\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
 ,item->key,item->value,value,config_file);return RESULT_SUCCESS;}if(strstr(
-config_file,"\x75\x73\x65\x72")){if((0x19b6+3108-0x25d9)==item->update_flag){
+config_file,"\x75\x73\x65\x72")){if((0x987+4915-0x1cb9)==item->update_flag){
 printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x73\x65\x63\x6f\x6e\x64\x20\x63\x68\x61\x6e\x67\x65\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
 ,item->key,item->value,value,config_file);}else{item->update_flag=
-(0xa30+1140-0xea3);printf(
+(0x422+7732-0x2255);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x75\x73\x65\x72\x73\x6b\x69\x70\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x31\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
 ,item->key,item->value,value,config_file);return RESULT_SUCCESS;}}printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6b\x65\x79\x3d\x25\x73\x20\x63\x68\x61\x6e\x67\x65\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x74\x6f\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
 ,item->key,item->value,value);free(item->value);item->value=(char*)malloc(
 value_buf_len);if(!item->value)return RESULT_MALLOC_FAIL;strncpy(item->value,
-value,value_buf_len-(0xa08+3521-0x17c8));item->value[value_buf_len-
-(0xa4b+2274-0x132c)]='\0';item->update_flag=(0x819+7674-0x2612);return 
+value,value_buf_len-(0x148d+4721-0x26fd));item->value[value_buf_len-
+(0x1cf+4652-0x13fa)]='\0';item->update_flag=(0x92+7434-0x1d9b);return 
 RESULT_SUCCESS;}newItem=(T_NV_ITEM*)malloc(sizeof(T_NV_ITEM));if(!newItem){
 printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x31\x20" "\n"
 );return RESULT_MALLOC_FAIL;}newItem->key=(char*)malloc(strlen(key)+
-(0x1fe5+432-0x2194));if(!newItem->key){free(newItem);printf(
+(0x14+5538-0x15b5));if(!newItem->key){free(newItem);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x32" "\n"
 );return RESULT_MALLOC_FAIL;}newItem->value=(char*)malloc(value_buf_len);if(!
 newItem->value){free(newItem->key);free(newItem);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x33\x20" "\n"
 );return RESULT_MALLOC_FAIL;}strncpy(newItem->key,key,key_buf_len-
-(0x14af+2538-0x1e98));newItem->key[key_buf_len-(0x498+3439-0x1206)]='\0';strncpy
-(newItem->value,value,value_buf_len-(0x1b1+2125-0x9fd));newItem->value[
-value_buf_len-(0xdf9+926-0x1196)]='\0';newItem->next=NULL;newItem->saveFlag=
-saveFlag;newItem->update_flag=(0x780+2550-0x1175);printf(
+(0x1381+3330-0x2082));newItem->key[key_buf_len-(0x1165+4520-0x230c)]='\0';
+strncpy(newItem->value,value,value_buf_len-(0x69b+1136-0xb0a));newItem->value[
+value_buf_len-(0x720+2023-0xf06)]='\0';newItem->next=NULL;newItem->saveFlag=
+saveFlag;newItem->update_flag=(0x435+8105-0x23dd);printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x61\x64\x64\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
 ,newItem->key,newItem->value);if(!list->nvTable[index])list->nvTable[index]=
 newItem;else{newItem->next=list->nvTable[index]->next;list->nvTable[index]->next
 =newItem;}return RESULT_SUCCESS;}return RESULT_FAIL;}int reloadFactroyParam(
 T_NV_NODE*list){char*val=NULL;FILE*fp=NULL;T_NV_CONFIG*config=NULL;char buf[
-NV_MAX_ITEM_LEN]={(0x1757+2833-0x2268)};printf(
+NV_MAX_ITEM_LEN]={(0xbd2+4375-0x1ce9)};printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x6e\x76\x46\x69\x6c\x65\x3a\x25\x73" "\n"
 ,list->nvFile);for(config=list->fileList;config;config=config->next){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x63\x6f\x6e\x66\x69\x67\x46\x69\x6c\x65\x20\x73\x74\x61\x72\x74\x3a\x25\x73\x21" "\n"
 ,config->configFile);fp=fopen(config->configFile,"\x72\x6f");if(!fp){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x6f\x70\x65\x6e\x20\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
 ,config->configFile,errno);return RESULT_FILE_OPEN_FAIL;}while(fgets(buf,
-NV_MAX_ITEM_LEN,fp)){if(buf[(0xaaa+2950-0x1630)]=='\n'||buf[(0x231+6991-0x1d80)]
-==((char)(0x204+452-0x3a5)))continue;val=strchr(buf,((char)(0xa7+1272-0x562)));
-if(!val){printf(
+NV_MAX_ITEM_LEN,fp)){if(buf[(0x1173+2974-0x1d11)]=='\n'||buf[(0x36f+7242-0x1fb9)
+]==((char)(0x1a14+1717-0x20a6)))continue;val=strchr(buf,
+((char)(0x6b0+7867-0x252e)));if(!val){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x6f\x72\x6d\x61\x74\x20\x65\x72\x72\x6f\x72\x3a\x73\x74\x72\x69\x6e\x67\x20\x3d\x20\x25\x73" "\n"
-,config->configFile,buf);continue;}buf[strlen(buf)-(0x91c+3095-0x1532)]='\0';*
-val++='\0';nvupdate(list->nvFile,config->configFile,buf,val,(0x466+1690-0xaff));
-}printf(
+,config->configFile,buf);continue;}buf[strlen(buf)-(0x1143+2434-0x1ac4)]='\0';*
+val++='\0';nvupdate(list->nvFile,config->configFile,buf,val,(0x1446+2881-0x1f86)
+);}printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x63\x6f\x6e\x66\x69\x67\x46\x69\x6c\x65\x20\x65\x6e\x64\x3a\x25\x73\x21" "\n"
 ,config->configFile);fclose(fp);}return RESULT_SUCCESS;}void dump_list(T_NV_ITEM
 *list){if(list==NULL){printf(
@@ -108,11 +108,11 @@
 list->next;while(p!=NULL){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x75\x6d\x70\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x2c\x20\x70\x3d\x30\x78\x25\x78" "\n"
 ,p->key,p->value,((unsigned int)p));p=p->next;}}int delete_not_needed(T_NV_NODE*
-list){int index=(0x2138+1057-0x2559);T_NV_ITEM*item=NULL;T_NV_ITEM head={
-(0x2088+2-0x208a)};T_NV_ITEM*prev=&head;printf(
+list){int index=(0x210b+1495-0x26e2);T_NV_ITEM*item=NULL;T_NV_ITEM head={
+(0x6a0+5136-0x1ab0)};T_NV_ITEM*prev=&head;printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x65\x6c\x65\x74\x65\x5f\x6e\x6f\x74\x5f\x6e\x65\x65\x64\x65\x64\x20\x65\x6e\x74\x65\x72\x20\x2a\x2a\x2a" "\n"
-);for(index=(0xd20+3883-0x1c4b);index<NV_HASH_LEN;index++){head.next=list->
-nvTable[index];prev=&head;for(item=prev->next;item;){if((0x249+8252-0x2284)==
+);for(index=(0x17f2+2607-0x2221);index<NV_HASH_LEN;index++){head.next=list->
+nvTable[index];prev=&head;for(item=prev->next;item;){if((0xc20+3494-0x19c5)==
 item->update_flag){prev=item;item=item->next;}else{printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x65\x6c\x65\x74\x65\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
 ,item->key,item->value);prev->next=item->next;free(item->key);free(item->value);
diff --git a/ap/app/zte_comm/phonebook/src/pb_db.c b/ap/app/zte_comm/phonebook/src/pb_db.c
index 39f5f8b..7ffbfa4 100755
--- a/ap/app/zte_comm/phonebook/src/pb_db.c
+++ b/ap/app/zte_comm/phonebook/src/pb_db.c
@@ -1,8 +1,8 @@
 
 #include "pb_com.h"

 T_zPb_DbResult atPb_CreatDb(){T_zPb_DbResult result=ZPB_DB_OK;CHAR sql[
-ZPB_MAX_BYTES_DB]={(0x523+6985-0x206c)};UINT32 count=(0x3ab+3187-0x101e);result=
-atPb_ExecDbSql(ZPB_CREATE_PBM_TABLE,NULL,NULL);if(ZPB_DB_OK!=result){slog(
+ZPB_MAX_BYTES_DB]={(0x1e98+1267-0x238b)};UINT32 count=(0xc91+6265-0x250a);result
+=atPb_ExecDbSql(ZPB_CREATE_PBM_TABLE,NULL,NULL);if(ZPB_DB_OK!=result){slog(
 PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x70\x62\x6d\x3a\x63\x72\x65\x61\x74\x65\x20\x70\x62\x6d\x20\x74\x61\x62\x6c\x65\x20\x72\x65\x73\x75\x6c\x74\x20\x69\x73\x20\x25\x64" "\n"
 ,result);return result;}result=atPb_ExecDbSql(
@@ -18,18 +18,18 @@
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_USIM);result=atPb_ExecDbSql(sql,NULL,NULL);if(
 ZPB_DB_OK!=result){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x70\x62\x6d\x3a\x63\x72\x65\x61\x74\x65\x20\x70\x62\x6d\x5f\x64\x65\x76\x69\x63\x65\x5f\x63\x61\x70\x61\x62\x69\x6c\x69\x74\x79\x20\x74\x61\x62\x6c\x65\x20\x72\x65\x73\x75\x6c\x74\x20\x69\x73\x20\x25\x64" "\n"
-,result);return result;}memset(sql,(0x1+1876-0x755),sizeof(sql));snprintf(sql,
-sizeof(sql)-(0xed5+5161-0x22fd),
+,result);return result;}memset(sql,(0xdab+4942-0x20f9),sizeof(sql));snprintf(sql
+,sizeof(sql)-(0x65a+3682-0x14bb),
 "\x73\x65\x6c\x65\x63\x74\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x66\x72\x6f\x6d\x20\x25\x73"
 ,ZPB_DB_SIM_CAPABILITY_TABLE);(VOID)atPb_ExecDbSql(sql,atPb_DbCountTableLineCb,&
-count);if((0x20+8882-0x22d2)<count){memset(sql,(0x90+892-0x40c),sizeof(sql));
-snprintf(sql,sizeof(sql)-(0x1f3+3785-0x10bb),
+count);if((0xfbc+5649-0x25cd)<count){memset(sql,(0x802+3233-0x14a3),sizeof(sql))
+;snprintf(sql,sizeof(sql)-(0x1c6+5912-0x18dd),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x53\x69\x6d\x5f\x74\x79\x70\x65\x3e\x3d\x30"
 ,ZPB_DB_SIM_CAPABILITY_TABLE);result=atPb_ExecDbSql(sql,NULL,NULL);if(ZPB_DB_OK
 !=result){slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x53\x65\x74\x53\x69\x6d\x43\x61\x70\x61\x63\x69\x74\x79\x54\x61\x62\x6c\x65\x3a\x66\x61\x69\x6c\x21" "\n"
 );return result;}}return ZPB_DB_OK;}T_zPb_DbResult atPb_DropDb(){T_zPb_DbResult 
-result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0xfea+5441-0x252b)};result=
+result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0x18d4+1920-0x2054)};result=
 atPb_ExecDbSql(ZTE_DROP_PBM_SQL,NULL,NULL);if(ZPB_DB_OK!=result){slog(PB_PRINT,
 SLOG_ERR,
 "\x61\x74\x50\x62\x5f\x44\x72\x6f\x70\x44\x62\x3a\x64\x65\x6c\x20\x70\x62\x6d\x20\x74\x61\x62\x6c\x65\x20\x72\x65\x73\x75\x6c\x74\x20\x69\x73\x20\x25\x64" "\n"
@@ -51,7 +51,7 @@
 );return ZPB_DB_ERROR_INVALIDPTR;}slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x73\x71\x6c\x69\x74\x65\x33\x5f\x6f\x70\x65\x6e\x20\x63\x61\x6c\x6c"
 );
-#if (0x6ac+7102-0x226a)

+#if (0xe03+6250-0x266d)

 if(!fopen(ZPB_DB_PATH,"\x72")){file=fopen(ZPB_DB_PATH,"\x77");if(!file){printf(
 "\x75\x6e\x61\x62\x6c\x65\x20\x74\x6f\x20\x6f\x70\x65\x6e\x20\x20\x66\x69\x6c\x65\x20\x65\x74\x63\x5f\x72\x77\x2f\x70\x62\x6d\x2e\x64\x62" "\n"
 );}else{printf(
@@ -68,32 +68,32 @@
 "\x70\x62\x3a\x70\x62\x6d\x3a\x63\x61\x6e\x20\x6e\x6f\x74\x20\x63\x6c\x6f\x73\x65\x20\x64\x62"
 );return ZPB_DB_ERROR;}
 #ifdef WEBS_SECURITY

-if(access(ZPB_TMP_PATH,F_OK)==(0x5d5+6848-0x2095)){slog(PB_PRINT,SLOG_ERR,
+if(access(ZPB_TMP_PATH,F_OK)==(0xbf7+3288-0x18cf)){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x70\x62\x6d\x3a\x74\x6d\x70\x20\x64\x62\x20\x73\x74\x61\x79");if(
-remove(ZPB_TMP_PATH)!=(0xdcf+2094-0x15fd)){slog(PB_PRINT,SLOG_ERR,
+remove(ZPB_TMP_PATH)!=(0x1e15+1693-0x24b2)){slog(PB_PRINT,SLOG_ERR,
 "\x72\x65\x6d\x6f\x76\x65\x20\x5a\x50\x42\x5f\x54\x4d\x50\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c"
-);}}if(rename(ZPB_SEC_PATH,ZPB_TMP_PATH)!=(0x80+9784-0x26b8)){slog(PB_PRINT,
+);}}if(rename(ZPB_SEC_PATH,ZPB_TMP_PATH)!=(0xd2d+1757-0x140a)){slog(PB_PRINT,
 SLOG_ERR,
 "\x72\x65\x6e\x61\x6d\x65\x20\x5a\x50\x42\x5f\x53\x45\x43\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c"
-);}{char rnum_buf[(0x194+5701-0x17c1)]={(0x3c2+2089-0xbeb)};char cmd[
-(0x116+1254-0x57c)]={(0xccd+4773-0x1f72)};sc_cfg_get(
+);}{char rnum_buf[(0xa32+783-0xd29)]={(0x57+7462-0x1d7d)};char cmd[
+(0x10c5+3406-0x1d93)]={(0xe02+4685-0x204f)};sc_cfg_get(
 "\x72\x6e\x75\x6d\x5f\x61\x74",rnum_buf,sizeof(rnum_buf));snprintf(cmd,sizeof(
 cmd),
 "\x2f\x62\x69\x6e\x2f\x6f\x70\x65\x6e\x73\x73\x6c\x20\x65\x6e\x63\x20\x2d\x65\x20\x2d\x61\x65\x73\x32\x35\x36\x20\x2d\x73\x61\x6c\x74\x20\x2d\x69\x6e\x20\x25\x73\x20\x2d\x6f\x75\x74\x20\x25\x73\x20\x2d\x70\x61\x73\x73\x20\x70\x61\x73\x73\x3a\x25\x73"
 ,ZPB_DB_PATH,ZPB_SEC_PATH,rnum_buf);zxic_system(cmd);if(access(ZPB_SEC_PATH,F_OK
-)==(0xec6+2855-0x19ed)){if(remove(ZPB_TMP_PATH)!=(0x28d+3723-0x1118)){slog(
+)==(0x796+6072-0x1f4e)){if(remove(ZPB_TMP_PATH)!=(0x9db+4656-0x1c0b)){slog(
 PB_PRINT,SLOG_ERR,
 "\x72\x65\x6d\x6f\x76\x65\x20\x5a\x50\x42\x5f\x54\x4d\x50\x5f\x50\x41\x54\x48\x31\x20\x66\x61\x69\x6c"
 );}}}
 #endif	

 return ZPB_DB_OK;}static check_sql_cmd(const char*pSql){if(pSql!=NULL){if(strstr
-(pSql,"\x3b")||strstr(pSql,"\x2d\x2d")){return(0x1cf+9535-0x270e);}return
-(0x6e8+7785-0x2550);}return(0x1ad+7323-0x1e48);}T_zPb_DbResult atPb_ExecDbSql(
+(pSql,"\x3b")||strstr(pSql,"\x2d\x2d")){return(0x1329+1998-0x1af7);}return
+(0x1443+1704-0x1aea);}return(0x491+5125-0x1896);}T_zPb_DbResult atPb_ExecDbSql(
 const char*pSql,sqlite3_callback callback,VOID*pFvarg){sqlite3*pDb=NULL;CHAR 
-dbErrMsg[(0xd0a+5468-0x21e6)]={(0x10ab+2705-0x1b3c)};if(NULL==pSql){return 
+dbErrMsg[(0x19f9+1349-0x1ebe)]={(0x5b0+8040-0x2518)};if(NULL==pSql){return 
 ZPB_DB_ERROR_INVALIDPTR;}
 #ifdef WEBS_SECURITY

-if(check_sql_cmd(pSql)==(0x372+8637-0x252f)){slog(PB_PRINT,SLOG_ERR,
+if(check_sql_cmd(pSql)==(0x1497+2828-0x1fa3)){slog(PB_PRINT,SLOG_ERR,
 "\x21\x21\x61\x74\x50\x62\x5f\x45\x78\x65\x63\x44\x62\x53\x71\x6c\x3a\x78\x73\x73\x20\x25\x73" "\n"
 ,pSql);return ZPB_DB_ERROR_INVALIDPTR;}
 #endif	

@@ -102,34 +102,33 @@
 );return ZPB_DB_ERROR_NOTOPENDB;}slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x45\x78\x65\x63\x44\x62\x53\x71\x6c\x3a\x25\x73" "\n"
 ,pSql);if(sqlite3_exec(pDb,pSql,callback,pFvarg,NULL)){strncpy(dbErrMsg,
-sqlite3_errmsg(pDb),sizeof(dbErrMsg)-(0xf19+1695-0x15b7));slog(PB_PRINT,SLOG_ERR
+sqlite3_errmsg(pDb),sizeof(dbErrMsg)-(0x177+4657-0x13a7));slog(PB_PRINT,SLOG_ERR
 ,
 "\x70\x62\x3a\x70\x62\x6d\x3a\x63\x61\x6e\x20\x6e\x6f\x74\x20\x65\x78\x65\x63\x20\x73\x71\x6c\x2c\x73\x71\x6c\x69\x74\x65\x33\x5f\x65\x72\x72\x6d\x73\x67\x3a\x25\x73\x2e"
 ,dbErrMsg);(VOID)sqlite3_close(pDb);return ZPB_DB_ERROR;}(VOID)atPb_DbClose(pDb)
 ;return ZPB_DB_OK;}SINT32 atPb_InitApIndexCb(VOID*fvarg,int line,char**zresult,
-char**lname){SINT32 index=(0xd+419-0x1b0);if((0x21f6+902-0x257b)>line){slog(
+char**lname){SINT32 index=(0x1158+3696-0x1fc8);if((0x1d0d+21-0x1d21)>line){slog(
 PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x49\x6e\x69\x74\x41\x70\x49\x6e\x64\x65\x78\x43\x62\x3a\x72\x65\x63\x6f\x72\x64\x20\x6e\x6f\x20\x64\x61\x74\x61\x2e" "\n"
-);return-(0x13d+7310-0x1dca);}index=atoi(zresult[(0xbf6+6305-0x2497)]);if(index>
+);return-(0x73+7933-0x1f6f);}index=atoi(zresult[(0x19c6+724-0x1c9a)]);if(index>
 ZPB_AP_MAX_RECORD){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x49\x6e\x69\x74\x41\x70\x49\x6e\x64\x65\x78\x43\x62\x3a\x69\x6e\x64\x65\x78\x20\x6f\x76\x65\x72\x66\x6c\x6f\x77\x2e" "\n"
-);return-(0xf77+1455-0x1525);}slog(PB_PRINT,SLOG_DEBUG,
+);return-(0x14a5+2820-0x1fa8);}slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x49\x6e\x69\x74\x41\x70\x49\x6e\x64\x65\x78\x43\x62\x3a\x70\x62\x6d\x5f\x69\x6e\x64\x65\x78\x3d\x25\x64" "\n"
-,index);g_zPb_ApIndex[index]=PBM_SUCCESS;return(0x1451+3806-0x232f);}
-T_zPb_DbResult atPb_InitApIndex(){CHAR sql[ZPB_MAX_BYTES_DB]={
-(0x2e9+6412-0x1bf5)};SINT32 i=(0x31b+5133-0x1727);g_zPb_ApIndex[
-(0x2c2+8573-0x243f)]=ZPB_AP_MAX_RECORD;for(i=(0x10a6+2480-0x1a55);i<=
-g_zPb_ApIndex[(0x1147+4019-0x20fa)];i++){g_zPb_ApIndex[i]=PBM_ERROR_NOT_FOUND;}
-snprintf(sql,sizeof(sql),
+,index);g_zPb_ApIndex[index]=PBM_SUCCESS;return(0x9f1+5375-0x1ef0);}
+T_zPb_DbResult atPb_InitApIndex(){CHAR sql[ZPB_MAX_BYTES_DB]={(0x196+1441-0x737)
+};SINT32 i=(0x1253+1766-0x1938);g_zPb_ApIndex[(0x13a2+2946-0x1f24)]=
+ZPB_AP_MAX_RECORD;for(i=(0xcaa+681-0xf52);i<=g_zPb_ApIndex[(0x7ec+1435-0xd87)];i
+++){g_zPb_ApIndex[i]=PBM_ERROR_NOT_FOUND;}snprintf(sql,sizeof(sql),
 "\x73\x65\x6c\x65\x63\x74\x20\x50\x62\x6d\x5f\x69\x6e\x64\x65\x78\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_AP);return atPb_ExecDbSql(sql,atPb_InitApIndexCb,
-ZUFI_NULL);}INT zte_pbm_check_and_creat_dir(char*path){if(-(0x1664+2022-0x1e49)
-==access(path,(0x499+4418-0x15db))){slog(PB_PRINT,SLOG_DEBUG,
+ZUFI_NULL);}INT zte_pbm_check_and_creat_dir(char*path){if(-(0xbd5+6207-0x2413)==
+access(path,(0x1f39+167-0x1fe0))){slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x70\x62\x6d\x3a\x25\x73\x20\x64\x6f\x65\x73\x20\x6e\x6f\x74\x20\x65\x78\x69\x73\x74\x2c\x73\x6f\x63\x72\x65\x61\x74\x65\x20\x69\x74\x2e" "\n"
-,ZPB_DB_DIR);if(-(0xb58+4117-0x1b6c)==mkdir(path,(0x834+4010-0x15df))){slog(
+,ZPB_DB_DIR);if(-(0x27+5544-0x15ce)==mkdir(path,(0x1129+5186-0x236c))){slog(
 PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x3a\x66\x61\x69\x6c\x65\x64\x20\x74\x6f\x20\x63\x72\x65\x61\x74\x65\x20\x64\x62\x20\x64\x69\x72\x2e" "\n"
-);return-(0x806+6680-0x221d);}}return(0x941+610-0xba3);}UINT8 
+);return-(0x160+4591-0x134e);}}return(0x862+2229-0x1117);}UINT8 
 zte_pbm_check_web_pbm_dir(VOID){
 #ifdef _MBB_OS_UCLINUX

 (VOID)zte_pbm_check_and_creat_dir(
@@ -143,24 +142,24 @@
 "\x2f\x65\x74\x63\x5f\x72\x77\x2f\x63\x6f\x6e\x66\x69\x67");
 #endif

 return ZUFI_SUCC;}T_zPb_DbResult atPb_DelSimRecFromPbTable(SINT32 index){
-T_zPb_DbResult result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0x1bff+2362-0x2539)
-};snprintf(sql,sizeof(sql),
+T_zPb_DbResult result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0xa01+1-0xa02)};
+snprintf(sql,sizeof(sql),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64\x20\x61\x6e\x64\x20\x50\x62\x6d\x5f\x69\x6e\x64\x65\x78\x3d\x25\x64"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_USIM,index);result=atPb_ExecDbSql(sql,NULL,NULL);
 if(ZPB_DB_OK==result){g_zPb_SimIndex[index]=PBM_ERROR_NOT_FOUND;}return result;}
 T_zPb_DbResult atPb_LoadARecToPbmTable(T_zPb_WebContact*pbPara){T_zPb_DbResult 
-result=ZPB_DB_ERROR;CHAR sql[ZPB_MAX_BYTES_DB]={(0x10f6+3643-0x1f31)};if(NULL==
+result=ZPB_DB_ERROR;CHAR sql[ZPB_MAX_BYTES_DB]={(0x62d+3202-0x12af)};if(NULL==
 pbPara){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x4c\x6f\x61\x64\x41\x52\x65\x63\x54\x6f\x50\x62\x6d\x54\x61\x62\x6c\x65\x3a\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74"
 );return ZPB_DB_ERROR_INVALIDPTR;}snprintf(sql,sizeof(sql),"insert into %s (Pbm_index,Location,Number,Type,Name,Anr,Anr1,Email,Sne) \

 			values(\'%d\',\'%d\',\'%s\',\'%d\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\')",ZPB_DB_PBM_TABLE,pbPara->pbIndex,pbPara->pbLocation,pbPara->mobilNumber,pbPara
 ->pbType,pbPara->name,pbPara->homeNumber,pbPara->officeNumber,pbPara->email,
 pbPara->sne);result=atPb_ExecDbSql(sql,NULL,NULL);if(ZPB_DB_OK==result){CHAR 
-pbMax[(0x1c23+1013-0x1fe6)]={(0x184b+302-0x1979)};sc_cfg_get(ZPB_NV_USIMINDEXMAX
-,pbMax,sizeof(pbMax));if((pbPara->pbIndex>=(0xfbd+2641-0x1a0d))&&(pbPara->
-pbIndex<=atoi(pbMax))){g_zPb_SimIndex[pbPara->pbIndex]=PBM_SUCCESS;}(VOID)
-sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);}else{(VOID)sc_cfg_set(
-ZPB_NV_WRITE_FLAG,ZPB_NEW_ERROR);}slog(PB_PRINT,SLOG_DEBUG,
+pbMax[(0xad0+3129-0x16d7)]={(0xa30+5326-0x1efe)};sc_cfg_get(ZPB_NV_USIMINDEXMAX,
+pbMax,sizeof(pbMax));if((pbPara->pbIndex>=(0x2140+226-0x2221))&&(pbPara->pbIndex
+<=atoi(pbMax))){g_zPb_SimIndex[pbPara->pbIndex]=PBM_SUCCESS;}(VOID)sc_cfg_set(
+ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);}else{(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,
+ZPB_NEW_ERROR);}slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x70\x62\x6d\x3a\x65\x78\x65\x63\x20\x74\x61\x62\x6c\x65\x20\x25\x73\x20\x72\x65\x73\x75\x6c\x74\x20\x25\x64" "\n"
 ,ZPB_DB_PBM_TABLE,result);return result;}VOID atPb_SqlModifyOneRec(
 T_zPb_WebContact*pbmPara,char*sql,int len){printf(
@@ -174,17 +173,17 @@
 pbmPara->pbType,pbmPara->name,pbmPara->homeNumber,pbmPara->officeNumber,pbmPara
 ->email,pbmPara->sne,pbmPara->group,pbmPara->pbId);}}T_zPb_DbResult 
 atPb_DbGetParamCb(VOID*fvarg,int line,char**zresult,char**lname){T_zPb_Header 
-para={(0x7c1+4324-0x18a5)};if((0x2209+1196-0x26b4)>line){slog(PB_PRINT,SLOG_ERR,
+para={(0xa4d+4765-0x1cea)};if((0x1b83+1695-0x2221)>line){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x44\x62\x47\x65\x74\x50\x61\x72\x61\x6d\x43\x62\x3a\x72\x65\x63\x6f\x72\x64\x20\x6e\x6f\x20\x64\x61\x74\x61\x2e"
-);return ZPB_DB_ERROR;}para.pbIndex=atoi(zresult[(0x1501+4512-0x26a1)]);para.
-pbLocation=atoi(zresult[(0x2e2+5417-0x180a)]);slog(PB_PRINT,SLOG_DEBUG,
+);return ZPB_DB_ERROR;}para.pbIndex=atoi(zresult[(0x10a4+5554-0x2656)]);para.
+pbLocation=atoi(zresult[(0x1c7b+34-0x1c9c)]);slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x44\x62\x47\x65\x74\x50\x61\x72\x61\x6d\x43\x62\x3a\x20\x69\x6e\x64\x65\x78\x3d\x25\x64\x2c\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64"
 ,para.pbIndex,para.pbLocation);memcpy(fvarg,&para,sizeof(para));return ZPB_DB_OK
 ;}T_zPb_DbResult atPb_GetIndexLocationById(T_zPb_Header*pbPara){CHAR sql[
-ZPB_MAX_BYTES_DB]={(0xb10+4541-0x1ccd)};snprintf(sql,sizeof(sql)-
-(0x314+3497-0x10bc),
+ZPB_MAX_BYTES_DB]={(0x228c+847-0x25db)};snprintf(sql,sizeof(sql)-
+(0xfd3+4378-0x20ec),
 "\x73\x65\x6c\x65\x63\x74\x20\x50\x62\x6d\x5f\x69\x6e\x64\x65\x78\x2c\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x69\x64\x3d\x25\x64"
-,ZPB_DB_PBM_TABLE,pbPara->pbId);memset(pbPara,(0x228b+124-0x2307),sizeof(
+,ZPB_DB_PBM_TABLE,pbPara->pbId);memset(pbPara,(0x1f44+1556-0x2558),sizeof(
 T_zPb_Header));return atPb_ExecDbSql(sql,atPb_DbGetParamCb,pbPara);}VOID 
 atPb_SqlNewOneRec(T_zPb_WebContact*pbmPara,CHAR*sql,int len){if(
 ZPB_LOCATION_USIM==pbmPara->pbLocation){snprintf(sql,len,"insert into %s (Pbm_index,Location,Number,Type,Name,Anr,Anr1,Email,Sne)\

@@ -196,7 +195,7 @@
 pbmPara->pbType,pbmPara->name,pbmPara->homeNumber,pbmPara->officeNumber,pbmPara
 ->email,pbmPara->sne,pbmPara->group);}}T_zPb_DbResult 
 atPb_WriteContactToPbmTable(T_zPb_WebContact*pPbRecord,BOOL pbNewFlag){
-T_zPb_DbResult result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0x1f36+351-0x2095)}
+T_zPb_DbResult result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0x4a6+5909-0x1bbb)}
 ;if(NULL==pPbRecord){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x57\x72\x69\x74\x65\x43\x6f\x6e\x74\x61\x63\x74\x54\x6f\x50\x62\x6d\x54\x61\x62\x6c\x65\x3a\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74"
 );return ZPB_DB_ERROR_INVALIDPTR;}slog(PB_PRINT,SLOG_DEBUG,
@@ -207,75 +206,75 @@
 ZPB_LOCATION_USIM==pPbRecord->pbLocation){g_zPb_SimIndex[(pPbRecord->pbIndex)]=
 PBM_SUCCESS;}else if(ZPB_LOCATION_AP==pPbRecord->pbLocation){g_zPb_ApIndex[(
 pPbRecord->pbIndex)]=PBM_SUCCESS;}}return result;}SINT32 atPb_DbCountTableLineCb
-(VOID*fvarg,int line,char**zresult,char**lname){if((0x224d+216-0x2324)>line){
-slog(PB_PRINT,SLOG_ERR,
+(VOID*fvarg,int line,char**zresult,char**lname){if((0x4c3+3-0x4c5)>line){slog(
+PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x70\x62\x6d\x3a\x72\x65\x63\x6f\x72\x64\x20\x6e\x6f\x20\x64\x61\x74\x61\x2e"
-);return-(0xef8+6161-0x2708);}*(int*)fvarg=atoi(zresult[(0x16d+2307-0xa70)]);
-return(0x10b6+691-0x1369);}T_zPb_DbResult atPb_SetSimCapacityTable(
+);return-(0x1a2d+429-0x1bd9);}*(int*)fvarg=atoi(zresult[(0xf54+4285-0x2011)]);
+return(0x2bb+2780-0xd97);}T_zPb_DbResult atPb_SetSimCapacityTable(
 T_zPb_UsimCapacity pbPara){T_zPb_DbResult result=ZPB_DB_OK;CHAR sql[
-ZPB_MAX_BYTES_DB]={(0x8ef+6654-0x22ed)};UINT32 count=(0x127c+4181-0x22d1);
-snprintf(sql,sizeof(sql)-(0x1053+2340-0x1976),
+ZPB_MAX_BYTES_DB]={(0x170c+952-0x1ac4)};UINT32 count=(0x43c+3857-0x134d);
+snprintf(sql,sizeof(sql)-(0x1b4c+2234-0x2405),
 "\x73\x65\x6c\x65\x63\x74\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x66\x72\x6f\x6d\x20\x25\x73"
 ,ZPB_DB_SIM_CAPABILITY_TABLE);(VOID)atPb_ExecDbSql(sql,atPb_DbCountTableLineCb,&
-count);if((0xf+5025-0x13b0)<count){memset(sql,(0x1af+8788-0x2403),sizeof(sql));
-snprintf(sql,sizeof(sql)-(0x395+6434-0x1cb6),
+count);if((0x2e6+7806-0x2164)<count){memset(sql,(0x1bb+5551-0x176a),sizeof(sql))
+;snprintf(sql,sizeof(sql)-(0x1546+3387-0x2280),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x53\x69\x6d\x5f\x74\x79\x70\x65\x3e\x3d\x30"
 ,ZPB_DB_SIM_CAPABILITY_TABLE);result=atPb_ExecDbSql(sql,NULL,NULL);if(ZPB_DB_OK
 !=result){slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x53\x65\x74\x53\x69\x6d\x43\x61\x70\x61\x63\x69\x74\x79\x54\x61\x62\x6c\x65\x3a\x66\x61\x69\x6c\x21" "\n"
-);return result;}}memset(sql,(0x8a0+1294-0xdae),sizeof(sql));snprintf(sql,sizeof
-(sql)-(0x985+802-0xca6),"insert into %s (Sim_type,Max_record_number,Used_record_number,Max_number_len,Max_name_len,Max_anr_len,Max_anr1_len, \

+);return result;}}memset(sql,(0x1634+3725-0x24c1),sizeof(sql));snprintf(sql,
+sizeof(sql)-(0x4d0+2655-0xf2e),"insert into %s (Sim_type,Max_record_number,Used_record_number,Max_number_len,Max_name_len,Max_anr_len,Max_anr1_len, \

 	          Max_email_len,Max_sne_len) values(\'%d\',\'%d\',\'%d\',\'%d\',\'%d\',\'%d\',\'%d\',\'%d\',\'%d\')",ZPB_DB_SIM_CAPABILITY_TABLE,pbPara.simType,pbPara.maxRecordNum,pbPara.
 usedRecordNum,pbPara.maxNumberLen,pbPara.maxNameLen,pbPara.maxAnrLen,pbPara.
 maxAnr1Len,pbPara.maxEmailLen,pbPara.maxSneLen);slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x53\x65\x74\x53\x69\x6d\x43\x61\x70\x61\x63\x69\x74\x79\x54\x61\x62\x6c\x65\x3a\x6f\x6b\x21" "\n"
 );return atPb_ExecDbSql(sql,NULL,NULL);}T_zPb_DbResult atPb_SetApCapacityTable()
 {T_zPb_DbResult result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={
-(0x1e1d+1918-0x259b)};SINT32 count=(0x182+9587-0x26f5);T_zPb_ApCapacity pbPara={
-(0x7d3+5014-0x1b69)};snprintf(sql,sizeof(sql)-(0xdfb+5328-0x22ca),
+(0x16aa+2339-0x1fcd)};SINT32 count=(0xc2a+3088-0x183a);T_zPb_ApCapacity pbPara={
+(0x1601+1288-0x1b09)};snprintf(sql,sizeof(sql)-(0x19+90-0x72),
 "\x73\x65\x6c\x65\x63\x74\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x66\x72\x6f\x6d\x20\x25\x73"
 ,ZPB_DB_DEVICE_CAPABILITY_TABLE);(VOID)atPb_ExecDbSql(sql,
-atPb_DbCountTableLineCb,&count);if((0x7b5+5912-0x1ecd)<count){memset(sql,
-(0x2cc+3297-0xfad),sizeof(sql));snprintf(sql,sizeof(sql)-(0xca4+1054-0x10c1),
+atPb_DbCountTableLineCb,&count);if((0x162b+3846-0x2531)<count){memset(sql,
+(0x1436+1304-0x194e),sizeof(sql));snprintf(sql,sizeof(sql)-(0x7cf+6732-0x221a),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73",
 ZPB_DB_DEVICE_CAPABILITY_TABLE);result=atPb_ExecDbSql(sql,NULL,NULL);if(
 ZPB_DB_OK!=result){slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x53\x65\x74\x41\x70\x43\x61\x70\x61\x63\x69\x74\x79\x54\x61\x62\x6c\x65\x3a\x66\x61\x69\x6c\x21" "\n"
-);return result;}}memset(sql,(0x547+454-0x70d),sizeof(sql));snprintf(sql,sizeof(
-sql)-(0x3cd+2920-0xf34),
+);return result;}}memset(sql,(0xcdc+3588-0x1ae0),sizeof(sql));snprintf(sql,
+sizeof(sql)-(0x4dd+8729-0x26f5),
 "\x73\x65\x6c\x65\x63\x74\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_AP);result=atPb_ExecDbSql(sql,
 atPb_DbCountTableLineCb,&count);if(ZPB_DB_OK==result){pbPara.usedRecordNum=count
 ;pbPara.maxRecordNum=ZPB_AP_MAX_RECORD;}slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x6d\x61\x78\x5f\x72\x65\x63\x5f\x6e\x75\x6d\x3d\x25\x64\x2c\x75\x73\x65\x64\x3d\x25\x64"
-,pbPara.maxRecordNum,pbPara.usedRecordNum);memset(sql,(0x1889+2925-0x23f6),
-sizeof(sql));snprintf(sql,sizeof(sql)-(0xeb4+931-0x1256),
+,pbPara.maxRecordNum,pbPara.usedRecordNum);memset(sql,(0x70+7042-0x1bf2),sizeof(
+sql));snprintf(sql,sizeof(sql)-(0x4a2+3874-0x13c3),
 "\x69\x6e\x73\x65\x72\x74\x20\x69\x6e\x74\x6f\x20\x25\x73\x20\x28\x4d\x61\x78\x5f\x72\x65\x63\x6f\x72\x64\x5f\x6e\x75\x6d\x62\x65\x72\x2c\x55\x73\x65\x64\x5f\x72\x65\x63\x6f\x72\x64\x5f\x6e\x75\x6d\x62\x65\x72\x29\x20\x76\x61\x6c\x75\x65\x73\x28" "\'" "\x25\x64" "\'" "\x2c" "\'" "\x25\x64" "\'" "\x29"
 ,ZPB_DB_DEVICE_CAPABILITY_TABLE,pbPara.maxRecordNum,pbPara.usedRecordNum);return
  atPb_ExecDbSql(sql,NULL,NULL);}T_zPb_DbResult atPb_DbGetIndexByGroupCb(VOID*
 fvarg,int line,char**zresult,char**lname){T_zPb_ApIndex*pbIndex=NULL;int i=
-(0x11a7+3161-0x1e00);if((0x11ab+3602-0x1fbc)>line){return ZPB_DB_ERROR;}pbIndex=
-(T_zPb_ApIndex*)fvarg;i=pbIndex->count;slog(PB_PRINT,SLOG_DEBUG,
+(0x140+8775-0x2387);if((0x91d+4182-0x1972)>line){return ZPB_DB_ERROR;}pbIndex=(
+T_zPb_ApIndex*)fvarg;i=pbIndex->count;slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x44\x62\x47\x65\x74\x49\x6e\x64\x65\x78\x42\x79\x47\x72\x6f\x75\x70\x43\x62\x20\x65\x6e\x74\x65\x72\x2c\x69\x3d\x25\x64" "\n"
-,i);pbIndex->apIndex[i+(0x2360+93-0x23bc)]=atoi(zresult[(0x490+7312-0x2120)]);
+,i);pbIndex->apIndex[i+(0xa1a+5405-0x1f36)]=atoi(zresult[(0x13f5+2173-0x1c72)]);
 slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x67\x65\x74\x5f\x69\x6e\x64\x65\x78\x5f\x62\x79\x5f\x67\x72\x6f\x75\x70\x5f\x63\x62\x3a\x70\x62\x6d\x5f\x69\x6e\x64\x65\x78\x3d\x25\x64"
-,pbIndex->apIndex[i+(0xdb9+1780-0x14ac)]);pbIndex->count=i+(0x125f+475-0x1439);
+,pbIndex->apIndex[i+(0xc47+3134-0x1884)]);pbIndex->count=i+(0x638+5351-0x1b1e);
 slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x67\x65\x74\x5f\x69\x6e\x64\x65\x78\x5f\x62\x79\x5f\x67\x72\x6f\x75\x70\x5f\x63\x62\x3a\x70\x62\x6d\x20\x63\x6f\x75\x6e\x74\x20\x69\x73\x20\x25\x64"
 ,pbIndex->count);return ZPB_DB_OK;}T_zPb_DbResult atPb_DelRecFromPbmTableByGroup
 (T_zPb_ApIndex*index){T_zPb_DbResult result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]
-={(0xa7d+1507-0x1060)};SINT32 countByGroup=(0xf87+4244-0x201b);CHAR pbGroup[
-ZPB_PARAM_SIZE20]={(0x1ad+7776-0x200d)};sc_cfg_get(ZPB_NV_GROUP,pbGroup,sizeof(
-pbGroup));snprintf(sql,sizeof(sql)-(0x178d+1331-0x1cbf),
+={(0xa7f+4342-0x1b75)};SINT32 countByGroup=(0x16a6+2903-0x21fd);CHAR pbGroup[
+ZPB_PARAM_SIZE20]={(0xd44+850-0x1096)};sc_cfg_get(ZPB_NV_GROUP,pbGroup,sizeof(
+pbGroup));snprintf(sql,sizeof(sql)-(0x16c2+1052-0x1add),
 "\x73\x65\x6c\x65\x63\x74\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64\x20\x61\x6e\x64\x20\x28\x50\x62\x6d\x5f\x67\x72\x6f\x75\x70\x3d" "\"" "\x25\x73" "\"" "\x29"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_AP,pbGroup);(VOID)atPb_ExecDbSql(sql,
-atPb_DbCountTableLineCb,&countByGroup);memset(sql,(0x1a79+2040-0x2271),sizeof(
-sql));snprintf(sql,sizeof(sql)-(0x15c1+1278-0x1abe),
+atPb_DbCountTableLineCb,&countByGroup);memset(sql,(0xc79+5505-0x21fa),sizeof(sql
+));snprintf(sql,sizeof(sql)-(0xd57+3765-0x1c0b),
 "\x73\x65\x6c\x65\x63\x74\x20\x50\x62\x6d\x5f\x69\x6e\x64\x65\x78\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64\x20\x61\x6e\x64\x20\x28\x50\x62\x6d\x5f\x67\x72\x6f\x75\x70\x3d" "\"" "\x25\x73" "\"" "\x29"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_AP,pbGroup);result=atPb_ExecDbSql(sql,
 atPb_DbGetIndexByGroupCb,index);if(countByGroup==index->count){memset(sql,
-(0x1719+2988-0x22c5),sizeof(sql));snprintf(sql,sizeof(sql)-(0x400+7080-0x1fa7),
+(0x1c74+1487-0x2243),sizeof(sql));snprintf(sql,sizeof(sql)-(0x1d2f+188-0x1dea),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64\x20\x61\x6e\x64\x20\x28\x50\x62\x6d\x5f\x67\x72\x6f\x75\x70\x3d" "\"" "\x25\x73" "\"" "\x29"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_AP,pbGroup);if(ZPB_DB_OK==atPb_ExecDbSql(sql,NULL
 ,NULL)){(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);}slog(PB_PRINT,
@@ -283,7 +282,7 @@
 "\x70\x62\x3a\x70\x62\x6d\x3a\x65\x78\x65\x63\x20\x74\x61\x62\x6c\x65\x20\x25\x73\x20\x72\x65\x73\x75\x6c\x74\x20\x25\x64" "\n"
 ,ZPB_DB_PBM_TABLE,result);}else{return ZPB_DB_ERROR;}(VOID)sc_cfg_set(
 ZPB_NV_GROUP,"");return result;}VOID atPb_GetLocationIndexForDel(T_zPb_DelInfo*
-recData,SINT32 delTime){T_zPb_Header pbHeader={(0x12b7+4428-0x2403)};if(NULL==
+recData,SINT32 delTime){T_zPb_Header pbHeader={(0xdf1+4246-0x1e87)};if(NULL==
 recData){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x47\x65\x74\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x49\x6e\x64\x65\x78\x46\x6f\x72\x44\x65\x6c\x2d\x2d\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74" "\n"
 );return;}pbHeader.pbId=recData->delId[delTime];if(ZPB_DB_OK!=
@@ -294,30 +293,30 @@
 "\x70\x62\x3a\x70\x62\x6d\x3a\x64\x65\x6c\x20\x69\x6e\x64\x65\x78\x3d\x25\x64\x2c\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64\x2c\x64\x65\x6c\x5f\x70\x62\x6d\x5f\x74\x69\x6d\x65\x3d\x25\x64"
 ,recData->delIndex[delTime],recData->delLocation,delTime);}T_zPb_DbResult 
 atPb_DelARecFromPbmTable(T_zPb_DelInfo*pbPara,SINT32 delTime){T_zPb_DbResult 
-result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0x2009+1458-0x25bb)};if(NULL==
-pbPara){slog(PB_PRINT,SLOG_ERR,
+result=ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0x404+1518-0x9f2)};if(NULL==pbPara
+){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x70\x62\x6d\x3a\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74"
 );return ZPB_DB_ERROR_INVALIDPTR;}atPb_GetLocationIndexForDel(pbPara,delTime);
 slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x44\x65\x6c\x41\x52\x65\x63\x46\x72\x6f\x6d\x50\x62\x6d\x54\x61\x62\x6c\x65\x20\x65\x6e\x74\x65\x72\x2c\x64\x65\x6c\x54\x69\x6d\x65\x3d\x25\x64\x2c\x69\x64\x3d\x25\x64" "\n"
-,delTime,pbPara->delId[delTime]);snprintf(sql,sizeof(sql)-(0x53d+119-0x5b3),
+,delTime,pbPara->delId[delTime]);snprintf(sql,sizeof(sql)-(0x2453+196-0x2516),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x69\x64\x3d\x25\x64"
 ,ZPB_DB_PBM_TABLE,pbPara->delId[delTime]);result=atPb_ExecDbSql(sql,NULL,NULL);
 if(ZPB_DB_OK==result){if(ZPB_LOCATION_AP==pbPara->delLocation){g_zPb_ApIndex[(
 pbPara->delIndex[delTime])]=PBM_ERROR_NOT_FOUND;}else if(ZPB_LOCATION_USIM==
 pbPara->delLocation){g_zPb_SimIndex[(pbPara->delIndex[delTime])]=
 PBM_ERROR_NOT_FOUND;}}return result;}VOID atPb_ClearSimPbmIndexArray(VOID){
-SINT32 i=(0x16df+4088-0x26d6);for(i=(0x99b+3479-0x1731);(i<=g_zPb_SimIndex[
-(0x8a8+4574-0x1a86)])&&(i<(ZPB_SIM_MAX_RECORD+(0xdc+4723-0x134e)));i++){
+SINT32 i=(0x78+5574-0x163d);for(i=(0x939+2383-0x1287);(i<=g_zPb_SimIndex[
+(0x773+1971-0xf26)])&&(i<(ZPB_SIM_MAX_RECORD+(0xc7+722-0x398)));i++){
 g_zPb_SimIndex[i]=PBM_ERROR_NOT_FOUND;}}VOID atPb_ClearApPbmIndexArray(VOID){
-SINT32 i=(0x1b20+2516-0x24f3);for(i=(0xb21+2390-0x1476);(i<=g_zPb_ApIndex[
-(0x4b9+4294-0x157f)])&&(i<(ZPB_AP_MAX_RECORD+(0x39b+8176-0x238a)));i++){
+SINT32 i=(0x172c+689-0x19dc);for(i=(0x1bd5+207-0x1ca3);(i<=g_zPb_ApIndex[
+(0x1519+21-0x152e)])&&(i<(ZPB_AP_MAX_RECORD+(0x225+8844-0x24b0)));i++){
 g_zPb_ApIndex[i]=PBM_ERROR_NOT_FOUND;}}T_zPb_DbResult 
 atPb_DelAllRecsFromPbmTable(T_zPb_DelInfo*pbPara){T_zPb_DbResult result=
-ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0xda5+4365-0x1eb2)};if(NULL==pbPara){slog
+ZPB_DB_OK;CHAR sql[ZPB_MAX_BYTES_DB]={(0x7b4+5486-0x1d22)};if(NULL==pbPara){slog
 (PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x44\x65\x6c\x41\x6c\x6c\x52\x65\x63\x73\x46\x72\x6f\x6d\x50\x62\x6d\x54\x61\x62\x6c\x65\x3a\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74" "\n"
-);return ZPB_DB_ERROR_INVALIDPTR;}snprintf(sql,sizeof(sql)-(0x4ec+1118-0x949),
+);return ZPB_DB_ERROR_INVALIDPTR;}snprintf(sql,sizeof(sql)-(0x121+3291-0xdfb),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64"
 ,ZPB_DB_PBM_TABLE,pbPara->delLocation);result=atPb_ExecDbSql(sql,NULL,NULL);slog
 (PB_PRINT,SLOG_DEBUG,
diff --git a/ap/app/zte_comm/phonebook/src/pb_main.c b/ap/app/zte_comm/phonebook/src/pb_main.c
index 9096c26..a4b8985 100755
--- a/ap/app/zte_comm/phonebook/src/pb_main.c
+++ b/ap/app/zte_comm/phonebook/src/pb_main.c
@@ -7,9 +7,9 @@
 VOID(*func_ptr)(UINT8*pDatabuf);BOOL need_block;}T_zPbHandleTable;VOID 
 atWeb_AddOneContact(UINT8*pDatabuf);VOID atWeb_DelOneContact(UINT8*pDatabuf);
 VOID atWeb_DelMultiContact(UINT8*pDatabuf);VOID atWeb_DelAllContact(UINT8*
-pDatabuf);T_zPb_optRsp g_PbOptRsp={(0x994+1750-0x106a)};sem_t g_Pb_sem_id={
-(0x184+6814-0x1c22)};int g_zPb_MsqId=-(0xe67+4000-0x1e06);int g_zPb_LocalMsqId=-
-(0x415+4379-0x152f);VOID atWeb_AddOneContact(UINT8*pDatabuf){T_zPb_WebContact*
+pDatabuf);T_zPb_optRsp g_PbOptRsp={(0x15a1+4253-0x263e)};sem_t g_Pb_sem_id={
+(0x988+6052-0x212c)};int g_zPb_MsqId=-(0x21d3+1179-0x266d);int g_zPb_LocalMsqId=
+-(0x260+3055-0xe4e);VOID atWeb_AddOneContact(UINT8*pDatabuf){T_zPb_WebContact*
 webPbContact=NULL;if(pDatabuf==NULL){printf(
 "\x5b\x70\x62\x5d\x2c\x20\x61\x74\x57\x65\x62\x5f\x41\x64\x64\x4f\x6e\x65\x43\x6f\x6e\x74\x61\x63\x74\x20\x70\x61\x72\x61\x20\x69\x73\x20\x6e\x75\x6c\x6c" "\n"
 );return;}webPbContact=(T_zPb_WebContact*)pDatabuf;atWeb_AddOnePb(webPbContact,
@@ -35,21 +35,23 @@
 zPb_RecvZpbicInd(UINT8*pDatabuf){T_zAt_ZpbicRes*ptPara=ZUFI_NULL;if(pDatabuf==
 NULL){return;}ptPara=(T_zAt_ZpbicRes*)(pDatabuf);printf(
 "\x7a\x50\x62\x5f\x52\x65\x63\x76\x5a\x70\x62\x69\x63\x49\x6e\x64\x20\x70\x61\x72\x61\x2c\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2c\x20\x74\x79\x70\x65\x3a\x25\x64" "\n"
-,ptPara->result,ptPara->opertype);if(((0x7b6+2043-0xfb0)==ptPara->result)&&(
-(0x11a7+3685-0x200b)==ptPara->opertype)){CHAR needPb[(0x911+5225-0x1d48)]={
-(0xaef+6381-0x23dc)};sc_cfg_get(NV_NEED_SUPPORT_PB,needPb,sizeof(needPb));if(
-(0x1053+1133-0x14c0)!=strcmp(needPb,"\x6e\x6f")){ipc_send_message(MODULE_ID_PB,
-MODULE_ID_AT_CTL,MSG_CMD_PBINIT_REQ,(0x7bb+1431-0xd52),NULL,(0xb11+5924-0x2235))
-;}}}VOID zPb_RecvZuslotInd(UINT8*pDatabuf){T_zAt_ZuslotRes*ptPara=ZUFI_NULL;if(
-pDatabuf==NULL){return;}ptPara=(T_zAt_ZuslotRes*)(pDatabuf);printf(
+,ptPara->result,ptPara->opertype);if(((0xabf+109-0xb2b)==ptPara->result)&&(
+(0x13ba+3519-0x2178)==ptPara->opertype)){CHAR needPb[(0x799+7461-0x248c)]={
+(0x15c4+3716-0x2448)};sc_cfg_get(NV_NEED_SUPPORT_PB,needPb,sizeof(needPb));if(
+(0x528+8275-0x257b)!=strcmp(needPb,"\x6e\x6f")){ipc_send_message(MODULE_ID_PB,
+MODULE_ID_AT_CTL,MSG_CMD_PBINIT_REQ,(0xa73+1736-0x113b),NULL,
+(0x10f3+3112-0x1d1b));}}}VOID zPb_RecvZuslotInd(UINT8*pDatabuf){T_zAt_ZuslotRes*
+ptPara=ZUFI_NULL;if(pDatabuf==NULL){return;}ptPara=(T_zAt_ZuslotRes*)(pDatabuf);
+printf(
 "\x7a\x50\x62\x5f\x52\x65\x63\x76\x5a\x70\x62\x69\x63\x49\x6e\x64\x20\x70\x61\x72\x61\x2c\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2c\x20\x74\x79\x70\x65\x3a\x25\x64" "\n"
-,ptPara->slot,ptPara->slot_state);if(ptPara->slot_state==(0x831+3480-0x15c9)){
-CHAR needPb[(0x1396+3419-0x20bf)]={(0x36d+2644-0xdc1)};sc_cfg_get(
-NV_NEED_SUPPORT_PB,needPb,sizeof(needPb));if((0x3a3+1180-0x83f)!=strcmp(needPb,
+,ptPara->slot,ptPara->slot_state);if(ptPara->slot_state==(0x422+3109-0x1047)){
+CHAR needPb[(0x41a+3758-0x1296)]={(0x5d9+4112-0x15e9)};sc_cfg_get(
+NV_NEED_SUPPORT_PB,needPb,sizeof(needPb));if((0x315+5507-0x1898)!=strcmp(needPb,
 "\x6e\x6f")){atPb_CfgPbNvInit();atPb_DelAllRecsSimDb();}}}VOID zPb_RecvPbInitRst
-(UINT8*pDatabuf){int pbReadRet=-(0xe25+2465-0x17c5);memcpy(&g_PbOptRsp,pDatabuf,
-sizeof(T_zPb_optRsp));if(g_PbOptRsp.result==-(0x2fa+6726-0x1d3f)){atPb_IintPbErr
-(NULL);return;}pbReadRet=atPb_SendScpbrSet_repeat(g_Pb_sem_id);printf(
+(UINT8*pDatabuf){int pbReadRet=-(0x297+8828-0x2512);memcpy(&g_PbOptRsp,pDatabuf,
+sizeof(T_zPb_optRsp));if(g_PbOptRsp.result==-(0x1d4d+2007-0x2523)){
+atPb_IintPbErr(NULL);return;}pbReadRet=atPb_SendScpbrSet_repeat(g_Pb_sem_id);
+printf(
 "\x7a\x50\x62\x5f\x52\x65\x63\x76\x50\x62\x49\x6e\x69\x74\x52\x73\x74\x20\x72\x65\x73\x75\x6c\x74\x3a\x25\x64" "\n"
 ,pbReadRet);sc_cfg_set(ZPB_NV_INIT,ZPB_OPERATE_SUC);}void zPbLocalHandleWebMsg(
 MSG_BUF*ptMsgBuf){assert(ptMsgBuf!=NULL);printf(
@@ -64,17 +66,18 @@
 ,ptMsgBuf->usMsgCmd);switch(ptMsgBuf->usMsgCmd){case MSG_CMD_WRITE_PB:case 
 MSG_CMD_DEL_A_PB:case MSG_CMD_DEL_MUTI_PB:case MSG_CMD_DEL_ALL_PB:
 ipc_send_message(MODULE_ID_PB,MODULE_ID_PB_LOCAL,ptMsgBuf->usMsgCmd,ptMsgBuf->
-usDataLen,(unsigned char*)ptMsgBuf->aucDataBuf,(0x1aa8+21-0x1abd));break;default
-:break;}}UINT8 zPbMsgCreat(VOID){g_zPb_MsqId=msgget(MODULE_ID_PB,IPC_CREAT|
-(0x1f8c+1554-0x241e));if(g_zPb_MsqId==-(0x2048+1388-0x25b3)){return ZUFI_FAIL;}
-g_zPb_LocalMsqId=msgget(MODULE_ID_PB_LOCAL,IPC_CREAT|(0x9b6+5350-0x1d1c));if(
-g_zPb_LocalMsqId==-(0xbda+6311-0x2480)){return ZUFI_FAIL;}sem_init(&g_Pb_sem_id,
-(0x1645+7-0x164c),(0x92+4256-0x1132));return ZUFI_SUCC;}void detect_modem_state(
-void){CHAR state[(0x327+7355-0x1fb0)]={(0x15c7+1114-0x1a21)};sc_cfg_get(
+usDataLen,(unsigned char*)ptMsgBuf->aucDataBuf,(0x2c6+4490-0x1450));break;
+default:break;}}UINT8 zPbMsgCreat(VOID){g_zPb_MsqId=msgget(MODULE_ID_PB,
+IPC_CREAT|(0x49d+2150-0xb83));if(g_zPb_MsqId==-(0x4eb+5450-0x1a34)){return 
+ZUFI_FAIL;}g_zPb_LocalMsqId=msgget(MODULE_ID_PB_LOCAL,IPC_CREAT|
+(0x1e0b+2194-0x251d));if(g_zPb_LocalMsqId==-(0x143+2893-0xc8f)){return ZUFI_FAIL
+;}sem_init(&g_Pb_sem_id,(0xb4b+5472-0x20ab),(0x21cb+1331-0x26fe));return 
+ZUFI_SUCC;}void detect_modem_state(void){CHAR state[(0x10e8+3591-0x1ebd)]={
+(0x1d9+5100-0x15c5)};sc_cfg_get(
 "\x6d\x6f\x64\x65\x6d\x5f\x6d\x61\x69\x6e\x5f\x73\x74\x61\x74\x65",state,sizeof(
-state));if((0x2015+1159-0x249c)==strcmp(state,
+state));if((0xef2+3290-0x1bcc)==strcmp(state,
 "\x6d\x6f\x64\x65\x6d\x5f\x73\x69\x6d\x5f\x75\x6e\x64\x65\x74\x65\x63\x74\x65\x64"
-)||(0x74d+3568-0x153d)==strcmp(state,
+)||(0x154+2016-0x934)==strcmp(state,
 "\x6d\x6f\x64\x65\x6d\x5f\x73\x69\x6d\x5f\x64\x65\x73\x74\x72\x6f\x79")){
 sc_cfg_set("\x70\x62\x6d\x5f\x69\x6e\x69\x74\x5f\x66\x6c\x61\x67","\x30");}}void
  zPbLocalHandleAtctlMsg(MSG_BUF*ptMsgBuf){assert(ptMsgBuf!=NULL);printf(
@@ -93,28 +96,28 @@
 MSG_CMD_ZUSLOT_IND:zPb_RecvZuslotInd(ptMsgBuf->aucDataBuf);break;case 
 MSG_CMD_PBINIT_RSP:ipc_send_message(MODULE_ID_PB,MODULE_ID_PB_LOCAL,ptMsgBuf->
 usMsgCmd,ptMsgBuf->usDataLen,(unsigned char*)ptMsgBuf->aucDataBuf,
-(0xaa3+134-0xb29));break;default:break;}}VOID zPbHandleResetToFactory(){CHAR 
-clearPb[(0xa35+1482-0xfcd)]={(0x18a+8924-0x2466)};sc_cfg_get(
+(0x4a7+6501-0x1e0c));break;default:break;}}VOID zPbHandleResetToFactory(){CHAR 
+clearPb[(0x18ca+2648-0x22f0)]={(0xab6+6840-0x256e)};sc_cfg_get(
 NV_CLEAR_PB_WHEN_RESTORE,clearPb,sizeof(clearPb));printf(
 "\x61\x74\x57\x65\x62\x5f\x52\x65\x73\x74\x6f\x72\x65\x46\x61\x63\x74\x6f\x72\x79\x53\x65\x74\x74\x69\x6e\x67\x20\x65\x6e\x74\x65\x72\x65\x64\x21\x20" "\n"
 );printf(
 "\x63\x6c\x65\x61\x72\x5f\x70\x62\x5f\x77\x68\x65\x6e\x5f\x72\x65\x73\x74\x6f\x72\x65\x3d\x25\x73\x20" "\n"
-,clearPb);if(strcmp(clearPb,"\x79\x65\x73")==(0x999+4348-0x1a95)){atPb_DropDb();
+,clearPb);if(strcmp(clearPb,"\x79\x65\x73")==(0xb04+5312-0x1fc4)){atPb_DropDb();
 }ipc_send_message(MODULE_ID_PB,MODULE_ID_MAIN_CTRL,MSG_CMD_RESET_RSP,
-(0x34d+4179-0x13a0),NULL,(0x61f+4619-0x182a));}void zPbHandleMainCtrlMsg(MSG_BUF
-*ptMsgBuf){assert(ptMsgBuf!=NULL);printf(
+(0x12f+4214-0x11a5),NULL,(0x15fc+2846-0x211a));}void zPbHandleMainCtrlMsg(
+MSG_BUF*ptMsgBuf){assert(ptMsgBuf!=NULL);printf(
 "\x50\x62\x20\x72\x65\x63\x76\x20\x6d\x61\x69\x6e\x20\x63\x74\x72\x6c\x20\x6d\x73\x67\x20\x63\x6d\x64\x3a\x25\x64" "\n"
 ,ptMsgBuf->usMsgCmd);switch(ptMsgBuf->usMsgCmd){case MSG_CMD_RESET_NOTIFY:
 zPbHandleResetToFactory(ptMsgBuf->aucDataBuf);break;default:break;}}void 
-pb_msg_thread_proc(void*arg){int iRet=(0x192f+2308-0x2233);MSG_BUF stMsg={
-(0x635+5983-0x1d94)};int msgSize=sizeof(MSG_BUF)-sizeof(SINT32);int queueId=*((
+pb_msg_thread_proc(void*arg){int iRet=(0x429+1385-0x992);MSG_BUF stMsg={
+(0x6a1+4406-0x17d7)};int msgSize=sizeof(MSG_BUF)-sizeof(SINT32);int queueId=*((
 int*)arg);prctl(PR_SET_NAME,"\x70\x62\x5f\x6c\x6f\x63\x61\x6c",
-(0xa37+2900-0x158b),(0x17d1+3548-0x25ad),(0xaf3+2377-0x143c));while(
-(0xb07+2584-0x151e)){iRet=(0xeb1+5599-0x2490);memset(&stMsg,(0x1537+368-0x16a7),
-sizeof(MSG_BUF));iRet=msgrcv(queueId,&stMsg,msgSize,(0x1ad5+1861-0x221a),
-(0x1589+2344-0x1eb1));printf(
+(0x7d3+4957-0x1b30),(0xa45+4747-0x1cd0),(0x5c5+7338-0x226f));while(
+(0x1a4a+2651-0x24a4)){iRet=(0x640+1617-0xc91);memset(&stMsg,(0x18f2+405-0x1a87),
+sizeof(MSG_BUF));iRet=msgrcv(queueId,&stMsg,msgSize,(0xe56+4516-0x1ffa),
+(0x10bb+2054-0x18c1));printf(
 "\x70\x62\x5f\x6d\x73\x67\x5f\x74\x68\x72\x65\x61\x64\x5f\x70\x72\x6f\x63\x3a\x25\x78\x2c\x25\x78\x20\x4d\x4f\x44\x55\x4c\x45\x5f\x49\x44\x5f\x41\x54\x5f\x43\x54\x4c\x3d\x25\x78" "\n"
-,stMsg.src_id,stMsg.usMsgCmd,MODULE_ID_AT_CTL);if(iRet>=(0x12ba+2638-0x1d08)){
+,stMsg.src_id,stMsg.usMsgCmd,MODULE_ID_AT_CTL);if(iRet>=(0x15db+3611-0x23f6)){
 switch(stMsg.src_id){case MODULE_ID_WEB_CGI:{zPbHandleWebMsg(&stMsg);break;}case
  MODULE_ID_AT_CTL:{zPbHandleAtctlMsg(&stMsg);break;}case MODULE_ID_PB:{
 zPbLocalHandleWebMsg(&stMsg);zPbLocalHandleAtctlMsg(&stMsg);break;}case 
@@ -122,29 +125,29 @@
 printf(
 "\x5b\x70\x62\x5d\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x2c\x20\x65\x72\x72\x6d\x73\x67\x20\x3d\x20\x25\x73" "\n"
 ,errno,strerror(errno));}}}int phonebook_main(int argc,char*argv[]){pthread_t 
-recv_thread_tid=(0x1680+3439-0x23ef);MSG_BUF msgBuf={(0xbdf+78-0xc2d)};CHAR 
-needPb[(0x44f+7592-0x21c5)]={(0xa03+5057-0x1dc4)};prctl(PR_SET_NAME,
-"\x70\x62\x5f\x6d\x61\x69\x6e",(0x11dd+4927-0x251c),(0x1aa4+1083-0x1edf),
-(0x82c+221-0x909));loglevel_init();sc_cfg_get(NV_NEED_SUPPORT_PB,needPb,sizeof(
-needPb));if((0x5b4+8298-0x261e)!=strcmp(needPb,"\x6e\x6f")){
+recv_thread_tid=(0x12ec+4961-0x264d);MSG_BUF msgBuf={(0x531+6513-0x1ea2)};CHAR 
+needPb[(0x341+7530-0x2079)]={(0x528+2145-0xd89)};prctl(PR_SET_NAME,
+"\x70\x62\x5f\x6d\x61\x69\x6e",(0x118+403-0x2ab),(0x6aa+6298-0x1f44),
+(0xcea+435-0xe9d));loglevel_init();sc_cfg_get(NV_NEED_SUPPORT_PB,needPb,sizeof(
+needPb));if((0x191+5730-0x17f3)!=strcmp(needPb,"\x6e\x6f")){
 #ifdef WEBS_SECURITY

-if(access(ZPB_DB_PATH,F_OK)!=(0x184+8080-0x2114)){if(access(ZPB_TMP_PATH,F_OK)==
-(0x1617+3664-0x2467)){if(remove(ZPB_SEC_PATH)!=(0xdfa+357-0xf5f)){slog(PB_PRINT,
-SLOG_ERR,
+if(access(ZPB_DB_PATH,F_OK)!=(0xf2f+51-0xf62)){if(access(ZPB_TMP_PATH,F_OK)==
+(0x1cd1+2386-0x2623)){if(remove(ZPB_SEC_PATH)!=(0x669+6746-0x20c3)){slog(
+PB_PRINT,SLOG_ERR,
 "\x72\x65\x6d\x6f\x76\x65\x20\x5a\x50\x42\x5f\x53\x45\x43\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c"
-);}if(rename(ZPB_TMP_PATH,ZPB_SEC_PATH)!=(0x664+4211-0x16d7)){slog(PB_PRINT,
+);}if(rename(ZPB_TMP_PATH,ZPB_SEC_PATH)!=(0x11d5+2458-0x1b6f)){slog(PB_PRINT,
 SLOG_ERR,
 "\x72\x65\x6e\x61\x6d\x65\x20\x5a\x50\x42\x5f\x54\x4d\x50\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c"
-);}}if(access(ZPB_SEC_PATH,F_OK)==(0x51+8397-0x211e)){char rnum_buf[
-(0x176a+2508-0x211e)]={(0x227f+458-0x2449)};char cmd[(0x5e6+7698-0x2378)]={
-(0x547+5977-0x1ca0)};sc_cfg_get("\x72\x6e\x75\x6d\x5f\x61\x74",rnum_buf,sizeof(
+);}}if(access(ZPB_SEC_PATH,F_OK)==(0x95f+6866-0x2431)){char rnum_buf[
+(0x831+1957-0xfbe)]={(0x21e9+518-0x23ef)};char cmd[(0xe2c+5608-0x2394)]={
+(0x313+5119-0x1712)};sc_cfg_get("\x72\x6e\x75\x6d\x5f\x61\x74",rnum_buf,sizeof(
 rnum_buf));snprintf(cmd,sizeof(cmd),
 "\x2f\x62\x69\x6e\x2f\x6f\x70\x65\x6e\x73\x73\x6c\x20\x65\x6e\x63\x20\x2d\x64\x20\x2d\x61\x65\x73\x32\x35\x36\x20\x2d\x73\x61\x6c\x74\x20\x2d\x69\x6e\x20\x25\x73\x20\x2d\x6f\x75\x74\x20\x25\x73\x20\x2d\x70\x61\x73\x73\x20\x70\x61\x73\x73\x3a\x25\x73"
 ,ZPB_SEC_PATH,ZPB_DB_PATH,rnum_buf);zxic_system(cmd);}}
 #endif		

-zPbMsgCreat();atPb_Init();}else{return-(0xb1+1450-0x65a);}printf(
+zPbMsgCreat();atPb_Init();}else{return-(0x17b+6498-0x1adc);}printf(
 "\x50\x62\x20\x61\x70\x70\x20\x69\x6e\x69\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64\x2c\x20\x77\x69\x6c\x6c\x20\x74\x6f\x20\x72\x65\x63\x65\x69\x76\x65\x20\x6d\x73\x67\x2c\x20\x6d\x73\x67\x69\x64\x3a\x25\x64" "\n"
 ,g_zPb_MsqId);if(pthread_create(&recv_thread_tid,NULL,pb_msg_thread_proc,(void*)
-(&g_zPb_LocalMsqId))==-(0x982+4628-0x1b95)){assert((0x42f+421-0x5d4));}
-detect_modem_state();pb_msg_thread_proc(&g_zPb_MsqId);return(0x1f0a+919-0x22a1);
+(&g_zPb_LocalMsqId))==-(0xe55+324-0xf98)){assert((0x58c+2781-0x1069));}
+detect_modem_state();pb_msg_thread_proc(&g_zPb_MsqId);return(0x88a+6712-0x22c2);
 }
diff --git a/ap/app/zte_comm/phonebook/src/pb_proc.c b/ap/app/zte_comm/phonebook/src/pb_proc.c
index 1d91f74..ee11a9f 100755
--- a/ap/app/zte_comm/phonebook/src/pb_proc.c
+++ b/ap/app/zte_comm/phonebook/src/pb_proc.c
@@ -3,187 +3,186 @@
 #include <semaphore.h>

 #include <limits.h>

 #include "pb_com.h"

-#define ZPB_UCS2                    (0x7fb+7181-0x2407)

-#define ZPB_UCS2_PREFIX             (0x1c03+2519-0x255a)

-#define ZPB_UCS2_PREFIX_LEN         (0x1c4d+2372-0x258f)

-#define ZPB_NON_GSM                     (0xfe6+3377-0x1cf7)

-#define ZPB_GSM_CHARACTER_SET_SIZE      (0x429+6395-0x1ca4)

-#define ZPB_INIT_LOAD_RECORD_NUM    (0x526+8420-0x25d8)

+#define ZPB_UCS2                    (0x37a+8739-0x259c)

+#define ZPB_UCS2_PREFIX             (0x1523+1612-0x1aef)

+#define ZPB_UCS2_PREFIX_LEN         (0x1e1c+2157-0x2687)

+#define ZPB_NON_GSM                     (0x1512+581-0x1737)

+#define ZPB_GSM_CHARACTER_SET_SIZE      (0x13c2+2542-0x1d30)

+#define ZPB_INIT_LOAD_RECORD_NUM    (0x1662+271-0x173f)

 VOID atPb_CvtChCode(UINT16 basePointer,UINT8 srcData,UINT8*chMsb,UINT8*chLsb);
 BOOL atPb_CvtU82ToU80(const UINT8*srcData,UINT32 srcLen,UINT8*destData,UINT32 
 destLen);BOOL atPb_CvtU81ToU80(const UINT8*srcData,UINT32 srcLen,UINT8*destData,
 UINT32 destLen);extern VOID atPb_ClearSimPbmIndexArray(VOID);extern sem_t 
 g_Pb_sem_id;extern T_zPb_optRsp g_PbOptRsp;UINT32 g_zPb_DelIndex=
-(0x4f4+2872-0x102c);SINT32 g_zPb_SimIndex[ZPB_SIM_MAX_RECORD+(0x20f9+303-0x2227)
-]={(0x1998+2252-0x2264)};SINT32 g_zPb_ApIndex[ZPB_AP_MAX_RECORD+
-(0xcf8+4754-0x1f89)]={(0x2250+1189-0x26f5)};T_zPb_DelStatusMultiOrAll 
-g_zPb_DelStatusUsim={(0x2477+445-0x2634)};const unsigned char G_ZPB_NEWUCS2TOGSM
-[ZPB_GSM_CHARACTER_SET_SIZE*(0x1287+4968-0x25ed)]={ZPB_NON_GSM,ZPB_NON_GSM,
+(0x13c4+72-0x140c);SINT32 g_zPb_SimIndex[ZPB_SIM_MAX_RECORD+(0x3bc+6487-0x1d12)]
+={(0xd0f+2844-0x182b)};SINT32 g_zPb_ApIndex[ZPB_AP_MAX_RECORD+(0x216+2079-0xa34)
+]={(0x802+6892-0x22ee)};T_zPb_DelStatusMultiOrAll g_zPb_DelStatusUsim={
+(0x1846+1829-0x1f6b)};const unsigned char G_ZPB_NEWUCS2TOGSM[
+ZPB_GSM_CHARACTER_SET_SIZE*(0xc06+4557-0x1dd1)]={ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
-ZPB_NON_GSM,ZPB_NON_GSM,(0x979+1851-0x10aa),ZPB_NON_GSM,ZPB_NON_GSM,
-(0x303+3995-0x1291),ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
+ZPB_NON_GSM,ZPB_NON_GSM,(0x34a+1829-0xa65),ZPB_NON_GSM,ZPB_NON_GSM,
+(0xf1c+4967-0x2276),ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
-ZPB_NON_GSM,(0x597+7331-0x221a),(0x3d1+7344-0x2060),(0xbb6+2185-0x141d),
-(0x8d8+3936-0x1815),(0x1949+2736-0x23f7),(0x179b+3462-0x24fc),
-(0x1bc7+1108-0x1ff5),(0x1bd2+2606-0x25d9),(0x15d4+4232-0x2634),
-(0x1a5f+1368-0x1f8e),(0xa92+5590-0x203e),(0xe66+5749-0x24b0),
-(0x1258+5096-0x2614),(0x2a1+4083-0x1267),(0xa78+7228-0x2686),(0xf51+4429-0x206f)
-,(0x1324+4114-0x2306),(0xce1+6220-0x24fc),(0xb55+3329-0x1824),(0x74+8561-0x21b2)
-,(0x1cf4+101-0x1d25),(0x86b+510-0xa34),(0x51+8535-0x2172),(0x602+1655-0xc42),
-(0x16fc+3568-0x24b4),(0x448+4101-0x1414),(0x184a+746-0x1afa),(0xc48+2223-0x14bc)
-,(0x19a9+3382-0x26a3),(0x36f+8920-0x260a),(0x161a+3626-0x2406),
-(0xca9+6669-0x2677),(0x100+9542-0x2646),(0x1753+2226-0x1fc4),
-(0x10b7+4216-0x20ed),(0x19b2+2940-0x24eb),(0xfdd+3669-0x1dee),
-(0x1947+2328-0x221a),(0x8a5+7415-0x2556),(0x110f+4819-0x239b),
-(0x1837+1547-0x1dfa),(0x1d98+1163-0x21da),(0x572+4197-0x158d),(0x81d+1230-0xca0)
-,(0x49a+8541-0x25ab),(0x1178+2195-0x19be),(0x1649+3497-0x23a4),
-(0x168a+641-0x18bc),(0x14a1+4470-0x25c7),(0xc23+1110-0x1028),
-(0x10b9+3946-0x1fd1),(0x552+1534-0xafd),(0xc9f+4919-0x1f82),(0x6d3+592-0x8ce),
-(0x51c+5018-0x1860),(0x88b+7225-0x246d),(0x12b9+764-0x155d),(0x1231+4663-0x240f)
-,(0x178+9554-0x2670),(0x103c+4338-0x20d3),ZPB_NON_GSM,(0x71b+2731-0x1169),
-ZPB_NON_GSM,(0x1617+3704-0x247e),ZPB_NON_GSM,(0x519+2994-0x106a),
-(0x362+7361-0x1fc1),(0x18c+7436-0x1e35),(0x274+1637-0x875),(0x5e8+6249-0x1dec),
-(0x25c+6770-0x1c68),(0x392+6386-0x1c1d),(0x29f+5867-0x1922),(0xdfc+669-0x1030),
-(0x1abb+1326-0x1f7f),(0x129d+1027-0x1635),(0x523+6333-0x1d74),
-(0x1038+212-0x109f),(0x11e0+2917-0x1cd7),(0x1973+2140-0x2160),
-(0x2b8+7210-0x1e72),(0x1180+4088-0x2107),(0xe3d+2072-0x15e3),(0xb86+854-0xe69),
-(0x946+6478-0x2220),(0x2d1+4891-0x1577),(0x10fd+4044-0x2053),(0xe91+1029-0x121f)
-,(0x1dda+512-0x1f62),(0xcdb+115-0xcd5),(0x1249+2648-0x1c27),ZPB_NON_GSM,
+ZPB_NON_GSM,(0x12d7+1895-0x1a1e),(0xfb2+2284-0x187d),(0x920+1930-0x1088),
+(0x5d7+7911-0x249b),(0x1297+3784-0x215d),(0xdb7+3321-0x1a8b),(0xcaa+5656-0x229c)
+,(0x521+5558-0x1ab0),(0x3b7+4719-0x15fe),(0x12fa+2954-0x1e5b),
+(0xaef+4572-0x1ca1),(0x323+2950-0xe7e),(0xd5+5270-0x153f),(0x1793+2383-0x20b5),
+(0x3a1+8606-0x2511),(0x9dc+4173-0x19fa),(0x639+861-0x966),(0xa57+3847-0x192d),
+(0x193a+2730-0x23b2),(0x13dc+2051-0x1bac),(0x21e8+118-0x222a),
+(0x1837+2124-0x204e),(0xf69+316-0x106f),(0x1b56+1389-0x208c),(0x391+8937-0x2642)
+,(0x1574+1408-0x1abb),(0x17a8+74-0x17b8),(0xbf3+3553-0x1999),(0x458+1676-0xaa8),
+(0x1524+166-0x158d),(0x18ad+2238-0x212d),(0xdd9+3331-0x1a9d),(0x1c3d+591-0x1e8c)
+,(0x10f1+4987-0x242b),(0x184d+932-0x1baf),(0x1481+2217-0x1ce7),
+(0x5c+8819-0x228b),(0x11e4+278-0x12b5),(0xcc1+4882-0x1f8d),(0xec2+1619-0x14ce),
+(0x12a4+1792-0x195c),(0x2b8+3643-0x10aa),(0x1363+4063-0x22f8),
+(0x1511+2079-0x1ce5),(0x6db+3541-0x1464),(0x457+5364-0x18fe),(0x709+360-0x823),
+(0x19c7+2380-0x22c4),(0x9d7+5683-0x1fba),(0x12ff+4275-0x2361),
+(0x16f2+2467-0x2043),(0x612+2131-0xe12),(0x6ef+881-0xa0c),(0x1b9a+1322-0x206f),
+(0xfba+4319-0x2043),(0x6b8+5815-0x1d18),(0x7bf+2186-0xff1),(0x819+3442-0x1532),
+(0x119d+256-0x1243),(0x1936+1400-0x1e53),ZPB_NON_GSM,(0x13c1+99-0x13c7),
+ZPB_NON_GSM,(0xce6+675-0xf78),ZPB_NON_GSM,(0x76d+557-0x939),(0x139b+2346-0x1c63)
+,(0x424+4574-0x159f),(0x10a0+4168-0x2084),(0x52a+6875-0x1fa0),
+(0x1173+1907-0x1880),(0xed7+1270-0x1366),(0x1b49+1007-0x1ed0),
+(0x143b+2714-0x1e6c),(0xf4+1016-0x482),(0x9df+4470-0x1aea),(0x16b8+1175-0x1ae3),
+(0x936+6957-0x23f6),(0xdf9+6344-0x2653),(0x6a6+2770-0x1109),(0x35a+6496-0x1c4a),
+(0xc0+1520-0x63f),(0xba0+1618-0x1180),(0xeaa+1515-0x1422),(0x1410+1671-0x1a23),
+(0x545+8375-0x2587),(0x2da+134-0x2ea),(0xa74+3547-0x17d8),(0x37f+6936-0x1e1f),
+(0xaf+7304-0x1cbe),(0x8d1+727-0xb2e),ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
-ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
-ZPB_NON_GSM,(0x14ad+2801-0x1f5e),ZPB_NON_GSM,(0xdf9+4085-0x1ded),
-(0x1fff+515-0x21de),(0x1605+312-0x173a),ZPB_NON_GSM,(0x3d2+4114-0x1385),
+ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,(0x4ab+1945-0xc04),
+ZPB_NON_GSM,(0x4ff+4005-0x14a3),(0x7d4+2922-0x131a),(0x56a+7712-0x2387),
+ZPB_NON_GSM,(0xada+6669-0x2488),ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
 ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,
-ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,ZPB_NON_GSM,(0x1ad8+1861-0x21bd)
-,(0x60+6414-0x192d),(0x1cf7+2015-0x2495),(0x1426+116-0x1459),
-(0x212d+1106-0x253e),(0xd47+2602-0x1716),(0x2f4+2934-0xe5c),(0x5a8+5035-0x1937),
-(0x613+111-0x679),(0x177+6680-0x1b4a),(0x6a5+3013-0x124b),(0x1235+2169-0x1a69),
-(0x1788+1427-0x1cd6),(0x326+1990-0xaa3),(0x6e3+148-0x72e),(0x5ef+1769-0xc8f),
-(0xbf+5281-0x1517),ZPB_NON_GSM,(0x67c+5082-0x19f9),(0x1c9+2852-0xc9e),
-(0x1761+2616-0x214a),(0x654+2737-0x10b6),(0x977+4381-0x1a45),(0x12c+7193-0x1ce9)
-,ZPB_NON_GSM,(0x255+9348-0x26ce),(0xba1+6225-0x239d),(0x14a6+4431-0x25a0),
-(0xef0+804-0x11bf),(0xaed+6032-0x221f),(0x807+2837-0x12c3),ZPB_NON_GSM,
-(0x2174+156-0x21f2),(0xc0d+1080-0xfc6),(0x628+1410-0xb49),(0x406+4114-0x13b7),
-(0xbe8+2399-0x14e6),(0xa22+6018-0x2129),(0xf13+4998-0x228a),(0x3f2+1650-0xa47),
-(0x2e8+9212-0x26db),(0x15a4+2529-0x1f81),(0x1245+354-0x13a2),(0x188+5710-0x1771)
-,(0x368+6262-0x1b79),(0x1153+776-0x1454),(0xd46+5433-0x2216),(0xbb6+5086-0x1f2b)
-,(0x16a9+2567-0x2047),ZPB_NON_GSM,(0xaec+4571-0x1c4a),(0x98+3653-0xed5),
-(0x418+411-0x544),(0xe38+290-0xeeb),(0x56d+3368-0x1226),(0xed8+1104-0x12ac),
-ZPB_NON_GSM,(0x1b9c+1092-0x1fd4),(0x770+7359-0x2429),(0xb04+6779-0x250a),
-(0x6a7+7695-0x2441),(0x2398+948-0x26ce),(0x1722+1937-0x1e3a),ZPB_NON_GSM,
-(0xb8+1676-0x6cb)};VOID atPb_Init(VOID){UINT32 pbCount=(0x1c08+1202-0x20ba);
-g_zPb_SimIndex[(0x3c9+4335-0x14b8)]=(0x1036+2405-0x199b);sc_cfg_set(ZPB_NV_INIT,
-ZPB_LOADING);(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);for(pbCount=
-(0xf55+2960-0x1ae4);pbCount<=ZPB_SIM_MAX_RECORD;pbCount++){g_zPb_SimIndex[
-pbCount]=PBM_ERROR_NOT_FOUND;}if(ZPB_DB_OK!=atPb_CreatDb()){slog(PB_PRINT,
-SLOG_ERR,"pb:atPb_Init:create pbm table failed\n");return;}if(ZPB_DB_OK!=
-atPb_InitApIndex()){slog(PB_PRINT,SLOG_ERR,
+ZPB_NON_GSM,(0xae8+1517-0x1075),(0x136c+1985-0x1aec),(0x9e6+597-0xbfa),
+(0x226c+518-0x2431),(0x483+2036-0xc36),(0x70+4636-0x1231),(0x189a+1296-0x1d9c),
+(0xfa4+3096-0x1ba0),(0xb8d+3136-0x17c4),(0x9f2+7396-0x2691),(0xee5+5217-0x2327),
+(0xc6a+1018-0x101f),(0x1378+1757-0x1a10),(0xef8+3753-0x1d58),(0x12a7+579-0x14a1)
+,(0x108c+4456-0x21ab),(0x349+5947-0x1a3b),ZPB_NON_GSM,(0x51f+1241-0x99b),
+(0x1ff2+410-0x213d),(0x191b+1233-0x1d9d),(0x7a7+2427-0x10d3),
+(0x1bbc+1452-0x2119),(0x1959+2105-0x2136),ZPB_NON_GSM,(0x554+308-0x67d),
+(0xe9+2218-0x93e),(0x2264+289-0x2330),(0x3a4+3680-0x11af),(0xea1+6121-0x262c),
+(0x796+609-0x99e),ZPB_NON_GSM,(0x1350+2716-0x1dce),(0x116d+2247-0x19b5),
+(0x876+6467-0x2158),(0x746+4817-0x19b6),(0x73+2552-0xa0a),(0x11c1+2918-0x1cac),
+(0xea5+2954-0x1a20),(0x927+601-0xb63),(0x1945+1236-0x1e10),(0xc3b+6785-0x26b8),
+(0x814+603-0xa6a),(0x3f0+3110-0xfb1),(0xeef+121-0xf03),(0x1503+3862-0x2412),
+(0xa30+1459-0xf7a),(0x7ba+1484-0xd1d),(0x6c+8338-0x2095),ZPB_NON_GSM,
+(0x222+7813-0x202a),(0xb66+5629-0x215b),(0x546+8484-0x25fb),(0x655+3424-0x1346),
+(0x9f4+2002-0x1157),(0x15b+6698-0x1b09),ZPB_NON_GSM,(0x91d+2246-0x11d7),
+(0xf4a+299-0x106f),(0x653+7259-0x2239),(0xb8c+6291-0x23aa),(0x1243+1032-0x15cd),
+(0x1558+2481-0x1e90),ZPB_NON_GSM,(0x6a1+85-0x67d)};VOID atPb_Init(VOID){UINT32 
+pbCount=(0x122+3622-0xf48);g_zPb_SimIndex[(0x13ff+334-0x154d)]=
+(0x1a81+2063-0x2290);sc_cfg_set(ZPB_NV_INIT,ZPB_LOADING);(VOID)sc_cfg_set(
+ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);for(pbCount=(0x672+4848-0x1961);pbCount<=
+ZPB_SIM_MAX_RECORD;pbCount++){g_zPb_SimIndex[pbCount]=PBM_ERROR_NOT_FOUND;}if(
+ZPB_DB_OK!=atPb_CreatDb()){slog(PB_PRINT,SLOG_ERR,
+"pb:atPb_Init:create pbm table failed\n");return;}if(ZPB_DB_OK!=atPb_InitApIndex
+()){slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x49\x6e\x69\x74\x3a\x69\x6e\x69\x74\x20\x61\x70\x49\x6e\x64\x65\x78\x20\x66\x61\x69\x6c\x65\x64" "\n"
 );return;}(VOID)atPb_SetApCapacityTable();}VOID atPb_CfgPbNvInit(VOID){(VOID)
 sc_cfg_set(ZPB_NV_USIMINDEXMIN,"\x30");(VOID)sc_cfg_set(ZPB_NV_USIMINDEXMAX,
 "\x30");(VOID)sc_cfg_set(ZPB_NV_USIMMEMORYFULL,"\x6e\x6f");}int 
 atpb_CvtUcs2ToAlphaField(char*src,int srcLen,char*dest){int i=
-(0x45d+6281-0x1ce6);int min=32767;int max=(0xe02+4564-0x1fd6);int temp=
-(0x70d+3023-0x12dc);int outOff=(0x1ee8+605-0x2145);printf(
+(0x74a+6426-0x2064);int min=32767;int max=(0xaa4+6134-0x229a);int temp=
+(0x6a2+968-0xa6a);int outOff=(0x1415+2977-0x1fb6);printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x70\x62\x5f\x43\x76\x74\x55\x63\x73\x32\x54\x6f\x41\x6c\x70\x68\x61\x46\x69\x65\x6c\x64\x2c\x20\x73\x72\x63\x4c\x65\x6e\x3d\x25\x64" "\n"
-,srcLen);if(srcLen<=(0x1616+2220-0x1ec2)||src==NULL||dest==NULL){return-
-(0x3b1+2989-0xf5d);}if(srcLen<=(0x6aa+7273-0x2311)){dest[(0x18db+108-0x1947)]=
-(0xd05+6190-0x24b3);memcpy(dest+(0x100+4134-0x1125),src,srcLen);printf(
+,srcLen);if(srcLen<=(0x260+219-0x33b)||src==NULL||dest==NULL){return-
+(0x6d+4390-0x1192);}if(srcLen<=(0x4b2+2483-0xe63)){dest[(0xf1c+5824-0x25dc)]=
+(0x1dc2+2053-0x2547);memcpy(dest+(0x16b8+3149-0x2304),src,srcLen);printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x70\x62\x5f\x43\x76\x74\x55\x63\x73\x32\x54\x6f\x41\x6c\x70\x68\x61\x46\x69\x65\x6c\x64\x2c\x20\x75\x73\x65\x20\x38\x30\x20\x63\x6f\x64\x65\x2c\x20\x6c\x65\x6e\x20\x3d\x25\x64" "\n"
-,srcLen+(0x1452+3286-0x2127));return srcLen+(0x1463+2432-0x1de2);}for(i=
-(0x3db+6236-0x1c37);i<srcLen;i+=(0x459+8304-0x24c7)){if(src[i]!=
-(0x7ac+7829-0x2641)){temp=(int)(((src[i]<<(0x11bf+373-0x132c))&65280)|(src[i+
-(0xd68+1675-0x13f2)]&(0x886+5433-0x1cc0)));
-#if (0x5fb+2758-0x10c1) 
-if(temp<(0x13a6+4297-0x246f)){max=min+(0x42c+4710-0x1610);break;}
+,srcLen+(0x1946+2056-0x214d));return srcLen+(0x2a2+3366-0xfc7);}for(i=
+(0x18d2+3279-0x25a1);i<srcLen;i+=(0x1eb+9405-0x26a6)){if(src[i]!=
+(0x1832+3441-0x25a3)){temp=(int)(((src[i]<<(0x521+1424-0xaa9))&65280)|(src[i+
+(0x144+2672-0xbb3)]&(0x115c+4405-0x2192)));
+#if (0xec+2378-0xa36) 
+if(temp<(0x41c+6528-0x1d9c)){max=min+(0xd18+3094-0x18ac);break;}
 #endif            

 if(min>temp){min=temp;}if(max<temp){max=temp;}}}printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x70\x62\x5f\x43\x76\x74\x55\x63\x73\x32\x54\x6f\x41\x6c\x70\x68\x61\x46\x69\x65\x6c\x64\x2c\x20\x6d\x69\x6e\x3d\x25\x64\x2c\x20\x6d\x61\x78\x3d\x25\x64" "\n"
-,min,max);if((max-min)<(0x1b7+6353-0x1a07)){if((unsigned char)(min&
-(0x1603+2776-0x205b))==(unsigned char)(max&(0x7f9+3758-0x1627))){dest[
-(0x1a46+2250-0x230f)]=(unsigned char)(srcLen/(0x1033+3501-0x1dde));dest[
-(0x626+1092-0xa6a)]=(unsigned char)(0x1a64+545-0x1c04);min=(int)(min&32640);dest
-[(0xd28+1326-0x1254)]=(unsigned char)((min>>(0x6bd+6707-0x20e9))&
-(0x617+3360-0x1238));outOff=(0xd41+1346-0x1280);printf(
+,min,max);if((max-min)<(0x1dc6+1431-0x22dc)){if((unsigned char)(min&
+(0x339+710-0x57f))==(unsigned char)(max&(0x531+3580-0x12ad))){dest[
+(0x12f+1574-0x754)]=(unsigned char)(srcLen/(0x1170+5137-0x257f));dest[
+(0x15b1+1214-0x1a6f)]=(unsigned char)(0xbf1+839-0xeb7);min=(int)(min&32640);dest
+[(0xb85+2542-0x1571)]=(unsigned char)((min>>(0x604+356-0x761))&
+(0x1165+5520-0x25f6));outOff=(0x1c13+2700-0x269c);printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x70\x62\x5f\x43\x76\x74\x55\x63\x73\x32\x54\x6f\x41\x6c\x70\x68\x61\x46\x69\x65\x6c\x64\x2c\x20\x75\x73\x65\x20\x38\x31\x20\x63\x6f\x64\x65" "\n"
-);}else{dest[(0x1cba+2309-0x25be)]=(unsigned char)(srcLen/(0xa3d+4558-0x1c09));
-dest[(0xa66+2558-0x1464)]=(unsigned char)(0xd37+4188-0x1d11);dest[
-(0x20d8+1549-0x26e3)]=(unsigned char)((min>>(0x978+5355-0x1e5b))&
-(0x488+6302-0x1c27));dest[(0x5d1+5207-0x1a25)]=(unsigned char)(min&
-(0xe4c+5235-0x21c0));outOff=(0x12e2+3671-0x2135);printf(
+);}else{dest[(0x170+814-0x49d)]=(unsigned char)(srcLen/(0x1d2+8239-0x21ff));dest
+[(0x12df+661-0x1574)]=(unsigned char)(0x103f+2029-0x17aa);dest[
+(0x282+6226-0x1ad2)]=(unsigned char)((min>>(0x636+365-0x79b))&
+(0xf0f+2400-0x1770));dest[(0xaad+2479-0x1459)]=(unsigned char)(min&
+(0x10b4+3846-0x1ebb));outOff=(0x54d+2644-0xf9d);printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x70\x62\x5f\x43\x76\x74\x55\x63\x73\x32\x54\x6f\x41\x6c\x70\x68\x61\x46\x69\x65\x6c\x64\x2c\x20\x75\x73\x65\x20\x38\x32\x20\x63\x6f\x64\x65" "\n"
-);}for(i=(0x262+3273-0xf2b);i<srcLen;i+=(0xbfb+533-0xe0e)){if(src[i]==
-(0x171b+3460-0x249f)){dest[outOff]=(unsigned char)(src[i+(0x1278+595-0x14ca)]&
-(0x8a8+7460-0x254d));}else{temp=(int)((((src[i]<<(0x14dd+4039-0x249c))&65280)|(
-src[i+(0x554+661-0x7e8)]&(0x2d5+5680-0x1806)))-min);dest[outOff]=(unsigned char)
-(temp|(0xe6c+1749-0x14c1));}outOff++;}printf(
+);}for(i=(0x7d0+2873-0x1309);i<srcLen;i+=(0x1985+3240-0x262b)){if(src[i]==
+(0x1c6+861-0x523)){dest[outOff]=(unsigned char)(src[i+(0x210+3860-0x1123)]&
+(0x1c33+1211-0x206f));}else{temp=(int)((((src[i]<<(0x897+4053-0x1864))&65280)|(
+src[i+(0xe55+2838-0x196a)]&(0xc36+3748-0x19db)))-min);dest[outOff]=(unsigned 
+char)(temp|(0x1907+669-0x1b24));}outOff++;}printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x70\x62\x5f\x43\x76\x74\x55\x63\x73\x32\x54\x6f\x41\x6c\x70\x68\x61\x46\x69\x65\x6c\x64\x2c\x20\x20\x6f\x75\x74\x4f\x66\x66\x3d\x25\x64\x2c\x64\x65\x73\x74\x5b\x25\x64\x5d\x3d\x25\x78" "\n"
-,outOff,outOff,dest[outOff]);return outOff;}dest[(0x214+4838-0x14fa)]=
-(0x1d15+2625-0x26d6);memcpy(dest+(0x1013+5475-0x2575),src,srcLen);printf(
+,outOff,outOff,dest[outOff]);return outOff;}dest[(0x21f+284-0x33b)]=
+(0xba9+2607-0x1558);memcpy(dest+(0xd8a+2398-0x16e7),src,srcLen);printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x70\x62\x5f\x43\x76\x74\x55\x63\x73\x32\x54\x6f\x41\x6c\x70\x68\x61\x46\x69\x65\x6c\x64\x2c\x20\x75\x73\x65\x20\x38\x30\x20\x63\x6f\x64\x65\x2c\x20\x6c\x65\x6e\x20\x3d\x25\x64" "\n"
-,srcLen+(0x135f+488-0x1546));return srcLen+(0xc13+609-0xe73);}int 
+,srcLen+(0x672+8330-0x26fb));return srcLen+(0xdef+3505-0x1b9f);}int 
 atPb_GetU80Code(const UINT8*srcCode,UINT32 srcCodeLen,UINT8*destCode,UINT32 
 destCodeLen){assert(destCode!=NULL&&srcCode!=NULL);if(srcCodeLen==
-(0xe67+4431-0x1fb6)||destCodeLen==(0x11af+3769-0x2068)||destCodeLen<srcCodeLen){
-return-(0x6f+2958-0xbfc);}memset(destCode,(0xdb+8054-0x2051),destCodeLen);
-destCode[(0x9b+6389-0x1990)]=(0xf4d+3447-0x1c44);printf(
+(0x1493+1042-0x18a5)||destCodeLen==(0x14aa+370-0x161c)||destCodeLen<srcCodeLen){
+return-(0xce8+343-0xe3e);}memset(destCode,(0x979+1596-0xfb5),destCodeLen);
+destCode[(0x573+3885-0x14a0)]=(0x524+4495-0x1633);printf(
 "\x63\x68\x65\x6e\x6a\x69\x65\x20\x2d\x2d\x2d\x2d\x2d\x61\x74\x50\x62\x5f\x47\x65\x74\x55\x38\x30\x43\x6f\x64\x65\x2d\x2d\x2d\x2d\x2d\x73\x72\x63\x43\x6f\x64\x65\x5b\x30\x5d\x20\x3d\x20\x25\x64" "\n"
-,srcCode[(0x1de8+757-0x20dd)]);switch(srcCode[(0x1542+305-0x1673)]){case
-(0x6c6+3135-0x1285):{memcpy(destCode,srcCode,srcCodeLen);return srcCodeLen;}case
-(0x1cb7+393-0x1dbf):{atPb_CvtU81ToU80(srcCode+(0x9cc+6056-0x2173),srcCodeLen-
-(0x6b6+4509-0x1852),destCode+(0x7f8+6132-0x1feb),destCodeLen-(0x1600+724-0x18d3)
-);return srcCode[(0x84f+7498-0x2598)]*(0x458+5686-0x1a8c)+(0x13d9+3176-0x2040);}
-case(0x1f20+1613-0x24eb):{atPb_CvtU82ToU80(srcCode+(0x72a+3693-0x1596),
-srcCodeLen-(0x9e5+6777-0x245d),destCode+(0x82+1616-0x6d1),destCodeLen-
-(0xba5+1138-0x1016));return srcCode[(0x43f+8081-0x23cf)]*(0xf43+196-0x1005)+
-(0x718+702-0x9d5);}default:{return-(0x1058+1147-0x14d2);}}}BOOL atPb_CvtU82ToU80
-(const UINT8*srcData,UINT32 srcLen,UINT8*destData,UINT32 destLen){UINT8 chNum=
-(0x143f+55-0x1476);UINT16 basePointer=(0x9ef+1499-0xfca);UINT8 iCurChar=
-(0x1b51+446-0x1d0f);UINT32 iCurSrc=(0x14f9+343-0x1650);chNum=(UINT32)srcData[
-(0x511+3064-0x1109)];basePointer=(UINT16)srcData[(0x1a54+1185-0x1ef4)];
-basePointer=basePointer<<(0x10ba+2502-0x1a78);basePointer=basePointer+srcData[
-(0x1bf+3749-0x1062)];if(chNum*(0x1298+810-0x15c0)>destLen){return FALSE;}for(
-iCurSrc=(0xaa7+5744-0x2114);iCurSrc<srcLen&&iCurChar<chNum;iCurSrc++,iCurChar++)
-{UINT8*curDest=destData+(0x56c+6747-0x1fc5)*iCurChar;atPb_CvtChCode(basePointer,
-srcData[iCurSrc],curDest,curDest+(0x14e2+2641-0x1f32));}return TRUE;}BOOL 
-atPb_CvtU81ToU80(const UINT8*srcData,UINT32 srcLen,UINT8*destData,UINT32 destLen
-){UINT8 chNum=(0x88c+378-0xa06);UINT16 basePointer=(0x1c76+2579-0x2689);UINT8 
-iCurChar=(0xe01+256-0xf01);UINT32 iCurSrc=(0xb59+207-0xc28);chNum=srcData[
-(0x38c+6539-0x1d17)];basePointer=((UINT16)srcData[(0x1d13+1251-0x21f5)])<<
-(0xfe2+885-0x1350);if(chNum*(0x79b+117-0x80e)>destLen){return FALSE;}for(iCurSrc
-=(0x47d+4454-0x15e1);iCurSrc<srcLen&&iCurChar<chNum;iCurSrc++,iCurChar++){UINT8*
-curDest=destData+(0x1000+1664-0x167e)*iCurChar;atPb_CvtChCode(basePointer,
-srcData[iCurSrc],curDest,curDest+(0x11a6+4034-0x2167));}return TRUE;}VOID 
+,srcCode[(0x1a+6526-0x1998)]);switch(srcCode[(0x1971+2473-0x231a)]){case
+(0x2296+70-0x225c):{memcpy(destCode,srcCode,srcCodeLen);return srcCodeLen;}case
+(0xc5b+2788-0x16be):{atPb_CvtU81ToU80(srcCode+(0x5df+4170-0x1628),srcCodeLen-
+(0x13e5+417-0x1585),destCode+(0x176+2465-0xb16),destCodeLen-(0xc18+4066-0x1bf9))
+;return srcCode[(0x4c5+2103-0xcfb)]*(0xa2d+3793-0x18fc)+(0x941+2819-0x1443);}
+case(0x111d+1186-0x153d):{atPb_CvtU82ToU80(srcCode+(0x2aa+2490-0xc63),srcCodeLen
+-(0x481+3249-0x1131),destCode+(0x1d16+99-0x1d78),destCodeLen-(0x800+858-0xb59));
+return srcCode[(0x1461+1637-0x1ac5)]*(0xf04+843-0x124d)+(0x13cf+3732-0x2262);}
+default:{return-(0x556+4563-0x1728);}}}BOOL atPb_CvtU82ToU80(const UINT8*srcData
+,UINT32 srcLen,UINT8*destData,UINT32 destLen){UINT8 chNum=(0x1666+767-0x1965);
+UINT16 basePointer=(0x8+7845-0x1ead);UINT8 iCurChar=(0x83+265-0x18c);UINT32 
+iCurSrc=(0x12f6+2487-0x1cad);chNum=(UINT32)srcData[(0x180+6135-0x1977)];
+basePointer=(UINT16)srcData[(0x1771+1418-0x1cfa)];basePointer=basePointer<<
+(0x1991+130-0x1a0b);basePointer=basePointer+srcData[(0xeaa+5772-0x2534)];if(
+chNum*(0xf54+3668-0x1da6)>destLen){return FALSE;}for(iCurSrc=(0x22d+7366-0x1ef0)
+;iCurSrc<srcLen&&iCurChar<chNum;iCurSrc++,iCurChar++){UINT8*curDest=destData+
+(0xaef+6665-0x24f6)*iCurChar;atPb_CvtChCode(basePointer,srcData[iCurSrc],curDest
+,curDest+(0xf22+1139-0x1394));}return TRUE;}BOOL atPb_CvtU81ToU80(const UINT8*
+srcData,UINT32 srcLen,UINT8*destData,UINT32 destLen){UINT8 chNum=
+(0xef8+555-0x1123);UINT16 basePointer=(0x402+8096-0x23a2);UINT8 iCurChar=
+(0x677+395-0x802);UINT32 iCurSrc=(0xc63+2102-0x1499);chNum=srcData[
+(0x838+3281-0x1509)];basePointer=((UINT16)srcData[(0x1821+1262-0x1d0e)])<<
+(0x14d+2027-0x931);if(chNum*(0x975+4595-0x1b66)>destLen){return FALSE;}for(
+iCurSrc=(0x1148+2729-0x1bef);iCurSrc<srcLen&&iCurChar<chNum;iCurSrc++,iCurChar++
+){UINT8*curDest=destData+(0x996+6008-0x210c)*iCurChar;atPb_CvtChCode(basePointer
+,srcData[iCurSrc],curDest,curDest+(0x9e4+5749-0x2058));}return TRUE;}VOID 
 atPb_CvtChCode(UINT16 basePointer,UINT8 srcData,UINT8*chMsb,UINT8*chLsb){UINT16 
-curChar=(0x16b+6335-0x1a2a);assert(chMsb!=NULL&&chLsb!=NULL);if((srcData&
-(0xa88+5166-0x1e36))==(0x158c+637-0x1809)){curChar=srcData;}else{curChar=
-basePointer+(srcData&(0xb7+9030-0x237e));}*chMsb=(UINT8)(curChar>>
-(0x37f+5053-0x1734));*chLsb=(UINT8)((curChar<<(0x58c+5631-0x1b83))>>
-(0x939+6229-0x2186));return;}int atPb_String2Bytes(const char*pSrc,unsigned char
-*pDst,int nSrcLength){int i=(0x3c8+4105-0x13d1);if(pSrc==NULL||pDst==NULL||
-nSrcLength<(0x903+6153-0x210c)){return-(0x60c+4839-0x18f2);}for(i=
-(0x325+6742-0x1d7b);i<nSrcLength;i+=(0x9ba+2918-0x151e)){if(*pSrc>=
-((char)(0x1e15+191-0x1ea4))&&*pSrc<=((char)(0x7a6+6746-0x21c7))){*pDst=(*pSrc-
-((char)(0x1c7+2371-0xada)))<<(0xa1c+2079-0x1237);}else{*pDst=((toupper(*pSrc)-
-((char)(0x144+8878-0x23b1)))+(0x1279+1252-0x1753))<<(0xa4d+5161-0x1e72);}pSrc++;
-if(*pSrc>=((char)(0x1131+5251-0x2584))&&*pSrc<=((char)(0x15cc+1665-0x1c14))){*
-pDst|=*pSrc-((char)(0x285+6937-0x1d6e));}else{*pDst|=(toupper(*pSrc)-
-((char)(0x64b+1643-0xc75)))+(0x106+3141-0xd41);}pSrc++;pDst++;}return nSrcLength
-/(0x2d7+3916-0x1221);}int atPb_Bytes2String(const unsigned char*pSrc,char*pDst,
+curChar=(0x42d+969-0x7f6);assert(chMsb!=NULL&&chLsb!=NULL);if((srcData&
+(0x1245+1239-0x169c))==(0x389+430-0x537)){curChar=srcData;}else{curChar=
+basePointer+(srcData&(0x968+3169-0x154a));}*chMsb=(UINT8)(curChar>>
+(0x930+2469-0x12cd));*chLsb=(UINT8)((curChar<<(0x1465+3181-0x20ca))>>
+(0xf37+423-0x10d6));return;}int atPb_String2Bytes(const char*pSrc,unsigned char*
+pDst,int nSrcLength){int i=(0x1c1b+699-0x1ed6);if(pSrc==NULL||pDst==NULL||
+nSrcLength<(0x1d4+1055-0x5f3)){return-(0x5b0+6845-0x206c);}for(i=
+(0xa18+5042-0x1dca);i<nSrcLength;i+=(0x1d0a+1834-0x2432)){if(*pSrc>=
+((char)(0x1b3c+879-0x1e7b))&&*pSrc<=((char)(0x177c+3744-0x25e3))){*pDst=(*pSrc-
+((char)(0x78c+3322-0x1456)))<<(0x7fa+5652-0x1e0a);}else{*pDst=((toupper(*pSrc)-
+((char)(0x1445+1112-0x185c)))+(0x2b5+8758-0x24e1))<<(0x344+2457-0xcd9);}pSrc++;
+if(*pSrc>=((char)(0x922+4645-0x1b17))&&*pSrc<=((char)(0x3e5+6221-0x1bf9))){*pDst
+|=*pSrc-((char)(0x423+7056-0x1f83));}else{*pDst|=(toupper(*pSrc)-
+((char)(0x70+1030-0x435)))+(0x1b32+570-0x1d62);}pSrc++;pDst++;}return nSrcLength
+/(0xd8d+5421-0x22b8);}int atPb_Bytes2String(const unsigned char*pSrc,char*pDst,
 int nSrcLength){const char tab[]=
 "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x41\x42\x43\x44\x45\x46";int i=
-(0xa79+5852-0x2155);if(pSrc==NULL||pDst==NULL||nSrcLength<(0xc59+4488-0x1de1)){
-return-(0x19c5+116-0x1a38);}for(i=(0xc66+5336-0x213e);i<nSrcLength;i++){*pDst++=
-tab[*pSrc>>(0x14d0+2515-0x1e9f)];*pDst++=tab[*pSrc&(0x198+314-0x2c3)];pSrc++;}*
-pDst='\0';return nSrcLength*(0x1d8b+1846-0x24bf);}static VOID atPb_WebRecodeShow
-(T_zPb_WebContact const*pFromweb){slog(PB_PRINT,SLOG_DEBUG,
+(0x9e3+1690-0x107d);if(pSrc==NULL||pDst==NULL||nSrcLength<(0x13a6+534-0x15bc)){
+return-(0x11b2+4507-0x234c);}for(i=(0x7ac+1401-0xd25);i<nSrcLength;i++){*pDst++=
+tab[*pSrc>>(0x10f7+634-0x136d)];*pDst++=tab[*pSrc&(0xb2d+4262-0x1bc4)];pSrc++;}*
+pDst='\0';return nSrcLength*(0x1bcd+477-0x1da8);}static VOID atPb_WebRecodeShow(
+T_zPb_WebContact const*pFromweb){slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x66\x72\x6f\x6d\x77\x65\x62\x2e\x49\x6e\x64\x65\x78\x3d\x25\x64" "\n"
 ,pFromweb->pbIndex);slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x66\x72\x6f\x6d\x77\x65\x62\x2e\x4e\x61\x6d\x65\x3d\x25\x73" "\n",
@@ -202,21 +201,20 @@
 ){sc_cfg_set(ZPB_NV_INIT,ZPB_OPERATE_SUC);printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x50\x62\x5f\x53\x65\x6e\x64\x53\x63\x70\x62\x72\x53\x65\x74\x20\x61\x74\x42\x61\x73\x65\x5f\x49\x69\x6e\x74\x50\x62\x4f\x6b\x20" "\n"
 );}VOID atPb_RecvCpbsReadRsp(T_zPb_AtCpbsReadRes*cpbsInd){CHAR resInfo[
-(0x5eb+5584-0x1ba7)]={(0xf7f+782-0x128d)};if(strncmp(cpbsInd->locType,"\x53\x4d"
-,(0x933+3170-0x1593))==(0xdcb+476-0xfa7)){(VOID)snprintf(resInfo,
-(0xe7c+1388-0x13d4),"\x25\x64",cpbsInd->usedEntries);(VOID)sc_cfg_set(
-NV_PB_USEDENTRIES,resInfo);memset(resInfo,(0x747+1270-0xc3d),
-(0x1a11+1962-0x21a7));(VOID)snprintf(resInfo,(0x11aa+2079-0x19b5),"\x25\x64",
-cpbsInd->totalEntries);(VOID)sc_cfg_set(NV_PB_TOTALENTRIES,resInfo);
-g_zPb_SimIndex[(0x12d5+2052-0x1ad9)]=(UINT32)(cpbsInd->totalEntries);}else{
-printf(
+(0xfa0+2423-0x1903)]={(0xada+7082-0x2684)};if(strncmp(cpbsInd->locType,
+"\x53\x4d",(0xf63+1603-0x15a4))==(0x15e5+3179-0x2250)){(VOID)snprintf(resInfo,
+(0x11e1+4336-0x22bd),"\x25\x64",cpbsInd->usedEntries);(VOID)sc_cfg_set(
+NV_PB_USEDENTRIES,resInfo);memset(resInfo,(0x77+531-0x28a),(0x1ab2+2353-0x23cf))
+;(VOID)snprintf(resInfo,(0x365+9094-0x26d7),"\x25\x64",cpbsInd->totalEntries);(
+VOID)sc_cfg_set(NV_PB_TOTALENTRIES,resInfo);g_zPb_SimIndex[(0x3c4+976-0x794)]=(
+UINT32)(cpbsInd->totalEntries);}else{printf(
 "\x61\x74\x50\x62\x5f\x52\x65\x63\x76\x43\x70\x62\x73\x52\x65\x61\x64\x52\x73\x70\x20\x6e\x6f\x74\x20\x53\x4d\x3a\x25\x73" "\n"
 ,cpbsInd->locType);}}static VOID atPb_SetScpbrResToNv(CHAR const*pbNvKeyWord,
-UINT32 len){char converted[(0x84c+4612-0x1a46)]={(0xe8+2726-0xb8e)};assert(
-pbNvKeyWord!=ZUFI_NULL);(VOID)snprintf(converted,(0x1459+3093-0x2064),"\x25\x64"
-,len);(VOID)sc_cfg_set(pbNvKeyWord,converted);}VOID atPb_ScpbrTestRsp(
-T_zPb_AtScpbrTestRes*scpbsInd){T_zPb_UsimCapacity pbPara={(0x5ad+5743-0x1c1c)};
-CHAR pbUsed[(0x8a7+5385-0x1d7e)]={(0x1385+1672-0x1a0d)};sc_cfg_get(
+UINT32 len){char converted[(0xf2+1588-0x71c)]={(0x65c+6451-0x1f8f)};assert(
+pbNvKeyWord!=ZUFI_NULL);(VOID)snprintf(converted,(0x476+4168-0x14b4),"\x25\x64",
+len);(VOID)sc_cfg_set(pbNvKeyWord,converted);}VOID atPb_ScpbrTestRsp(
+T_zPb_AtScpbrTestRes*scpbsInd){T_zPb_UsimCapacity pbPara={(0xa44+4953-0x1d9d)};
+CHAR pbUsed[(0x1b55+1458-0x20d5)]={(0x74b+2701-0x11d8)};sc_cfg_get(
 NV_PB_USEDENTRIES,pbUsed,sizeof(pbUsed));g_zPb_DelIndex=(UINT32)scpbsInd->
 minIndex;pbPara.simType=ZPB_USIM;pbPara.maxRecordNum=scpbsInd->maxIndex;pbPara.
 usedRecordNum=atoi(pbUsed);pbPara.maxNumberLen=scpbsInd->maxNumberLen;pbPara.
@@ -225,22 +223,22 @@
 atPb_SetScpbrResToNv(ZPB_NV_USIMINDEXMIN,(UINT32)scpbsInd->minIndex);
 atPb_SetScpbrResToNv(ZPB_NV_USIMINDEXMAX,(UINT32)scpbsInd->maxIndex);(VOID)
 atPb_SetSimCapacityTable(pbPara);}int atPb_SendScpbrSet_repeat(sem_t tSemId){int
- min=(0x232+2752-0xcf2);int max=(0x1ff+3023-0xdce);int res=(0x8cd+4684-0x1b19);
-int index=(0x235+5720-0x188d);CHAR pbMin[(0x1578+1925-0x1ccb)]={
-(0x87f+7561-0x2608)};CHAR pbMax[(0x118c+3955-0x20cd)]={(0xbb8+6925-0x26c5)};int 
-indexmin=(0xce4+4170-0x1d2e);int indexmax=(0x1349+2397-0x1ca6);
-T_zPb_ScpbrReadRes scpbrReadInfo={(0x7af+779-0xaba)};sc_cfg_get(
-ZPB_NV_USIMINDEXMIN,pbMin,sizeof(pbMin));sc_cfg_get(ZPB_NV_USIMINDEXMAX,pbMax,
-sizeof(pbMax));(VOID)sc_cfg_set(ZPB_NV_INIT,ZPB_LOADING);if(strcmp(pbMin,"\x30")
-==(0x3e2+4780-0x168e)||strcmp(pbMax,"\x30")==(0x16b0+548-0x18d4)){sc_cfg_set(
-ZPB_NV_INIT,ZPB_OPERATE_SUC);printf(
+ min=(0x265+8167-0x224c);int max=(0x3bc+4803-0x167f);int res=
+(0x1430+2648-0x1e88);int index=(0x16b2+3485-0x244f);CHAR pbMin[
+(0x15ec+1127-0x1a21)]={(0x239+1899-0x9a4)};CHAR pbMax[(0x139f+3397-0x20b2)]={
+(0x1e4+7916-0x20d0)};int indexmin=(0x1275+4563-0x2448);int indexmax=
+(0x31+9213-0x242e);T_zPb_ScpbrReadRes scpbrReadInfo={(0x18af+2262-0x2185)};
+sc_cfg_get(ZPB_NV_USIMINDEXMIN,pbMin,sizeof(pbMin));sc_cfg_get(
+ZPB_NV_USIMINDEXMAX,pbMax,sizeof(pbMax));(VOID)sc_cfg_set(ZPB_NV_INIT,
+ZPB_LOADING);if(strcmp(pbMin,"\x30")==(0x1+9895-0x26a8)||strcmp(pbMax,"\x30")==
+(0x279+3673-0x10d2)){sc_cfg_set(ZPB_NV_INIT,ZPB_OPERATE_SUC);printf(
 "\x61\x74\x50\x62\x5f\x53\x65\x6e\x64\x53\x63\x70\x62\x72\x53\x65\x74\x20\x63\x61\x72\x64\x20\x75\x6e\x73\x75\x70\x70\x6f\x72\x74\x20\x70\x62" "\n"
-);return-(0x5e2+123-0x65c);}sscanf(pbMin,"\x25\x64",&min);sscanf(pbMax,
-"\x25\x64",&max);if((min<(0x11aa+3704-0x2022)||min>INT_MAX-(0xcaf+5812-0x2362))
-||(max<(0x1394+4558-0x2562)||max>INT_MAX-(0x2141+266-0x224a))){printf(
+);return-(0x1873+2502-0x2238);}sscanf(pbMin,"\x25\x64",&min);sscanf(pbMax,
+"\x25\x64",&max);if((min<(0x87+1551-0x696)||min>INT_MAX-(0xda6+311-0xedc))||(max
+<(0x9df+6047-0x217e)||max>INT_MAX-(0x1cc4+427-0x1e6e))){printf(
 "\x61\x74\x50\x62\x5f\x53\x65\x6e\x64\x53\x63\x70\x62\x72\x53\x65\x74\x20\x70\x62\x20\x6e\x75\x6d\x20\x65\x72\x72\x20\x6d\x69\x6e\x3a\x25\x64\x2c\x20\x6d\x61\x78\x3a\x25\x64" "\n"
-,min,max);return-(0x1a62+1722-0x211b);}while((0x56+1682-0x6e7)){if(indexmin<min)
-{indexmin=min;indexmax=min+ZPB_INIT_LOAD_RECORD_NUM-(0xa29+6090-0x21f2);if(
+,min,max);return-(0xdcd+2161-0x163d);}while((0xdfb+3014-0x19c0)){if(indexmin<min
+){indexmin=min;indexmax=min+ZPB_INIT_LOAD_RECORD_NUM-(0x118+862-0x475);if(
 indexmax>max){indexmax=max;break;}printf(
 "\x5b\x50\x42\x5d\x20\x31\x31\x31\x20\x69\x6e\x64\x65\x78\x6d\x69\x6e\x3d\x25\x64\x2c\x20\x69\x6e\x64\x65\x78\x6d\x61\x78\x3d\x25\x64\x2c\x28\x25\x64\x2d\x25\x64\x29" "\n"
 ,indexmin,indexmax,min,max);}else{indexmin=indexmin+ZPB_INIT_LOAD_RECORD_NUM;if(
@@ -252,17 +250,17 @@
 ,indexmin,indexmax,min,max);}scpbrReadInfo.minIndex=indexmin;scpbrReadInfo.
 maxIndex=indexmax;res=ipc_send_message(MODULE_ID_PB,MODULE_ID_AT_CTL,
 MSG_CMD_READ_PB_REQ,sizeof(T_zPb_ScpbrReadRes),&scpbrReadInfo,
-(0xf4b+5442-0x248d));sem_wait(&g_Pb_sem_id);if(g_PbOptRsp.result==-
-(0x1032+3849-0x1f3a)){break;}}return g_PbOptRsp.result;}
-#if (0x146+6708-0x1b7a)

+(0x1be2+2272-0x24c2));sem_wait(&g_Pb_sem_id);if(g_PbOptRsp.result==-
+(0x8d7+2668-0x1342)){break;}}return g_PbOptRsp.result;}
+#if (0x495+3987-0x1428)

 int atPb_SendScpbrSet(PSTR pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){UINT32 
-indexmin=(0x178d+2515-0x2160);UINT32 indexmax=(0x40+7229-0x1c7d);CHAR atcmdMsg[
-(0x216+3604-0xfe4)]={(0x8+8258-0x204a)};int res=(0xa7d+1701-0x1122);CHAR pbMin[
-(0x958+2585-0x133f)]={(0xae9+5241-0x1f62)};CHAR pbMax[(0x309+7987-0x220a)]={
-(0x450+4433-0x15a1)};sc_cfg_get(ZPB_NV_USIMINDEXMIN,pbMin,sizeof(pbMin));
+indexmin=(0x5dd+2946-0x115f);UINT32 indexmax=(0x53c+3394-0x127e);CHAR atcmdMsg[
+(0x65c+7518-0x2374)]={(0x1385+727-0x165c)};int res=(0x6d4+1553-0xce5);CHAR pbMin
+[(0x1875+2180-0x20c7)]={(0x1df+2269-0xabc)};CHAR pbMax[(0x224+7448-0x1f0a)]={
+(0x114+8655-0x22e3)};sc_cfg_get(ZPB_NV_USIMINDEXMIN,pbMin,sizeof(pbMin));
 sc_cfg_get(ZPB_NV_USIMINDEXMAX,pbMax,sizeof(pbMax));(VOID)sc_cfg_set(ZPB_NV_INIT
-,ZPB_LOADING);if(strcmp(pbMin,"\x30")==(0x9f2+178-0xaa4)||strcmp(pbMax,"\x30")==
-(0x1b68+795-0x1e83)){printf(
+,ZPB_LOADING);if(strcmp(pbMin,"\x30")==(0x10dd+1040-0x14ed)||strcmp(pbMax,"\x30"
+)==(0x62a+2927-0x1199)){printf(
 "\x61\x74\x50\x62\x5f\x53\x65\x6e\x64\x53\x63\x70\x62\x72\x53\x65\x74\x20\x63\x61\x72\x64\x20\x75\x6e\x73\x75\x70\x70\x6f\x72\x74\x20\x70\x62" "\n"
 );return ZAT_RESULT_OK;}sscanf(pbMin,"\x25\x64",&indexmin);sscanf(pbMax,
 "\x25\x64",&indexmax);(VOID)snprintf(atcmdMsg,sizeof(atcmdMsg),
@@ -271,46 +269,45 @@
 atcmdMsg,cid,pAtRst,atRstSize);pthread_mutex_unlock(&smsdb_mutex);return res;}
 #endif

 UINT8 atPb_EncodeText(CHAR*pbDst,CHAR const*pbTextSrc,UINT32 dstLen){UINT8 i=
-(0xc55+655-0xee4);CHAR strTarget[ZPB_TEXT_SIZE_BYTES]={(0x857+5395-0x1d6a)};if(
-pbTextSrc!=ZUFI_NULL){if(strlen(pbTextSrc)*(0x6f5+7884-0x25bd)+
-ZPB_UCS2_PREFIX_LEN<dstLen){snprintf((CHAR*)&strTarget[(0x1ba+8786-0x240c)],
-sizeof(strTarget),"\x25\x30\x32\x58",ZPB_UCS2_PREFIX);for(i=(0x22e7+173-0x2394);
-(i<strlen(pbTextSrc))&&(i*(0x7f+6011-0x17f6)+ZPB_UCS2_PREFIX_LEN<dstLen);i++){
-snprintf(strTarget+i*(0xc99+5766-0x231b)+ZPB_UCS2_PREFIX_LEN,sizeof(strTarget)-i
-*(0x81b+566-0xa4d)-ZPB_UCS2_PREFIX_LEN,"\x30\x30\x25\x30\x32\x58",pbTextSrc[i]);
-}strncpy(pbDst,strTarget,dstLen-(0xc15+4682-0x1e5e));return ZUFI_SUCC;}}return 
-ZUFI_FAIL;}VOID atPb_ScpbrSetRsp(T_zPb_ScpbrSetRes*atRes){T_zPb_WebContact 
-pbRecord={(0x12fc+3365-0x2021)};CHAR pbDst[ZPB_TEXT_SIZE_BYTES]={
-(0x100b+5796-0x26af)};CHAR text[ZPB_TEXT_SIZE_BYTES]={(0xfb4+2601-0x19dd)};int 
-text_len=(0x12b5+3926-0x220b);int tmp_len=(0x348+9032-0x2690);CHAR tmp[
-ZPB_TEXT_SIZE_BYTES]={(0xc29+1197-0x10d6)};if(atRes->coding!=ZPB_UCS2){if(
+(0x410+7943-0x2317);CHAR strTarget[ZPB_TEXT_SIZE_BYTES]={(0x563+3996-0x14ff)};if
+(pbTextSrc!=ZUFI_NULL){if(strlen(pbTextSrc)*(0x661+5490-0x1bcf)+
+ZPB_UCS2_PREFIX_LEN<dstLen){snprintf((CHAR*)&strTarget[(0x1345+288-0x1465)],
+sizeof(strTarget),"\x25\x30\x32\x58",ZPB_UCS2_PREFIX);for(i=(0x1874+2243-0x2137)
+;(i<strlen(pbTextSrc))&&(i*(0xd73+5633-0x2370)+ZPB_UCS2_PREFIX_LEN<dstLen);i++){
+snprintf(strTarget+i*(0x275+4228-0x12f5)+ZPB_UCS2_PREFIX_LEN,sizeof(strTarget)-i
+*(0x93f+5770-0x1fc5)-ZPB_UCS2_PREFIX_LEN,"\x30\x30\x25\x30\x32\x58",pbTextSrc[i]
+);}strncpy(pbDst,strTarget,dstLen-(0x1849+1808-0x1f58));return ZUFI_SUCC;}}
+return ZUFI_FAIL;}VOID atPb_ScpbrSetRsp(T_zPb_ScpbrSetRes*atRes){
+T_zPb_WebContact pbRecord={(0x11ca+770-0x14cc)};CHAR pbDst[ZPB_TEXT_SIZE_BYTES]=
+{(0x58b+8497-0x26bc)};CHAR text[ZPB_TEXT_SIZE_BYTES]={(0x5f4+380-0x770)};int 
+text_len=(0x44c+5839-0x1b1b);int tmp_len=(0x1213+3476-0x1fa7);CHAR tmp[
+ZPB_TEXT_SIZE_BYTES]={(0x17a+4148-0x11ae)};if(atRes->coding!=ZPB_UCS2){if(
 atPb_EncodeText(pbDst,atRes->text,ZPB_TEXT_SIZE_BYTES)==ZUFI_SUCC){strncpy(atRes
-->text,pbDst+(0x245+1053-0x660),sizeof(atRes->text)-(0x4f9+3334-0x11fe));}else{
+->text,pbDst+(0x75+4301-0x1140),sizeof(atRes->text)-(0x11f+8216-0x2136));}else{
 slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x53\x63\x70\x62\x72\x53\x65\x74\x52\x73\x70\x65\x6e\x63\x6f\x64\x65\x20\x65\x72\x72\x21\x2e" "\n"
 );return;}}else{text_len=atPb_String2Bytes(&atRes->text,&text,strlen(atRes->text
 ));tmp_len=atPb_GetU80Code(&text,text_len,&tmp,ZPB_TEXT_SIZE_BYTES);if(tmp_len<
-(0x17fa+3209-0x2483))return;memset(&text,(0x1297+4475-0x2412),
-ZPB_TEXT_SIZE_BYTES);text_len=atPb_Bytes2String(&tmp,&text,tmp_len);if(text_len>
-(0x1e32+1507-0x2413)){memset(&atRes->text,(0xdbc+5178-0x21f6),
-ZPB_TEXT_SIZE_BYTES);memcpy(&atRes->text,text+(0x83a+608-0xa98),strlen(text)-
-(0x801+311-0x936));}}pbRecord.pbId=-(0x53+7330-0x1cf4);pbRecord.pbIndex=(SINT32)
-atRes->index;strncpy(pbRecord.name,atRes->text,sizeof(pbRecord.name)-
-(0x678+957-0xa34));strncpy(pbRecord.mobilNumber,atRes->number1,sizeof(pbRecord.
-mobilNumber)-(0xa24+4365-0x1b30));strncpy(pbRecord.officeNumber,atRes->number2,
-sizeof(pbRecord.officeNumber)-(0x1fd3+363-0x213d));strncpy(pbRecord.homeNumber,
-atRes->number3,sizeof(pbRecord.homeNumber)-(0xf1+2480-0xaa0));strncpy(pbRecord.
-email,atRes->email,sizeof(pbRecord.email)-(0x78+339-0x1ca));pbRecord.pbLocation=
-ZPB_LOCATION_USIM;(VOID)atPb_LoadARecToPbmTable(&pbRecord);}VOID 
-atPb_SetDelStatusMultOrAll(){if(g_zPb_DelStatusUsim.dealFailNum>
-(0x94c+5270-0x1de2)){if(g_zPb_DelStatusUsim.dealSuccNum>(0x126+3097-0xd3f)){(
-VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_MUL_DEL_PART_SUC);}else{(VOID)sc_cfg_set(
-ZPB_NV_WRITE_FLAG,ZPB_DEL_ERROR);}}else{(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,
-ZPB_OPERATE_SUC);}}
-#if (0x83c+1855-0xf7b)

+(0xbbf+4124-0x1bdb))return;memset(&text,(0x1c14+2236-0x24d0),ZPB_TEXT_SIZE_BYTES
+);text_len=atPb_Bytes2String(&tmp,&text,tmp_len);if(text_len>(0x17d+8105-0x2124)
+){memset(&atRes->text,(0xbe3+121-0xc5c),ZPB_TEXT_SIZE_BYTES);memcpy(&atRes->text
+,text+(0x15aa+1423-0x1b37),strlen(text)-(0x1175+646-0x13f9));}}pbRecord.pbId=-
+(0x6b6+5922-0x1dd7);pbRecord.pbIndex=(SINT32)atRes->index;strncpy(pbRecord.name,
+atRes->text,sizeof(pbRecord.name)-(0x4b1+4674-0x16f2));strncpy(pbRecord.
+mobilNumber,atRes->number1,sizeof(pbRecord.mobilNumber)-(0x54+9893-0x26f8));
+strncpy(pbRecord.officeNumber,atRes->number2,sizeof(pbRecord.officeNumber)-
+(0x35f+2867-0xe91));strncpy(pbRecord.homeNumber,atRes->number3,sizeof(pbRecord.
+homeNumber)-(0x4c+3147-0xc96));strncpy(pbRecord.email,atRes->email,sizeof(
+pbRecord.email)-(0x9a1+3991-0x1937));pbRecord.pbLocation=ZPB_LOCATION_USIM;(VOID
+)atPb_LoadARecToPbmTable(&pbRecord);}VOID atPb_SetDelStatusMultOrAll(){if(
+g_zPb_DelStatusUsim.dealFailNum>(0xe3+7165-0x1ce0)){if(g_zPb_DelStatusUsim.
+dealSuccNum>(0xdd3+444-0xf8f)){(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,
+ZPB_MUL_DEL_PART_SUC);}else{(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_DEL_ERROR);}}
+else{(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);}}
+#if (0x8a0+4141-0x18cd)

 VOID atPb_RecvScpbwAddErr(UINT8*pErrCode){(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,
-ZPB_NEW_ERROR);if((strncmp(pErrCode,ZAT_ERRCODE_MEMORY_FULL,(0xb8d+1129-0xff4))
-==(0x180a+1688-0x1ea2))){(VOID)sc_cfg_set(ZPB_NV_USIMMEMORYFULL,"\x79\x65\x73");
+ZPB_NEW_ERROR);if((strncmp(pErrCode,ZAT_ERRCODE_MEMORY_FULL,(0x1199+5356-0x2683)
+)==(0xd4f+3749-0x1bf4))){(VOID)sc_cfg_set(ZPB_NV_USIMMEMORYFULL,"\x79\x65\x73");
 printf(
 "\x70\x62\x3a\x52\x65\x63\x76\x20\x43\x4d\x45\x20\x45\x72\x72\x43\x6f\x64\x65\x3a\x20\x32\x30\x2e" "\n"
 );}else{printf(
@@ -321,84 +318,83 @@
 ZPB_NEW_ERROR);printf(
 "\x70\x62\x3a\x52\x65\x63\x76\x20\x41\x74\x20\x53\x63\x70\x62\x77\x20\x6d\x6f\x64\x69\x66\x79\x20\x65\x72\x72\x2e" "\n"
 );}VOID pb_AsctoHex(UINT16*pcHex,SINT32 iDstLen,UINT8 const*pcASC,SINT32 iSrcLen
-){UINT32 iOddOrEven=(0x1636+4118-0x264c);UINT8 iTemp=(0x78d+4328-0x1875);SINT32 
-i=(0x30c+5906-0x1a1e);if((NULL==pcHex)||(NULL==pcASC)||((0x364+8368-0x2414)==
-iDstLen)||(iDstLen<(iSrcLen/(0x1762+3396-0x24a4)+(0xc61+5160-0x2088)))){return;}
-for(i=(0x3b6+940-0x762);i<iSrcLen;i++){if(iOddOrEven%(0x3da+7618-0x219a)==
-(0x1449+2231-0x1d00)){iTemp=*(pcASC+i);if((iTemp>=((char)(0x4b+6697-0x1a44)))&&(
-iTemp<=((char)(0x197f+2192-0x21d6)))){*(pcHex+i/(0x122b+141-0x12b6))|=(UINT8)(
-iTemp-(0x21f+8062-0x216d))<<(0x586+6521-0x1efb);}else{*(pcHex+i/
-(0xec6+2847-0x19e3))|=(UINT8)(iTemp-(0x1da6+1516-0x235b))<<(0x18d0+1458-0x1e7e);
-}}else{iTemp=*(pcASC+i);if((iTemp>=((char)(0x9c1+280-0xaa9)))&&(iTemp<=
-((char)(0x8b4+3806-0x1759)))){*(pcHex+i/(0x237+7224-0x1e6d))|=iTemp-
-(0x771+4406-0x1877);}else{*(pcHex+i/(0x1479+3035-0x2052))|=iTemp-
-(0x8ed+3491-0x1659);}}iOddOrEven++;}}SINT32 atPb_IfUcs2IsSMS7(UINT16*psUcs2,
-SINT32 iLength){int iRetVal=(0x885+3650-0x16c6);char cTemp;int i=
-(0x2e1+907-0x66c);if(NULL==psUcs2){return-(0x1f53+1627-0x25ad);}for(i=
-(0x1205+1742-0x18d3);i<iLength;i++){if((0x2051+523-0x215c)>psUcs2[i]){switch(
-psUcs2[i]){case(0xb1d+3855-0x1a20):case(0x9ac+5671-0x1f78):case
-(0x207c+295-0x2147):case(0x95a+1582-0xf2b):case(0x1819+1484-0x1d87):case
-(0x278+7794-0x206f):case(0x71b+2658-0x1101):case(0x333+5607-0x189d):case
-(0x830+4150-0x17e8):case(0xb0d+6622-0x2447):case(0x52+7278-0x1ca0):{break;}
+){UINT32 iOddOrEven=(0xdb4+1797-0x14b9);UINT8 iTemp=(0x5ff+946-0x9b1);SINT32 i=
+(0x12da+2869-0x1e0f);if((NULL==pcHex)||(NULL==pcASC)||((0x11e1+5228-0x264d)==
+iDstLen)||(iDstLen<(iSrcLen/(0x44a+445-0x605)+(0x52a+5247-0x19a8)))){return;}for
+(i=(0x21a8+831-0x24e7);i<iSrcLen;i++){if(iOddOrEven%(0x1832+885-0x1ba5)==
+(0x23c+7298-0x1ebe)){iTemp=*(pcASC+i);if((iTemp>=((char)(0x74c+5219-0x1b7f)))&&(
+iTemp<=((char)(0xa8d+4145-0x1a85)))){*(pcHex+i/(0xddd+505-0xfd4))|=(UINT8)(iTemp
+-(0xa96+4193-0x1ac7))<<(0xa49+2616-0x147d);}else{*(pcHex+i/(0x4e0+3184-0x114e))
+|=(UINT8)(iTemp-(0xba+6414-0x1991))<<(0xf7c+4076-0x1f64);}}else{iTemp=*(pcASC+i)
+;if((iTemp>=((char)(0x1779+1538-0x1d4b)))&&(iTemp<=((char)(0x374+4387-0x145e))))
+{*(pcHex+i/(0x195b+437-0x1b0e))|=iTemp-(0xb0a+4545-0x1c9b);}else{*(pcHex+i/
+(0xdb8+1120-0x1216))|=iTemp-(0x12e8+2658-0x1d13);}}iOddOrEven++;}}SINT32 
+atPb_IfUcs2IsSMS7(UINT16*psUcs2,SINT32 iLength){int iRetVal=(0x17c0+368-0x192f);
+char cTemp;int i=(0x6c1+5484-0x1c2d);if(NULL==psUcs2){return-(0x4e3+5537-0x1a83)
+;}for(i=(0xc92+5012-0x2026);i<iLength;i++){if((0x108+2485-0x9bd)>psUcs2[i]){
+switch(psUcs2[i]){case(0x2238+770-0x252e):case(0xa00+4306-0x1a77):case
+(0x47c+5470-0x197e):case(0x19fb+2654-0x23fc):case(0x765+3079-0x130e):case
+(0x3f8+7822-0x220b):case(0x981+1293-0xe12):case(0x1925+1175-0x1d3f):case
+(0xde6+1925-0x14ed):case(0xf83+5077-0x22b4):case(0x1493+1843-0x1ba6):{break;}
 default:{cTemp=(char)G_ZPB_NEWUCS2TOGSM[psUcs2[i]];if(ZPB_NON_GSM==cTemp){
-iRetVal=(0x3f1+4621-0x15fe);}break;}}}else{switch(psUcs2[i]){case
-(0xd57+5652-0x1fd7):case(0xba4+4142-0x182c):case(0xf8b+2323-0x150b):case
-(0x10d9+5560-0x22f6):case(0xb1f+1722-0xe30):case(0xfeb+3807-0x1b2a):case
-(0x948+2021-0xd65):case(0x42d+6382-0x1978):case(0x13d3+501-0x1210):case
-(0x18e9+72-0x1593):{break;}default:{iRetVal=(0xde4+4793-0x209d);break;}}}if(
-(0x8ef+1696-0xf8f)==iRetVal){break;}}return iRetVal;}static UINT8 
+iRetVal=(0xcfc+6037-0x2491);}break;}}}else{switch(psUcs2[i]){case
+(0xd06+4188-0x19ce):case(0x1ed3+2702-0x25bb):case(0x1fd8+1047-0x205c):case
+(0x794+379-0x574):case(0x1599+503-0x13e7):case(0x7d4+632-0x6ac):case
+(0xb7b+5150-0x1bd1):case(0x644+6757-0x1d06):case(0x191a+55-0x1599):case
+(0xd86+2384-0x1338):{break;}default:{iRetVal=(0x10a+4971-0x1475);break;}}}if(
+(0x10ea+1333-0x161f)==iRetVal){break;}}return iRetVal;}static UINT8 
 atPb_EncodeNameToUcs2(char*pbDst,UINT32 iDstLen,char const*pbSrc){UINT16 acHex[
-(0x1d3b+959-0x1ffa)]={(0xc0c+2064-0x141c)};SINT32 srclen=(0x18fb+934-0x1ca1);
-SINT32 rest=(0x915+851-0xc68);assert(pbDst!=NULL&&pbSrc!=NULL);srclen=(SINT32)
-strlen(pbSrc);slog(PB_PRINT,SLOG_DEBUG,
+(0x12d4+260-0x12d8)]={(0x5c+213-0x131)};SINT32 srclen=(0x26c+764-0x568);SINT32 
+rest=(0xd5a+237-0xe47);assert(pbDst!=NULL&&pbSrc!=NULL);srclen=(SINT32)strlen(
+pbSrc);slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x50\x62\x5f\x45\x6e\x63\x6f\x64\x65\x4e\x61\x6d\x65\x54\x6f\x55\x63\x73\x32\x20\x69\x6e\x70\x75\x74\x20\x70\x73\x53\x72\x63\x3d\x25\x73\x2c\x69\x53\x72\x63\x4c\x65\x6e\x3d\x25\x64" "\n"
-,pbSrc,srclen);pb_AsctoHex(acHex,(0x1212+3984-0x20a2),(UINT8*)pbSrc,srclen);rest
-=atPb_IfUcs2IsSMS7(acHex,srclen/(0x1247+4341-0x2338));if(rest==
-(0x14e6+990-0x18c3)){return atPb_EncodeText(pbDst,pbSrc,iDstLen);}else if(rest==
-(0x1be6+2761-0x26af)){if(strlen(pbSrc)+(0x335+3432-0x109b)<iDstLen){memcpy(pbDst
-,"\x38\x30",(0x6bd+2626-0x10fd));memcpy(pbDst+(0x35d+2381-0xca8),pbSrc,srclen);
-return ZUFI_SUCC;}}return ZUFI_FAIL;}SINT32 atPb_FindIdleIndex(T_zPb_WebContact 
-const*pbRecv,BOOL pbNewFlag){SINT32 count=(0x1759+1864-0x1ea0);SINT32 total=
-(0x40a+2511-0xdd9);SINT32*IndexType=NULL;if((NULL==pbRecv)){slog(PB_PRINT,
-SLOG_ERR,
+,pbSrc,srclen);pb_AsctoHex(acHex,(0x163d+2798-0x202b),(UINT8*)pbSrc,srclen);rest
+=atPb_IfUcs2IsSMS7(acHex,srclen/(0xc67+5389-0x2170));if(rest==
+(0x145a+4459-0x25c4)){return atPb_EncodeText(pbDst,pbSrc,iDstLen);}else if(rest
+==(0x116b+523-0x1376)){if(strlen(pbSrc)+(0x9a0+2366-0x12dc)<iDstLen){memcpy(
+pbDst,"\x38\x30",(0x23+9477-0x2526));memcpy(pbDst+(0x9b7+341-0xb0a),pbSrc,srclen
+);return ZUFI_SUCC;}}return ZUFI_FAIL;}SINT32 atPb_FindIdleIndex(
+T_zPb_WebContact const*pbRecv,BOOL pbNewFlag){SINT32 count=(0x823+4664-0x1a5a);
+SINT32 total=(0x1196+4426-0x22e0);SINT32*IndexType=NULL;if((NULL==pbRecv)){slog(
+PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x66\x69\x6e\x64\x5f\x70\x62\x6d\x5f\x69\x6e\x64\x65\x78\x3a\x74\x68\x65\x20\x70\x61\x72\x61\x20\x6f\x66\x20\x66\x69\x6e\x64\x5f\x70\x62\x6d\x5f\x69\x6e\x64\x65\x78\x20\x61\x72\x65\x20\x4e\x55\x4c\x4c" "\n"
-);return-(0x15d2+4116-0x25e5);}if(TRUE==pbNewFlag){if(ZPB_LOCATION_USIM==pbRecv
-->pbLocation){total=g_zPb_SimIndex[(0x1466+2314-0x1d70)];IndexType=
-g_zPb_SimIndex;}else if(ZPB_LOCATION_AP==pbRecv->pbLocation){total=g_zPb_ApIndex
-[(0xa93+7052-0x261f)];IndexType=g_zPb_ApIndex;}for(;count<=total;count++){if((
-NULL!=IndexType)&&(IndexType[count]==PBM_ERROR_NOT_FOUND)){break;}}if(count>
-total){slog(PB_PRINT,SLOG_ERR,
+);return-(0x181b+1578-0x1e44);}if(TRUE==pbNewFlag){if(ZPB_LOCATION_USIM==pbRecv
+->pbLocation){total=g_zPb_SimIndex[(0x920+2603-0x134b)];IndexType=g_zPb_SimIndex
+;}else if(ZPB_LOCATION_AP==pbRecv->pbLocation){total=g_zPb_ApIndex[
+(0x59d+2226-0xe4f)];IndexType=g_zPb_ApIndex;}for(;count<=total;count++){if((NULL
+!=IndexType)&&(IndexType[count]==PBM_ERROR_NOT_FOUND)){break;}}if(count>total){
+slog(PB_PRINT,SLOG_ERR,
 "\x70\x62\x3a\x66\x69\x6e\x64\x5f\x70\x62\x6d\x5f\x69\x6e\x64\x65\x78\x3a\x63\x61\x6e\x20\x6e\x6f\x74\x20\x66\x69\x6e\x64\x20\x69\x6e\x64\x65\x78\x5f\x69\x64\x2c\x69\x6e\x64\x65\x78\x5f\x69\x64\x3d\x25\x64" "\n" "\x2e"
-,count);return-(0x1d3+2003-0x9a5);}slog(PB_PRINT,SLOG_DEBUG,
+,count);return-(0x4f8+1386-0xa61);}slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x66\x69\x6e\x64\x5f\x70\x62\x6d\x5f\x69\x6e\x64\x65\x78\x3a\x20\x69\x6e\x64\x65\x78\x5f\x69\x64\x3d\x25\x64\x2c\x20\x74\x6f\x74\x61\x6c\x20\x69\x73\x20\x25\x64" "\n"
 ,count,total);return count;}else{return pbRecv->pbIndex;}}BOOL atPb_GetASCII(
-CHAR*pSrc,CHAR*pDst,SINT32 len){SINT32 j=(0x21c+5678-0x184a);SINT32 i=
-(0x588+8057-0x2501);CHAR buf[ZPB_TEXT_SIZE_BYTES]={(0x783+7143-0x236a)};CHAR str
-[(0x23a+6295-0x1ace)]={(0x37c+6641-0x1d6d)};SINT32 length=(0x178c+3194-0x2406);
-length=atPb_String2Bytes(pSrc,buf,len);for(i=(0x7d+4428-0x11c9);i<length;i+=
-(0x2125+1401-0x269c)){if(buf[i]!=(0xbd1+6891-0x26bc)||buf[i+(0x65d+5719-0x1cb3)]
->(0x1270+1725-0x18ae)){return FALSE;}pDst[j++]=buf[i+(0xa40+7318-0x26d5)];}
-return TRUE;}VOID atWeb_AddOrModOnePbUsim(T_zPb_WebContact*pWebPbContact,BOOL 
-pbNewFlag,sem_t semId){int atRes=(0x36a+3072-0xf6a);CHAR pbName[
-ZPB_TEXT_SIZE_BYTES+(0x1ed1+1656-0x2546)]={(0xc53+2964-0x17e7)};CHAR buf_src[
-ZPB_TEXT_SIZE_BYTES+(0x17c0+1760-0x1e9d)]={(0x1fe6+187-0x20a1)};CHAR buf_dest[
-ZPB_TEXT_SIZE_BYTES+(0x1731+216-0x1806)]={(0x86f+107-0x8da)};T_zPb_ScpbwParam 
-scpbwParam={(0x92+5115-0x148d)};int len=(0x1f59+72-0x1fa1);atPb_WebRecodeShow(
-pWebPbContact);if(atPb_GetASCII(pWebPbContact->name,pbName,strlen(pWebPbContact
-->name))){scpbwParam.coding=(0xb52+3897-0x1a8b);}else{len=atPb_String2Bytes(
+CHAR*pSrc,CHAR*pDst,SINT32 len){SINT32 j=(0x669+1839-0xd98);SINT32 i=
+(0x1236+411-0x13d1);CHAR buf[ZPB_TEXT_SIZE_BYTES]={(0x1b3b+1552-0x214b)};CHAR 
+str[(0xcc7+4926-0x2002)]={(0x1272+703-0x1531)};SINT32 length=(0xa9d+1240-0xf75);
+length=atPb_String2Bytes(pSrc,buf,len);for(i=(0x1103+3391-0x1e42);i<length;i+=
+(0x1ab+9479-0x26b0)){if(buf[i]!=(0x214+3853-0x1121)||buf[i+(0xe9+4522-0x1292)]>
+(0x109f+4022-0x1fd6)){return FALSE;}pDst[j++]=buf[i+(0xda2+6190-0x25cf)];}return
+ TRUE;}VOID atWeb_AddOrModOnePbUsim(T_zPb_WebContact*pWebPbContact,BOOL 
+pbNewFlag,sem_t semId){int atRes=(0x5cd+6909-0x20ca);CHAR pbName[
+ZPB_TEXT_SIZE_BYTES+(0x9a8+6795-0x2430)]={(0x114c+5566-0x270a)};CHAR buf_src[
+ZPB_TEXT_SIZE_BYTES+(0x593+4736-0x1810)]={(0x157f+358-0x16e5)};CHAR buf_dest[
+ZPB_TEXT_SIZE_BYTES+(0x547+3670-0x139a)]={(0x1658+4078-0x2646)};T_zPb_ScpbwParam
+ scpbwParam={(0x1cf3+767-0x1ff2)};int len=(0x161f+518-0x1825);atPb_WebRecodeShow
+(pWebPbContact);if(atPb_GetASCII(pWebPbContact->name,pbName,strlen(pWebPbContact
+->name))){scpbwParam.coding=(0x130c+1843-0x1a3f);}else{len=atPb_String2Bytes(
 pWebPbContact->name,buf_src,strlen(pWebPbContact->name));len=
 atpb_CvtUcs2ToAlphaField(buf_src,len,buf_dest);atPb_Bytes2String(buf_dest,pbName
-,len);scpbwParam.coding=(0x836+2803-0x1328);}scpbwParam.pbIndex=pWebPbContact->
+,len);scpbwParam.coding=(0x205b+1381-0x25bf);}scpbwParam.pbIndex=pWebPbContact->
 pbIndex;strncpy(scpbwParam.name,pbName,sizeof(scpbwParam.name)-
-(0x89f+4693-0x1af3));strncpy(scpbwParam.mobilNumber,pWebPbContact->mobilNumber,
-sizeof(scpbwParam.mobilNumber)-(0x19e8+2185-0x2270));strncpy(scpbwParam.
+(0x76b+2594-0x118c));strncpy(scpbwParam.mobilNumber,pWebPbContact->mobilNumber,
+sizeof(scpbwParam.mobilNumber)-(0x14b5+651-0x173f));strncpy(scpbwParam.
 officeNumber,pWebPbContact->officeNumber,sizeof(scpbwParam.officeNumber)-
-(0x69c+5312-0x1b5b));strncpy(scpbwParam.homeNumber,pWebPbContact->homeNumber,
-sizeof(scpbwParam.homeNumber)-(0x682+2196-0xf15));strncpy(scpbwParam.email,
-pWebPbContact->email,sizeof(scpbwParam.email)-(0x137c+743-0x1662));
+(0x8b7+4017-0x1867));strncpy(scpbwParam.homeNumber,pWebPbContact->homeNumber,
+sizeof(scpbwParam.homeNumber)-(0xd82+6379-0x266c));strncpy(scpbwParam.email,
+pWebPbContact->email,sizeof(scpbwParam.email)-(0xcf+3154-0xd20));
 ipc_send_message(MODULE_ID_PB,MODULE_ID_AT_CTL,MSG_CMD_ADD_MODIFY_PB_REQ,sizeof(
-T_zPb_ScpbwParam),(unsigned char*)&scpbwParam,(0x142b+3348-0x213f));sem_wait(&
-g_Pb_sem_id);if(g_PbOptRsp.result!=(0x1248+1477-0x180c)){(VOID)sc_cfg_set(
+T_zPb_ScpbwParam),(unsigned char*)&scpbwParam,(0x71+8445-0x216e));sem_wait(&
+g_Pb_sem_id);if(g_PbOptRsp.result!=(0x1f15+270-0x2022)){(VOID)sc_cfg_set(
 ZPB_NV_WRITE_FLAG,ZPB_NEW_ERROR);if(TRUE==pbNewFlag){printf(
 "\x70\x62\x3a\x61\x64\x64\x20\x53\x63\x70\x62\x77\x20\x65\x72\x72\x6f\x72\x2e" "\n"
 );}else{printf(
@@ -411,17 +407,17 @@
 );}else{(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_NEW_ERROR);printf(
 "\x70\x62\x3a\x57\x72\x69\x74\x65\x43\x6f\x6e\x74\x61\x63\x74\x54\x6f\x50\x62\x6d\x54\x61\x62\x6c\x65\x20\x65\x72\x72\x6f\x72\x2e" "\n"
 );}}VOID atWeb_AddOnePb(T_zPb_WebContact*webPbContact,sem_t semId){SINT32 
-idleIndex=(0x10f4+3136-0x1d33);T_zPb_Header pbHeader={(0xdf1+5129-0x21fa)};BOOL 
-pbNewFlag=FALSE;T_zPb_DelInfo delRecord={(0x991+4600-0x1b89)};CHAR ptFlag[
-(0xdb8+1825-0x14c5)]={(0x18f0+1270-0x1de6)};printf(
+idleIndex=(0x53+4307-0x1125);T_zPb_Header pbHeader={(0x194+1211-0x64f)};BOOL 
+pbNewFlag=FALSE;T_zPb_DelInfo delRecord={(0x1b0d+2514-0x24df)};CHAR ptFlag[
+(0x135+2256-0x9f1)]={(0x3b0+5853-0x1a8d)};printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x57\x65\x62\x5f\x41\x64\x64\x4f\x6e\x65\x50\x62\x2c\x20\x70\x62\x49\x64\x3d\x25\x64\x21" "\n"
-,webPbContact->pbId);if(-(0x4d2+7746-0x2313)==webPbContact->pbId){slog(PB_PRINT,
+,webPbContact->pbId);if(-(0x35b+6880-0x1e3a)==webPbContact->pbId){slog(PB_PRINT,
 SLOG_DEBUG,
 "\x70\x62\x3a\x61\x74\x57\x65\x62\x5f\x41\x64\x64\x4f\x6e\x65\x50\x62\x20\x6e\x65\x77\x2e" "\n"
 );pbNewFlag=TRUE;idleIndex=atPb_FindIdleIndex(webPbContact,pbNewFlag);printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x57\x65\x62\x5f\x41\x64\x64\x4f\x6e\x65\x50\x62\x20\x69\x64\x6c\x65\x49\x6e\x64\x65\x78\x3d\x25\x64\x2e" "\n"
-,idleIndex);if(idleIndex!=-(0x1591+3760-0x2440)){webPbContact->pbIndex=idleIndex
-;}else{(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_NEW_ERROR);printf(
+,idleIndex);if(idleIndex!=-(0x77+4277-0x112b)){webPbContact->pbIndex=idleIndex;}
+else{(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_NEW_ERROR);printf(
 "\x5b\x50\x42\x5d\x20\x6d\x65\x6d\x6f\x72\x79\x20\x69\x73\x20\x66\x75\x6c\x6c\x2c\x20\x63\x61\x6e\x20\x6e\x6f\x74\x20\x61\x64\x64\x20\x72\x65\x63\x6f\x64\x65\x20\x61\x6e\x79\x20\x6d\x6f\x72\x65\x2e" "\n"
 );return;}}else{printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x57\x65\x62\x5f\x41\x64\x64\x4f\x6e\x65\x50\x62\x20\x6d\x6f\x64\x69\x66\x79\x2e" "\n"
@@ -439,27 +435,27 @@
 );(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_LOCATION_IS_NULL);}printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x57\x65\x62\x5f\x41\x64\x64\x4f\x6e\x65\x50\x62\x20\x64\x65\x6c\x5f\x69\x64\x3d\x25\x64\x2e" "\n"
 ,webPbContact->del_id);sc_cfg_get(ZPB_NV_WRITE_FLAG,ptFlag,sizeof(ptFlag));if(
-(0x564+7745-0x23a5)==strcmp("\x30",ptFlag)&&-(0x180c+2362-0x2145)!=webPbContact
-->del_id){delRecord.delId[(0x273+5785-0x190c)]=webPbContact->del_id;
+(0x1a04+764-0x1d00)==strcmp("\x30",ptFlag)&&-(0x117+5060-0x14da)!=webPbContact->
+del_id){delRecord.delId[(0x11bf+5211-0x261a)]=webPbContact->del_id;
 atWeb_DelOnepb(&delRecord,semId);}}VOID atWeb_DelOnepb(T_zPb_DelInfo*delRecord,
-sem_t semId){CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0xaeb+1463-0x10a2)};int atRes=
-(0x18ed+3223-0x2584);SINT32 delTime=(0x32d+290-0x44f);
+sem_t semId){CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0x8e8+1334-0xe1e)};int atRes=
+(0xa78+4827-0x1d53);SINT32 delTime=(0xa50+5703-0x2097);
 atPb_GetLocationIndexForDel(delRecord,delTime);printf(
 "\x5b\x50\x42\x5d\x20\x64\x65\x6c\x5f\x61\x5f\x70\x62\x6d\x5f\x72\x65\x63\x6f\x72\x64\x2d\x2d\x64\x65\x6c\x20\x69\x6e\x64\x65\x78\x3d\x25\x64\x2c\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64" "\n"
-,delRecord->delIndex[(0x14c+722-0x41e)],delRecord->delLocation);if(
+,delRecord->delIndex[(0x159+4600-0x1351)],delRecord->delLocation);if(
 ZPB_LOCATION_AP==delRecord->delLocation){if(ZPB_DB_OK==atPb_DelARecFromPbmTable(
 delRecord,delTime)){(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x57\x65\x62\x5f\x44\x65\x6c\x4f\x6e\x65\x70\x62\x2d\x2d\x64\x65\x6c\x20\x41\x50\x20\x73\x75\x63\x63\x65\x73\x73" "\n"
 );return;}slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x3a\x64\x65\x6c\x5f\x61\x5f\x70\x62\x6d\x5f\x72\x65\x63\x6f\x72\x64\x3a\x72\x65\x6d\x6f\x76\x65\x20\x72\x65\x63\x20\x66\x72\x6f\x6d\x20\x70\x62\x6d\x20\x74\x61\x62\x6c\x65\x20\x66\x61\x69\x6c\x65\x64" "\n"
 );(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_DEL_ERROR);}else if(ZPB_LOCATION_USIM==
-delRecord->delLocation){CHAR pbMax[(0x16d4+3759-0x2551)]={(0x1177+3785-0x2040)};
+delRecord->delLocation){CHAR pbMax[(0x10ab+4664-0x22b1)]={(0x1fac+900-0x2330)};
 sc_cfg_get(ZPB_NV_USIMINDEXMAX,pbMax,sizeof(pbMax));if((delRecord->delIndex[
-(0x94c+5652-0x1f60)]>=(0x1618+3312-0x2307))&&(delRecord->delIndex[
-(0xe71+6071-0x2628)]<=atoi(pbMax))){ipc_send_message(MODULE_ID_PB,
+(0x13d8+716-0x16a4)]>=(0x50+3251-0xd02))&&(delRecord->delIndex[
+(0xaf1+2329-0x140a)]<=atoi(pbMax))){ipc_send_message(MODULE_ID_PB,
 MODULE_ID_AT_CTL,MSG_CMD_DELETE_PB_REQ,sizeof(int),(unsigned char*)&delRecord->
-delIndex[(0x611+7125-0x21e6)],(0x5cb+229-0x6b0));sem_wait(&g_Pb_sem_id);if(
-g_PbOptRsp.result!=(0x1c36+799-0x1f54)){sc_cfg_set(ZPB_NV_WRITE_FLAG,
+delIndex[(0x9d3+6723-0x2416)],(0x14e0+3104-0x2100));sem_wait(&g_Pb_sem_id);if(
+g_PbOptRsp.result!=(0x887+2832-0x1396)){sc_cfg_set(ZPB_NV_WRITE_FLAG,
 ZPB_DEL_ERROR);}sc_cfg_set(ZPB_NV_USIMMEMORYFULL,"\x6e\x6f");}if(ZPB_DB_OK==
 atPb_DelARecFromPbmTable(delRecord,delTime)){(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,
 ZPB_OPERATE_SUC);printf(
@@ -469,9 +465,9 @@
 "\x70\x62\x3a\x64\x65\x6c\x5f\x61\x5f\x70\x62\x6d\x5f\x72\x65\x63\x6f\x72\x64\x3a\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x69\x73\x20\x4e\x55\x4c\x4c" "\n"
 );(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_LOCATION_IS_NULL);}}VOID 
 atWeb_DelMultPb(T_zPb_DelInfo*delRecord,sem_t semId){CHAR errCode[
-ZSVR_AT_RES_CODE_LEN]={(0x1fff+1784-0x26f7)};int atRes=(0x1ccc+1077-0x2101);
-SINT32 delCount=(0x927+885-0xc9c);(VOID)sc_cfg_set(NV_PHO_DEL,"");memset(&
-g_zPb_DelStatusUsim,(0x7aa+2605-0x11d7),sizeof(T_zPb_DelStatusMultiOrAll));
+ZSVR_AT_RES_CODE_LEN]={(0xfed+3479-0x1d84)};int atRes=(0xd58+5646-0x2366);SINT32
+ delCount=(0xce6+5284-0x218a);(VOID)sc_cfg_set(NV_PHO_DEL,"");memset(&
+g_zPb_DelStatusUsim,(0x1324+2012-0x1b00),sizeof(T_zPb_DelStatusMultiOrAll));
 g_zPb_DelStatusUsim.dealFlag=ZPB_DEL_MULTI_RECORD_USIM;for(;delCount<delRecord->
 delTotal;delCount++){slog(PB_PRINT,SLOG_DEBUG,
 "\x70\x62\x33\x3a\x64\x65\x6c\x49\x64\x5b\x25\x64\x5d\x3d\x25\x64\x2c\x64\x65\x6c\x5f\x70\x62\x6d\x5f\x69\x6e\x64\x65\x78\x5b\x25\x64\x5d\x3d\x25\x64" "\n"
@@ -482,14 +478,14 @@
 "\x70\x62\x3a\x70\x62\x6d\x3a\x72\x65\x6d\x6f\x76\x65\x20\x74\x68\x65\x20\x69\x28\x25\x64\x29\x20\x72\x65\x63\x20\x66\x72\x6f\x6d\x20\x70\x62\x6d\x20\x74\x61\x62\x6c\x65\x20\x66\x61\x69\x6c\x65\x64" "\n"
 ,delCount);g_zPb_DelStatusUsim.dealFailNum++;continue;}g_zPb_DelStatusUsim.
 dealSuccNum++;}else if(ZPB_LOCATION_USIM==delRecord->delLocation){CHAR pbMax[
-(0x1791+789-0x1a74)]={(0x1038+425-0x11e1)};sc_cfg_get(ZPB_NV_USIMINDEXMAX,pbMax,
-sizeof(pbMax));if((delRecord->delIndex[delCount]>=(0x112+2028-0x8fd))&&(
+(0x3f2+3500-0x116c)]={(0x192+3867-0x10ad)};sc_cfg_get(ZPB_NV_USIMINDEXMAX,pbMax,
+sizeof(pbMax));if((delRecord->delIndex[delCount]>=(0x174+9476-0x2677))&&(
 delRecord->delIndex[delCount]<=atoi(pbMax))){printf(
 "\x70\x62\x39\x3a\x61\x74\x57\x65\x62\x5f\x44\x65\x6c\x4d\x75\x6c\x74\x50\x62\x3a\x72\x65\x6d\x6f\x76\x65\x20\x74\x68\x65\x20\x69\x6e\x64\x65\x78\x28\x25\x64\x29\x20\x72\x65\x63\x20\x66\x72\x6f\x6d\x20\x70\x62\x6d\x20\x74\x61\x62\x6c\x65" "\n"
 ,delRecord->delIndex[delCount]);ipc_send_message(MODULE_ID_PB,MODULE_ID_AT_CTL,
 MSG_CMD_DELETE_PB_REQ,sizeof(int),(unsigned char*)&delRecord->delIndex[delCount]
-,(0xd64+6223-0x25b3));sem_wait(&g_Pb_sem_id);if(g_PbOptRsp.result!=
-(0x403+5023-0x17a1)){g_zPb_DelStatusUsim.dealFailNum++;sc_cfg_set(
+,(0x38d+1677-0xa1a));sem_wait(&g_Pb_sem_id);if(g_PbOptRsp.result!=
+(0x164b+4255-0x26e9)){g_zPb_DelStatusUsim.dealFailNum++;sc_cfg_set(
 ZPB_NV_WRITE_FLAG,ZPB_DEL_ERROR);}else{g_zPb_DelStatusUsim.dealSuccNum++;
 sc_cfg_set(ZPB_NV_USIMMEMORYFULL,"\x6e\x6f");}}else{continue;}(VOID)
 atPb_DelSimRecFromPbTable(delRecord->delIndex[delCount]);}else{slog(PB_PRINT,
@@ -497,14 +493,14 @@
 "\x70\x62\x3a\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x69\x73\x20\x4e\x55\x4c\x4c" "\n"
 );(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_LOCATION_IS_NULL);}}
 atPb_SetDelStatusMultOrAll();}T_zPb_DbResult atPb_DelRecByGroup(VOID){
-T_zPb_DbResult result=ZPB_DB_OK;T_zPb_ApIndex index={(0x1a27+3036-0x2603)};
-SINT32 i=(0xee8+904-0x126f);result=atPb_DelRecFromPbmTableByGroup(&index);if(
+T_zPb_DbResult result=ZPB_DB_OK;T_zPb_ApIndex index={(0xf6b+5860-0x264f)};SINT32
+ i=(0xd3a+2295-0x1630);result=atPb_DelRecFromPbmTableByGroup(&index);if(
 ZPB_DB_OK!=result){(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_DEL_ERROR);return 
 result;}(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);for(i=
-(0x1a34+1606-0x2079);i<=ZPB_AP_MAX_RECORD;i++){if((0x12b1+1589-0x18e6)!=index.
+(0x17c3+3185-0x2433);i<=ZPB_AP_MAX_RECORD;i++){if((0x1957+2747-0x2412)!=index.
 apIndex[i]){g_zPb_ApIndex[(index.apIndex[i])]=PBM_ERROR_NOT_FOUND;}}return 
 result;}VOID atPb_DelAllRecsSimDb(VOID){CHAR sql[ZPB_MAX_BYTES_DB]={
-(0x9b5+5774-0x2043)};snprintf(sql,sizeof(sql)-(0x22e0+387-0x2462),
+(0x90f+5969-0x2060)};snprintf(sql,sizeof(sql)-(0x103+53-0x137),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_USIM);if(ZPB_DB_OK==atPb_ExecDbSql(sql,NULL,NULL)
 ){atPb_ClearSimPbmIndexArray();if(ZPB_DB_OK!=atPb_ExecDbSql(
@@ -513,28 +509,28 @@
 );(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_DEL_ERROR);return;}(VOID)sc_cfg_set(
 ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);}else{(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,
 ZPB_DEL_ERROR);}}VOID atPb_DelAllRecsSim(T_zPb_DelInfo*pdelRecord,sem_t semId){
-CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0xfd7+1891-0x173a)};int atRes=
-(0x1808+2772-0x22dc);UINT32 i=(0x777+6879-0x2256);CHAR sql[ZPB_MAX_BYTES_DB]={
-(0x642+1334-0xb78)};UINT32 count=(0x1fa9+591-0x21f8);if(pdelRecord!=NULL){memset
-(&g_zPb_DelStatusUsim,(0x744+2462-0x10e2),sizeof(T_zPb_DelStatusMultiOrAll));
+CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0x2f2+8711-0x24f9)};int atRes=
+(0x13ba+1777-0x1aab);UINT32 i=(0xb62+810-0xe8c);CHAR sql[ZPB_MAX_BYTES_DB]={
+(0x946+2985-0x14ef)};UINT32 count=(0x1bf+1267-0x6b2);if(pdelRecord!=NULL){memset
+(&g_zPb_DelStatusUsim,(0xdcf+5076-0x21a3),sizeof(T_zPb_DelStatusMultiOrAll));
 g_zPb_DelStatusUsim.dealFlag=ZPB_DEL_ALL_RECORD_USIM;snprintf(sql,sizeof(sql)-
-(0xbd2+6876-0x26ad),
+(0x11f5+34-0x1216),
 "\x73\x65\x6c\x65\x63\x74\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_USIM);(VOID)atPb_ExecDbSql(sql,
-atPb_DbCountTableLineCb,&count);if((0x115f+3828-0x2053)<count){CHAR pbMin[
-(0x1609+3537-0x23a8)]={(0x1f0+7101-0x1dad)};CHAR pbMax[(0x3e6+2587-0xdcf)]={
-(0x13ff+3635-0x2232)};UINT32 i_pbMin=(0x13d1+4530-0x2583);UINT32 i_pbMax=
-(0xea8+6057-0x2651);sc_cfg_get(ZPB_NV_USIMINDEXMIN,pbMin,sizeof(pbMin));
+atPb_DbCountTableLineCb,&count);if((0x506+58-0x540)<count){CHAR pbMin[
+(0x1701+307-0x1802)]={(0x1b89+752-0x1e79)};CHAR pbMax[(0x1785+3875-0x2676)]={
+(0x1181+707-0x1444)};UINT32 i_pbMin=(0x1112+859-0x146d);UINT32 i_pbMax=
+(0x12e1+2445-0x1c6e);sc_cfg_get(ZPB_NV_USIMINDEXMIN,pbMin,sizeof(pbMin));
 sc_cfg_get(ZPB_NV_USIMINDEXMAX,pbMax,sizeof(pbMax));i_pbMin=atoi(pbMin);i_pbMax=
 atoi(pbMax);if(i_pbMin>ZPB_SIM_MAX_RECORD||i_pbMax>ZPB_SIM_MAX_RECORD){printf(
 "\x5b\x50\x42\x5d\x20\x61\x74\x50\x62\x5f\x44\x65\x6c\x41\x6c\x6c\x52\x65\x63\x73\x53\x69\x6d\x20\x73\x69\x6d\x20\x69\x6e\x64\x65\x78\x20\x74\x6f\x6f\x20\x6c\x61\x72\x67\x65" "\n"
 );return;}for(i=i_pbMin;i<=i_pbMax;i++){ipc_send_message(MODULE_ID_PB,
 MODULE_ID_AT_CTL,MSG_CMD_DELETE_PB_REQ,sizeof(int),(unsigned char*)&i,
-(0x119d+2699-0x1c28));sem_wait(&g_Pb_sem_id);if(g_PbOptRsp.result!=
-(0xd13+4027-0x1ccd)){g_zPb_DelStatusUsim.dealFailNum++;sc_cfg_set(
+(0x5fa+5837-0x1cc7));sem_wait(&g_Pb_sem_id);if(g_PbOptRsp.result!=
+(0x75c+2043-0xf56)){g_zPb_DelStatusUsim.dealFailNum++;sc_cfg_set(
 ZPB_NV_WRITE_FLAG,ZPB_DEL_ERROR);}else{g_zPb_DelStatusUsim.dealSuccNum++;
 sc_cfg_set(ZPB_NV_USIMMEMORYFULL,"\x6e\x6f");}}snprintf(sql,sizeof(sql)-
-(0x381+5210-0x17da),
+(0x7d7+2112-0x1016),
 "\x64\x65\x6c\x65\x74\x65\x20\x66\x72\x6f\x6d\x20\x25\x73\x20\x77\x68\x65\x72\x65\x20\x4c\x6f\x63\x61\x74\x69\x6f\x6e\x3d\x25\x64"
 ,ZPB_DB_PBM_TABLE,ZPB_LOCATION_USIM);if(ZPB_DB_OK==atPb_ExecDbSql(sql,NULL,NULL)
 ){(VOID)sc_cfg_set(ZPB_NV_WRITE_FLAG,ZPB_OPERATE_SUC);atPb_ClearSimPbmIndexArray
diff --git a/ap/app/zte_comm/sms/src/sms_code.c b/ap/app/zte_comm/sms/src/sms_code.c
index d67e75c..cac3c07 100755
--- a/ap/app/zte_comm/sms/src/sms_code.c
+++ b/ap/app/zte_comm/sms/src/sms_code.c
@@ -6,663 +6,662 @@
 #ifdef WIN32

 #include <wchar.h>

 #endif

-#define     NON_GSM                         (0x1f46+1471-0x24e5)

+#define     NON_GSM                         (0x34+4140-0x1040)

 #define     NON_GSM_P                       NON_GSM

 extern T_zUfiSms_ConcatInfo g_zUfiSms_ConcatSms;static const wms_udh_s_type*
-const_header;char g_zUfiSms_DigAscMap[(0x1c28+1409-0x2199)]={
-((char)(0x1d17+160-0x1d87)),((char)(0x936+5231-0x1d74)),
-((char)(0xbc3+4731-0x1e0c)),((char)(0x51c+8052-0x245d)),
-((char)(0xe97+6283-0x26ee)),((char)(0x1f93+1482-0x2528)),
-((char)(0x15c0+2376-0x1ed2)),((char)(0x904+688-0xb7d)),
-((char)(0x1406+2448-0x1d5e)),((char)(0x1c47+1720-0x22c6)),
-((char)(0x3c8+1964-0xb33)),((char)(0x1265+660-0x14b7)),
-((char)(0x4c2+1330-0x9b1)),((char)(0x18f5+2775-0x2388)),
-((char)(0xdc9+5990-0x24ea)),((char)(0xdd2+627-0xfff))};extern SMS_PARAM 
-g_zUfiSms_SendingSms;extern UINT16 g_zUfiSms_IsLanguageShift;extern int 
-g_zUfiSms_Language;static int SerializeNumbers_sms(const char*pSrc,char*pDst,int
- nSrcLength);const unsigned short g_zUfiSms_AsciiToGsmdefaultTable[]={
-((char)(0xbd1+5182-0x1fef)),((char)(0xc75+3929-0x1bae)),
-((char)(0x149+8369-0x21da)),((char)(0xc93+4017-0x1c24)),
-((char)(0xa98+3349-0x178d)),((char)(0x6b2+5751-0x1d09)),
-((char)(0x1880+1677-0x1eed)),((char)(0x4dd+1534-0xabb)),
-((char)(0x19ba+1169-0x1e2b)),((char)(0x1c1f+221-0x1cdc)),
-((char)(0x1a7f+1231-0x1f2e)),((char)(0x4df+6307-0x1d62)),
-((char)(0x87b+4265-0x1904)),((char)(0x3e3+7083-0x1f6e)),
-((char)(0x938+3303-0x15ff)),((char)(0xd6d+2421-0x16c2)),
-((char)(0xbcb+6809-0x2644)),((char)(0x1a17+742-0x1cdd)),
-((char)(0x8e9+5577-0x1e92)),((char)(0x1583+4161-0x25a4)),
-((char)(0x2508+81-0x2539)),((char)(0x809+7217-0x241a)),
-((char)(0x1fe0+1785-0x26b9)),((char)(0xb9+6082-0x185b)),
-((char)(0xad7+4545-0x1c78)),((char)(0x6f6+6305-0x1f77)),
-((char)(0xea9+2260-0x175d)),((char)(0x1cf+6709-0x1be4)),
-((char)(0x1227+3110-0x1e2d)),((char)(0x1a0d+1455-0x1f9c)),
-((char)(0x85f+1144-0xcb7)),((char)(0x26b+4498-0x13dd)),
-((char)(0x1877+767-0x1b56)),((char)(0x9aa+156-0xa25)),(0x13bd+2172-0x1c17),
-((char)(0xa8c+4523-0x1c14)),(0x1388+1222-0x184c),((char)(0x177c+2935-0x22ce)),
-((char)(0x22dd+39-0x22de)),(0x6e9+7034-0x223c),((char)(0x37a+7620-0x2116)),
-((char)(0x1c38+1591-0x2246)),((char)(0x1e15+961-0x21ac)),
-((char)(0x511+1239-0x9bd)),((char)(0x3b0+13-0x391)),((char)(0xa1c+7141-0x25d4)),
-((char)(0x1e6+1894-0x91e)),((char)(0x910+2020-0x10c5)),
-((char)(0xff9+3018-0x1b93)),((char)(0x138b+2465-0x1cfb)),
-((char)(0x1945+3265-0x25d4)),((char)(0x269+6056-0x19de)),
-((char)(0x619+646-0x86b)),((char)(0xd79+3755-0x1bef)),
-((char)(0x1253+1184-0x16bd)),((char)(0x57b+4090-0x153e)),
-((char)(0x421+3446-0x115f)),((char)(0x52f+4579-0x16d9)),
-((char)(0xdda+1013-0x1195)),((char)(0x551+787-0x829)),
-((char)(0x1905+1323-0x1df4)),((char)(0x2fc+6980-0x1e03)),
-((char)(0x1b61+2632-0x256b)),((char)(0x13e0+2973-0x1f3e)),(0x245+2018-0xa27),
-((char)(0x6d9+774-0x99e)),((char)(0x1bc4+2337-0x24a3)),
-((char)(0x1a6b+2958-0x25b6)),((char)(0x7cf+2781-0x1268)),
-((char)(0x17cb+1781-0x1e7b)),((char)(0x3a1+5432-0x1893)),
-((char)(0x244+3361-0xf1e)),((char)(0x1701+2954-0x2243)),
-((char)(0x611+2469-0xf6d)),((char)(0xf89+5-0xf44)),((char)(0x3dc+1954-0xb33)),
-((char)(0x23b+762-0x4e9)),((char)(0xb5a+1626-0x1167)),
-((char)(0x1c56+1659-0x2283)),((char)(0xc25+5386-0x20e0)),((char)(0xd57+1-0xd08))
-,((char)(0x543+7171-0x20f5)),((char)(0x4d4+4587-0x166d)),
-((char)(0x1029+571-0x1211)),((char)(0xfa8+2270-0x1832)),
-((char)(0x4c3+936-0x816)),((char)(0x274+7069-0x1dbb)),
-((char)(0x849+4037-0x17b7)),((char)(0xaff+218-0xb81)),
-((char)(0x593+8224-0x255a)),((char)(0xed4+508-0x1076)),(0x20e1+8205-0x25b2),
-(0x1d4f+6307-0x1ac3),6974,(0x21b5+6859-0x216c),(0xe3a+2570-0x1833),
-((char)(0x435+6262-0x1c8b)),((char)(0xe49+1766-0x14ce)),
-((char)(0x2020+1437-0x255b)),((char)(0x5d8+3688-0x13dd)),
-((char)(0x16b+8884-0x23bb)),((char)(0x100a+1436-0x1541)),
-((char)(0xc90+5755-0x22a5)),((char)(0x1864+179-0x18b0)),
-((char)(0x4dc+8010-0x23be)),((char)(0x1e8+9541-0x26c4)),
-((char)(0x15e1+1619-0x1bca)),((char)(0x1804+114-0x180b)),
-((char)(0x797+654-0x9b9)),((char)(0x200+7121-0x1d64)),
-((char)(0x129+7641-0x1e94)),((char)(0x8db+293-0x991)),((char)(0x299+1166-0x6b7))
-,((char)(0xae3+1473-0x1033)),((char)(0x23f8+404-0x251a)),
-((char)(0x2e0+1260-0x759)),((char)(0x1528+3862-0x23ca)),
-((char)(0x2f1+4043-0x1247)),((char)(0x118b+499-0x1308)),
-((char)(0xa60+4374-0x1aff)),((char)(0xc30+574-0xdf6)),
-((char)(0x1614+2497-0x1f5c)),((char)(0x84+6193-0x183b)),6952,6976,6953,
-(0x1e0c+6691-0x1cf2),((char)(0x2a2+6354-0x1b54)),((char)(0x1d68+2234-0x2602)),
-((char)(0x1c43+2394-0x257d)),((char)(0x42f+3450-0x1189)),
-((char)(0x1c07+2033-0x23d8)),((char)(0x1101+4883-0x23f4)),
-((char)(0x1c36+1249-0x20f7)),((char)(0x171+1630-0x7af)),
-((char)(0x1acb+3117-0x26d8)),((char)(0x792+5205-0x1bc7)),
-((char)(0x1888+2865-0x2399)),((char)(0xcc7+4286-0x1d65)),
-((char)(0xc06+6772-0x265a)),((char)(0xf8f+3809-0x1e50)),
-((char)(0x1274+1356-0x17a0)),((char)(0x261+7103-0x1e00)),
-((char)(0x4c4+828-0x7e0)),((char)(0x85c+5612-0x1e28)),
-((char)(0x1bef+2278-0x24b5)),((char)(0x1426+3994-0x23a0)),
-((char)(0x255+884-0x5a9)),((char)(0xde3+3799-0x1c9a)),
-((char)(0x20c+5603-0x17cf)),((char)(0xb35+3720-0x199d)),
-((char)(0x933+3572-0x1707)),((char)(0x1c32+84-0x1c66)),
-((char)(0xaf2+5723-0x212d)),((char)(0x12a0+3309-0x1f6d)),
-((char)(0x1359+3772-0x21f5)),((char)(0x11ca+4562-0x237c)),
-((char)(0x2260+798-0x255e)),((char)(0x5db+6995-0x210e)),
-((char)(0x11e2+699-0x147d)),((char)(0xc35+2164-0x1489)),(0xc61+6328-0x24d9),
-((char)(0xd17+2559-0x16f6)),(0x2215+1065-0x263d),(0x1e6c+637-0x20c5),
-(0xb38+5404-0x2051),((char)(0x6e7+4792-0x197f)),(0x7f6+5290-0x1c41),
-((char)(0x110+8671-0x22cf)),((char)(0x41c+1897-0xb65)),
-((char)(0x5db+6999-0x2112)),((char)(0x1b68+803-0x1e6b)),
-((char)(0x1074+78-0x10a2)),((char)(0xfd9+950-0x136f)),
-((char)(0x2ad+8003-0x21d0)),((char)(0x86d+4194-0x18af)),
-((char)(0x42a+932-0x7ae)),((char)(0x4f6+6726-0x1f1c)),
-((char)(0xe22+1624-0x145a)),((char)(0x89a+3048-0x1462)),
-((char)(0xb3f+1434-0x10b9)),((char)(0x14f4+1902-0x1c42)),
-((char)(0x12ec+2126-0x1b1a)),((char)(0xd56+1005-0x1123)),(0x496+8357-0x2530),
-((char)(0x258+4470-0x13ae)),((char)(0x3c5+5807-0x1a54)),
-((char)(0x629+2998-0x11bf)),((char)(0x303+2625-0xd24)),
-((char)(0xddd+2214-0x1663)),((char)(0xe42+2320-0x1732)),(0x18dd+2171-0x20f8),
-((char)(0x320+5101-0x16ed)),((char)(0x7aa+3432-0x14f2)),
-((char)(0x10c1+1271-0x1598)),((char)(0x159+1519-0x728)),(0xc49+2957-0x177b),
-(0x77c+3340-0x147a),(0x3bf+4862-0x16a1),(0x1273+3741-0x2107),
-((char)(0x76c+5174-0x1b82)),(0xda3+900-0x1108),((char)(0xb4b+1519-0x111a)),
-((char)(0x7ed+640-0xa4d)),((char)(0x9bf+1408-0xf1f)),
-((char)(0x1751+1506-0x1d13)),((char)(0xf0a+1158-0x1370)),
-((char)(0x18d6+3413-0x260b)),((char)(0x299+3157-0xece)),(0x74b+3714-0x1570),
-((char)(0x15b+466-0x30d)),((char)(0x1431+3721-0x229a)),
-((char)(0x2429+707-0x26cc)),((char)(0x106+4943-0x1435)),(0xfc6+5305-0x2423),
-((char)(0xf2c+4602-0x2106)),((char)(0x1e36+304-0x1f46)),
-((char)(0x1626+1405-0x1b83)),((char)(0x55a+8189-0x2537)),
-((char)(0x7e9+7669-0x25be)),(0x1199+4716-0x23a7),((char)(0x157+4366-0x1245)),
-((char)(0xb90+2473-0x1519)),(0x1730+2874-0x224c),(0xed9+5525-0x23ef),
-((char)(0x108f+5265-0x2500)),((char)(0xcfc+614-0xf42)),
-((char)(0xf34+2314-0x181e)),(0x16d+4949-0x1447),(0x753+6968-0x227c),
-(0xc4b+1655-0x12a5),((char)(0xde6+82-0xe18)),(0x2c+9652-0x25dc),
-(0x8ab+1714-0xf58),((char)(0x1d05+2493-0x26a2)),((char)(0x1ceb+2221-0x2578)),
-(0x501+541-0x717),((char)(0x21e0+39-0x21e7)),((char)(0x10db+1418-0x1645)),
-((char)(0x9da+3271-0x1681)),((char)(0x79b+4378-0x1895)),(0x1129+3174-0x1d12),
-(0xb0+2176-0x928),((char)(0x169+1642-0x7b3)),((char)(0x25c4+289-0x26c5)),
-((char)(0x43c+5695-0x1a5b)),(0xb49+6310-0x2373),((char)(0x106a+3268-0x1d0e)),
-(0x786+7377-0x244b),(0x1652+2977-0x21ed),((char)(0x3a8+5043-0x173b)),
-((char)(0xbe0+2986-0x176a)),(0xa2f+851-0xd04),((char)(0xbe0+6676-0x25d4)),
-((char)(0xaf+5440-0x15cf)),((char)(0x2051+1561-0x264a)),};const unsigned short 
-zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[][(0x1537+33-0x1556)]={{
-(0x21d+7010-0x1d76),(0x1214+252-0x1229)},{(0xc1b+4321-0x1cf2),
-(0xb5f+4563-0x1d26)},{(0xf1d+2848-0x1a30),(0x1ed+3621-0x1005)},{
-(0x1263+1247-0x172e),(0x188b+428-0x19d9)},{(0x11b0+2475-0x1b33),
-(0xb76+2885-0x1640)},{(0x381+5398-0x186e),(0x709+2201-0xf25)},{
-(0x19c5+1863-0x20dd),(0x2134+1212-0x2594)},{(0xd33+5140-0x210b),
-(0x13ca+4437-0x24c4)},{(0x5ad+6596-0x1f34),(0x7db+3845-0x1662)},{
-(0x159f+1585-0x1b92),(0x351+6033-0x1a85)},{(0x1199+1503-0x1738),
-(0x175b+1124-0x1b43)},{(0x1429+1121-0x1849),(0xa3f+7247-0x25cd)},{
-(0xbed+2775-0x167b),(0x89d+2237-0x108d)},{(0x1cab+1765-0x2341),
-(0x152+5696-0x16bf)},{(0xb71+4941-0x1e69),(0x273+7083-0x1d44)},{
-(0x16b3+2744-0x210a),(0x3a6+7955-0x21d8)},{(0xee1+4760-0x2114),8364},{
-(0x10e8+65-0x10c0),(0xbf5+5435-0x2043)},{(0x12f9+3722-0x2114),
-(0x692+7038-0x211d)},{(0x11a6+2256-0x1a01),(0x94a+3298-0x1532)},};const unsigned
- short Ucs2_To_Gsm7_SPANISH_Table_UCS[][(0x2323+164-0x23c5)]={{
-(0x7a3+4787-0x1a46),(0x1449+3745-0x1f56)},{(0x2f8+5475-0x1849),
-(0x16f0+830-0x1688)},{(0xbc6+5754-0x222d),(0x157b+1765-0x18cd)},{
-(0x867+2775-0x132a),(0x16d5+4500-0x24ce)},{(0x1d20+28-0x1d27),
-(0x1362+3968-0x1f39)},{(0xca7+799-0xfb0),(0x1483+2149-0x1948)},{
-(0xcb6+3348-0x19b3),(0x1196+5119-0x21ed)},{(0x11b3+2345-0x1ac4),
-(0x126b+5486-0x2436)},{(0x8e8+6250-0x2139),(0xe21+6175-0x22a8)},{
-(0x4ef+6845-0x1f92),(0x14a2+2724-0x1ba8)},};const unsigned char 
-Ucs2_To_Gsm7_SPANISH_Table_ASC[]={NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x1360+1344-0x1896),NON_GSM,NON_GSM,
-(0xef+9685-0x26b7),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+const_header;char g_zUfiSms_DigAscMap[(0x2610+94-0x265e)]={
+((char)(0x33d+9153-0x26ce)),((char)(0x76c+6414-0x2049)),
+((char)(0xafa+7163-0x26c3)),((char)(0x10cc+780-0x13a5)),
+((char)(0x649+2965-0x11aa)),((char)(0xae3+1311-0xfcd)),
+((char)(0xc76+3213-0x18cd)),((char)(0x161a+2875-0x211e)),
+((char)(0x8d9+706-0xb63)),((char)(0xeab+4455-0x1fd9)),
+((char)(0x11b4+4526-0x2321)),((char)(0x7ed+4256-0x184b)),
+((char)(0x9d1+635-0xc09)),((char)(0xa2+642-0x2e0)),((char)(0xf5b+1992-0x16de)),
+((char)(0xd59+1635-0x1376))};extern SMS_PARAM g_zUfiSms_SendingSms;extern UINT16
+ g_zUfiSms_IsLanguageShift;extern int g_zUfiSms_Language;static int 
+SerializeNumbers_sms(const char*pSrc,char*pDst,int nSrcLength);const unsigned 
+short g_zUfiSms_AsciiToGsmdefaultTable[]={((char)(0xce0+1485-0x128d)),
+((char)(0x37+1923-0x79a)),((char)(0x2f8+1017-0x6d1)),((char)(0x12c+7323-0x1da7))
+,((char)(0x8e4+4647-0x1aeb)),((char)(0x1000+3286-0x1cb6)),
+((char)(0x8f+6900-0x1b63)),((char)(0x52f+6015-0x1c8e)),
+((char)(0xf0d+2898-0x1a3f)),((char)(0x618+835-0x93b)),
+((char)(0xa16+6539-0x2381)),((char)(0x1912+1488-0x1ec2)),
+((char)(0xb5+8313-0x210e)),((char)(0x20dd+458-0x2287)),((char)(0x7eb+110-0x839))
+,((char)(0x9dd+6033-0x214e)),((char)(0xa31+5434-0x1f4b)),
+((char)(0x21a7+1406-0x2705)),((char)(0xbad+5492-0x2101)),
+((char)(0x1a12+3013-0x25b7)),((char)(0x4a+7645-0x1e07)),
+((char)(0x3aa+6020-0x1b0e)),((char)(0x7f+4588-0x124b)),
+((char)(0x921+1652-0xf75)),((char)(0x2f8+6058-0x1a82)),
+((char)(0x1395+1260-0x1861)),((char)(0x1f3+5970-0x1925)),
+((char)(0x2009+540-0x2205)),((char)(0x1265+2615-0x1c7c)),
+((char)(0x8cc+4963-0x1c0f)),((char)(0x1b7+5882-0x1891)),
+((char)(0xc66+1456-0x11f6)),((char)(0x1fc+153-0x275)),
+((char)(0x1fd4+1113-0x240c)),(0x2f5+3996-0x126f),((char)(0x262+3269-0xf04)),
+(0x1060+889-0x13d7),((char)(0x697+4826-0x194c)),((char)(0x10fb+4272-0x2185)),
+(0x11db+4379-0x22cf),((char)(0x798+4132-0x1794)),((char)(0xe8a+2300-0x175d)),
+((char)(0x12a2+3985-0x2209)),((char)(0x11d5+1917-0x1927)),
+((char)(0xd9d+5025-0x2112)),((char)(0x885+6820-0x22fc)),
+((char)(0x4c7+1693-0xb36)),((char)(0x939+3122-0x153c)),
+((char)(0xedf+5218-0x2311)),((char)(0x311+5701-0x1925)),
+((char)(0x1e73+1798-0x2547)),((char)(0x1b6b+2310-0x243e)),
+((char)(0xf0d+5387-0x23e4)),((char)(0x1f34+1282-0x2401)),
+((char)(0x18c6+1160-0x1d18)),((char)(0x11d0+1582-0x17c7)),
+((char)(0x1a05+2321-0x22de)),((char)(0xc98+5564-0x221b)),
+((char)(0x21b+258-0x2e3)),((char)(0x22ba+903-0x2606)),
+((char)(0xa8d+3991-0x19e8)),((char)(0x19fd+1614-0x200e)),
+((char)(0x17fa+3112-0x23e4)),((char)(0xa6d+5542-0x1fd4)),(0x814+3026-0x13e6),
+((char)(0x10b3+589-0x12bf)),((char)(0x13f5+932-0x1757)),
+((char)(0x5df+4358-0x16a2)),((char)(0x64c+3953-0x1579)),
+((char)(0x366+7221-0x1f56)),((char)(0x3bf+3902-0x12b7)),
+((char)(0x8f9+3752-0x175a)),((char)(0x1cc2+1463-0x2231)),
+((char)(0x327+3504-0x108e)),((char)(0x2bf+1410-0x7f7)),
+((char)(0xbfc+6869-0x2686)),((char)(0x654+748-0x8f4)),
+((char)(0x1950+1453-0x1eb0)),((char)(0xbf+3248-0xd21)),
+((char)(0xced+1243-0x1179)),((char)(0x5a9+1140-0x9cd)),
+((char)(0x2eb+7309-0x1f27)),((char)(0x969+2668-0x1383)),
+((char)(0x1ba5+1677-0x21df)),((char)(0x9d9+4220-0x1a01)),
+((char)(0x1edf+1167-0x2319)),((char)(0x15b9+499-0x1756)),
+((char)(0x868+1901-0xf7e)),((char)(0x7e9+3952-0x1701)),
+((char)(0xf7+9501-0x25bb)),((char)(0xa11+3524-0x177b)),(0x264b+1876-0x1263),6959
+,(0x2144+4380-0x1722),6932,(0xa3d+179-0xadf),((char)(0x1134+778-0x141e)),
+((char)(0x3da+6231-0x1bd0)),((char)(0xdb7+814-0x1083)),
+((char)(0x2389+131-0x23a9)),((char)(0x122f+1917-0x1948)),
+((char)(0x1706+2440-0x2029)),((char)(0x23a+6991-0x1d23)),
+((char)(0x22d0+460-0x2435)),((char)(0x1ad3+1964-0x2217)),
+((char)(0x19c2+2076-0x2175)),((char)(0x1487+3304-0x2105)),
+((char)(0x428+1771-0xaa8)),((char)(0xc30+5522-0x2156)),
+((char)(0x31d+6210-0x1af2)),((char)(0x88f+7245-0x246e)),
+((char)(0xd23+5822-0x2372)),((char)(0xeca+1367-0x13b1)),
+((char)(0x2f7+7480-0x1fbe)),((char)(0x1007+2782-0x1a73)),
+((char)(0x11c4+2434-0x1ad3)),((char)(0x1f13+739-0x2182)),
+((char)(0x1240+349-0x1328)),((char)(0x9ec+6424-0x228e)),
+((char)(0x9e0+2757-0x142e)),((char)(0x469+8796-0x264d)),
+((char)(0x441+1842-0xafa)),((char)(0x185b+1147-0x1c5c)),(0x1df4+645-0x551),6976,
+6953,(0x21cf+4449-0x17f3),((char)(0x5ad+1988-0xd51)),
+((char)(0x1bed+1987-0x2390)),((char)(0x121b+5334-0x26d1)),
+((char)(0x267+7690-0x2051)),((char)(0xad6+2180-0x133a)),
+((char)(0x19ab+2643-0x23de)),((char)(0x120+3519-0xebf)),
+((char)(0x1aed+2738-0x257f)),((char)(0x417+3764-0x12ab)),
+((char)(0x417+6537-0x1d80)),((char)(0x218d+233-0x2256)),
+((char)(0xbf3+5927-0x22fa)),((char)(0x1767+1904-0x1eb7)),
+((char)(0x1a24+2306-0x2306)),((char)(0x2055+791-0x234c)),
+((char)(0x9ca+835-0xced)),((char)(0x699+415-0x818)),((char)(0x956+5621-0x1f2b)),
+((char)(0x7c3+6654-0x21a1)),((char)(0x111a+5456-0x264a)),
+((char)(0x3f4+3264-0x1094)),((char)(0x172d+216-0x17e5)),
+((char)(0x1832+2717-0x22af)),((char)(0x6a7+5671-0x1cae)),
+((char)(0xc52+828-0xf6e)),((char)(0x11e5+1832-0x18ed)),
+((char)(0x19e0+99-0x1a23)),((char)(0x226b+337-0x239c)),
+((char)(0x68a+4363-0x1775)),((char)(0xb88+3471-0x18f7)),
+((char)(0x9c3+6705-0x23d4)),((char)(0xb6+7573-0x1e2b)),
+((char)(0x11d4+3804-0x2090)),((char)(0x3b8+5687-0x19cf)),(0x63a+5570-0x1bbc),
+((char)(0xfad+183-0x1044)),(0x6d1+4996-0x1a54),(0x18c0+143-0x192b),
+(0x4a2+1457-0xa50),((char)(0x1899+126-0x18f7)),(0x447+8416-0x24c8),
+((char)(0x143c+1196-0x18c8)),((char)(0x25+1367-0x55c)),
+((char)(0x2048+999-0x240f)),((char)(0x514+6635-0x1edf)),
+((char)(0x3e8+1759-0xaa7)),((char)(0x211f+807-0x2426)),
+((char)(0x9e4+1212-0xe80)),((char)(0x1d3c+2231-0x25d3)),
+((char)(0x1812+2066-0x2004)),((char)(0x770+451-0x913)),
+((char)(0x1f76+1178-0x23f0)),((char)(0x9d9+4231-0x1a40)),
+((char)(0xa3a+6025-0x21a3)),((char)(0x9fa+3534-0x17a8)),
+((char)(0x1815+376-0x196d)),((char)(0x1b74+2465-0x24f5)),(0x148f+1734-0x1b4a),
+((char)(0x10f3+1100-0x151f)),((char)(0x7dd+4689-0x1a0e)),
+((char)(0x92d+5170-0x1d3f)),((char)(0x32d+1070-0x73b)),
+((char)(0x3f3+3559-0x11ba)),((char)(0x1db6+2233-0x264f)),(0x1781+1287-0x1c28),
+((char)(0xf30+4693-0x2165)),((char)(0x18a+7252-0x1dbe)),
+((char)(0x161c+3641-0x2435)),((char)(0x19b+3509-0xf30)),(0xbfa+1356-0x10eb),
+(0x1119+1925-0x1890),(0x184+1866-0x8b2),(0x1474+2478-0x1e19),
+((char)(0x162+3122-0xd74)),(0x23e5+585-0x260f),((char)(0x1540+3387-0x225b)),
+((char)(0x874+854-0xbaa)),((char)(0x342+7868-0x21de)),
+((char)(0xc84+5675-0x228f)),((char)(0x565+2223-0xdf4)),
+((char)(0x249f+384-0x25ff)),((char)(0x115c+5512-0x26c4)),(0x697+3387-0x1375),
+((char)(0x1477+2386-0x1da9)),((char)(0x1a00+2355-0x2313)),
+((char)(0x17c7+1000-0x1b8f)),((char)(0x1a2a+887-0x1d81)),(0x578+4492-0x16a8),
+((char)(0x743+5481-0x1c8c)),((char)(0x2ef+4937-0x1618)),
+((char)(0x5ba+1113-0x9f3)),((char)(0x774+2874-0x128e)),
+((char)(0xd20+5310-0x21be)),(0x1a83+702-0x1ce3),((char)(0x3dd+3397-0x1102)),
+((char)(0x2e1+7772-0x211d)),(0x1528+1543-0x1b11),(0x14d3+4208-0x24c4),
+((char)(0xa4f+4651-0x1c5a)),((char)(0x1707+2547-0x20da)),
+((char)(0x24c+7758-0x207a)),(0x346+1978-0xa85),(0x9fd+5505-0x1f6f),
+(0x1cd+6629-0x1b95),((char)(0x616+8227-0x2619)),(0x5e1+4857-0x18d6),
+(0x3f+7849-0x1ee3),((char)(0xca6+1737-0x134f)),((char)(0x25ff+74-0x2629)),
+(0x13b0+4132-0x23cd),((char)(0x10c0+4085-0x2095)),((char)(0xcba+5655-0x22b1)),
+((char)(0xd24+1848-0x143c)),((char)(0xd8a+94-0xdc8)),(0xd55+4703-0x1f37),
+(0x11f+5305-0x15d0),((char)(0x3b8+4793-0x1651)),((char)(0xa5a+6980-0x257e)),
+((char)(0x2221+801-0x2522)),(0x92+8602-0x21b0),((char)(0x5a+9727-0x2639)),
+(0x2348+806-0x2662),(0x1558+1427-0x1ae5),((char)(0x1890+3521-0x2631)),
+((char)(0x130f+2469-0x1c94)),(0xf19+2228-0x174f),((char)(0x375+3764-0x1209)),
+((char)(0x125+6752-0x1b65)),((char)(0xd0d+2296-0x15e5)),};const unsigned short 
+zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[][(0xd1c+4584-0x1f02)]={{
+(0x325+5026-0x16be),(0x1a90+3357-0x26c6)},{(0x1247+3532-0x2009),
+(0x592+135-0x60d)},{(0x15b5+3215-0x2237),(0x9d+8566-0x2206)},{
+(0x70d+7182-0x2307),(0x1815+3846-0x26bd)},{(0xc82+4392-0x1d82),
+(0xb68+6015-0x226c)},{(0xa71+33-0xa69),(0x128d+5254-0x2696)},{
+(0x21c4+1356-0x26e1),(0x8b8+65-0x89d)},{(0x272+5496-0x17ae),(0xe4a+4758-0x2085)}
+,{(0x7cd+5574-0x1d56),(0x60c+3216-0x121e)},{(0x1491+295-0x157a),
+(0xe06+4769-0x204a)},{(0x180+3746-0xfe2),(0x188+2590-0xb2a)},{
+(0xdff+2544-0x17ae),(0x989+7407-0x25b7)},{(0xea+6188-0x18cd),
+(0x1bef+2252-0x23ee)},{(0xdc6+6472-0x26bf),(0x1b7+2179-0x967)},{
+(0x6c0+5460-0x1bbf),(0x760+2516-0x105a)},{(0xdaf+6205-0x258b),
+(0xa34+6644-0x2347)},{(0x1ac4+529-0x1c70),8364},{(0xb25+4095-0x1abb),
+(0xdad+1499-0x129b)},{(0xec4+809-0x117e),(0x1ac6+3136-0x2613)},{
+(0xaac+3416-0x178f),(0x3ab+2951-0xe38)},};const unsigned short 
+Ucs2_To_Gsm7_SPANISH_Table_UCS[][(0x15ff+2600-0x2025)]={{(0xa67+3279-0x1726),
+(0x1e3c+1225-0x1f71)},{(0x16df+3116-0x22f9),(0xb2a+1382-0xcea)},{
+(0xea3+1152-0x1310),(0x8ef+3923-0x14af)},{(0xb34+1469-0x10dd),
+(0x1adf+1807-0x1e53)},{(0x1b99+1925-0x2309),(0x240c+1450-0x260d)},{
+(0x292+2367-0xbbb),(0x554+746-0x49e)},{(0xfb+2221-0x991),(0x144a+5232-0x2512)},{
+(0xb03+1554-0x10fd),(0x15d9+3319-0x1f2d)},{(0x77a+5090-0x1b43),
+(0x9ad+5746-0x1c87)},{(0x1307+2827-0x1df8),(0x2251+661-0x2148)},};const unsigned
+ char Ucs2_To_Gsm7_SPANISH_Table_ASC[]={NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x12bc+3778-0x2174),NON_GSM,NON_GSM,
+(0x1395+824-0x16c0),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,(0xe6d+5898-0x2557),(0x2e2+8546-0x2423),(0x352+7155-0x1f23),
-(0x75c+348-0x895),(0x1143+2529-0x1b22),(0x14a2+3583-0x227c),(0xcb+3098-0xcbf),
-(0x11b+3392-0xe34),(0xefc+4235-0x1f5f),(0xa2c+4928-0x1d43),(0xb08+3972-0x1a62),
-(0x116a+4202-0x21a9),(0x1157+3594-0x1f35),(0xa8+7171-0x1c7e),(0xfa8+3605-0x1d8f)
-,(0x68+7119-0x1c08),(0x6d+5323-0x1508),(0xa83+3621-0x1877),(0xb85+6196-0x2387),
-(0xc7+2924-0xc00),(0x749+1898-0xe7f),(0x35d+5757-0x19a5),(0x4e0+3053-0x1097),
-(0xe48+5632-0x2411),(0xb10+6872-0x25b0),(0x1ea6+122-0x1ee7),(0x159d+1586-0x1b95)
-,(0x426+7009-0x1f4c),(0x79d+2067-0xf74),(0x901+86-0x91a),(0x45b+159-0x4bc),
-(0x1f2+5747-0x1826),(0x14d8+2747-0x1f93),(0x324+580-0x527),(0x867+5977-0x1f7e),
-(0x765+2389-0x1077),(0x150+1696-0x7ac),(0xbe8+6898-0x2695),(0x57b+5518-0x1ac3),
-(0xea+7652-0x1e87),(0x981+1590-0xf6f),(0x20d+4979-0x1537),(0x1d0+7457-0x1ea7),
-(0xdaa+1586-0x1391),(0x945+7453-0x2616),(0xae5+5061-0x1e5d),(0x2ff+8704-0x24b1),
-(0x165b+2986-0x21b6),(0x47c+7794-0x229e),(0x5ff+3158-0x1204),(0x3c3+1556-0x985),
-(0x726+3087-0x12e2),(0x104d+2738-0x1aab),(0x1880+3036-0x2407),
-(0x10db+1624-0x16dd),(0x1901+2086-0x20d0),(0x706+523-0x8b9),(0xe1+402-0x21a),
-(0x1c08+137-0x1c37),NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x1b59+929-0x1ee9),NON_GSM,
-(0x682+3037-0x11fe),(0x11c8+1905-0x18d7),(0x11bb+1426-0x16ea),
-(0x857+7300-0x2477),(0x1666+1710-0x1caf),(0x54c+7176-0x20ee),(0xee1+4988-0x21f6)
-,(0x52d+7174-0x20cb),(0x404+245-0x490),(0x87f+7055-0x23a4),(0xfb7+452-0x1110),
-(0x8b7+5030-0x1bf1),(0xad8+377-0xbe4),(0xdbf+5285-0x21f6),(0xf38+3774-0x1d87),
-(0xca2+3212-0x18be),(0x1737+3701-0x253b),(0xdf+3786-0xf37),(0x1652+692-0x1893),
-(0xb44+5487-0x203f),(0xa08+2556-0x138f),(0x1492+3595-0x2227),(0xf9b+5903-0x2633)
-,(0x25f7+174-0x262d),(0x14f1+1873-0x1bc9),(0xe9c+293-0xf47),NON_GSM,NON_GSM,
+NON_GSM,(0x1c3d+2033-0x240e),(0x6e4+1092-0xb07),(0x1998+127-0x19f5),
+(0x4c2+33-0x4c0),(0xfca+3319-0x1cbf),(0x50f+8377-0x25a3),(0x123+7339-0x1da8),
+(0xd6d+1378-0x12a8),(0xae5+1874-0x120f),(0x2d9+1632-0x910),(0x646+3150-0x126a),
+(0x732+6338-0x1fc9),(0x14b9+996-0x1871),(0x3f+555-0x23d),(0x1699+3446-0x23e1),
+(0x1cf+7147-0x1d8b),(0xa3+9670-0x2639),(0x3c9+3083-0xfa3),(0x832+3908-0x1744),
+(0x6c5+6023-0x1e19),(0x6bf+3983-0x161a),(0xb3a+3433-0x186e),(0x480+3485-0x11e7),
+(0x1283+2437-0x1bd1),(0x1773+2273-0x201c),(0x1b78+607-0x1d9e),
+(0x1d52+235-0x1e03),(0x19e0+2895-0x24f4),(0xa98+3242-0x1706),(0x8bb+5238-0x1cf4)
+,(0x326+8270-0x2336),(0xbf2+142-0xc41),(0x1d03+1815-0x241a),(0xb01+4942-0x1e0e),
+(0x151f+3615-0x22fc),(0x31f+8009-0x2225),(0x103b+2441-0x1980),
+(0x307+6427-0x1bdd),(0x1d54+2380-0x265a),(0xb7d+6061-0x22e3),(0x190+1725-0x805),
+(0xf41+5226-0x2362),(0x5c8+6953-0x20a7),(0x1135+1100-0x1536),
+(0x111b+3991-0x2066),(0x1c20+2427-0x254e),(0xeb1+1230-0x1331),
+(0x101d+5304-0x2486),(0x1140+2509-0x1abd),(0x927+685-0xb83),(0x626+3910-0x151a),
+(0x1886+2580-0x2247),(0x214+9287-0x2607),(0xb91+1850-0x1276),(0xdb5+3628-0x1b8b)
+,(0x4b6+7160-0x2057),(0x753+6563-0x209e),(0x261+9470-0x2706),(0xdf+8589-0x2212),
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x1487+3029-0x204b),NON_GSM,
+(0x14bd+3750-0x2302),(0x5fd+6819-0x203e),(0x83d+4755-0x1a6d),
+(0x1c52+1331-0x2121),(0xd63+1133-0x116b),(0x18a7+2178-0x20c3),
+(0x1ff8+566-0x21c7),(0xb00+318-0xbd6),(0x1a5b+2685-0x246f),(0xbd2+1224-0x1030),
+(0x715+3706-0x1524),(0x1722+307-0x17e9),(0x4c2+8030-0x23b3),(0x1379+887-0x1682),
+(0xfb+5811-0x173f),(0x7e1+6752-0x21d1),(0x715+1962-0xe4e),(0x589+1279-0xa16),
+(0x363+2593-0xd11),(0x1412+4377-0x24b7),(0x1d2b+2430-0x2634),(0x26d+4223-0x1276)
+,(0x1486+2305-0x1d10),(0x19da+2293-0x2257),(0x18d7+789-0x1b73),
+(0x112a+4336-0x21a0),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x12e1+664-0x155e),(0x1b7a+2793-0x2623)
-,NON_GSM,(0x96a+1663-0xfe8),(0x768+7617-0x2505),(0x862+2382-0x11ad),NON_GSM,
-(0x177d+3892-0x2652),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xa44+724-0xcb8),NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,(0x939+2612-0x1312),(0x1623+1009-0x1a06),
-(0x386+3528-0x1132),(0xb5d+3453-0x18d1),NON_GSM,(0x84c+5278-0x1ccb),NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xedc+41-0xea8),NON_GSM,NON_GSM
-,NON_GSM,NON_GSM,(0x1b26+2540-0x24b6),NON_GSM,(0x192c+774-0x1c27),NON_GSM,
-NON_GSM,NON_GSM,(0xb41+1489-0x10b4),NON_GSM,NON_GSM,(0xfda+953-0x1375),
-(0x1fbc+1570-0x255f),NON_GSM,NON_GSM,NON_GSM,(0x378+3392-0x103d),
-(0xd26+3394-0x1a59),(0x7a6+6788-0x220d),NON_GSM,(0x100d+4958-0x2367),
-(0xbd8+1926-0x1359),NON_GSM,NON_GSM,(0x11b8+513-0x13b2),NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,(0xae4+6045-0x2204),(0x266+6607-0x1c2d),NON_GSM,NON_GSM,NON_GSM,
-(0x1287+4958-0x2569),NON_GSM,(0x347+7529-0x20a4),(0x222f+454-0x23ef),NON_GSM,
-NON_GSM,(0xc20+6817-0x2643),NON_GSM,NON_GSM,NON_GSM};const unsigned short 
-zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[][(0x1deb+1149-0x2266)]={{
-(0x1df+8154-0x21b4),(0x3d9+8741-0x2514)},{(0x1100+4948-0x244b),
-(0xd85+6440-0x25c6)},{(0x5d8+5020-0x196a),(0xef8+5985-0x264d)},{
-(0x977+5139-0x1d7f),(0x1b58+672-0x1d24)},{(0x17a3+911-0x1b26),
-(0x6c2+6588-0x1f8a)},{(0x10e1+2099-0x1907),(0x1f5+4439-0x133f)},{
-(0x2159+742-0x2431),(0x736+1405-0xbf2)},{(0xf12+1351-0x144a),
-(0x1a18+3277-0x2604)},{(0x25f4+111-0x2651),(0x1c4f+527-0x1ab8)},{
-(0x700+4711-0x1954),(0xe42+7127-0x2686)},{(0xfc9+1930-0x173f),(0x1c1+1716-0x817)
-},{(0x1f2b+1069-0x2343),(0xce7+7258-0x2598)},{(0x1443+777-0x1736),
-(0x4bc+4521-0x12c5)},{(0x653+5828-0x1d00),(0xf11+3821-0x1a56)},{
-(0x4ed+4230-0x155b),(0x4bf+516-0x320)},{(0xd0b+5614-0x22e0),(0x10b5+1947-0x14b8)
-},{(0x5cd+1709-0xc5b),(0xf2a+3562-0x1c4a)},{(0x15f2+1078-0x1a00),
-(0xd7d+2569-0x170b)},{(0x476+8675-0x2630),(0xfa5+44-0xf54)},{
-(0x1ad8+1026-0x1eab),(0x169c+188-0x16fc)},{(0x1cc9+1197-0x213a),
-(0x217+3353-0xed5)},{(0x880+3931-0x179e),(0xeb9+5097-0x2224)},{
-(0x36f+8831-0x25b0),(0x12ba+2660-0x1cc1)},{(0xb02+4224-0x1b42),
-(0x7d2+7764-0x25aa)},{(0x1a87+924-0x1de2),(0x16f6+626-0x18a8)},{
-(0x705+4114-0x16ce),(0x136c+4052-0x2273)},{(0xc74+3893-0x1b5a),
-(0xf99+2632-0x190e)},{(0x1c46+1162-0x207b),(0x3bc+7691-0x20ed)},{
-(0xeb+6398-0x198e),(0x17af+2817-0x21ed)},{(0x8fd+3863-0x17b8),
-(0x17e6+553-0x193a)},{(0x1da5+346-0x1e9e),(0x241+7881-0x2048)},{
-(0x765+6048-0x1ea0),8364},{(0x7e7+3389-0x14bb),(0x237+6160-0x195a)},{
-(0x1b3d+2520-0x24a6),(0xdf2+3945-0x1c68)},{(0x101f+5738-0x2614),
-(0xcc8+5134-0x1fdc)},{(0x1162+4762-0x2381),(0x77d+7880-0x2562)},{
-(0xd5+2834-0xb6b),(0x1a59+3405-0x26b1)},{(0x1f3d+152-0x1f56),(0x1be8+427-0x1cb1)
-},};const unsigned short Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[][(0x457+3979-0x13e0)
-]={{(0x702+7747-0x2535),(0x934+7940-0x24a4)},{(0x1089+1927-0x17fb),8929},{
-(0xbf3+5036-0x1f87),8364},{(0x379+3150-0xf62),8364},};const unsigned char 
-Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[]={NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x1859+2479-0x21fe),NON_GSM,NON_GSM,
-(0x588+327-0x6c2),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,(0x824+5152-0x1c24),(0x418+5629-0x19f4),(0x65f+2085-0xe62),
-(0x92+1582-0x69d),(0x9d8+4145-0x1a07),(0x1ba7+704-0x1e42),(0x80a+7894-0x26ba),
-(0x1a74+1532-0x2049),(0x158b+3863-0x247a),(0x6b5+4780-0x1938),
-(0x1090+562-0x1298),(0x79+8171-0x2039),(0x181+8909-0x2422),(0x453+915-0x7b9),
-(0x3ea+628-0x630),(0x27c+6460-0x1b89),(0x1d31+1115-0x215c),(0x1aa+1136-0x5e9),
-(0x15e2+4216-0x2628),(0x1db3+2130-0x25d2),(0x1a68+440-0x1bec),
-(0x672+3227-0x12d8),(0x6b1+6021-0x1e00),(0x3f5+5614-0x19ac),(0x1836+2157-0x206b)
-,(0x27c+3871-0x1162),(0x20c9+5-0x2094),(0x2383+592-0x2598),(0xdf6+3116-0x19e6),
-(0x1b4+5192-0x15bf),(0xb0+456-0x23a),(0x3aa+8581-0x24f0),(0x93a+1904-0x10aa),
-(0xf80+2412-0x18ab),(0x17e0+3899-0x26d9),(0x1995+3118-0x2580),
-(0x502+5380-0x19c2),(0x1d0f+1363-0x221d),(0x8c4+4777-0x1b27),(0x183+2849-0xc5d),
-(0x1434+1795-0x1aef),(0x369+9080-0x2698),(0x1e2b+1770-0x24cb),(0x327+905-0x665),
-(0xb45+628-0xd6d),(0x1e98+594-0x209d),(0x2323+718-0x25a3),(0x142f+161-0x1481),
-(0x72c+3293-0x13b9),(0x1a4d+2529-0x23dd),(0x6a8+5564-0x1c12),
-(0x1b70+2430-0x249b),(0xd12+4867-0x1fc1),(0xa45+868-0xd54),(0x192f+1370-0x1e33),
-(0x170+2388-0xa6d),(0x213+1191-0x662),(0x23d6+120-0x23f5),(0x1d3a+869-0x2045),
-NON_GSM,(0xeac+5761-0x2516),NON_GSM,(0xf83+988-0x1349),(0x979+5711-0x1fb7),
-(0x22ec+926-0x260d),(0xa5a+3333-0x16fe),(0xa4+9434-0x251c),(0x3a0+2274-0xc1f),
-(0xb89+2995-0x16d8),(0x1950+2239-0x21aa),(0x7d7+477-0x94e),(0xc9f+1624-0x1290),
-(0x2200+735-0x2477),(0x1109+2492-0x1a5c),(0xcc6+4538-0x1e16),(0x18c+8340-0x21b5)
-,(0xb77+5878-0x2201),(0xac5+28-0xa74),(0x1436+4643-0x25eb),(0x1148+3449-0x1e52),
-(0x512+334-0x5f0),(0x95c+6736-0x233b),(0x124+1951-0x851),(0x767+6640-0x20e4),
-(0xef4+625-0x10f1),(0x1ae8+1433-0x200c),(0x2bb+4314-0x131f),(0x104a+5113-0x23cc)
-,(0x11f7+4732-0x23fb),(0x21d+6361-0x1a7d),(0x239+3020-0xd8b),NON_GSM,
-(0x1fb5+1046-0x23b1),NON_GSM,(0x844+840-0xb2c),NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+(0x19f6+2193-0x226c),(0x16d4+3898-0x25ce),NON_GSM,(0x33f+3747-0x11e1),
+(0x5eb+2553-0xfc0),(0xcb+5593-0x16a1),NON_GSM,(0x18c+6868-0x1c01),NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-(0x1249+1309-0x174b),NON_GSM_P,NON_GSM,(0x1493+2573-0x1e9f),NON_GSM_P,
-(0x1032+5045-0x23e4),NON_GSM,(0xcdc+5066-0x2047),NON_GSM,NON_GSM,
-(0x1d74+611-0x1fc5),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x1b7+7991-0x20ca),
+NON_GSM,NON_GSM,(0xeb4+5894-0x255a),NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+(0x1479+456-0x15e6),(0x148c+3563-0x2269),(0x4a0+5885-0x1b81),(0x13c2+230-0x149f)
+,NON_GSM,(0x73+5123-0x1457),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,(0xe3+3291-0xd61),NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xb7+605-0x2b8),
+NON_GSM,(0xf35+3453-0x1ca7),NON_GSM,NON_GSM,NON_GSM,(0x191b+3536-0x268d),NON_GSM
+,NON_GSM,(0x73+9420-0x2521),(0x1b80+1532-0x20fd),NON_GSM,NON_GSM,NON_GSM,
+(0x1664+1136-0x1a59),(0x12d2+2026-0x1aad),(0x740+5127-0x1b2a),NON_GSM,
+(0xf18+4982-0x228a),(0x25dc+101-0x263c),NON_GSM,NON_GSM,(0xd53+2604-0x1778),
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xc48+1809-0x12dc),(0x2f3+926-0x689),NON_GSM,
+NON_GSM,NON_GSM,(0x112f+639-0x1332),NON_GSM,(0x4d5+1975-0xc80),
+(0x16d1+2869-0x2200),NON_GSM,NON_GSM,(0x12da+4187-0x22b7),NON_GSM,NON_GSM,
+NON_GSM};const unsigned short zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[][
+(0x9d5+304-0xb03)]={{(0xaaf+1261-0xf97),(0x12c1+4169-0x2220)},{(0x1ec+925-0x580)
+,(0x1343+360-0x13c4)},{(0x2019+43-0x203a),(0xb38+788-0xe40)},{
+(0xe5b+2995-0x1a03),(0x1db8+449-0x1ea5)},{(0xde7+4993-0x215c),
+(0x4bf+6467-0x1d0e)},{(0x83+3551-0xe55),(0xe81+5017-0x220d)},{
+(0x1108+5225-0x2563),(0x11c+9450-0x2545)},{(0xd90+1346-0x12c3),
+(0x30a+4594-0x141b)},{(0xdb8+4506-0x1f40),(0x446+6141-0x189d)},{
+(0xf8f+3455-0x1cfb),(0x1157+528-0xfd4)},{(0xa1d+5956-0x214d),(0xe58+2872-0x1932)
+},{(0x306+6060-0x1a9d),(0x5c5+5225-0x1685)},{(0x950+1581-0xf67),
+(0x1992+911-0x1981)},{(0xe06+3869-0x1d0c),(0x191c+3681-0x23d5)},{
+(0x1bf+2549-0xb9c),(0x1c38+406-0x1a2b)},{(0x106b+3678-0x1eb0),(0x104d+269-0xdc2)
+},{(0x137+3086-0xd26),(0x13d9+1473-0x18d0)},{(0x1c25+2017-0x23de),
+(0x21c7+234-0x2236)},{(0x25bc+204-0x265f),(0xecb+4436-0x1fa2)},{
+(0x14ea+2323-0x1dce),(0xcc+7619-0x1e33)},{(0x5a1+4013-0x1512),
+(0xbf3+1164-0x1024)},{(0x1138+4049-0x20cc),(0xd1f+5573-0x2266)},{
+(0x73f+3229-0x139e),(0x1136+4531-0x228c)},{(0xe63+936-0x11cb),(0x190+1786-0x80e)
+},{(0xb79+3312-0x1828),(0x837+2232-0x102f)},{(0xc8f+5241-0x20bf),
+(0xfd2+5103-0x22f4)},{(0x19d4+83-0x19d8),(0x960+6433-0x21ae)},{
+(0xc6f+3973-0x1b9f),(0x1610+4059-0x2511)},{(0x1938+2670-0x234b),
+(0xd7+5070-0x13e2)},{(0x1b30+2797-0x25c1),(0x74c+5009-0x1a08)},{
+(0xb68+918-0xe9d),(0x1a93+3201-0x2652)},{(0x1de1+41-0x1da5),8364},{
+(0x1eed+1810-0x2596),(0xb70+5767-0x210a)},{(0xa10+5549-0x1f4e),
+(0x980+7381-0x2562)},{(0x1ad7+2044-0x225e),(0x39a+3245-0xf4d)},{
+(0xc8+5697-0x168e),(0x669+3419-0x12e1)},{(0x7b6+3418-0x1494),
+(0x193b+2654-0x22a4)},{(0x16b1+3805-0x250f),(0xe8d+371-0xf1e)},};const unsigned 
+short Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[][(0x852+1647-0xebf)]={{
+(0xb4b+3464-0x18c3),(0x1652+2719-0x1d5d)},{(0x1a88+417-0x1c14),8929},{
+(0x17db+1866-0x1f0d),8364},{(0x1b8+3251-0xe06),(0x2547+2457-0xe34)},};const 
+unsigned char Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[]={NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x1988+935-0x1d25),
+NON_GSM,NON_GSM,(0x12c+6343-0x19e6),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x25b+6540-0x1bd3),(0xceb+1700-0x1381),
-(0x9a8+200-0xa54),(0x19f9+1928-0x2126),NON_GSM_P,NON_GSM_P,NON_GSM_P,
-(0xbd5+2278-0x14a8),NON_GSM,(0x1169+4769-0x23eb),(0x600+4801-0x18a3),NON_GSM,
-NON_GSM,(0xd08+2310-0x15ce),NON_GSM,NON_GSM,NON_GSM,NON_GSM_P,NON_GSM,
-(0x3f2+6115-0x1bbc),(0x1e1b+1909-0x2585),(0xe0a+1509-0x1393),NON_GSM_P,NON_GSM,
-NON_GSM_P,NON_GSM,(0x1188+5048-0x24e3),NON_GSM,(0x14e9+4001-0x242c),NON_GSM,
-NON_GSM,NON_GSM_P,(0x42f+8510-0x24ee),(0x163a+3087-0x223a),(0x32+2826-0xb1f),
-(0xb6+1154-0x4bd),NON_GSM_P,NON_GSM_P,NON_GSM_P,(0x9d3+1070-0xdf8),NON_GSM_P,
-(0x811+382-0x98a),(0x872+7404-0x255a),NON_GSM,NON_GSM_P,(0x9fc+2312-0x12fd),
-NON_GSM,NON_GSM,NON_GSM,NON_GSM_P,NON_GSM_P,(0x148c+2279-0x1d6b),
-(0x1f5f+727-0x222a),(0xd18+5083-0x2077),NON_GSM_P,NON_GSM,NON_GSM_P,NON_GSM_P,
-(0x586+8397-0x264d),NON_GSM,(0x1685+2538-0x1ff1),NON_GSM,NON_GSM,NON_GSM};const 
-unsigned short zte_sms_GSMDefault_To_UCS2_Table_Ex[][(0x1ba2+1400-0x2118)]={{
-(0x1b58+2866-0x2680),(0xbc3+13-0xbc4)},{(0x1ea+1936-0x966),(0x1e5+2237-0xa44)},{
-(0x1985+3408-0x26ad),(0x6a1+2461-0xfc3)},{(0x1b4b+1864-0x226a),
-(0x48d+3170-0x1072)},{(0x14a+7732-0x1f4f),(0x565+3159-0x1160)},{
-(0xfb1+506-0x116f),(0x452+5004-0x1783)},{(0x2b7+7674-0x2074),(0x102+5272-0x151c)
-},{(0xd16+3607-0x1aef),(0xceb+6073-0x2447)},{(0xdc2+76-0xdce),
-(0x1c74+1140-0x206c)},{(0x5b3+2668-0xfba),8364},};const unsigned short 
-UCS2_To_GSMDefault_Table_UCS2[][(0xf5b+4764-0x21f5)]={{(0xbdd+6290-0x245f),
-(0xdf3+3210-0x16e9)},{(0xd53+1019-0x113c),(0x772+1352-0x914)},{
-(0x4a6+2545-0xe84),(0x8e4+3813-0x1436)},{(0x57b+1203-0xa1a),(0x3b6+1191-0x4c2)},
-{(0x17+3102-0xc20),(0x101a+5246-0x20ef)},{(0x19d3+3202-0x263f),
-(0x48f+8041-0x2058)},{(0x418+4349-0x14fe),(0x1688+4852-0x25d4)},{
-(0x16a+6850-0x1c14),(0x1c24+407-0x1a18)},{(0xa7b+3984-0x19f2),
-(0xca6+7274-0x2578)},{(0x1903+2220-0x2195),(0xfc5+6689-0x2648)},};const unsigned
- char UCS2_To_GSMDefault_Table_ASC[]={NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xc70+2595-0x1689),NON_GSM,NON_GSM,
-(0xe16+4458-0x1f73),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,NON_GSM,(0x9bc+5462-0x1ef2),(0xcfd+4925-0x2019),
+(0xc1a+2610-0x162a),(0x156+5622-0x1729),(0x6c8+8082-0x2658),(0xbaa+492-0xd71),
+(0x2007+1663-0x2660),(0x1730+2027-0x1ef4),(0xdec+2366-0x1702),
+(0x1926+1916-0x2079),(0x581+1601-0xb98),(0x137f+471-0x152b),(0x886+2632-0x12a2),
+(0xf7a+2147-0x17b0),(0xa95+2552-0x145f),(0x584+4295-0x161c),(0x8d3+302-0x9d1),
+(0x12d4+2184-0x1b2b),(0x653+7765-0x2476),(0x88f+2893-0x13a9),
+(0x1aa9+3195-0x26f0),(0x8d2+4831-0x1b7c),(0xb25+1451-0x109a),(0xbdd+4056-0x1b7e)
+,(0xb5b+4043-0x1aee),(0x6a0+3736-0x14ff),(0x1aac+2500-0x2436),
+(0xa46+7336-0x26b3),(0xa39+4190-0x1a5b),(0xb9+723-0x34f),(0xed1+3089-0x1aa4),
+(0x405+8478-0x24e4),(0x12eb+4053-0x22c0),(0xdbc+349-0xed8),(0xe36+3423-0x1b53),
+(0x1604+2355-0x1ef4),(0x1900+2106-0x20f6),(0xd74+3864-0x1c47),
+(0xd12+2817-0x17cd),(0x436+4157-0x142c),(0x813+6754-0x222d),(0x712+2027-0xeb4),
+(0x16cf+1279-0x1b84),(0x17e4+908-0x1b25),(0x594+5007-0x18d7),(0x1d21+78-0x1d22),
+(0x15a3+1662-0x1bd3),(0x1a98+738-0x1d2b),(0xcc6+392-0xdfe),(0x1274+5340-0x26ff),
+(0x216+2620-0xc00),(0xbe7+4696-0x1dec),(0x1941+3027-0x24c0),(0x1892+2761-0x2306)
+,(0x19f2+1593-0x1fd5),(0xe42+1846-0x1521),(0xc62+2524-0x15e6),
+(0x15e7+3593-0x2397),(0x2a3+4193-0x12aa),NON_GSM,(0x11f2+4110-0x21e9),NON_GSM,
+(0x9a3+3174-0x15f3),(0x12c0+582-0x14f5),(0x1309+327-0x13d3),(0x90+7732-0x1e63),
+(0x68f+1407-0xbac),(0x1c86+553-0x1e4c),(0x9ba+6218-0x21a0),(0x61f+2557-0xfb7),
+(0x540+4401-0x160b),(0x18d+6050-0x18c8),(0x13bc+4732-0x25d0),(0x98+1123-0x492),
+(0x175+2822-0xc11),(0x7d8+5401-0x1c86),(0x9fd+5446-0x1ed7),(0x1019+3234-0x1c4e),
+(0x2dd+3911-0x11b6),(0xde8+2656-0x17d9),(0x188d+1141-0x1c92),(0x306+6443-0x1bc0)
+,(0x1d85+159-0x1db2),(0x1870+1185-0x1c9e),(0x170f+3534-0x2469),
+(0x873+6499-0x2161),(0x670+5733-0x1c5f),(0x2a7+2861-0xd5d),(0x1386+2161-0x1b7f),
+(0x18f1+89-0x18d1),(0x86c+1212-0xcae),NON_GSM,(0xe31+4136-0x1e3f),NON_GSM,
+(0x57f+6129-0x1d10),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,(0x16ff+1149-0x1b5c),(0x1172+1076-0x1585),(0x17f7+3732-0x2669),
-(0x668+3798-0x151b),(0x9b+5781-0x172e),(0x1bec+2437-0x254c),(0x4d2+7137-0x208d),
-(0x17cd+3174-0x240c),(0x13a3+4814-0x2649),(0x10c2+3737-0x1f32),
-(0xcbc+2757-0x1757),(0x1e66+1287-0x2342),(0x9c6+6178-0x21bc),(0x1200+678-0x1479)
-,(0xc7a+1308-0x1168),(0x82+8263-0x209a),(0x996+1979-0x1121),(0xb23+3321-0x17eb),
-(0x9e0+178-0xa60),(0x1506+358-0x1639),(0x12f8+2274-0x1ba6),(0x3a3+769-0x66f),
-(0xfb3+2179-0x1800),(0xfcc+1342-0x14d3),(0x1a0+4489-0x12f1),(0x1cda+2575-0x26b0)
-,(0x35b+9022-0x265f),(0x576+4526-0x16e9),(0xf27+1718-0x15a1),(0x4d2+2828-0xfa1),
-(0x5ed+3456-0x132f),(0x6a1+5323-0x1b2d),(0x1a91+1904-0x2201),(0x457+2775-0xeed),
-(0xa6a+4510-0x1bc6),(0x7d5+2693-0x1217),(0x1513+2602-0x1ef9),(0xb27+2570-0x14ec)
-,(0x743+651-0x988),(0x1624+1419-0x1b68),(0x1b9f+945-0x1f08),(0x5aa+6754-0x1fc3),
-(0x8ef+6912-0x23a5),(0xe9f+303-0xf83),(0xb44+5048-0x1eb0),(0x11dd+2516-0x1b64),
-(0x1560+669-0x17af),(0x1cf8+1307-0x21c4),(0x16cb+829-0x19b8),(0xbc2+6060-0x231d)
-,(0x14bb+224-0x1549),(0x1e88+926-0x21d3),(0x6a0+4024-0x1604),(0x1bb9+249-0x1c5d)
-,(0x12a+4344-0x11cc),(0xc26+2528-0x15af),(0xc47+2716-0x168b),(0x48d+3214-0x10c2)
-,(0x611+5896-0x1cbf),NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xa15+278-0xb1a),NON_GSM,
-(0xb8c+202-0xbf5),(0xe51+3927-0x1d46),(0x2cb+3983-0x11f7),(0x260+5361-0x16ed),
-(0x1093+5064-0x23f6),(0x597+6121-0x1d1a),(0x2f2+804-0x5af),(0x1dda+685-0x201f),
-(0x1917+2914-0x2410),(0x8c+1406-0x5a0),(0x1575+3096-0x2122),(0x1791+262-0x182b),
-(0x5d0+5055-0x1922),(0x6b1+7874-0x2505),(0x1560+699-0x17ac),(0xaad+2025-0x1226),
-(0x282+7928-0x2109),(0xa3+4911-0x1360),(0x1dd+981-0x53f),(0x1871+3320-0x24f5),
-(0x653+2051-0xde1),(0x153+1157-0x562),(0x60b+5916-0x1cb0),(0x2469+478-0x25cf),
-(0x1090+351-0x1176),(0xc47+4023-0x1b84),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x1bc+4301-0x126e),NON_GSM_P,
+NON_GSM,(0xaa8+1653-0x111c),NON_GSM_P,(0x1752+3433-0x24b8),NON_GSM,
+(0xaf9+1050-0xeb4),NON_GSM,NON_GSM,(0x241c+347-0x2565),NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,(0x2e8+3552-0x10a4),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+(0xd99+1315-0x12a8),(0x1927+2702-0x23a7),(0x1ce4+1783-0x23bf),
+(0x213c+291-0x2204),NON_GSM_P,NON_GSM_P,NON_GSM_P,(0x1dfd+159-0x1e89),NON_GSM,
+(0xf30+1781-0x1606),(0x671+4078-0x1641),NON_GSM,NON_GSM,(0x1425+271-0x14f4),
+NON_GSM,NON_GSM,NON_GSM,NON_GSM_P,NON_GSM,(0x28+3451-0xd8a),(0x184b+1194-0x1cea)
+,(0x1c27+611-0x1e2e),NON_GSM_P,NON_GSM,NON_GSM_P,NON_GSM,(0xae7+6046-0x2228),
+NON_GSM,(0x1d70+505-0x1f0b),NON_GSM,NON_GSM,NON_GSM_P,(0xe90+4914-0x2143),
+(0x1436+326-0x156d),(0x482+2018-0xc47),(0x121a+2790-0x1c85),NON_GSM_P,NON_GSM_P,
+NON_GSM_P,(0xddf+4509-0x1f73),NON_GSM_P,(0x998+5759-0x2012),(0xd84+2019-0x1563),
+NON_GSM,NON_GSM_P,(0xdaf+2764-0x1874),NON_GSM,NON_GSM,NON_GSM,NON_GSM_P,
+NON_GSM_P,(0xdf6+3163-0x1a49),(0x1167+4717-0x23c8),(0x13a3+4949-0x267c),
+NON_GSM_P,NON_GSM,NON_GSM_P,NON_GSM_P,(0x1124+2953-0x1ca7),NON_GSM,
+(0x745+7889-0x2598),NON_GSM,NON_GSM,NON_GSM};const unsigned short 
+zte_sms_GSMDefault_To_UCS2_Table_Ex[][(0x2b9+604-0x513)]={{(0x320+2616-0xd4e),
+(0x1ee7+1681-0x256c)},{(0x1176+4416-0x22a2),(0x9b2+5815-0x200b)},{
+(0xb9+7781-0x1ef6),(0x4aa+1365-0x984)},{(0x644+424-0x7c3),(0x3f8+993-0x75c)},{
+(0x1bb+5830-0x1852),(0x117b+356-0x1283)},{(0x2563+458-0x26f1),(0x34c+1649-0x962)
+},{(0x1214+1624-0x182f),(0x148a+4576-0x25ec)},{(0x784+4530-0x18f8),
+(0x1366+4550-0x24cf)},{(0x43c+2834-0xf0e),(0x242c+270-0x24be)},{
+(0x23f+5951-0x1919),8364},};const unsigned short UCS2_To_GSMDefault_Table_UCS2[]
+[(0x5bf+3462-0x1343)]={{(0x21bd+640-0x242d),(0x22d7+76-0x1f8f)},{
+(0xc51+1431-0x11d6),(0x1a31+1162-0x1b15)},{(0x199d+2449-0x231b),
+(0x13bb+3440-0x1d98)},{(0x269+3229-0xef2),(0x1a09+3994-0x2608)},{
+(0x19e9+1099-0x1e1f),(0xf4c+1741-0x1270)},{(0x8dc+2436-0x124a),
+(0x1983+2712-0x207b)},{(0x520+2936-0x1081),(0x17df+3926-0x238d)},{
+(0x1a39+1768-0x2109),(0x979+7218-0x2208)},{(0x1ef9+1711-0x258f),
+(0x16b3+3679-0x217a)},{(0x15d7+1845-0x1cf2),(0x1908+3067-0x2165)},};const 
+unsigned char UCS2_To_GSMDefault_Table_ASC[]={NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x20d+5853-0x18e0),NON_GSM,
+NON_GSM,(0xfcd+161-0x1061),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,(0x159c+1144-0x19f4),(0x3b6+5728-0x19f5),(0x1a9+2370-0xac9),
+(0x1648+863-0x1984),(0x452+8001-0x2391),(0x1cb+1787-0x8a1),(0xbe1+5481-0x2124),
+(0x1053+776-0x1334),(0x53b+7396-0x21f7),(0xd4f+673-0xfc7),(0xb23+1070-0xf27),
+(0x8a2+1291-0xd82),(0x7bc+403-0x923),(0x15f2+1897-0x1d2e),(0xabb+5380-0x1f91),
+(0x8e6+7677-0x26b4),(0x28d+6762-0x1cc7),(0xbcf+3420-0x18fa),(0x54a+7098-0x20d2),
+(0xe38+971-0x11d0),(0x1a2+322-0x2b0),(0x912+959-0xc9c),(0x1348+1006-0x1700),
+(0x1c1b+1005-0x1fd1),(0xc9+9173-0x2466),(0x493+6099-0x1c2d),(0x490+571-0x691),
+(0xc61+2273-0x1507),(0x650+237-0x701),(0x6ed+1892-0xe14),(0x1687+2656-0x20a9),
+(0xb69+6114-0x230c),(0x2151+1182-0x25ef),(0xb8f+1286-0x1054),(0x52b+8561-0x265a)
+,(0x52b+7722-0x2312),(0xdb+7618-0x1e59),(0x20d8+1056-0x24b3),(0x1cfc+863-0x2015)
+,(0xebc+5745-0x24e6),(0x54+9635-0x25af),(0x1077+5616-0x261e),(0xf02+1324-0x13e4)
+,(0x314+9061-0x262e),(0x6b7+5412-0x1b8f),(0x1b63+210-0x1be8),(0x950+2718-0x13a0)
+,(0x1a99+3236-0x26ee),(0x800+3436-0x151c),(0x1ec5+208-0x1f44),
+(0xdf5+2181-0x1628),(0x1229+5354-0x26c0),(0x4e3+1174-0x925),(0x88c+7206-0x245d),
+(0x149a+1582-0x1a72),(0x51d+1948-0xc62),(0x13e4+4406-0x24c2),(0x7a3+3715-0x15cd)
+,(0x16bc+3314-0x2354),NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x11d6+3895-0x20fc),
+NON_GSM,(0xd69+5289-0x21b1),(0x196c+1941-0x209f),(0x36b+3657-0x1151),
+(0x93+9936-0x26ff),(0x220a+40-0x21cd),(0x12c+4086-0x10bc),(0x1cb+7756-0x1fb0),
+(0x121c+487-0x139b),(0x1670+2516-0x1fdb),(0x580+4798-0x17d4),
+(0x146f+1302-0x191a),(0x15f2+2275-0x1e69),(0x1587+2963-0x20ad),
+(0xd8c+2897-0x186f),(0x440+1820-0xaed),(0x1944+2195-0x2167),(0x5df+1367-0xac5),
+(0x1f6a+501-0x20ed),(0x386+6371-0x1bf6),(0x979+2513-0x12d6),(0x25a+4863-0x14e4),
+(0x1f3a+818-0x21f6),(0xe07+3521-0x1b51),(0x190d+1097-0x1cde),(0x932+1950-0x1057)
+,(0x17d4+276-0x186e),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,(0x1809+1487-0x1dbd),(0x10a0+5472-0x25c0),NON_GSM,
-(0x363+5083-0x173d),(0x984+522-0xb6a),(0x1e1d+697-0x20d3),NON_GSM,
-(0x3f5+8825-0x260f),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+(0xc90+2164-0x14e9),(0x10df+4544-0x225f),NON_GSM,(0xbca+408-0xd61),
+(0xe8b+3644-0x1ca3),(0x23f3+591-0x263f),NON_GSM,(0xa11+6348-0x227e),NON_GSM,
 NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0xd79+6439-0x2640),NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,(0x977+4923-0x1c57),(0x381+6603-0x1d3e),
-(0xa6+6010-0x1804),(0x9b2+7114-0x2573),NON_GSM,(0x1fc+3384-0xf15),NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x712+1374-0xc13),NON_GSM,
-NON_GSM,NON_GSM,NON_GSM,(0x43b+3596-0x11eb),NON_GSM,(0xda1+2571-0x17a1),NON_GSM,
-NON_GSM,NON_GSM,(0x60+1858-0x744),NON_GSM,NON_GSM,(0xe4d+360-0xf97),
-(0x27a+7893-0x20d0),NON_GSM,NON_GSM,NON_GSM,(0x6e2+8167-0x264e),
-(0x651+243-0x735),(0x44f+5107-0x1825),NON_GSM,(0x19db+2365-0x2314),
-(0xcaa+3556-0x1a89),NON_GSM,NON_GSM,(0x697+552-0x8b8),NON_GSM,NON_GSM,NON_GSM,
-NON_GSM,(0x884+3181-0x1474),(0x9f0+6528-0x2368),NON_GSM,NON_GSM,NON_GSM,
-(0xb42+3226-0x1760),NON_GSM,(0x1f5+1284-0x6ed),(0x1dd1+963-0x218e),NON_GSM,
-NON_GSM,(0x1924+3111-0x24cd),NON_GSM,NON_GSM,NON_GSM};const unsigned short 
-zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[]={(0x490+1141-0x8c5),(0x666+4447-0x1722),
-(0x840+1055-0xc3b),(0x15d3+3292-0x220a),(0x11c6+2599-0x1b03),
-(0x1007+5692-0x255a),(0x314+2802-0xd0c),(0x1da4+1775-0x23a6),
-(0x141d+3784-0x21f2),(0x440+6627-0x1d3c),(0x6e2+7057-0x2269),(0x6c7+1053-0xa10),
-(0x13ea+4518-0x249c),(0x1c52+2029-0x2432),(0xe77+6465-0x26f7),
-(0xf79+3150-0x1ae6),(0xa66+6005-0x1e47),(0x662+3163-0x125e),(0xb0a+7174-0x2666),
-(0x1e94+1642-0x2437),(0x1ead+1558-0x2403),(0x2225+1020-0x403),
-(0x2c3+4732-0x14e1),(0xba8+6789-0x25d1),(0x2187+1797-0x7e0),(0x89c+4251-0x1864),
-(0x4a5+8188-0x2425),(0x714+6021-0x1df9),(0x2ab+1430-0x77f),(0x94c+1297-0xd7b),
-(0xc59+247-0xc86),(0x21ad+386-0x2266),(0x238+3621-0x103d),(0x1141+3792-0x1ff0),
-(0x1bfd+780-0x1ee7),(0x180c+1974-0x1f9f),(0x939+5303-0x1d40),(0x2141+896-0x249c)
-,(0x636+7353-0x22c9),(0x1147+83-0x1173),(0xada+464-0xc82),(0x1526+2029-0x1cea),
-(0x1fe2+1238-0x248e),(0xfaf+4903-0x22ab),(0x1432+3014-0x1fcc),
-(0xe79+4354-0x1f4e),(0x491+7650-0x2245),(0x908+7546-0x2653),(0x1f94+1764-0x2648)
-,(0x11c+6912-0x1beb),(0x2b8+3079-0xe8d),(0x268+812-0x561),(0xbbd+3011-0x174c),
-(0x112a+2607-0x1b24),(0x14c+5400-0x162e),(0xcc7+4528-0x1e40),(0xd4a+3860-0x1c26)
-,(0xc56+5345-0x20fe),(0x11ab+1272-0x1669),(0xb7+8723-0x228f),
-(0x110d+1888-0x1831),(0x177d+3676-0x259c),(0x17f6+1371-0x1d13),
-(0x16d9+3921-0x25eb),(0x27d+8841-0x2439),(0x14ef+162-0x1550),(0x61d+2772-0x10af)
-,(0x11b0+2145-0x19ce),(0x1586+1669-0x1bc7),(0x169f+4101-0x265f),
-(0xe7+3878-0xfc7),(0x64d+5899-0x1d11),72,(0x2096+153-0x20e6),(0x1d8b+540-0x1f5d)
-,(0xb8c+5500-0x20bd),(0x7da+2342-0x10b4),(0x220+1560-0x7eb),(0x328+6443-0x1c05),
-(0x1dd1+1315-0x22a5),(0x1dc2+1071-0x21a1),(0x11d7+5205-0x25db),
-(0x1554+2575-0x1f11),(0x79f+4363-0x1857),(0xa32+6727-0x2425),(0x74+3354-0xd39),
-(0x107b+4213-0x209a),(0x15a8+2821-0x2056),(0x1a35+2014-0x21bb),
-(0x1ce1+943-0x2037),(0x34b+8959-0x25f0),(0x16e3+335-0x176f),(0xab0+4655-0x1c0a),
-(0x810+259-0x839),(0x8a0+455-0x98b),(0x56f+2189-0xd55),(0x12c4+270-0x1354),
-(0x10b7+3933-0x1fb3),(0x1a56+1007-0x1de3),(0x10fb+3632-0x1ec8),
-(0xe0a+2329-0x16bf),(0x6bc+5911-0x1d6e),(0x6c3+4582-0x1843),(0x1635+2189-0x1e5b)
-,(0xaf0+3402-0x17d2),(0xe52+1558-0x13ff),(0xf31+3167-0x1b26),(0x1f71+566-0x213c)
-,(0xbcc+6634-0x254a),(0x1dc0+1585-0x2384),(0xf2b+3880-0x1de5),
-(0x13c1+665-0x15eb),(0x1939+2198-0x215f),(0xa88+4820-0x1ceb),(0x6c2+3028-0x1224)
-,(0xf30+1097-0x1306),(0x622+2315-0xeb9),(0x500+3419-0x11e6),(0xa0f+6185-0x21c2),
-(0x15cb+4444-0x26b0),(0x142d+2572-0x1dc1),(0x1456+1636-0x1a41),
-(0x5c7+1489-0xb1e),(0x13d3+4259-0x2393),(0x15e3+857-0x1847),(0x78b+7526-0x2491),
-(0xbf5+5179-0x1f34),(0x343+599-0x4ba)};const unsigned short 
-zte_sms_GSMDefault_To_UCS2_Table[]={(0x36f+6024-0x1ab7),(0x64c+7831-0x2440),
-(0x10f6+5244-0x254e),(0xfa1+5509-0x2481),(0xb32+5402-0x1f64),(0x1688+419-0x1742)
-,(0xd06+6664-0x2615),(0xd47+6220-0x24a7),(0x946+2989-0x1401),(0x2374+850-0x25ff)
-,(0xa47+4421-0x1b82),(0xaaa+6653-0x23cf),(0x377+760-0x577),(0x582+2094-0xda3),
-(0x35d+3512-0x1050),(0xe52+2483-0x1720),(0x95f+2800-0x10bb),(0x1b94+888-0x1ead),
-(0x226f+703-0x2188),(0x768+4990-0x1753),(0x2404+152-0x2101),(0x15ff+2345-0x1b7f)
-,(0xbb5+1261-0xd02),(0x21f1+1085-0x2286),(0x1144+5695-0x23e0),
-(0x1191+1777-0x14ea),(0x10a6+1768-0x13f0),(0x1f4+1506-0x736),(0x759+2933-0x1208)
-,(0x653+6472-0x1eb5),(0x363+4943-0x15d3),(0x20a+3949-0x10ae),(0xbb5+2816-0x1695)
-,(0x1121+3670-0x1f56),(0x207+8808-0x244d),(0x462+3037-0x101c),
-(0x1ee4+1134-0x22ae),(0xa43+6196-0x2252),(0x5e0+2747-0x1075),
-(0x18dc+3371-0x25e0),(0xb6f+2688-0x15c7),(0x1516+35-0x1510),(0x58f+1995-0xd30),
-(0x1bba+1992-0x2357),(0x9a+3369-0xd97),(0x128b+2390-0x1bb4),(0x14f8+1653-0x1b3f)
-,(0x11dc+2792-0x1c95),(0xc37+4745-0x1e90),(0x1ba5+2751-0x2633),
-(0xadc+1505-0x108b),(0xab6+1062-0xea9),(0x49c+8618-0x2612),(0x14c7+3979-0x241d),
-(0x92+9151-0x241b),(0x1da4+1625-0x23c6),(0x150+8800-0x2378),(0x529+2790-0xfd6),
-(0x1307+4617-0x24d6),(0x23f+8695-0x23fb),(0x284+9205-0x263d),(0xb51+2494-0x14d2)
-,(0xfb0+531-0x1185),(0x230a+388-0x244f),(0x1ab3+1093-0x1e57),(0x2e2+6224-0x1af1)
-,(0x8ff+1199-0xd6c),(0x1c31+2681-0x2667),(0x16f+8017-0x207c),(0xaa0+3780-0x191f)
-,(0x16d+2224-0x9d7),(0x6f3+473-0x885),(0x2504+130-0x253e),(0x208b+928-0x23e2),
-(0x871+1680-0xeb7),(0x1609+3533-0x238b),(0xb2+3686-0xecc),(0x2b8+1492-0x83f),
-(0x197+6517-0x1abe),(0xc7b+6366-0x250a),(0x123c+2765-0x1cb9),(0x704+43-0x6de),
-(0x87+9341-0x24b2),(0x1266+341-0x1368),(0x131+8346-0x2177),(0x571+5493-0x1a91),
-(0xa2f+2296-0x12d1),(0x8e3+4361-0x1995),(0x1aa7+548-0x1c73),(0x184a+2816-0x22f1)
-,(0x1b31+2208-0x2377),(0x2a1+7327-0x1e7c),(0x182b+1302-0x1c6b),
-(0x798+4518-0x186d),(0x1bac+754-0x1dc2),(0x1195+5461-0x2643),(0x7fa+5979-0x1e96)
-,(0x1b42+1414-0x2067),(0x8d7+738-0xb57),(0x1377+1759-0x19f3),(0xec2+1643-0x14c9)
-,(0x10ff+4051-0x206d),(0x971+5483-0x1e76),(0xa7+7313-0x1cd1),
-(0x1488+2960-0x1fb0),(0xa70+320-0xb47),(0x1f1b+918-0x2247),(0xe0a+5680-0x23cf),
-(0xd9c+6413-0x263d),(0x24c3+23-0x246d),(0x35b+1704-0x995),(0xa67+1922-0x117a),
-(0x5c3+714-0x81d),(0x16eb+2581-0x208f),(0x18b0+264-0x1946),(0x11e0+2634-0x1bb7),
-(0x894+1835-0xf4b),(0x2164+1187-0x2592),(0x1d56+1838-0x240e),(0xa38+3597-0x17ce)
-,(0x16c4+4084-0x2640),(0xcef+4464-0x1de6),(0x6db+1565-0xc7e),(0x127+1699-0x6e6),
-(0x352+8763-0x2497),(0x6d0+6761-0x2048),(0x111+4440-0x116d),(0x8fd+5388-0x1d29)}
-;int Bytes2String(const unsigned char*pSrc,char*pDst,int nSrcLength){const char 
-tab[]="0123456789ABCDEF";int i=(0xc1+687-0x370);if(pSrc==NULL||pDst==NULL||
-nSrcLength<(0x158d+2819-0x2090)){return-(0x13d5+3716-0x2258);}for(i=
-(0x4+3627-0xe2f);i<nSrcLength;i++){*pDst++=tab[*pSrc>>(0x23db+81-0x2428)];*pDst
-++=tab[*pSrc&(0x342+2137-0xb8c)];pSrc++;}*pDst='\0';return nSrcLength*
-(0x1c43+1347-0x2184);}int String2Bytes(const char*pSrc,unsigned char*pDst,int 
-nSrcLength){int i=(0xbf6+3297-0x18d7);if(pSrc==NULL||pDst==NULL||nSrcLength<
-(0xfe2+3051-0x1bcd)){return-(0x132b+2320-0x1c3a);}for(i=(0x5f4+6394-0x1eee);i<
-nSrcLength;i+=(0x42c+5196-0x1876)){if(*pSrc>=((char)(0xa06+2178-0x1258))&&*pSrc
-<=((char)(0xb4a+3486-0x18af))){*pDst=(*pSrc-((char)(0x15f+7376-0x1dff)))<<
-(0x657+3347-0x1366);}else{*pDst=((toupper(*pSrc)-((char)(0x129+3442-0xe5a)))+
-(0x19b9+3376-0x26df))<<(0x112b+2768-0x1bf7);}pSrc++;if(*pSrc>=
-((char)(0x611+68-0x625))&&*pSrc<=((char)(0x535+2744-0xfb4))){*pDst|=*pSrc-
-((char)(0xb31+2560-0x1501));}else{*pDst|=(toupper(*pSrc)-
-((char)(0x548+149-0x59c)))+(0x609+2912-0x115f);}pSrc++;pDst++;}return nSrcLength
-/(0x13f+3130-0xd77);}int EncodeUcs2(const char*pSrc,unsigned char*pDst,int 
-nSrcLength){if(pSrc==NULL||pDst==NULL||nSrcLength<(0x15da+1399-0x1b51)){return-
-(0x1b6+6789-0x1c3a);}(void)String2Bytes(pSrc,pDst,(int)nSrcLength);return 
-nSrcLength/(0x535+7089-0x20e4);}int Encode7bit(const char*pSrc,unsigned char*
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,NON_GSM,(0x5c3+2419-0xed6),NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+(0xe2+4189-0x10e4),(0x2447+330-0x2583),(0x888+5154-0x1c8e),(0x1498+1520-0x1a7f),
+NON_GSM,(0xb3a+2968-0x16b3),NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,NON_GSM,
+NON_GSM,(0x980+3420-0x167f),NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x8d0+6276-0x20f8),
+NON_GSM,(0xeda+5753-0x2548),NON_GSM,NON_GSM,NON_GSM,(0x19af+2916-0x24b5),NON_GSM
+,NON_GSM,(0x23c0+478-0x2580),(0x9cc+4133-0x1972),NON_GSM,NON_GSM,NON_GSM,
+(0x788+4335-0x17fc),(0x744+3034-0x130f),(0x1773+2650-0x21b0),NON_GSM,
+(0x10b+191-0x1c6),(0x1b16+357-0x1c76),NON_GSM,NON_GSM,(0x9fb+1855-0x1133),
+NON_GSM,NON_GSM,NON_GSM,NON_GSM,(0x1333+4899-0x25d9),(0x126+3635-0xf51),NON_GSM,
+NON_GSM,NON_GSM,(0x1559+2638-0x1f2b),NON_GSM,(0x13d4+181-0x147d),
+(0x85b+296-0x97d),NON_GSM,NON_GSM,(0xed8+2374-0x17a0),NON_GSM,NON_GSM,NON_GSM};
+const unsigned short zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[]={
+(0xbd7+4520-0x1d3f),(0x10ed+49-0x107b),(0x788+3594-0x156e),(0x428+4419-0x14c6),
+(0x1202+490-0x1302),(0x6e5+5131-0x1a07),(0x18ec+684-0x1a9e),(0xfe1+5128-0x22fc),
+(0x1c29+1809-0x2247),(0x856+6393-0x2068),(0x22a+6209-0x1a61),(0x943+7826-0x2701)
+,(0x785+1323-0xbbc),(0x270+8822-0x24d9),(0x14a9+2122-0x1c32),(0x3a8+3233-0xf68),
+(0x109f+3406-0x1a59),(0x1495+1417-0x19bf),(0x2d2+8938-0x2512),
+(0x586+5877-0x1bb4),(0x1f48+69-0x1ecd),8734,(0x81f+4479-0x1940),
+(0x1b63+1438-0x20a5),(0x20f7+6303-0x18ea),(0x1fcd+324-0x203e),
+(0x679+4585-0x17e6),(0x13ec+4080-0x233c),(0x2c7+5905-0x1916),(0x535+3819-0x133e)
+,(0xe45+4104-0x1d83),(0x1a36+74-0x19b7),(0x5c0+5430-0x1ad6),(0xbcf+1875-0x1301),
+(0x718+6013-0x1e73),(0x155b+4448-0x2698),(0x2381+372-0x2445),
+(0x1301+1100-0x1728),(0xeac+5844-0x255a),(0x26b9+103-0x26f9),(0x8b7+1199-0xd3e),
+(0x17ff+1433-0x1d6f),(0x1485+1292-0x1967),(0x217+6876-0x1cc8),
+(0x418+7610-0x21a6),(0x8bd+6686-0x22ae),(0xe6c+3238-0x1ae4),(0x5a6+4301-0x1644),
+(0xf34+1284-0x1408),(0x2090+647-0x22e6),(0xd0b+5395-0x21ec),(0x826+3430-0x1559),
+(0x600+1852-0xd08),(0x832+1763-0xee0),(0x632+5531-0x1b97),(0x9fb+4167-0x1a0b),
+(0xd30+2670-0x1766),(0x71b+2538-0x10cc),(0x85f+1017-0xc1e),(0x9ff+5174-0x1dfa),
+(0x985+6218-0x2193),(0xfea+4807-0x2274),(0x1d96+68-0x1d9c),(0x1e58+1984-0x25d9),
+(0x11c4+3748-0x1f9b),(0xcac+6510-0x25d9),(0xb1+2679-0xae6),(0x6a4+6748-0x20bd),
+(0x1d19+661-0x1f6a),(0x4c+8261-0x204c),(0x13c1+4943-0x26ca),(0x2c3+4776-0x1524),
+(0x745+5425-0x1c2e),(0x4cd+8604-0x2620),(0x42b+5048-0x1799),(0x798+7928-0x2645),
+(0x92a+6824-0x2386),(0xa60+3869-0x1930),(0x12ed+3131-0x1eda),(0x6a+1800-0x723),
+(0x1195+2220-0x19f1),(0x310+1793-0x9c0),(0xd02+6042-0x244a),(0x18f3+2719-0x233f)
+,(0x1045+4447-0x2150),(0x11a2+4413-0x228a),(0x1a81+1000-0x1e13),
+(0x122d+4633-0x23ef),(0x92b+1763-0xfb6),(0x2ba+8016-0x21b1),(0xdf2+461-0xf65),
+(0x5e8+3920-0x1475),(0x809+7247-0x2383),(0x16f3+4263-0x26c0),(0x813+1349-0xc7c),
+(0xf28+31-0xea0),(0x1bc3+446-0x1d03),(0x1320+996-0x16a3),(0x1418+4628-0x25ca),
+(0x1174+480-0x12f1),(0xdaa+5496-0x22be),(0xea2+3530-0x1c07),(0x921+7303-0x2542),
+(0x50f+130-0x52a),(0xb6+4538-0x1208),(0x1282+172-0x12c5),(0xe9c+3780-0x1cf6),
+(0x9d8+6120-0x2155),(0x6b8+4892-0x1968),(0x53d+8611-0x2673),(0x1854+1435-0x1d81)
+,(0xc9f+4509-0x1dcd),(0x836+49-0x7f7),(0x159+533-0x2fd),(0x6cc+3251-0x130d),
+(0xd9c+6209-0x256a),(0x4b2+4861-0x173b),(0x1a10+930-0x1d3d),(0x6ef+5856-0x1d59),
+(0x1c48+2247-0x2498),(0x47b+5959-0x1b4a),(0x58c+5071-0x18e2),
+(0x10d8+5231-0x24cd),(0xaf2+2983-0x15b6),(0xbff+1644-0x1176),
+(0x1477+4226-0x2499),(0x1569+2800-0x1f5d),(0xec7+5395-0x22fa)};const unsigned 
+short zte_sms_GSMDefault_To_UCS2_Table[]={(0xaf9+55-0xaf0),(0x455+1418-0x93c),
+(0x1c55+458-0x1dfb),(0x568+6763-0x1f2e),(0x10db+3036-0x1bcf),(0x33c+9149-0x2610)
+,(0x1243+4475-0x22c5),(0x15c+7027-0x1be3),(0x24d+5665-0x177c),
+(0x101+7268-0x1c9e),(0x915+799-0xc2a),(0x2324+685-0x24f9),(0x21d+7530-0x1e8f),
+(0x69f+5154-0x1ab4),(0x123a+2728-0x1c1d),(0x1fbd+316-0x2014),(0x3cb+2060-0x843),
+(0xc8c+3172-0x1891),(0x1530+2711-0x1c21),(0x7e9+8478-0x2574),(0x444+5977-0x1802)
+,(0x12eb+2905-0x1a9b),(0x1ca4+3399-0x264b),(0xac8+7296-0x23a0),
+(0x1acd+1814-0x1e40),(0x18da+4260-0x25e6),(0xd84+2533-0x13cb),
+(0x1cbb+2631-0x2662),(0xb4f+2136-0x12e1),(0x110b+2616-0x1a5d),
+(0x11b+5382-0x1542),(0x45f+4483-0x1519),(0x301+911-0x670),(0x244+6178-0x1a45),
+(0x171f+3463-0x2484),(0x497+2912-0xfd4),(0x1b0+3124-0xd40),(0x243d+691-0x26cb),
+(0x453+122-0x4a7),(0x107+3136-0xd20),(0x769+1770-0xe2b),(0x8e1+964-0xc7c),
+(0x832+7514-0x2562),(0x62+2768-0xb07),(0x97d+375-0xac8),(0x82a+1598-0xe3b),
+(0xda0+2067-0x1585),(0x1746+58-0x1751),(0x1e8f+1578-0x2489),(0x247+6485-0x1b6b),
+(0x10a1+5034-0x2419),(0x458+3392-0x1165),(0x4ff+4542-0x1689),(0x585+1921-0xcd1),
+(0x10cc+3690-0x1f00),(0xc67+5755-0x22ab),(0xe63+5637-0x2430),(0xf45+4544-0x20cc)
+,(0x274+1172-0x6ce),(0x652+7801-0x2490),(0x1552+2439-0x1e9d),(0x87c+468-0xa13),
+(0x424+5989-0x1b4b),(0x99+4417-0x119b),(0x128c+1122-0x164d),(0x21f1+107-0x221b),
+(0x16ef+2092-0x1ed9),(0xd52+1109-0x1164),(0x818+3390-0x1512),(0xec3+2182-0x1704)
+,(0xf58+5387-0x241d),(0x1c7b+2596-0x2658),(0x1494+1591-0x1a83),
+(0xfd7+3424-0x1cee),(0x19b6+1797-0x2071),(0x1136+4610-0x22ed),
+(0x1409+173-0x146a),(0x2cb+5132-0x168a),(0x368+1349-0x85f),(0xc51+1698-0x12a4),
+(0x619+1832-0xcf1),(0x7a7+7899-0x2631),(0x357+476-0x4e1),(0xfa2+4283-0x200a),
+(0x1861+1219-0x1cd0),(0x156c+2671-0x1f86),(0x9b+2343-0x96c),(0x8c5+2891-0x13b9),
+(0x1139+801-0x1402),(0x4ea+4691-0x16e4),(0x1362+670-0x15a6),(0x325+1788-0x95d),
+(0xce5+3859-0x1b22),(0x760+6725-0x20d4),(0x882+1881-0xeff),(0x1b6a+1914-0x223d),
+(0xce0+4279-0x1cd8),(0x1c6+1648-0x7d5),(0x66a+1571-0xc2b),(0xa23+3736-0x1858),
+(0x18a+8210-0x2138),(0x179+9149-0x24d1),(0x908+188-0x95e),(0xb2+7953-0x1f5c),
+(0x46f+6411-0x1d12),(0x1f88+400-0x20af),(0xed8+1148-0x12ea),(0x921+4233-0x193f),
+(0x1162+4791-0x23ad),(0xc3b+4069-0x1bb3),(0x4b4+6604-0x1e12),(0xc0+932-0x3f5),
+(0x152c+2972-0x2058),(0x15a2+2476-0x1edd),(0xa2d+3236-0x165f),
+(0x23c9+250-0x2450),(0x2e2+7739-0x20a9),(0x2f2+5233-0x16ee),(0x1558+3373-0x220f)
+,(0x1774+552-0x1925),(0x615+4106-0x15a7),(0xd5d+3736-0x1b7c),(0x140+3893-0xffb),
+(0xff3+3129-0x1b48),(0x403+6501-0x1c72),(0x192+6334-0x195f),(0x3b2+1680-0x946),
+(0x182a+1759-0x1e29)};int Bytes2String(const unsigned char*pSrc,char*pDst,int 
+nSrcLength){const char tab[]="0123456789ABCDEF";int i=(0x843+6632-0x222b);if(
+pSrc==NULL||pDst==NULL||nSrcLength<(0x210a+843-0x2455)){return-
+(0x18b+1586-0x7bc);}for(i=(0x12c1+4991-0x2640);i<nSrcLength;i++){*pDst++=tab[*
+pSrc>>(0x619+1361-0xb66)];*pDst++=tab[*pSrc&(0xfd1+3388-0x1cfe)];pSrc++;}*pDst=
+'\0';return nSrcLength*(0x75d+4462-0x18c9);}int String2Bytes(const char*pSrc,
+unsigned char*pDst,int nSrcLength){int i=(0xbb+5904-0x17cb);if(pSrc==NULL||pDst
+==NULL||nSrcLength<(0x104b+2858-0x1b75)){return-(0x1e38+1662-0x24b5);}for(i=
+(0x1553+2994-0x2105);i<nSrcLength;i+=(0x172a+85-0x177d)){if(*pSrc>=
+((char)(0x16c8+833-0x19d9))&&*pSrc<=((char)(0x1304+2212-0x1b6f))){*pDst=(*pSrc-
+((char)(0xd9a+5496-0x22e2)))<<(0x140d+2680-0x1e81);}else{*pDst=((toupper(*pSrc)-
+((char)(0x1946+616-0x1b6d)))+(0x2440+528-0x2646))<<(0x83+9648-0x262f);}pSrc++;if
+(*pSrc>=((char)(0x13f7+3421-0x2124))&&*pSrc<=((char)(0xe77+6080-0x25fe))){*pDst
+|=*pSrc-((char)(0x127+3775-0xfb6));}else{*pDst|=(toupper(*pSrc)-
+((char)(0x1598+2922-0x20c1)))+(0xc5b+885-0xfc6);}pSrc++;pDst++;}return 
+nSrcLength/(0x118b+5403-0x26a4);}int EncodeUcs2(const char*pSrc,unsigned char*
+pDst,int nSrcLength){if(pSrc==NULL||pDst==NULL||nSrcLength<(0x2372+479-0x2551)){
+return-(0x9fa+4630-0x1c0f);}(void)String2Bytes(pSrc,pDst,(int)nSrcLength);return
+ nSrcLength/(0x2bf+4157-0x12fa);}int Encode7bit(const char*pSrc,unsigned char*
 pDst,int nSrcLength){int nSrc;int nDst;int nChar;unsigned char nLeft=
-(0x912+3700-0x1786);if(pSrc==NULL||pDst==NULL||nSrcLength<(0x450+7607-0x2207)){
-return-(0x15c8+4363-0x26d2);}nSrc=(0x63+6068-0x1817);nDst=(0x1ba+3167-0xe19);
-while(nSrc<nSrcLength){nChar=nSrc&(0x15dd+405-0x176b);if(nChar==
-(0xca5+5128-0x20ad)){nLeft=*pSrc;if((g_zUfiSms_ConcatSms.total_msg>
-(0x1238+3283-0x1f0a))&&(nSrc==(nSrcLength-(0xe8+1579-0x712)))){nDst++;}}else{*
-pDst=(*pSrc<<((0x1a45+542-0x1c5b)-nChar))|nLeft;nLeft=*pSrc>>nChar;pDst++;nDst++
-;}pSrc++;nSrc++;}return nDst;}SINT32 zUfiSms_EncodePdu_DeliverReport(CHAR*pDst,
-UINT8 TP_FCS){SINT32 nLength=(0xb04+5117-0x1f01);SINT32 nDstLength=
-(0x91c+4497-0x1aad);UINT8 buf[(0xcc2+3471-0x1951)]={(0xf81+782-0x128f)};if(NULL
-==pDst){return-(0x8b9+1541-0xebd);}if(TP_FCS!=(0x9ed+3807-0x18cc)){buf[
-(0xb15+6030-0x22a3)]=(0x89+3356-0xda5);buf[(0xbac+6183-0x23d2)]=TP_FCS;buf[
-(0x88b+5-0x88e)]=(0xd1b+1496-0x12f3);nDstLength+=Bytes2String(buf,&pDst[
-nDstLength],(0x16ad+3626-0x24d4));}else{buf[(0xa6+6854-0x1b6c)]=
-(0x183d+51-0x1870);buf[(0x485+4493-0x1611)]=(0x10b+3111-0xd32);nDstLength+=
-Bytes2String(buf,&pDst[nDstLength],(0x1a82+2492-0x243c));}return nDstLength;}
+(0x1746+1566-0x1d64);if(pSrc==NULL||pDst==NULL||nSrcLength<(0x7f1+3544-0x15c9)){
+return-(0x419+3428-0x117c);}nSrc=(0x15c+8841-0x23e5);nDst=(0x11e4+748-0x14d0);
+while(nSrc<nSrcLength){nChar=nSrc&(0x1b72+2242-0x242d);if(nChar==
+(0x156+5316-0x161a)){nLeft=*pSrc;if((g_zUfiSms_ConcatSms.total_msg>
+(0x38+1953-0x7d8))&&(nSrc==(nSrcLength-(0x711+5951-0x1e4f)))){nDst++;}}else{*
+pDst=(*pSrc<<((0x292+3109-0xeaf)-nChar))|nLeft;nLeft=*pSrc>>nChar;pDst++;nDst++;
+}pSrc++;nSrc++;}return nDst;}SINT32 zUfiSms_EncodePdu_DeliverReport(CHAR*pDst,
+UINT8 TP_FCS){SINT32 nLength=(0x1266+1460-0x181a);SINT32 nDstLength=
+(0x15fd+4211-0x2670);UINT8 buf[(0x8c9+5344-0x1ca9)]={(0x4c5+5076-0x1899)};if(
+NULL==pDst){return-(0x568+2002-0xd39);}if(TP_FCS!=(0x7a5+7565-0x2532)){buf[
+(0x1422+1827-0x1b45)]=(0xbcc+1979-0x1387);buf[(0xcab+4126-0x1cc8)]=TP_FCS;buf[
+(0x133a+2428-0x1cb4)]=(0x292+7451-0x1fad);nDstLength+=Bytes2String(buf,&pDst[
+nDstLength],(0xd8a+2394-0x16e1));}else{buf[(0x7d3+6661-0x21d8)]=
+(0x16d2+1490-0x1ca4);buf[(0x32b+1403-0x8a5)]=(0x740+460-0x90c);nDstLength+=
+Bytes2String(buf,&pDst[nDstLength],(0x1a27+2331-0x2340));}return nDstLength;}
 unsigned long zUfiSms_ConvertAsciiToGsmDefault(const unsigned char*inputs,
-unsigned char*outputs,unsigned long len){unsigned long i=(0xaf+2281-0x998);
-unsigned long j=(0xb40+5362-0x2032);unsigned long k=(0x1082+2022-0x1868);if(NULL
-==inputs||NULL==outputs){printf(
+unsigned char*outputs,unsigned long len){unsigned long i=(0x491+5903-0x1ba0);
+unsigned long j=(0x901+281-0xa1a);unsigned long k=(0x17+4038-0xfdd);if(NULL==
+inputs||NULL==outputs){printf(
 "\x73\x6d\x73\x3a\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73");
-return(0x1436+3479-0x21cd);}for(i=(0x29c+5400-0x17b4);i<len;i++){j=inputs[i];if(
-g_zUfiSms_AsciiToGsmdefaultTable[j]<(0x661+1976-0xd1a)){outputs[k]=
+return(0x5d8+7920-0x24c8);}for(i=(0xc07+2909-0x1764);i<len;i++){j=inputs[i];if(
+g_zUfiSms_AsciiToGsmdefaultTable[j]<(0x6f7+1061-0xa1d)){outputs[k]=
 g_zUfiSms_AsciiToGsmdefaultTable[j];}else{outputs[k]=(
-g_zUfiSms_AsciiToGsmdefaultTable[j]&65280)>>(0x1da+1648-0x842);k++;outputs[k]=(
-g_zUfiSms_AsciiToGsmdefaultTable[j]&(0x2f5+3239-0xe9d));}k++;}return k;}unsigned
- long zUfiSms_ConvertUcs2ToSpanish(const unsigned char*def,unsigned char*
-gsm_default,unsigned long len){unsigned long i=(0x1e3+6923-0x1cee);unsigned long
- k=(0xfb+5909-0x1810);unsigned long p=(0x1747+1212-0x1c03);unsigned long tmp=
-(0x110d+4558-0x22db);unsigned long s1=(0x758+3932-0x16b4),s2=
-(0x14b5+1878-0x1c0b);unsigned long q=(0x99c+2645-0x13f1);s1=sizeof(
+g_zUfiSms_AsciiToGsmdefaultTable[j]&65280)>>(0x1fa4+919-0x2333);k++;outputs[k]=(
+g_zUfiSms_AsciiToGsmdefaultTable[j]&(0x738+2720-0x10d9));}k++;}return k;}
+unsigned long zUfiSms_ConvertUcs2ToSpanish(const unsigned char*def,unsigned char
+*gsm_default,unsigned long len){unsigned long i=(0x25a5+271-0x26b4);unsigned 
+long k=(0x41b+7024-0x1f8b);unsigned long p=(0x9c0+5484-0x1f2c);unsigned long tmp
+=(0x13+474-0x1ed);unsigned long s1=(0x451+6854-0x1f17),s2=(0xb23+5779-0x21b6);
+unsigned long q=(0x1a7d+1560-0x2095);s1=sizeof(
 zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex)/sizeof(
-zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[(0xad4+5007-0x1e63)]);s2=sizeof(
+zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[(0xcf6+1859-0x1439)]);s2=sizeof(
 Ucs2_To_Gsm7_SPANISH_Table_UCS)/sizeof(Ucs2_To_Gsm7_SPANISH_Table_UCS[
-(0x1559+224-0x1639)]);for(i=(0x1364+1000-0x174c);i<len;i++){if(def[i]==
-(0x1372+2278-0x1c58)){i++;if(Ucs2_To_Gsm7_SPANISH_Table_ASC[def[i]]!=NON_GSM){
+(0x12f+8444-0x222b)]);for(i=(0x1579+4061-0x2556);i<len;i++){if(def[i]==
+(0xb94+1701-0x1239)){i++;if(Ucs2_To_Gsm7_SPANISH_Table_ASC[def[i]]!=NON_GSM){
 gsm_default[k]=Ucs2_To_Gsm7_SPANISH_Table_ASC[def[i]];k++;continue;}else if((
-Ucs2_To_Gsm7_SPANISH_Table_ASC[def[i]]==NON_GSM)&&(def[i]==(0x9a5+6325-0x223a)))
-{gsm_default[k]=(0xa6c+590-0xc9a);k++;continue;}for(q=(0x47b+2002-0xc4d);q<s1;q
-++){if(def[i]==zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[q][(0x1b6+3994-0x114f)]){
-gsm_default[k]=(0x221+6960-0x1d36);k++;gsm_default[k]=
-zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[q][(0x74b+7626-0x2515)];break;}}}else{tmp=
-(def[i]<<(0xa18+2110-0x124e))+def[i+(0x20ed+906-0x2476)];i++;if(tmp==
-(0x223f+1516-0x77f)){gsm_default[k]=(0x6d1+1745-0xd87);k++;gsm_default[k]=
-(0xebb+1709-0x1503);k++;}for(p=(0x1a53+317-0x1b90);p<s2;p++){if(tmp==
-Ucs2_To_Gsm7_SPANISH_Table_UCS[p][(0xc2+2134-0x917)]){gsm_default[k]=
-Ucs2_To_Gsm7_SPANISH_Table_UCS[p][(0x118a+5131-0x2595)];break;}}}k++;}
-gsm_default[k]='\0';return k;}unsigned long zUfiSms_ConvertUcs2ToPortuguese(
-const unsigned char*def,unsigned char*gsm_default,unsigned long len){unsigned 
-long i=(0x560+2110-0xd9e);unsigned long k=(0x14b9+105-0x1522);unsigned long p=
-(0x9a1+4175-0x19f0);unsigned long tmp=(0xa11+6126-0x21ff);unsigned long s1=
-(0xa7d+7291-0x26f8),s2=(0x133d+2575-0x1d4c);unsigned long q=(0x152b+2031-0x1d1a)
-;s1=sizeof(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex)/sizeof(
-zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[(0x7b1+7756-0x25fd)]);s2=sizeof(
+Ucs2_To_Gsm7_SPANISH_Table_ASC[def[i]]==NON_GSM)&&(def[i]==(0x1ce3+1710-0x2371))
+){gsm_default[k]=(0x1308+1087-0x1727);k++;continue;}for(q=(0x1486+1754-0x1b60);q
+<s1;q++){if(def[i]==zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[q][(0x11fa+152-0x1291)
+]){gsm_default[k]=(0x19b7+1540-0x1fa0);k++;gsm_default[k]=
+zte_sms_GSM7_SPANISH_To_UCS2_Table_Ex[q][(0x9cc+7171-0x25cf)];break;}}}else{tmp=
+(def[i]<<(0x74+830-0x3aa))+def[i+(0xa4c+1251-0xf2e)];i++;if(tmp==8364){
+gsm_default[k]=(0x3b9+7419-0x2099);k++;gsm_default[k]=(0x2d6+8540-0x23cd);k++;}
+for(p=(0x105+6219-0x1950);p<s2;p++){if(tmp==Ucs2_To_Gsm7_SPANISH_Table_UCS[p][
+(0xd62+6250-0x25cb)]){gsm_default[k]=Ucs2_To_Gsm7_SPANISH_Table_UCS[p][
+(0x1bef+1595-0x222a)];break;}}}k++;}gsm_default[k]='\0';return k;}unsigned long 
+zUfiSms_ConvertUcs2ToPortuguese(const unsigned char*def,unsigned char*
+gsm_default,unsigned long len){unsigned long i=(0x1c4b+747-0x1f36);unsigned long
+ k=(0x92+3932-0xfee);unsigned long p=(0x1bc+4759-0x1453);unsigned long tmp=
+(0x14bd+2047-0x1cbc);unsigned long s1=(0x8ca+4073-0x18b3),s2=(0x2188+111-0x21f7)
+;unsigned long q=(0xa93+754-0xd85);s1=sizeof(
+zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex)/sizeof(
+zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[(0xe31+5940-0x2565)]);s2=sizeof(
 Ucs2_To_Gsm7_PORTUGUESE_Table_UCS)/sizeof(Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[
-(0x990+166-0xa36)]);for(i=(0x6a4+6028-0x1e30);i<len;i++){if(def[i]==
-(0x65+7948-0x1f71)){i++;if(Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[def[i]]!=NON_GSM){
+(0x10af+611-0x1312)]);for(i=(0x669+76-0x6b5);i<len;i++){if(def[i]==
+(0xeb4+419-0x1057)){i++;if(Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[def[i]]!=NON_GSM){
 gsm_default[k]=Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[def[i]];k++;continue;}else if((
 Ucs2_To_Gsm7_PORTUGUESE_Table_ASC[def[i]]==NON_GSM)&&(def[i]==
-(0xaeb+6940-0x25e7))){gsm_default[k]=(0x19c2+80-0x19f2);k++;continue;}for(q=
-(0x868+3656-0x16b0);q<s1;q++){if(def[i]==
-zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[q][(0x1f48+1425-0x24d8)]){gsm_default[k
-]=(0xaa3+4114-0x1a9a);k++;gsm_default[k]=
-zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[q][(0x1846+542-0x1a64)];break;}}}else{
-tmp=(def[i]<<(0x13d2+4755-0x265d))+def[i+(0x730+6418-0x2041)];i++;if(tmp==8364){
-gsm_default[k]=(0x1c6d+2571-0x265d);k++;gsm_default[k]=(0x334+4256-0x136f);k++;
-continue;}for(p=(0x694+2172-0xf10);p<s2;p++){if(tmp==
-Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[p][(0xa82+778-0xd8b)]){gsm_default[k]=
-Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[p][(0xcec+5539-0x228f)];break;}}}k++;}
+(0x767+3967-0x16c6))){gsm_default[k]=(0x298+5170-0x16aa);k++;continue;}for(q=
+(0x4c+8816-0x22bc);q<s1;q++){if(def[i]==zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex
+[q][(0x149d+582-0x16e2)]){gsm_default[k]=(0x17af+591-0x19e3);k++;gsm_default[k]=
+zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[q][(0xe37+2176-0x16b7)];break;}}}else{
+tmp=(def[i]<<(0xd1+3449-0xe42))+def[i+(0x80b+232-0x8f2)];i++;if(tmp==8364){
+gsm_default[k]=(0x1412+4753-0x2688);k++;gsm_default[k]=(0xc61+1521-0x11ed);k++;
+continue;}for(p=(0x651+2891-0x119c);p<s2;p++){if(tmp==
+Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[p][(0x10c+4862-0x1409)]){gsm_default[k]=
+Ucs2_To_Gsm7_PORTUGUESE_Table_UCS[p][(0x19d8+3371-0x2703)];break;}}}k++;}
 gsm_default[k]='\0';return k;}unsigned long zUfiSms_ConvertUcs2ToGsmDefault(
 const unsigned char*def,unsigned char*gsm_default,unsigned long len){unsigned 
-long i=(0x911+2044-0x110d);unsigned long k=(0x13e1+2246-0x1ca7);unsigned long p=
-(0x79d+5449-0x1ce6);unsigned long tmp=(0xa55+3224-0x16ed);unsigned long s1=
-(0x8e7+6463-0x2226),s2=(0x16af+3973-0x2634);unsigned long q=(0x1860+3425-0x25c1)
-;s1=sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex)/sizeof(
-zte_sms_GSMDefault_To_UCS2_Table_Ex[(0x1cb+3094-0xde1)]);s2=sizeof(
+long i=(0x2260+921-0x25f9);unsigned long k=(0x83d+2722-0x12df);unsigned long p=
+(0x8ac+4127-0x18cb);unsigned long tmp=(0x14dd+368-0x164d);unsigned long s1=
+(0x2473+264-0x257b),s2=(0xd10+5096-0x20f8);unsigned long q=(0x11d3+4673-0x2414);
+s1=sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex)/sizeof(
+zte_sms_GSMDefault_To_UCS2_Table_Ex[(0x1dc7+1081-0x2200)]);s2=sizeof(
 UCS2_To_GSMDefault_Table_UCS2)/sizeof(UCS2_To_GSMDefault_Table_UCS2[
-(0x18ab+1962-0x2055)]);for(i=(0xbcf+5356-0x20bb);i<len;i++){if(def[i]==
-(0x3e0+1399-0x957)){i++;if(UCS2_To_GSMDefault_Table_ASC[def[i]]!=NON_GSM){
+(0x95+7789-0x1f02)]);for(i=(0x15b3+537-0x17cc);i<len;i++){if(def[i]==
+(0x16b2+1974-0x1e68)){i++;if(UCS2_To_GSMDefault_Table_ASC[def[i]]!=NON_GSM){
 gsm_default[k]=UCS2_To_GSMDefault_Table_ASC[def[i]];k++;continue;}else if((
-UCS2_To_GSMDefault_Table_ASC[def[i]]==NON_GSM)&&(def[i]==(0x770+4834-0x1a32))){
-gsm_default[k]=(0x903+1633-0xf44);k++;continue;}for(q=(0x6f+7621-0x1e34);q<s1;q
-++){if(def[i]==zte_sms_GSMDefault_To_UCS2_Table_Ex[q][(0x10b9+4197-0x211d)]){
-gsm_default[k]=(0x965+2504-0x1312);k++;gsm_default[k]=
-zte_sms_GSMDefault_To_UCS2_Table_Ex[q][(0x540+3806-0x141e)];break;}}}else{tmp=(
-def[i]<<(0x6b4+4695-0x1903))+def[i+(0x29f+4437-0x13f3)];i++;if(tmp==8364){
-gsm_default[k]=(0x10ec+4142-0x20ff);k++;gsm_default[k]=(0x19a4+3224-0x25d7);k++;
-continue;}for(p=(0x1bf+6220-0x1a0b);p<s2;p++){if(tmp==
-UCS2_To_GSMDefault_Table_UCS2[p][(0xa0b+2850-0x152c)]){gsm_default[k]=
-UCS2_To_GSMDefault_Table_UCS2[p][(0x43a+7393-0x211b)];break;}}}k++;}gsm_default[
+UCS2_To_GSMDefault_Table_ASC[def[i]]==NON_GSM)&&(def[i]==(0x1905+790-0x1bfb))){
+gsm_default[k]=(0x138+411-0x2b3);k++;continue;}for(q=(0x241+5553-0x17f2);q<s1;q
+++){if(def[i]==zte_sms_GSMDefault_To_UCS2_Table_Ex[q][(0x15e7+3932-0x2542)]){
+gsm_default[k]=(0x36a+8067-0x22d2);k++;gsm_default[k]=
+zte_sms_GSMDefault_To_UCS2_Table_Ex[q][(0x1778+3275-0x2443)];break;}}}else{tmp=(
+def[i]<<(0x12e9+30-0x12ff))+def[i+(0x851+4620-0x1a5c)];i++;if(tmp==8364){
+gsm_default[k]=(0x12da+3259-0x1f7a);k++;gsm_default[k]=(0x2bd+9132-0x2604);k++;
+continue;}for(p=(0xad+6462-0x19eb);p<s2;p++){if(tmp==
+UCS2_To_GSMDefault_Table_UCS2[p][(0x1bcf+2459-0x2569)]){gsm_default[k]=
+UCS2_To_GSMDefault_Table_UCS2[p][(0x43b+7452-0x2157)];break;}}}k++;}gsm_default[
 k]='\0';return k;}UINT8 zUfiSms_TsIntToBcd(const UINT8 i){return(UINT8)(((i%
-(0x1080+197-0x113b))+((i/(0x1c89+2637-0x26cc))<<(0x1e9+5719-0x183c))));}void 
+(0x12ba+2850-0x1dd2))+((i/(0x581+6038-0x1d0d))<<(0x4e8+6738-0x1f36))));}void 
 zUfiSms_DecodeRelativeTime(UINT8 iValidTime,T_zUfiSms_TimeStamp*ptTimeStamp){
-uint32 i=(0x1080+4029-0x203d);if(ptTimeStamp!=NULL){memset((void*)ptTimeStamp,
-(0xe1f+3934-0x1d7d),sizeof(wms_timestamp_s_type));if(iValidTime<
-(0x615+3181-0x11f2)){i=(iValidTime+(0xfc3+656-0x1252))*(0xf74+714-0x1239);
-ptTimeStamp->hour=(UINT8)zUfiSms_TsIntToBcd((UINT8)(i/(0x3f+6725-0x1a48)));
-ptTimeStamp->minute=(UINT8)zUfiSms_TsIntToBcd((UINT8)(i%(0x1653+2204-0x1eb3)));}
-else if(iValidTime<(0x183d+3783-0x265d)){i=(iValidTime-(0x2117+1303-0x259f))*
-(0x112+392-0x27c);ptTimeStamp->hour=(UINT8)zUfiSms_TsIntToBcd((UINT8)(
-(0x169f+578-0x18d5)+i/(0x871+1928-0xfbd)));ptTimeStamp->minute=(UINT8)
-zUfiSms_TsIntToBcd((UINT8)(i%(0xf3+405-0x24c)));}else if(iValidTime<
-(0x1f7+1896-0x89a)){i=iValidTime-(0x524+2023-0xc65);ptTimeStamp->month=(UINT8)
-zUfiSms_TsIntToBcd((UINT8)(i/(0x290+8704-0x2472)));ptTimeStamp->day=(UINT8)
-zUfiSms_TsIntToBcd((UINT8)(i%(0xecf+2137-0x170a)));}else{i=(iValidTime-
-(0x128b+259-0x12ce))*(0x1d6+1018-0x5c9);ptTimeStamp->year=(UINT8)
-zUfiSms_TsIntToBcd((UINT8)(i/(0x1298+3175-0x1d92)));ptTimeStamp->month=(UINT8)
-zUfiSms_TsIntToBcd((UINT8)((i%(0x143a+530-0x14df))/(0x1d05+2067-0x24fa)));
-ptTimeStamp->day=(UINT8)zUfiSms_TsIntToBcd((UINT8)((i%(0xfb8+3148-0x1a97))%
-(0x597+7894-0x244f)));}}else{printf(
+uint32 i=(0x155a+1696-0x1bfa);if(ptTimeStamp!=NULL){memset((void*)ptTimeStamp,
+(0xe70+460-0x103c),sizeof(wms_timestamp_s_type));if(iValidTime<
+(0xa3d+2790-0x1493)){i=(iValidTime+(0xf17+2462-0x18b4))*(0x37c+3600-0x1187);
+ptTimeStamp->hour=(UINT8)zUfiSms_TsIntToBcd((UINT8)(i/(0x1b0c+2696-0x2558)));
+ptTimeStamp->minute=(UINT8)zUfiSms_TsIntToBcd((UINT8)(i%(0xa7a+2580-0x1452)));}
+else if(iValidTime<(0x15d9+1468-0x1aee)){i=(iValidTime-(0x4cd+2146-0xca0))*
+(0x114d+2832-0x1c3f);ptTimeStamp->hour=(UINT8)zUfiSms_TsIntToBcd((UINT8)(
+(0x1b29+945-0x1ece)+i/(0x9d2+1719-0x104d)));ptTimeStamp->minute=(UINT8)
+zUfiSms_TsIntToBcd((UINT8)(i%(0x12ca+246-0x1384)));}else if(iValidTime<
+(0x13f+2702-0xb08)){i=iValidTime-(0x220f+1210-0x2623);ptTimeStamp->month=(UINT8)
+zUfiSms_TsIntToBcd((UINT8)(i/(0x1589+724-0x183f)));ptTimeStamp->day=(UINT8)
+zUfiSms_TsIntToBcd((UINT8)(i%(0x290+5020-0x160e)));}else{i=(iValidTime-
+(0x3ca+3408-0x105a))*(0x1947+1733-0x2005);ptTimeStamp->year=(UINT8)
+zUfiSms_TsIntToBcd((UINT8)(i/(0x78b+2380-0xf6a)));ptTimeStamp->month=(UINT8)
+zUfiSms_TsIntToBcd((UINT8)((i%(0x62a+2134-0xd13))/(0x739+7600-0x24cb)));
+ptTimeStamp->day=(UINT8)zUfiSms_TsIntToBcd((UINT8)((i%(0x893+5710-0x1d74))%
+(0x444+5008-0x17b6)));}}else{printf(
 "\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"
 );}}int zUfiSms_CharToInt(char*pCharArray,int iLen,unsigned char*pIntArray){int 
-i=(0xebf+2017-0x16a0);if(pIntArray==NULL||pCharArray==NULL){return ZUFI_FAIL;}
-for(i=(0x2230+444-0x23ec);i<iLen;i++){pIntArray[i]=pCharArray[i]-
-((char)(0x968+2166-0x11ae));}return ZUFI_SUCC;}void zUfiSms_FillGlobalTpudGsm7(
+i=(0x958+5303-0x1e0f);if(pIntArray==NULL||pCharArray==NULL){return ZUFI_FAIL;}
+for(i=(0x17d+1838-0x8ab);i<iLen;i++){pIntArray[i]=pCharArray[i]-
+((char)(0x6b1+2474-0x102b));}return ZUFI_SUCC;}void zUfiSms_FillGlobalTpudGsm7(
 T_zUfiSms_SubmitTpdu*ptSubmit,T_zUfiSms_ConcatInfo*ptConcatSms,
-T_zUfiSms_DbStoreData*ptDbSaveData){int i=(0xb52+6116-0x2336);if(ptConcatSms->
-total_msg>(0x1db+2572-0xbe6)){g_zUfiSms_SendingSms.TP_UDHI=(0x3e1+5026-0x1782);
-g_zUfiSms_SendingSms.TP_UD[(0x447+2538-0xe31)]=(0x27+5887-0x1721);
-g_zUfiSms_SendingSms.TP_UD[(0x117+388-0x29a)]=(0x668+2337-0xf84);
-g_zUfiSms_SendingSms.TP_UD[(0x12e6+2048-0x1ae4)]=(0x337+7645-0x2111);
-g_zUfiSms_SendingSms.TP_UD[(0x252+1112-0x6a7)]=(char)ptDbSaveData->concat_info[
-(0x865+1358-0xdb3)]%(0x123f+1019-0x153b);g_zUfiSms_SendingSms.TP_UD[
-(0x1ed2+1181-0x236b)]=(char)ptConcatSms->total_msg;g_zUfiSms_SendingSms.TP_UD[
-(0x10a+7432-0x1e0d)]=(char)ptConcatSms->current_sending+(0x86c+1498-0xe45);
-g_zUfiSms_SendingSms.TP_UD[(0xc18+6708-0x2646)]=(0x5c5+4990-0x193d);for(i=
-(0x17c6+920-0x1b5e);i<ptSubmit->user_data.sm_len;i++){g_zUfiSms_SendingSms.TP_UD
-[i+(0x1013+924-0x13a8)]=ptSubmit->user_data.sm_data[i];}g_zUfiSms_SendingSms.
-TP_UDLength=ptSubmit->user_data.sm_len+(0x17c+8238-0x21a3);}else{for(i=
-(0x1380+1859-0x1ac3);i<ptSubmit->user_data.sm_len;i++){g_zUfiSms_SendingSms.
-TP_UD[i]=ptSubmit->user_data.sm_data[i];}g_zUfiSms_SendingSms.TP_UDLength=
-ptSubmit->user_data.sm_len;}}void zUfiSms_FillGlobalTpudUcs2(
-T_zUfiSms_SubmitTpdu*ptSubmit,T_zUfiSms_ConcatInfo*ptConcatSms,
-T_zUfiSms_DbStoreData*ptDbSaveData){if(ptConcatSms->total_msg>
-(0x57b+4232-0x1602)){g_zUfiSms_SendingSms.TP_UDHI=(0xbb3+98-0xc14);
-g_zUfiSms_SendingSms.TP_UD[(0xc6+1553-0x6d7)]=(0x1032+792-0x1345);
-g_zUfiSms_SendingSms.TP_UD[(0xa3+2810-0xb9c)]=(0x1744+75-0x178a);
-g_zUfiSms_SendingSms.TP_UD[(0x11e8+425-0x138f)]=(0xdda+3295-0x1ab6);
-g_zUfiSms_SendingSms.TP_UD[(0x129+2563-0xb29)]=(char)ptDbSaveData->concat_info[
-(0x220+4394-0x134a)]%(0x1882+3331-0x2486);g_zUfiSms_SendingSms.TP_UD[
-(0xcf0+4733-0x1f69)]=(char)ptConcatSms->total_msg;g_zUfiSms_SendingSms.TP_UD[
-(0x37a+582-0x5bb)]=(char)ptConcatSms->current_sending+(0x1342+1764-0x1a25);(void
-)Bytes2String(ptSubmit->user_data.sm_data,&g_zUfiSms_SendingSms.TP_UD[
-(0x6b+6813-0x1b02)],ptSubmit->user_data.sm_len);}else{(void)Bytes2String(
-ptSubmit->user_data.sm_data,g_zUfiSms_SendingSms.TP_UD,ptSubmit->user_data.
-sm_len);}}unsigned char zUfiSms_Low2High(unsigned char x){if(x>=
-((char)(0x25a4+395-0x26ce))&&x<((char)(0x1173+261-0x1211))){x=(x-
-((char)(0x77d+6868-0x21f0)))+((char)(0xc81+6295-0x24d7));}return x;}unsigned 
-char zUfiSms_Char2Dec(unsigned char x){unsigned char d=(0xb98+4435-0x1ceb);if(x
->=((char)(0x1e5+3057-0xd95))&&x<((char)(0x172c+450-0x18a7))){d=(x-
-((char)(0x872+7494-0x2577)))+(0xb1d+389-0xc98);}else{d=x-
-((char)(0x9a5+4366-0x1a83));}return d;}unsigned char zUfiSms_Char2Byte(unsigned 
-char a,unsigned char b){unsigned char data=(0x1259+1706-0x1903);unsigned char l=
-(0xded+723-0x10c0),h=(0x11cf+3806-0x20ad);a=zUfiSms_Low2High(a);b=
+T_zUfiSms_DbStoreData*ptDbSaveData){int i=(0x109d+1633-0x16fe);if(ptConcatSms->
+total_msg>(0x132f+4052-0x2302)){g_zUfiSms_SendingSms.TP_UDHI=(0x19ad+271-0x1abb)
+;g_zUfiSms_SendingSms.TP_UD[(0x1079+331-0x11c4)]=(0x8cc+2486-0x127d);
+g_zUfiSms_SendingSms.TP_UD[(0x10b6+3530-0x1e7f)]=(0x10a2+2794-0x1b87);
+g_zUfiSms_SendingSms.TP_UD[(0x97+6481-0x19e6)]=(0x168c+409-0x1822);
+g_zUfiSms_SendingSms.TP_UD[(0x2c8+8410-0x239f)]=(char)ptDbSaveData->concat_info[
+(0x318+31-0x337)]%(0x1067+2951-0x1aef);g_zUfiSms_SendingSms.TP_UD[
+(0x1711+3776-0x25cd)]=(char)ptConcatSms->total_msg;g_zUfiSms_SendingSms.TP_UD[
+(0x14f+865-0x4ab)]=(char)ptConcatSms->current_sending+(0x1825+1804-0x1f30);
+g_zUfiSms_SendingSms.TP_UD[(0x1dc8+402-0x1f54)]=(0x446+7144-0x2028);for(i=
+(0x1735+961-0x1af6);i<ptSubmit->user_data.sm_len;i++){g_zUfiSms_SendingSms.TP_UD
+[i+(0x1a8+6181-0x19c6)]=ptSubmit->user_data.sm_data[i];}g_zUfiSms_SendingSms.
+TP_UDLength=ptSubmit->user_data.sm_len+(0x379+4145-0x13a3);}else{for(i=
+(0x1beb+801-0x1f0c);i<ptSubmit->user_data.sm_len;i++){g_zUfiSms_SendingSms.TP_UD
+[i]=ptSubmit->user_data.sm_data[i];}g_zUfiSms_SendingSms.TP_UDLength=ptSubmit->
+user_data.sm_len;}}void zUfiSms_FillGlobalTpudUcs2(T_zUfiSms_SubmitTpdu*ptSubmit
+,T_zUfiSms_ConcatInfo*ptConcatSms,T_zUfiSms_DbStoreData*ptDbSaveData){if(
+ptConcatSms->total_msg>(0x837+2784-0x1316)){g_zUfiSms_SendingSms.TP_UDHI=
+(0x319+5096-0x1700);g_zUfiSms_SendingSms.TP_UD[(0x5ad+6495-0x1f0c)]=
+(0x1973+1961-0x2117);g_zUfiSms_SendingSms.TP_UD[(0x12b6+2064-0x1ac5)]=
+(0x2114+705-0x23d0);g_zUfiSms_SendingSms.TP_UD[(0x139c+958-0x1758)]=
+(0x1317+2054-0x1b1a);g_zUfiSms_SendingSms.TP_UD[(0x1dbc+2089-0x25e2)]=(char)
+ptDbSaveData->concat_info[(0x669+5570-0x1c2b)]%(0xa7d+6100-0x2152);
+g_zUfiSms_SendingSms.TP_UD[(0x1438+4191-0x2493)]=(char)ptConcatSms->total_msg;
+g_zUfiSms_SendingSms.TP_UD[(0x11c0+2450-0x1b4d)]=(char)ptConcatSms->
+current_sending+(0x971+253-0xa6d);(void)Bytes2String(ptSubmit->user_data.sm_data
+,&g_zUfiSms_SendingSms.TP_UD[(0x103a+1822-0x1752)],ptSubmit->user_data.sm_len);}
+else{(void)Bytes2String(ptSubmit->user_data.sm_data,g_zUfiSms_SendingSms.TP_UD,
+ptSubmit->user_data.sm_len);}}unsigned char zUfiSms_Low2High(unsigned char x){if
+(x>=((char)(0x15db+4154-0x25b4))&&x<((char)(0x290+3148-0xe75))){x=(x-
+((char)(0x400+365-0x50c)))+((char)(0xb0c+5756-0x2147));}return x;}unsigned char 
+zUfiSms_Char2Dec(unsigned char x){unsigned char d=(0x6a9+6422-0x1fbf);if(x>=
+((char)(0x1c39+2765-0x26c5))&&x<((char)(0xa68+4688-0x1c71))){d=(x-
+((char)(0xcec+3398-0x19f1)))+(0x55c+550-0x778);}else{d=x-
+((char)(0x492+1370-0x9bc));}return d;}unsigned char zUfiSms_Char2Byte(unsigned 
+char a,unsigned char b){unsigned char data=(0x2a7+8438-0x239d);unsigned char l=
+(0xa62+1669-0x10e7),h=(0x17f7+2480-0x21a7);a=zUfiSms_Low2High(a);b=
 zUfiSms_Low2High(b);h=zUfiSms_Char2Dec(a);l=zUfiSms_Char2Dec(b);data=h*
-(0xe00+1849-0x1529)+l;return data;}void zUfiSms_Str2Bytes(unsigned char*text,int
- text_len,unsigned char*data,int data_len){int i=(0x988+2591-0x13a7);while(
-(0x5c8+3732-0x145a)*i+(0x2387+643-0x2609)<text_len){data[i]=zUfiSms_Char2Byte(
-text[(0x12c+547-0x34d)*i],text[(0x176+6677-0x1b89)*i+(0xd32+6422-0x2647)]);i++;}
-}int zUfiSms_SplitString(char*input,char***output,char cMatchChar){int src=
-(0x1745+503-0x193c);int dst=(0x3c+3400-0xd84);int count=(0x155d+699-0x1818);int 
-size=(0x1964+1990-0x2122);char quoted=(0x202c+916-0x23c0);char**tmpout=NULL;*
+(0x25c0+71-0x25f7)+l;return data;}void zUfiSms_Str2Bytes(unsigned char*text,int 
+text_len,unsigned char*data,int data_len){int i=(0x1a36+2644-0x248a);while(
+(0x15b+4532-0x130d)*i+(0x686+4728-0x18fd)<text_len){data[i]=zUfiSms_Char2Byte(
+text[(0x1016+4181-0x2069)*i],text[(0x12dd+2606-0x1d09)*i+(0xa77+657-0xd07)]);i++
+;}}int zUfiSms_SplitString(char*input,char***output,char cMatchChar){int src=
+(0x1c63+1385-0x21cc);int dst=(0x7c+2831-0xb8b);int count=(0x2098+707-0x235b);int
+ size=(0x2ea+7990-0x2218);char quoted=(0x179+6935-0x1c90);char**tmpout=NULL;*
 output=(char**)malloc(sizeof(char*)*size);if(NULL==*output){return-
-(0x9d2+5622-0x1fc7);}(*output)[count++]=input;for(src=dst=(0xeb7+2786-0x1999);
+(0x9ef+1575-0x1015);}(*output)[count++]=input;for(src=dst=(0x8b0+314-0x9ea);
 input[src];){char cInputChar=input[src];if(!quoted&&cInputChar==cMatchChar){
-input[dst++]=(0x460+6312-0x1d08);while(input[++src]&&(int)isspace(input[src])){}
-;if(count>=size){size+=(0x528+6234-0x1d72);tmpout=(char**)realloc(*output,sizeof
-(char*)*size);if(NULL==tmpout){return-(0x6ba+2497-0x107a);}*output=tmpout;}(*
+input[dst++]=(0x35b+6295-0x1bf2);while(input[++src]&&(int)isspace(input[src])){}
+;if(count>=size){size+=(0xc37+761-0xf20);tmpout=(char**)realloc(*output,sizeof(
+char*)*size);if(NULL==tmpout){return-(0x1fd1+1056-0x23f0);}*output=tmpout;}(*
 output)[count++]=input+dst;}else if(!quoted&&(cInputChar=='\''||cInputChar==
-((char)(0x21a8+93-0x21e3)))){quoted=cInputChar;src++;}else if(cInputChar==quoted
-){quoted=(0x17d+1887-0x8dc);src++;}else{if(cInputChar=='\\'&&quoted!='\''){src++
-;cInputChar=input[src];if(!cInputChar){free(*output);*output=NULL;return-
-(0x1395+2708-0x1e28);}}input[dst++]=cInputChar;src++;}}input[dst]=
-(0xf85+842-0x12cf);if(quoted){free(*output);*output=NULL;return-
-(0xff+5404-0x161a);}return count;}int zUfiSms_atohex(char c){int result=
-(0x1164+5217-0x25c5);if(c>=((char)(0x1750+2893-0x226d))&&c<=
-((char)(0xf52+5563-0x24d4))){result=c-((char)(0xae3+2030-0x12a1));}else if(c>=
-((char)(0xa6c+6460-0x2347))&&c<=((char)(0x906+607-0xaff))){result=(c-
-((char)(0x6d3+3201-0x12f3)))+(0x10d2+4048-0x2098);}else if(c>=
-((char)(0x1d9+850-0x4ea))&&c<=((char)(0x11e9+2785-0x1c84))){result=(c-
-((char)(0x274+5801-0x18dc)))+(0x1c0f+2613-0x263a);}else{at_print(LOG_DEBUG,
+((char)(0xe8a+4021-0x1e1d)))){quoted=cInputChar;src++;}else if(cInputChar==
+quoted){quoted=(0xaf+9046-0x2405);src++;}else{if(cInputChar=='\\'&&quoted!='\'')
+{src++;cInputChar=input[src];if(!cInputChar){free(*output);*output=NULL;return-
+(0xfb6+928-0x1355);}}input[dst++]=cInputChar;src++;}}input[dst]=
+(0x6e8+1131-0xb53);if(quoted){free(*output);*output=NULL;return-
+(0x861+5731-0x1ec3);}return count;}int zUfiSms_atohex(char c){int result=
+(0x1e87+642-0x2109);if(c>=((char)(0x157f+640-0x17cf))&&c<=
+((char)(0x128+4343-0x11e6))){result=c-((char)(0xa8b+5450-0x1fa5));}else if(c>=
+((char)(0x11b1+2145-0x19b1))&&c<=((char)(0x268+3027-0xdd5))){result=(c-
+((char)(0x4af+1968-0xbfe)))+(0xdba+2652-0x180c);}else if(c>=
+((char)(0x18ab+1709-0x1f17))&&c<=((char)(0x8cc+973-0xc53))){result=(c-
+((char)(0x10f7+5353-0x259f)))+(0xcbc+3430-0x1a18);}else{at_print(LOG_DEBUG,
 "\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"
 ,c);return result;}return result;}int zUfiSms_DispatchWtoi(unsigned char*in_ptr,
-int iLength,unsigned char*out_ptr){int low=(0xc8a+3886-0x1bb8);int high=
-(0x310+3033-0xee9);if(in_ptr==NULL||out_ptr==NULL){printf(
+int iLength,unsigned char*out_ptr){int low=(0xf8+6390-0x19ee);int high=
+(0x10bf+179-0x1172);if(in_ptr==NULL||out_ptr==NULL){printf(
 "\x73\x6d\x73\x3a\x69\x6e\x76\x61\x69\x6c\x64\x20\x70\x61\x72\x61\x6d\x65\x74\x65\x72" "\n"
-);return ZUFI_FAIL;}while(iLength>(0x87+2675-0xafa)){low=in_ptr[iLength-
-(0x159a+3966-0x2517)]&(0xad3+2197-0x1359);high=(in_ptr[iLength-(0x97d+563-0xbaf)
-]&(0x18d9+2387-0x213c))>>(0x12da+2844-0x1df2);out_ptr[(0x676+3361-0x1395)*
-iLength-(0x251+722-0x522)]=g_zUfiSms_DigAscMap[low];out_ptr[(0x5a6+212-0x678)*
-iLength-(0x20eb+494-0x22d7)]=g_zUfiSms_DigAscMap[high];iLength--;}return 
-ZUFI_SUCC;}unsigned int zte_wms_convert_PORTUGUESE_To_UCS2(const unsigned char*
-gsmdef,unsigned char*ucs2,unsigned int len){unsigned int i=(0x44d+5861-0x1b32);
-unsigned int j=(0x412+3049-0xffb);unsigned int k=(0xf1a+2459-0x18b5);unsigned 
-int p=(0x459+3219-0x10ec);unsigned int s=(0x6bc+4398-0x17ea);s=sizeof(
+);return ZUFI_FAIL;}while(iLength>(0x821+5747-0x1e94)){low=in_ptr[iLength-
+(0x113+9575-0x2679)]&(0x1d48+2332-0x2655);high=(in_ptr[iLength-
+(0xb66+3043-0x1748)]&(0x379+7357-0x1f46))>>(0x2032+420-0x21d2);out_ptr[
+(0x83c+2658-0x129c)*iLength-(0x250+8440-0x2347)]=g_zUfiSms_DigAscMap[low];
+out_ptr[(0xaf6+5466-0x204e)*iLength-(0xf3b+4546-0x20fb)]=g_zUfiSms_DigAscMap[
+high];iLength--;}return ZUFI_SUCC;}unsigned int 
+zte_wms_convert_PORTUGUESE_To_UCS2(const unsigned char*gsmdef,unsigned char*ucs2
+,unsigned int len){unsigned int i=(0x19e4+1409-0x1f65);unsigned int j=
+(0x3d1+3681-0x1232);unsigned int k=(0x114b+359-0x12b2);unsigned int p=
+(0xf22+3615-0x1d41);unsigned int s=(0x23e0+87-0x2437);s=sizeof(
 zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex)/sizeof(
-zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[(0x90b+6357-0x21e0)]);for(i=
-(0x127a+2906-0x1dd4);i<len;i++){j=gsmdef[i];if(j==(0x5dd+3907-0x1505)){i++;for(p
-=(0x1567+1679-0x1bf6);p<s;p++){if(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[p][
-(0x378+8278-0x23ce)]==gsmdef[i]){ucs2[k]=
-zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[p][(0x7c9+6041-0x1f61)]>>
-(0x50b+8003-0x2446);k++;ucs2[k]=(unsigned char)(
-zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[p][(0x16b8+1755-0x1d92)]);break;}}}else
-{ucs2[k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]>>(0xf1b+5680-0x2543);k++;ucs2[
-k]=(unsigned char)(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]);}k++;}ucs2[k]='\0';
+zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[(0x2b+476-0x207)]);for(i=
+(0x12b6+2844-0x1dd2);i<len;i++){j=gsmdef[i];if(j==(0x69d+1935-0xe11)){i++;for(p=
+(0x391+7191-0x1fa8);p<s;p++){if(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[p][
+(0x1f20+45-0x1f4d)]==gsmdef[i]){ucs2[k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex
+[p][(0xaaa+5375-0x1fa8)]>>(0x127c+157-0x1311);k++;ucs2[k]=(unsigned char)(
+zte_sms_GSM7_PORTUGUESE_To_UCS2_Table_Ex[p][(0x1713+3405-0x245f)]);break;}}}else
+{ucs2[k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]>>(0x237+1747-0x902);k++;ucs2[k
+]=(unsigned char)(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]);}k++;}ucs2[k]='\0';
 return k;}unsigned int zte_wms_convert_PORTUGUESE_To_UCS2_USE_GSM7_SS_PORTU_LS(
 const unsigned char*gsmdef,unsigned char*ucs2,unsigned int len){unsigned int i=
-(0xb4+3597-0xec1);unsigned int j=(0xa69+7223-0x26a0);unsigned int k=
-(0x51b+4321-0x15fc);unsigned int p=(0x29d+3883-0x11c8);unsigned int s=
-(0x1178+1329-0x16a9);s=sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex)/sizeof(
-zte_sms_GSMDefault_To_UCS2_Table_Ex[(0x23b+8213-0x2250)]);for(i=
-(0x1745+3767-0x25fc);i<len;i++){j=gsmdef[i];if(j==(0x8b1+2499-0x1259)){i++;for(p
-=(0x626+2731-0x10d1);p<s;p++){if(zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
-(0x1187+4082-0x2179)]==gsmdef[i]){ucs2[k]=zte_sms_GSMDefault_To_UCS2_Table_Ex[p]
-[(0x7ed+4350-0x18ea)]>>(0xc12+4138-0x1c34);k++;ucs2[k]=(unsigned char)(
-zte_sms_GSMDefault_To_UCS2_Table_Ex[p][(0x202+7153-0x1df2)]);break;}}}else{ucs2[
-k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]>>(0x301+3522-0x10bb);k++;ucs2[k]=(
+(0x98+5768-0x1720);unsigned int j=(0x3cf+8158-0x23ad);unsigned int k=
+(0x13bc+4308-0x2490);unsigned int p=(0xb1+4804-0x1375);unsigned int s=
+(0x11dc+5424-0x270c);s=sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex)/sizeof(
+zte_sms_GSMDefault_To_UCS2_Table_Ex[(0xb9c+3628-0x19c8)]);for(i=
+(0x506+7401-0x21ef);i<len;i++){j=gsmdef[i];if(j==(0x101a+5583-0x25ce)){i++;for(p
+=(0x1653+542-0x1871);p<s;p++){if(zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
+(0x8f4+2156-0x1160)]==gsmdef[i]){ucs2[k]=zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
+(0xfa4+2645-0x19f8)]>>(0x1081+4751-0x2308);k++;ucs2[k]=(unsigned char)(
+zte_sms_GSMDefault_To_UCS2_Table_Ex[p][(0xb6c+4554-0x1d35)]);break;}}}else{ucs2[
+k]=zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]>>(0x1cf6+1145-0x2167);k++;ucs2[k]=(
 unsigned char)(zte_sms_GSM7_PORTUGUESE_To_UCS2_Table[j]);}k++;}ucs2[k]='\0';
 return k;}unsigned long zte_wms_convert_GSMDefault_to_UCS2(const unsigned char*
-gsmdef,unsigned char*ucs2,unsigned long len){unsigned long i=(0x92c+5051-0x1ce7)
-;unsigned long j=(0xf4b+2095-0x177a);unsigned long k=(0xf4d+1182-0x13eb);
-unsigned long p=(0x4bd+2448-0xe4d);unsigned long s=(0x1148+4349-0x2245);unsigned
- long is_find=(0x8da+728-0xbb2);s=sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex)/
-sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex[(0x1c28+604-0x1e84)]);for(i=
-(0x184f+2986-0x23f9);i<len;i++){j=gsmdef[i];if(j==(0xc42+419-0xdca)){i++;for(p=
-(0xe80+2417-0x17f1);p<s;p++){if(zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
-(0x1c85+2223-0x2534)]==gsmdef[i]){ucs2[k]=zte_sms_GSMDefault_To_UCS2_Table_Ex[p]
-[(0x772+7077-0x2316)]>>(0xbaa+2925-0x170f);k++;ucs2[k]=(unsigned char)(
-zte_sms_GSMDefault_To_UCS2_Table_Ex[p][(0xcd6+3023-0x18a4)]);is_find=
-(0x7cc+3437-0x1538);break;}}if(!is_find){at_print(LOG_DEBUG,
+gsmdef,unsigned char*ucs2,unsigned long len){unsigned long i=
+(0x152a+1030-0x1930);unsigned long j=(0x234f+186-0x2409);unsigned long k=
+(0x24d+9031-0x2594);unsigned long p=(0xb05+2038-0x12fb);unsigned long s=
+(0x14f4+3183-0x2163);unsigned long is_find=(0x2498+73-0x24e1);s=sizeof(
+zte_sms_GSMDefault_To_UCS2_Table_Ex)/sizeof(zte_sms_GSMDefault_To_UCS2_Table_Ex[
+(0x684+6822-0x212a)]);for(i=(0xc3d+654-0xecb);i<len;i++){j=gsmdef[i];if(j==
+(0x91+8451-0x2179)){i++;for(p=(0x1200+1470-0x17be);p<s;p++){if(
+zte_sms_GSMDefault_To_UCS2_Table_Ex[p][(0xc9b+4908-0x1fc7)]==gsmdef[i]){ucs2[k]=
+zte_sms_GSMDefault_To_UCS2_Table_Ex[p][(0x6c9+4318-0x17a6)]>>(0x1cfb+981-0x20c8)
+;k++;ucs2[k]=(unsigned char)(zte_sms_GSMDefault_To_UCS2_Table_Ex[p][
+(0x195f+1731-0x2021)]);is_find=(0x1a6c+240-0x1b5b);break;}}if(!is_find){at_print
+(LOG_DEBUG,
 "\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"
-,gsmdef[i]);i--;ucs2[k]=zte_sms_GSMDefault_To_UCS2_Table[j]>>(0xcdc+965-0x1099);
-k++;ucs2[k]=(unsigned char)(zte_sms_GSMDefault_To_UCS2_Table[j]);}}else{ucs2[k]=
-zte_sms_GSMDefault_To_UCS2_Table[j]>>(0x16e2+202-0x17a4);k++;ucs2[k]=(unsigned 
+,gsmdef[i]);i--;ucs2[k]=zte_sms_GSMDefault_To_UCS2_Table[j]>>(0x135a+699-0x160d)
+;k++;ucs2[k]=(unsigned char)(zte_sms_GSMDefault_To_UCS2_Table[j]);}}else{ucs2[k]
+=zte_sms_GSMDefault_To_UCS2_Table[j]>>(0x69c+220-0x770);k++;ucs2[k]=(unsigned 
 char)(zte_sms_GSMDefault_To_UCS2_Table[j]);}k++;}ucs2[k]='\0';return k;}void 
 zUfiSms_ConvertUcs2(char*data,UINT16 sms_len,char*out_content){char 
-ascii_content[(0x66+6002-0x17d6)*ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX+
-(0x6b0+6480-0x1fff)]={(0xe4d+1816-0x1565)};UINT16 len=(0x1b4d+58-0x1b87);switch(
-g_zUfiSms_Language){case DCS_PORTUGUESE:if(g_zUfiSms_IsLanguageShift==
+ascii_content[(0x8f6+4605-0x1af1)*ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX+
+(0xd32+5012-0x20c5)]={(0x110a+981-0x14df)};UINT16 len=(0xc1a+3592-0x1a22);switch
+(g_zUfiSms_Language){case DCS_PORTUGUESE:if(g_zUfiSms_IsLanguageShift==
 WMS_UDH_NAT_LANG_SS){len=zte_wms_convert_PORTUGUESE_To_UCS2((const UINT8*)data,(
 UINT8*)ascii_content,sms_len);}else if(g_zUfiSms_IsLanguageShift==
 WMS_UDH_NAT_LANG_LS){len=zte_wms_convert_PORTUGUESE_To_UCS2_USE_GSM7_SS_PORTU_LS
@@ -671,75 +670,76 @@
 sms_len);break;}(void)zUfiSms_DispatchWtoi((char*)ascii_content,len,(char*)
 out_content);}boolean zUfiSms_DecodeContent(char*msg_content,UINT16 sms_len,
 boolean isEsc,char*out_content){boolean endEsc=FALSE;char*p=NULL;static char 
-data[(0x16d8+1306-0x1bf1)+(0x12ef+1733-0x1914)+(0x1ec+2019-0x9ce)]={
-(0x187a+2807-0x2371)};int len=(0x1090+4438-0x21e6);if(msg_content==NULL||
-out_content==NULL||sms_len>(0x413+3069-0xed0)||sms_len<(0x151+1393-0x6c0)){
-return endEsc;}len=sms_len;memset(data,(0x1f9d+1792-0x269d),(0xa64+2130-0x1214))
-;p=data;if(isEsc){*p=(0x332+7362-0x1fd9);p++;}zUfiSms_Str2Bytes((unsigned char*)
-msg_content,len,(unsigned char*)p,(0x2148+127-0x2127));if(p[len/
-(0xd6b+2919-0x18d0)-(0xe6+5350-0x15cb)]==(0x8b5+6602-0x2264)){endEsc=TRUE;}
-zUfiSms_ConvertUcs2(data,len/(0x775+6461-0x20b0)+(isEsc?(0x1895+2947-0x2417):
-(0xe92+1387-0x13fd))-(endEsc?(0x133f+1336-0x1876):(0x6c6+1279-0xbc5)),
-out_content);return endEsc;}byte*zUfiSms_SmsiUtilitoa(uint32 v,byte*s,UINT16 r){
-byte buf[(0xa2d+5050-0x1dc6)],c;int n;n=sizeof(buf)-(0x73b+3140-0x137e);buf[n]=
-'\0';do{c=(byte)(v%r);if(n<=(0xb48+2512-0x1518)){printf(
+data[(0x698+2868-0x11cb)+(0x156+6257-0x1927)+(0x1303+795-0x161d)]={
+(0x1188+2273-0x1a69)};int len=(0x1421+4592-0x2611);if(msg_content==NULL||
+out_content==NULL||sms_len>(0x22e7+142-0x2235)||sms_len<(0x1801+1562-0x1e19)){
+return endEsc;}len=sms_len;memset(data,(0x189f+2909-0x23fc),(0x20d1+437-0x21e4))
+;p=data;if(isEsc){*p=(0x17e4+785-0x1ada);p++;}zUfiSms_Str2Bytes((unsigned char*)
+msg_content,len,(unsigned char*)p,(0x1110+1079-0x14a7));if(p[len/
+(0x28d+6388-0x1b7f)-(0x10e7+5470-0x2644)]==(0xc41+2859-0x1751)){endEsc=TRUE;}
+zUfiSms_ConvertUcs2(data,len/(0x1563+2384-0x1eb1)+(isEsc?(0x44b+7939-0x234d):
+(0x36+5165-0x1463))-(endEsc?(0x67a+505-0x872):(0x1a04+922-0x1d9e)),out_content);
+return endEsc;}byte*zUfiSms_SmsiUtilitoa(uint32 v,byte*s,UINT16 r){byte buf[
+(0xae0+6779-0x253a)],c;int n;n=sizeof(buf)-(0x6c2+945-0xa72);buf[n]='\0';do{c=(
+byte)(v%r);if(n<=(0xcb3+6367-0x2592)){printf(
 "\x4f\x56\x45\x52\x46\x4c\x4f\x57\x20");break;}buf[--n]=(byte)((c>
-(0x37c+9021-0x26b0))?c+((char)(0x64d+1015-0xa03))-(0xda9+1905-0x1510):c+
-((char)(0x14b4+1362-0x19d6)));}while((v/=r)>(0x1aa8+370-0x1c1a));while((*s++=buf
-[n++])!=(0x1441+3785-0x230a));return(s-(0x248+1996-0xa13));}byte*
+(0x4bf+6094-0x1c84))?c+((char)(0x222+5903-0x18f0))-(0x45c+913-0x7e3):c+
+((char)(0x1a1c+2772-0x24c0)));}while((v/=r)>(0xfa1+4182-0x1ff7));while((*s++=buf
+[n++])!=(0x6cb+2686-0x1149));return(s-(0x48f+2391-0xde5));}byte*
 zUfiSms_SmsiAddrToStr(wms_address_s_type addr,byte*res_ptr,UINT8*type_of_addr){
-byte bcd_idx=(0x3ca+7126-0x1fa0);UINT8 temp=(0x1100+3344-0x1e10);*type_of_addr=
-(0xda2+4940-0x20ee);temp=(UINT8)((uint32)addr.number_type&(0xe3+3056-0xccc));*
-type_of_addr=(UINT8)((*type_of_addr|temp)<<(0x2120+1103-0x256b));temp=(UINT8)((
-uint32)addr.number_plan&(0x334+8149-0x2302));*type_of_addr=*type_of_addr|temp;*
-type_of_addr=*type_of_addr|(0x1b91+1629-0x216e);while(bcd_idx<addr.
-number_of_digits){if(addr.digits[bcd_idx]==(0x1b0+1296-0x6b6)){addr.digits[
-bcd_idx]=(0x15e1+1917-0x1d5e);}res_ptr=zUfiSms_SmsiUtilitoa((uint32)addr.digits[
-bcd_idx],res_ptr,(0xb76+2144-0x13c6));bcd_idx++;}return res_ptr;}byte*
+byte bcd_idx=(0x68b+3516-0x1447);UINT8 temp=(0x1c41+2119-0x2488);*type_of_addr=
+(0x2305+937-0x26ae);temp=(UINT8)((uint32)addr.number_type&(0x1b6a+1120-0x1fc3));
+*type_of_addr=(UINT8)((*type_of_addr|temp)<<(0x5c0+7294-0x223a));temp=(UINT8)((
+uint32)addr.number_plan&(0x14a+144-0x1d3));*type_of_addr=*type_of_addr|temp;*
+type_of_addr=*type_of_addr|(0x1107+5733-0x26ec);while(bcd_idx<addr.
+number_of_digits){if(addr.digits[bcd_idx]==(0x54a+8565-0x26b5)){addr.digits[
+bcd_idx]=(0x7c6+7575-0x255d);}res_ptr=zUfiSms_SmsiUtilitoa((uint32)addr.digits[
+bcd_idx],res_ptr,(0xf9b+4126-0x1fa9));bcd_idx++;}return res_ptr;}byte*
 zUfiSms_SmsiUtilitoaFill(word v,byte*rb_ptr){int n;byte c,*ptr;ptr=rb_ptr+
-(0x1755+212-0x1827);*ptr='\0';for(n=(0x269+3994-0x1203);n<(0x6e4+2313-0xfeb);++n
-){c=(byte)(v%(0x31+2771-0xafa));v/=(0x1b77+1869-0x22ba);*--ptr=(c+
-((char)(0x85d+396-0x9b9)));}return rb_ptr+(0x232+7244-0x1e7c);}void 
-zUfiSms_SprintfTime(char*str_time,int len,int t){if(t<(0x314+3131-0xf45)){
+(0x3ac+314-0x4e4);*ptr='\0';for(n=(0x668+448-0x828);n<(0xbf1+1677-0x127c);++n){c
+=(byte)(v%(0x4b+4999-0x13c8));v/=(0xe15+3029-0x19e0);*--ptr=(c+
+((char)(0xa38+1102-0xe56)));}return rb_ptr+(0x1709+3856-0x2617);}void 
+zUfiSms_SprintfTime(char*str_time,int len,int t){if(t<(0x11d0+2470-0x1b6c)){
 snprintf(str_time,len,"\x30\x25\x78",t);}else{snprintf(str_time,len,"\x25\x78",t
 );}}static void zUfiSms_ParseDeliverConcat8(T_zUfiSms_UdhConcat8*concat_8,
-T_zUfiSms_DbStoreData*db_data){int mux=(0x2c5+7730-0x20f7);concat_8->seq_num--;
+T_zUfiSms_DbStoreData*db_data){int mux=(0x1c16+598-0x1e6c);concat_8->seq_num--;
 if(concat_8->total_sm>ZTE_WMS_CONCAT_SMS_COUNT_MAX){mux=(concat_8->seq_num-
 concat_8->seq_num%ZTE_WMS_CONCAT_SMS_COUNT_MAX)/ZTE_WMS_CONCAT_SMS_COUNT_MAX;}
-db_data->concat_sms=(0x2bc+5018-0x1655);db_data->concat_info[
-(0x1601+3010-0x21c3)]=(0x598+2020-0xc7d)*mux+concat_8->msg_ref;db_data->
-concat_info[(0xaeb+6429-0x2406)]=concat_8->seq_num%ZTE_WMS_CONCAT_SMS_COUNT_MAX+
-(0x67+3133-0xca3);db_data->concat_info[(0x17b9+2012-0x1f94)]=concat_8->total_sm-
-ZTE_WMS_CONCAT_SMS_COUNT_MAX*mux>ZTE_WMS_CONCAT_SMS_COUNT_MAX-(0x703+1198-0xbb0)
-?ZTE_WMS_CONCAT_SMS_COUNT_MAX:(concat_8->total_sm%ZTE_WMS_CONCAT_SMS_COUNT_MAX);
-}static void zUfiSms_ParserLangSs(wms_udh_s_type*user_data_header){if(
-user_data_header==NULL){return;}switch(user_data_header->u.nat_lang_ss.
-nat_lang_id){case WMS_UDH_NAT_LANG_PORTUGUESE:g_zUfiSms_Language=DCS_PORTUGUESE;
-break;default:break;}}static void zUfiSms_ParserLangLs(T_zUfiSms_Udh*
+db_data->concat_sms=(0x2114+755-0x2406);db_data->concat_info[(0x544+6121-0x1d2d)
+]=(0x16b3+2141-0x1e11)*mux+concat_8->msg_ref;db_data->concat_info[
+(0x135c+724-0x162e)]=concat_8->seq_num%ZTE_WMS_CONCAT_SMS_COUNT_MAX+
+(0x767+5005-0x1af3);db_data->concat_info[(0x7e8+2346-0x1111)]=concat_8->total_sm
+-ZTE_WMS_CONCAT_SMS_COUNT_MAX*mux>ZTE_WMS_CONCAT_SMS_COUNT_MAX-
+(0x26c+1611-0x8b6)?ZTE_WMS_CONCAT_SMS_COUNT_MAX:(concat_8->total_sm%
+ZTE_WMS_CONCAT_SMS_COUNT_MAX);}static void zUfiSms_ParserLangSs(wms_udh_s_type*
 user_data_header){if(user_data_header==NULL){return;}switch(user_data_header->u.
 nat_lang_ss.nat_lang_id){case WMS_UDH_NAT_LANG_PORTUGUESE:g_zUfiSms_Language=
-DCS_PORTUGUESE;break;default:break;}}static void zUfiSms_ParseDeliverConcat16(
-T_zUfiSms_UdhConcat16*concat_16,T_zUfiSms_DbStoreData*db_data){int mux=
-(0x12bd+3568-0x20ad);concat_16->seq_num--;db_data->concat_sms=(0x587+763-0x881);
-#if (0x1226+1375-0x1785)

-db_data->concat_info[(0x200+2072-0xa18)]=concat_16->msg_ref;db_data->concat_info
-[(0x3f+8447-0x213d)]=concat_16->total_sm;db_data->concat_info[
-(0x652+7878-0x2516)]=concat_16->seq_num;
+DCS_PORTUGUESE;break;default:break;}}static void zUfiSms_ParserLangLs(
+T_zUfiSms_Udh*user_data_header){if(user_data_header==NULL){return;}switch(
+user_data_header->u.nat_lang_ss.nat_lang_id){case WMS_UDH_NAT_LANG_PORTUGUESE:
+g_zUfiSms_Language=DCS_PORTUGUESE;break;default:break;}}static void 
+zUfiSms_ParseDeliverConcat16(T_zUfiSms_UdhConcat16*concat_16,
+T_zUfiSms_DbStoreData*db_data){int mux=(0xb43+5830-0x2209);concat_16->seq_num--;
+db_data->concat_sms=(0x1f7+4593-0x13e7);
+#if (0xe5d+2937-0x19d6)

+db_data->concat_info[(0x45a+3547-0x1235)]=concat_16->msg_ref;db_data->
+concat_info[(0x1a67+2772-0x253a)]=concat_16->total_sm;db_data->concat_info[
+(0x16e6+722-0x19b6)]=concat_16->seq_num;
 #endif

 if(concat_16->total_sm>ZTE_WMS_CONCAT_SMS_COUNT_MAX){mux=(concat_16->seq_num-
 concat_16->seq_num%ZTE_WMS_CONCAT_SMS_COUNT_MAX)/ZTE_WMS_CONCAT_SMS_COUNT_MAX;}
-db_data->concat_info[(0x101a+5094-0x2400)]=(0xf7a+1806-0x1589)*mux+concat_16->
-msg_ref;db_data->concat_info[(0x5b9+1024-0x9b7)]=concat_16->seq_num%
-ZTE_WMS_CONCAT_SMS_COUNT_MAX+(0x4c9+4791-0x177f);db_data->concat_info[
-(0x42b+3422-0x1188)]=concat_16->total_sm-ZTE_WMS_CONCAT_SMS_COUNT_MAX*mux>
-ZTE_WMS_CONCAT_SMS_COUNT_MAX-(0x213a+245-0x222e)?ZTE_WMS_CONCAT_SMS_COUNT_MAX:(
+db_data->concat_info[(0x331+7569-0x20c2)]=(0xf99+4470-0x2010)*mux+concat_16->
+msg_ref;db_data->concat_info[(0xee2+2273-0x17c1)]=concat_16->seq_num%
+ZTE_WMS_CONCAT_SMS_COUNT_MAX+(0x2f9+8660-0x24cc);db_data->concat_info[
+(0x5a9+5166-0x19d6)]=concat_16->total_sm-ZTE_WMS_CONCAT_SMS_COUNT_MAX*mux>
+ZTE_WMS_CONCAT_SMS_COUNT_MAX-(0x263f+116-0x26b2)?ZTE_WMS_CONCAT_SMS_COUNT_MAX:(
 concat_16->total_sm%ZTE_WMS_CONCAT_SMS_COUNT_MAX);}static int 
 zUfiSms_ParseUdhiData(T_zUfiSms_Udh*user_data_header,T_zUfiSms_DbStoreData*
 db_data){if(NULL==user_data_header||NULL==db_data){printf(
 "\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73\x2e");return ZUFI_FAIL
 ;}switch(user_data_header->header_id){case WMS_UDH_CONCAT_8:db_data->concat_sms=
-(0x148+6285-0x19d4);zUfiSms_ParseDeliverConcat8(&(user_data_header->u.concat_8),
-db_data);break;case WMS_UDH_CONCAT_16:db_data->concat_sms=(0xae3+2935-0x1659);
+(0x14c4+3443-0x2236);zUfiSms_ParseDeliverConcat8(&(user_data_header->u.concat_8)
+,db_data);break;case WMS_UDH_CONCAT_16:db_data->concat_sms=(0x856+919-0xbec);
 zUfiSms_ParseDeliverConcat16(&(user_data_header->u.concat_16),db_data);break;
 case WMS_UDH_NAT_LANG_SS:g_zUfiSms_IsLanguageShift=WMS_UDH_NAT_LANG_SS;
 zUfiSms_ParserLangSs(user_data_header);break;case WMS_UDH_NAT_LANG_LS:
@@ -749,154 +749,154 @@
 );break;}return ZUFI_SUCC;}int zUfiSms_FormatDeliverDbdata(
 T_zUfiSms_ClientTsData*ts_data_ptr,T_zUfiSms_DbStoreData*db_data){int result=
 ZUFI_SUCC;wms_address_s_type*address_ptr=NULL;wms_gw_alphabet_e_type tp_dcs=
-WMS_GW_ALPHABET_MAX32;int i=(0x952+7131-0x252d);int ind=(0x618+7452-0x2334);if((
+WMS_GW_ALPHABET_MAX32;int i=(0x673+2141-0xed0);int ind=(0x14ef+4159-0x252e);if((
 NULL==ts_data_ptr)||(NULL==db_data)){printf(
 "\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73\x2e");return ZUFI_FAIL
 ;}address_ptr=&(ts_data_ptr->u.gw_pp.u.deliver.address);if(
 WMS_NUMBER_INTERNATIONAL==address_ptr->number_type){memset(db_data->number,
-(0x7a3+2186-0x102d),ZTE_WMS_ADDRESS_LEN_MAX+(0x11ba+416-0x1359));db_data->number
-[(0x145f+809-0x1788)]=((char)(0x1e0b+2033-0x25d1));for(i=(0x70a+4921-0x1a43);i<
-address_ptr->number_of_digits;i++){if((0xf1a+1495-0x14e7)==address_ptr->digits[i
-]){db_data->number[i+(0xc86+23-0xc9c)]=((char)(0x7c2+230-0x878));}else{db_data->
-number[i+(0x600+4063-0x15de)]=((char)(0x2271+285-0x235e))+address_ptr->digits[i]
-;}}}else if(WMS_NUMBER_ALPHANUMERIC==address_ptr->number_type){memcpy(db_data->
-number,address_ptr->digits,address_ptr->number_of_digits);}else{if(address_ptr->
-digit_mode==WMS_DIGIT_MODE_8_BIT){memcpy(&(db_data->number[(0x588+2444-0xf13)]),
-address_ptr->digits,address_ptr->number_of_digits);}else{for(i=
-(0x2ff+3066-0xef9);i<address_ptr->number_of_digits;i++){if((0x13a+1901-0x89d)==
-address_ptr->digits[i]){db_data->number[i]=((char)(0x1589+4029-0x2516));}else{
-db_data->number[i]=((char)(0x809+991-0xbb8))+address_ptr->digits[i];}}}}(void)
-zUfiSms_UtilTimeStamp(ts_data_ptr->u.gw_pp.u.deliver.timestamp,db_data->tp_scts,
-&db_data->julian_date);if(ts_data_ptr->u.gw_pp.u.deliver.
-user_data_header_present){db_data->tp_udhi=(0xf74+726-0x1249);}else{db_data->
-tp_udhi=(0x2f7+3095-0xf0e);}if(db_data->tp_udhi==(0x355+5628-0x1950)){for(ind=
-(0x1d43+1996-0x250f);ind<ts_data_ptr->u.gw_pp.u.deliver.user_data.num_headers;
-ind++){result=zUfiSms_ParseUdhiData(&(ts_data_ptr->u.gw_pp.u.deliver.user_data.
-headers[ind]),db_data);if(ZTE_WMS_CONCAT_SMS_COUNT_MAX<db_data->concat_info[
-(0x68d+8138-0x2656)]){printf(
+(0xe61+6105-0x263a),ZTE_WMS_ADDRESS_LEN_MAX+(0x882+7049-0x240a));db_data->number
+[(0x1f89+305-0x20ba)]=((char)(0x1c7a+1253-0x2134));for(i=(0x90c+7566-0x269a);i<
+address_ptr->number_of_digits;i++){if((0xd92+4173-0x1dd5)==address_ptr->digits[i
+]){db_data->number[i+(0x41b+3674-0x1274)]=((char)(0x225c+1154-0x26ae));}else{
+db_data->number[i+(0x1dc+8525-0x2328)]=((char)(0x411+8391-0x24a8))+address_ptr->
+digits[i];}}}else if(WMS_NUMBER_ALPHANUMERIC==address_ptr->number_type){memcpy(
+db_data->number,address_ptr->digits,address_ptr->number_of_digits);}else{if(
+address_ptr->digit_mode==WMS_DIGIT_MODE_8_BIT){memcpy(&(db_data->number[
+(0x11d8+5381-0x26dc)]),address_ptr->digits,address_ptr->number_of_digits);}else{
+for(i=(0x756+6754-0x21b8);i<address_ptr->number_of_digits;i++){if(
+(0x1742+863-0x1a97)==address_ptr->digits[i]){db_data->number[i]=
+((char)(0x5e7+2397-0xf14));}else{db_data->number[i]=((char)(0x48a+2477-0xe07))+
+address_ptr->digits[i];}}}}(void)zUfiSms_UtilTimeStamp(ts_data_ptr->u.gw_pp.u.
+deliver.timestamp,db_data->tp_scts,&db_data->julian_date);if(ts_data_ptr->u.
+gw_pp.u.deliver.user_data_header_present){db_data->tp_udhi=(0x374+6607-0x1d42);}
+else{db_data->tp_udhi=(0x415+865-0x776);}if(db_data->tp_udhi==
+(0x11e5+4607-0x23e3)){for(ind=(0x1a1a+183-0x1ad1);ind<ts_data_ptr->u.gw_pp.u.
+deliver.user_data.num_headers;ind++){result=zUfiSms_ParseUdhiData(&(ts_data_ptr
+->u.gw_pp.u.deliver.user_data.headers[ind]),db_data);if(
+ZTE_WMS_CONCAT_SMS_COUNT_MAX<db_data->concat_info[(0x2d3+5010-0x1664)]){printf(
 "\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"
-,db_data->concat_info[(0x1a34+814-0x1d61)],ZTE_WMS_CONCAT_SMS_COUNT_MAX);if(
+,db_data->concat_info[(0x123a+2771-0x1d0c)],ZTE_WMS_CONCAT_SMS_COUNT_MAX);if(
 WMS_STORAGE_TYPE_NV_V01==db_data->mem_store){zUfiSms_DelModemSms(db_data->index)
 ;}result=ZUFI_FAIL;}}}tp_dcs=ts_data_ptr->u.gw_pp.u.deliver.dcs.alphabet;db_data
 ->sms_class=ts_data_ptr->u.gw_pp.u.deliver.dcs.msg_class;if(
-WMS_GW_ALPHABET_8_BIT>=tp_dcs){db_data->tp_dcs=(unsigned char)(0x8ab+98-0x90c);}
-else if(WMS_GW_ALPHABET_UCS2==tp_dcs){db_data->tp_dcs=(unsigned char)
-(0x218+6024-0x199e);}else{printf(
+WMS_GW_ALPHABET_8_BIT>=tp_dcs){db_data->tp_dcs=(unsigned char)
+(0x13fb+368-0x156a);}else if(WMS_GW_ALPHABET_UCS2==tp_dcs){db_data->tp_dcs=(
+unsigned char)(0x923+6273-0x21a2);}else{printf(
 "\x69\x6e\x76\x61\x6c\x69\x64\x20\x74\x70\x5f\x64\x63\x73\x3d\x25\x64",tp_dcs);}
 db_data->tp_pid=(unsigned char)ts_data_ptr->u.gw_pp.u.deliver.pid;if(ts_data_ptr
 ->u.gw_pp.u.deliver.dcs.alphabet==WMS_GW_ALPHABET_UCS2){result=
 zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_data,
 ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_len,db_data->sms_content);db_data->
 alphabet=WMS_GW_ALPHABET_UCS2;}else if(ts_data_ptr->u.gw_pp.u.deliver.dcs.
-alphabet==WMS_GW_ALPHABET_8_BIT){for(ind=(0x21d2+183-0x2289);ind<ts_data_ptr->u.
-gw_pp.u.deliver.user_data.sm_len;ind++){db_data->sms_content[(0x118+1493-0x6e9)*
-ind]=((char)(0x123d+2661-0x1c72));db_data->sms_content[(0x5d0+2651-0x1027)*ind+
-(0x85d+1927-0xfe3)]=((char)(0x1806+3595-0x25e1));db_data->sms_content[
-(0x907+7292-0x257f)*ind+(0x15c2+3587-0x23c3)]=g_zUfiSms_DigAscMap[((ts_data_ptr
-->u.gw_pp.u.deliver.user_data.sm_data[ind]&(0x10a9+4664-0x21f1))>>
-(0x95+4154-0x10cb))];db_data->sms_content[(0xd7d+4527-0x1f28)*ind+
-(0xd02+6156-0x250b)]=g_zUfiSms_DigAscMap[(ts_data_ptr->u.gw_pp.u.deliver.
-user_data.sm_data[ind]&(0x344+3081-0xf3e))];db_data->alphabet=
-WMS_GW_ALPHABET_UCS2;}}else if(ts_data_ptr->u.gw_pp.u.deliver.dcs.alphabet==
-WMS_GW_ALPHABET_7_BIT_DEFAULT){result=zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.
-u.deliver.user_data.sm_data,ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_len,
-db_data->sms_content);db_data->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;db_data->
-tp_dcs=(unsigned char)(0x680+7555-0x2401);}return result;}int 
-zUfiSms_FormatSubmitDbdata(T_zUfiSms_ClientTsData*ts_data_ptr,
-T_zUfiSms_DbStoreData*db_data){int result=ZUFI_SUCC;wms_address_s_type*
-address_ptr=NULL;wms_gw_alphabet_e_type tp_dcs=WMS_GW_ALPHABET_MAX32;int i=
-(0x652+4121-0x166b);int ind=(0x5c9+379-0x744);if((NULL==ts_data_ptr)||(NULL==
-db_data)){printf("\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73\x2e")
-;return ZUFI_FAIL;}address_ptr=&(ts_data_ptr->u.gw_pp.u.submit.address);if((
+alphabet==WMS_GW_ALPHABET_8_BIT){for(ind=(0x704+6097-0x1ed5);ind<ts_data_ptr->u.
+gw_pp.u.deliver.user_data.sm_len;ind++){db_data->sms_content[(0x13f+49-0x16c)*
+ind]=((char)(0xef+7924-0x1fb3));db_data->sms_content[(0x11a9+45-0x11d2)*ind+
+(0x20f0+722-0x23c1)]=((char)(0x764+1509-0xd19));db_data->sms_content[
+(0xc77+4443-0x1dce)*ind+(0x4da+332-0x624)]=g_zUfiSms_DigAscMap[((ts_data_ptr->u.
+gw_pp.u.deliver.user_data.sm_data[ind]&(0x1bf+5070-0x149d))>>(0x8e1+453-0xaa2))]
+;db_data->sms_content[(0x951+5944-0x2085)*ind+(0xa5a+4564-0x1c2b)]=
+g_zUfiSms_DigAscMap[(ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_data[ind]&
+(0x6fa+4431-0x183a))];db_data->alphabet=WMS_GW_ALPHABET_UCS2;}}else if(
+ts_data_ptr->u.gw_pp.u.deliver.dcs.alphabet==WMS_GW_ALPHABET_7_BIT_DEFAULT){
+result=zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_data,
+ts_data_ptr->u.gw_pp.u.deliver.user_data.sm_len,db_data->sms_content);db_data->
+alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;db_data->tp_dcs=(unsigned char)
+(0x2e7+2723-0xd88);}return result;}int zUfiSms_FormatSubmitDbdata(
+T_zUfiSms_ClientTsData*ts_data_ptr,T_zUfiSms_DbStoreData*db_data){int result=
+ZUFI_SUCC;wms_address_s_type*address_ptr=NULL;wms_gw_alphabet_e_type tp_dcs=
+WMS_GW_ALPHABET_MAX32;int i=(0x1590+1549-0x1b9d);int ind=(0x1206+2377-0x1b4f);if
+((NULL==ts_data_ptr)||(NULL==db_data)){printf(
+"\x69\x6e\x76\x61\x6c\x69\x64\x20\x69\x6e\x70\x75\x74\x73\x2e");return ZUFI_FAIL
+;}address_ptr=&(ts_data_ptr->u.gw_pp.u.submit.address);if((
 WMS_NUMBER_INTERNATIONAL==address_ptr->number_type)){db_data->number[
-(0x2263+172-0x230f)]=((char)(0x368+3389-0x107a));for(i=(0x12ab+5134-0x26b9);i<
-address_ptr->number_of_digits;i++){if((0x228+3788-0x10ea)==address_ptr->digits[i
-]){db_data->number[i+(0x8ac+5201-0x1cfc)]=((char)(0x3a1+1021-0x76e));}else{
-db_data->number[i+(0x91a+4402-0x1a4b)]=((char)(0x123a+636-0x1486))+address_ptr->
-digits[i];}}}else{for(i=(0xdc0+3996-0x1d5c);i<address_ptr->number_of_digits;i++)
-{if((0x11f+4435-0x1268)==address_ptr->digits[i]){db_data->number[i]=
-((char)(0x6db+8043-0x2616));}else{db_data->number[i]=((char)(0xf68+5951-0x2677))
-+address_ptr->digits[i];}}}tp_dcs=ts_data_ptr->u.gw_pp.u.submit.dcs.alphabet;
+(0x1147+5177-0x2580)]=((char)(0x886+110-0x8c9));for(i=(0x11+6289-0x18a2);i<
+address_ptr->number_of_digits;i++){if((0xd76+4460-0x1ed8)==address_ptr->digits[i
+]){db_data->number[i+(0x9eb+7452-0x2706)]=((char)(0x1a5f+2981-0x25d4));}else{
+db_data->number[i+(0x1fc5+1252-0x24a8)]=((char)(0x144+6584-0x1acc))+address_ptr
+->digits[i];}}}else{for(i=(0x5d6+3135-0x1215);i<address_ptr->number_of_digits;i
+++){if((0xc50+1670-0x12cc)==address_ptr->digits[i]){db_data->number[i]=
+((char)(0xc67+6636-0x2623));}else{db_data->number[i]=((char)(0x339+1473-0x8ca))+
+address_ptr->digits[i];}}}tp_dcs=ts_data_ptr->u.gw_pp.u.submit.dcs.alphabet;
 db_data->sms_class=ts_data_ptr->u.gw_pp.u.submit.dcs.msg_class;if(
-WMS_GW_ALPHABET_8_BIT>=tp_dcs){db_data->tp_dcs=(unsigned char)(0x7b+293-0x19f);}
-else if(WMS_GW_ALPHABET_UCS2==tp_dcs){db_data->tp_dcs=(unsigned char)
-(0x87f+967-0xc44);}else{printf(
+WMS_GW_ALPHABET_8_BIT>=tp_dcs){db_data->tp_dcs=(unsigned char)(0x276+1791-0x974)
+;}else if(WMS_GW_ALPHABET_UCS2==tp_dcs){db_data->tp_dcs=(unsigned char)
+(0x384+3130-0xfbc);}else{printf(
 "\x69\x6e\x76\x61\x6c\x69\x64\x20\x74\x70\x5f\x64\x63\x73\x3d\x25\x64",tp_dcs);}
 db_data->tp_pid=(unsigned char)ts_data_ptr->u.gw_pp.u.submit.pid;db_data->
 msg_ref=(unsigned char)ts_data_ptr->u.gw_pp.u.submit.message_reference;if(
 ts_data_ptr->u.gw_pp.u.submit.user_data_header_present){db_data->tp_udhi=
-(0x1a67+2835-0x2579);}else{db_data->tp_udhi=(0xc63+6747-0x26be);}if(db_data->
-tp_udhi==(0xe17+1684-0x14aa)){for(ind=(0x146f+2117-0x1cb4);ind<ts_data_ptr->u.
+(0xb44+3935-0x1aa2);}else{db_data->tp_udhi=(0x12bc+3281-0x1f8d);}if(db_data->
+tp_udhi==(0x3ca+8390-0x248f)){for(ind=(0x12c7+4504-0x245f);ind<ts_data_ptr->u.
 gw_pp.u.submit.user_data.num_headers;ind++){result=zUfiSms_ParseUdhiData(&(
 ts_data_ptr->u.gw_pp.u.submit.user_data.headers[ind]),db_data);if(
-ZTE_WMS_CONCAT_SMS_COUNT_MAX<db_data->concat_info[(0xc6f+904-0xff6)]){printf(
+ZTE_WMS_CONCAT_SMS_COUNT_MAX<db_data->concat_info[(0x775+2551-0x116b)]){printf(
 "\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"
 );if(WMS_STORAGE_TYPE_NV_V01==db_data->mem_store){zUfiSms_DelModemSms(db_data->
 index);}result=ZUFI_FAIL;}}}if(ts_data_ptr->u.gw_pp.u.submit.dcs.alphabet==
 WMS_GW_ALPHABET_UCS2){result=zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.u.submit.
 user_data.sm_data,ts_data_ptr->u.gw_pp.u.submit.user_data.sm_len,db_data->
 sms_content);db_data->alphabet=WMS_GW_ALPHABET_UCS2;}else if(ts_data_ptr->u.
-gw_pp.u.submit.dcs.alphabet==WMS_GW_ALPHABET_8_BIT){for(ind=(0xd17+5859-0x23fa);
-ind<ts_data_ptr->u.gw_pp.u.submit.user_data.sm_len;ind++){db_data->sms_content[
-(0xb59+3346-0x1867)*ind]=((char)(0x23cf+342-0x24f5));db_data->sms_content[
-(0x1861+3758-0x270b)*ind+(0x1501+3564-0x22ec)]=((char)(0xaf3+2636-0x150f));
-db_data->sms_content[(0x313+5546-0x18b9)*ind+(0x12aa+665-0x1541)]=
+gw_pp.u.submit.dcs.alphabet==WMS_GW_ALPHABET_8_BIT){for(ind=(0x1785+3338-0x248f)
+;ind<ts_data_ptr->u.gw_pp.u.submit.user_data.sm_len;ind++){db_data->sms_content[
+(0xdad+4605-0x1fa6)*ind]=((char)(0xa11+2718-0x147f));db_data->sms_content[
+(0x276+5574-0x1838)*ind+(0x909+6489-0x2261)]=((char)(0x1be0+2076-0x23cc));
+db_data->sms_content[(0x941+7151-0x252c)*ind+(0x2a7+5276-0x1741)]=
 g_zUfiSms_DigAscMap[((ts_data_ptr->u.gw_pp.u.submit.user_data.sm_data[ind]&
-(0xd24+4912-0x1f64))>>(0x1321+4944-0x266d))];db_data->sms_content[
-(0xa57+2440-0x13db)*ind+(0x1007+2891-0x1b4f)]=g_zUfiSms_DigAscMap[(ts_data_ptr->
-u.gw_pp.u.submit.user_data.sm_data[ind]&(0x3f0+36-0x405))];db_data->alphabet=
+(0x19a6+2184-0x213e))>>(0x1910+1990-0x20d2))];db_data->sms_content[
+(0x729+3331-0x1428)*ind+(0x12e5+3973-0x2267)]=g_zUfiSms_DigAscMap[(ts_data_ptr->
+u.gw_pp.u.submit.user_data.sm_data[ind]&(0x75c+2401-0x10ae))];db_data->alphabet=
 WMS_GW_ALPHABET_UCS2;}}else if(ts_data_ptr->u.gw_pp.u.submit.dcs.alphabet==
 WMS_GW_ALPHABET_7_BIT_DEFAULT){result=zUfiSms_DispatchWtoi(ts_data_ptr->u.gw_pp.
 u.submit.user_data.sm_data,ts_data_ptr->u.gw_pp.u.submit.user_data.sm_len,
 db_data->sms_content);db_data->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;db_data->
-tp_dcs=(unsigned char)(0x79f+5902-0x1eab);}return result;}int InvertNumbers(
+tp_dcs=(unsigned char)(0x17f2+1391-0x1d5f);}return result;}int InvertNumbers(
 const char*pSrc,char*pDst,int nSrcLength){int nDstLength;char ch;int i=
-(0x11d1+2718-0x1c6f);if(pSrc==NULL||pDst==NULL||nSrcLength<(0x934+5857-0x2015)){
-return-(0xec6+4258-0x1f67);}nDstLength=nSrcLength;for(i=(0xc9d+806-0xfc3);i<
-nSrcLength;i+=(0x756+5403-0x1c6f)){ch=*pSrc++;*pDst++=*pSrc++;*pDst++=ch;}if(
-nSrcLength&(0xbc6+5150-0x1fe3)){*(pDst-(0x1405+3503-0x21b2))=
-((char)(0x12d+6586-0x1aa1));nDstLength++;}*pDst='\0';return nDstLength;}int 
+(0xe7a+2985-0x1a23);if(pSrc==NULL||pDst==NULL||nSrcLength<(0x13cc+1674-0x1a56)){
+return-(0x25d+1134-0x6ca);}nDstLength=nSrcLength;for(i=(0x1094+5257-0x251d);i<
+nSrcLength;i+=(0x724+1411-0xca5)){ch=*pSrc++;*pDst++=*pSrc++;*pDst++=ch;}if(
+nSrcLength&(0xa48+1880-0x119f)){*(pDst-(0x4d+6090-0x1815))=
+((char)(0x1216+114-0x1242));nDstLength++;}*pDst='\0';return nDstLength;}int 
 code_is_gsm7(const SMS_PARAM*pSrc,unsigned char buf[],int nLength){if(pSrc->
-TP_UDHI==(0x7fc+4348-0x18f7)){buf[(0x144b+2931-0x1fbb)]=(unsigned char)nLength;
-buf[(0x24f+7463-0x1f72)]=(unsigned char)pSrc->TP_UD[(0xa25+4447-0x1b84)];buf[
-(0x870+7246-0x24b9)]=(0x412+376-0x58a);buf[(0x813+6838-0x22c3)]=(unsigned char)
-pSrc->TP_UD[(0x374+8998-0x2698)];buf[(0x80c+6829-0x22b2)]=(unsigned char)pSrc->
-TP_UD[(0x104c+3688-0x1eb1)];buf[(0x16b8+3568-0x24a0)]=(unsigned char)pSrc->TP_UD
-[(0x1771+525-0x197a)];buf[(0x16ab+1762-0x1d84)]=(unsigned char)pSrc->TP_UD[
-(0x1269+815-0x1593)];buf[(0x18f+6420-0x1a99)]=(unsigned char)pSrc->TP_UD[
-(0x78b+1827-0xea7)];buf[(0x13d9+2784-0x1eaf)]=(unsigned char)(buf[
-(0x1a3c+315-0x1b6d)]<<(0xb7d+6099-0x234f));nLength=nLength-(0x19b+8538-0x22ee);
-nLength=Encode7bit(&(pSrc->TP_UD[(0x224b+257-0x2344)]),&buf[(0xf7f+4976-0x22e4)]
-,nLength+(0x4ea+3991-0x1480))+(0xe52+1131-0x12b9)+(0xaa1+1209-0xf54);
-#if (0x422+5136-0x1832)
-nLength+=(0x5ca+4826-0x18a2);
+TP_UDHI==(0x1021+2486-0x19d6)){buf[(0x197a+3050-0x2561)]=(unsigned char)nLength;
+buf[(0xd4f+1229-0x1218)]=(unsigned char)pSrc->TP_UD[(0x5c8+1860-0xd0c)];buf[
+(0xc51+3267-0x190f)]=(0xebb+1149-0x1338);buf[(0x1c44+1215-0x20fd)]=(unsigned 
+char)pSrc->TP_UD[(0x1172+123-0x11eb)];buf[(0x942+5946-0x2075)]=(unsigned char)
+pSrc->TP_UD[(0x8dd+2159-0x1149)];buf[(0x2c0+3001-0xe71)]=(unsigned char)pSrc->
+TP_UD[(0x33b+2515-0xd0a)];buf[(0xdc5+4775-0x2063)]=(unsigned char)pSrc->TP_UD[
+(0x65+4015-0x100f)];buf[(0x1b59+2804-0x2643)]=(unsigned char)pSrc->TP_UD[
+(0xcd2+3158-0x1921)];buf[(0xd0c+1299-0x1215)]=(unsigned char)(buf[
+(0xadd+6319-0x2382)]<<(0x14fc+1936-0x1c8b));nLength=nLength-(0x35d+5551-0x1905);
+nLength=Encode7bit(&(pSrc->TP_UD[(0xf8+2176-0x970)]),&buf[(0x1695+225-0x176b)],
+nLength+(0x1969+3399-0x26af))+(0x13b4+3968-0x2330)+(0x32b+1096-0x76d);
+#if (0x131f+2009-0x1af8)
+nLength+=(0x961+6179-0x2182);
 #endif

-}else{nLength=pSrc->TP_UDLength;buf[(0xc1+4266-0x1168)]=nLength;nLength=
-Encode7bit(pSrc->TP_UD,&buf[(0x1406+368-0x1572)],nLength+(0x413+4298-0x14dc))+
-(0x2ef+4096-0x12eb);}at_print(LOG_DEBUG,
+}else{nLength=pSrc->TP_UDLength;buf[(0xff4+2729-0x1a9a)]=nLength;nLength=
+Encode7bit(pSrc->TP_UD,&buf[(0x18e3+2318-0x21ed)],nLength+(0xaf0+5222-0x1f55))+
+(0x139c+516-0x159c);}at_print(LOG_DEBUG,
 "\x62\x75\x66\x20\x69\x73\x20\x25\x73" "\n",buf);return nLength;}int 
 code_is_ucs2(const SMS_PARAM*pSrc,unsigned char buf[],int nLength){nLength=
-strlen(pSrc->TP_UD);if(pSrc->TP_UDHI==(0x1758+198-0x181d)){buf[
-(0x1251+4059-0x2229)]=(unsigned char)nLength;buf[(0x1a50+600-0x1ca4)]=(unsigned 
-char)pSrc->TP_UD[(0x1836+2952-0x23be)];buf[(0x1758+3841-0x2654)]=
-(0xb77+6989-0x26c4);buf[(0x19e7+3154-0x2633)]=(unsigned char)pSrc->TP_UD[
-(0x13c7+903-0x174c)];buf[(0x555+2501-0xf13)]=(unsigned char)pSrc->TP_UD[
-(0x13a+3120-0xd67)];buf[(0xf75+1050-0x1387)]=(unsigned char)pSrc->TP_UD[
-(0xcd7+5739-0x233e)];buf[(0x1522+4566-0x26ef)]=(unsigned char)pSrc->TP_UD[
-(0x515+8342-0x25a6)];buf[(0x61f+398-0x7aa)]=(unsigned char)(EncodeUcs2(&(pSrc->
-TP_UD[(0x794+307-0x8c1)]),&buf[(0x70b+5303-0x1bb8)],nLength-(0x70f+7255-0x2360))
-+(0xbd3+1999-0x139c));nLength=buf[(0x58+6086-0x181b)]+(0xd28+4729-0x1f9d);}else{
-buf[(0x1072+5722-0x26c9)]=EncodeUcs2(pSrc->TP_UD,&buf[(0x1195+2478-0x1b3f)],
-nLength);nLength=buf[(0xff1+5387-0x24f9)]+(0x12c2+4421-0x2403);}return nLength;}
+strlen(pSrc->TP_UD);if(pSrc->TP_UDHI==(0x1e5c+2018-0x263d)){buf[
+(0x1739+727-0x1a0d)]=(unsigned char)nLength;buf[(0x83f+4376-0x1953)]=(unsigned 
+char)pSrc->TP_UD[(0x6f+4246-0x1105)];buf[(0x5e4+4439-0x1736)]=
+(0x1504+469-0x16d9);buf[(0x971+5135-0x1d7a)]=(unsigned char)pSrc->TP_UD[
+(0x344+8017-0x2293)];buf[(0xea9+1095-0x12e9)]=(unsigned char)pSrc->TP_UD[
+(0x4b+1173-0x4dd)];buf[(0x154b+4399-0x2672)]=(unsigned char)pSrc->TP_UD[
+(0x1ec0+1382-0x2422)];buf[(0x1803+575-0x1a39)]=(unsigned char)pSrc->TP_UD[
+(0xbaf+3209-0x1833)];buf[(0x1017+1363-0x1567)]=(unsigned char)(EncodeUcs2(&(pSrc
+->TP_UD[(0x4e1+1382-0xa41)]),&buf[(0x11a+8981-0x2425)],nLength-(0xd+7502-0x1d55)
+)+(0x64d+6185-0x1e70));nLength=buf[(0xb8c+2657-0x15ea)]+(0x798+2530-0x1176);}
+else{buf[(0xde8+4785-0x2096)]=EncodeUcs2(pSrc->TP_UD,&buf[(0xab1+3531-0x1878)],
+nLength);nLength=buf[(0x171+3140-0xdb2)]+(0x87a+7433-0x257f);}return nLength;}
 int Encode8bit(const char*pSrc,unsigned char*pDst,int nSrcLength){if(pSrc==NULL
-||pDst==NULL||nSrcLength<(0x11b4+2013-0x1991)){return-(0x773+8045-0x26df);}
-memcpy(pDst,pSrc,nSrcLength);return nSrcLength;}int EncodePdu_Submit(const 
-SMS_PARAM*pSrc,char*pDst){int nLength=(0xe55+3801-0x1d2e);int nDstLength=
-(0xdf+3785-0xfa8);unsigned char buf[(0xf50+1846-0x1586)]={(0x173+248-0x26b)};
-char tmpSCA[(0x136f+1128-0x17b3)]={(0x719+5918-0x1e37)};int check_udl=
-(0xd37+5228-0x21a3);memset(tmpSCA,(0x11dc+5332-0x26b0),sizeof(tmpSCA));if(pSrc==
-NULL||pDst==NULL){return-(0x11a9+4794-0x2462);}
-#if (0x38f+2258-0xc60)
+||pDst==NULL||nSrcLength<(0x538+3618-0x135a)){return-(0x1b35+376-0x1cac);}memcpy
+(pDst,pSrc,nSrcLength);return nSrcLength;}int EncodePdu_Submit(const SMS_PARAM*
+pSrc,char*pDst){int nLength=(0xc85+881-0xff6);int nDstLength=(0x1b27+962-0x1ee9)
+;unsigned char buf[(0xf5d+4533-0x2012)]={(0x86f+2312-0x1177)};char tmpSCA[
+(0xd45+5645-0x232e)]={(0x2084+1219-0x2547)};int check_udl=(0x70c+551-0x933);
+memset(tmpSCA,(0x464+2166-0xcda),sizeof(tmpSCA));if(pSrc==NULL||pDst==NULL){
+return-(0x5a1+4212-0x1614);}
+#if (0x85d+1494-0xe32)
 printf(
 "\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"
 );printf(
@@ -907,394 +907,394 @@
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x73\x63\x61\x3a\x25\x73" "\n",pSrc->
 SCA);
 #endif

-nLength=strlen(pSrc->SCA);buf[(0x1181+2-0x1183)]=(char)(((nLength)&
-(0x5f5+7104-0x21b4))==(0xd4f+598-0xfa5)?(nLength):nLength+(0x13eb+2080-0x1c0a))/
-(0x173+1212-0x62d)+(0x796+167-0x83c);buf[(0x963+5395-0x1e75)]=(0x96+7538-0x1d87)
-;strncpy(tmpSCA,pSrc->SCA,sizeof(tmpSCA)-(0xfd6+766-0x12d3));if(!(strncmp(pSrc->
-SCA,"\x30\x30\x38\x36",(0x103+4108-0x110b)))){memset(tmpSCA,(0x2e1+7023-0x1e50),
-sizeof(tmpSCA));nLength=nLength-(0x787+6144-0x1f86);
-#if (0x301+1345-0x841)
-nLength=nLength-(0xd37+1838-0x1464);strncpy(tmpSCA,&(pSrc->SCA[
-(0x161+4161-0x11a0)]),sizeof(tmpSCA)-(0x1734+1918-0x1eb1));
+nLength=strlen(pSrc->SCA);buf[(0x6e2+7394-0x23c4)]=(char)(((nLength)&
+(0x3c3+4392-0x14ea))==(0x1425+4003-0x23c8)?(nLength):nLength+(0xa17+6976-0x2556)
+)/(0x4e1+8215-0x24f6)+(0xfb1+1520-0x15a0);buf[(0xae4+3722-0x196d)]=
+(0x13bf+4049-0x230f);strncpy(tmpSCA,pSrc->SCA,sizeof(tmpSCA)-(0x9c6+2265-0x129e)
+);if(!(strncmp(pSrc->SCA,"\x30\x30\x38\x36",(0x10ec+1680-0x1778)))){memset(
+tmpSCA,(0x18d4+2214-0x217a),sizeof(tmpSCA));nLength=nLength-(0x181+628-0x3f4);
+#if (0x1b5d+2637-0x25a9)
+nLength=nLength-(0x1f6c+85-0x1fc0);strncpy(tmpSCA,&(pSrc->SCA[
+(0x65b+6053-0x1dfe)]),sizeof(tmpSCA)-(0x1beb+2381-0x2537));
 #else

-tmpSCA[(0x583+6501-0x1ee8)]=((char)(0x93+7681-0x1e69));strcpy(&(tmpSCA[
-(0x502+4004-0x14a5)]),&(pSrc->SCA[(0x141f+2431-0x1d9c)]));
+tmpSCA[(0x1c9+5948-0x1905)]=((char)(0xe90+4527-0x2014));strcpy(&(tmpSCA[
+(0xa7c+4353-0x1b7c)]),&(pSrc->SCA[(0xae2+5081-0x1eb9)]));
 #endif

-buf[(0xbc0+5494-0x2136)]=(char)((nLength&(0x411+5557-0x19c5))==
-(0xb86+4920-0x1ebe)?nLength:nLength+(0xb4a+2729-0x15f2))/(0xef7+3960-0x1e6d)+
-(0x1ff3+997-0x23d7);buf[(0x14e0+3095-0x20f6)]=(0xf81+677-0x1195);}else if(
-((char)(0xd03+2258-0x15aa))==pSrc->SCA[(0x8d2+4602-0x1acc)]){memset(tmpSCA,
-(0x1315+3329-0x2016),sizeof(tmpSCA));
-#if (0xfc1+5084-0x239c)
-nLength=nLength-(0x2032+790-0x2347);strncpy(tmpSCA,&(pSrc->SCA[
-(0xf7b+549-0x119f)]),sizeof(tmpSCA)-(0x14d+6939-0x1c67));
+buf[(0xe99+2591-0x18b8)]=(char)((nLength&(0x146+3080-0xd4d))==
+(0xb11+3548-0x18ed)?nLength:nLength+(0x1258+2453-0x1bec))/(0x748+6245-0x1fab)+
+(0x1662+3105-0x2282);buf[(0x24a0+317-0x25dc)]=(0xbb+344-0x182);}else if(
+((char)(0xdf1+336-0xf16))==pSrc->SCA[(0x37a+6839-0x1e31)]){memset(tmpSCA,
+(0x19c1+3301-0x26a6),sizeof(tmpSCA));
+#if (0xb55+2620-0x1590)
+nLength=nLength-(0x11c9+2708-0x1c5c);strncpy(tmpSCA,&(pSrc->SCA[
+(0x2318+722-0x25e9)]),sizeof(tmpSCA)-(0x1986+3081-0x258e));
 #else

 strcpy(tmpSCA,pSrc->SCA);
 #endif

-buf[(0x3c4+2236-0xc80)]=(char)((nLength&(0x73b+7809-0x25bb))==
-(0x1b17+497-0x1d08)?(nLength):nLength+(0xc38+3570-0x1a29))/(0x5d5+7554-0x2355)+
-(0x118f+2525-0x1b6b);buf[(0x1ff1+1270-0x24e6)]=(0x16b5+3011-0x21e7);}
-#if (0x10d3+5472-0x2632)
+buf[(0xdcd+1321-0x12f6)]=(char)((nLength&(0x4a6+3858-0x13b7))==
+(0xda2+3664-0x1bf2)?(nLength):nLength+(0x8b7+3953-0x1827))/(0x13f1+2314-0x1cf9)+
+(0x15ac+1624-0x1c03);buf[(0x1b19+2265-0x23f1)]=(0xc4d+1880-0x1314);}
+#if (0xb+4487-0x1191)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x32\x3a\x25\x73" "\n",
 pDst);
 #endif

-if(nLength<(0xd16+4617-0x1f1e)||nLength>=sizeof(tmpSCA))return-
-(0xdf0+2370-0x1731);nDstLength=Bytes2String(buf,pDst,(0x1072+3162-0x1cca));
+if(nLength<(0x1299+159-0x1337)||nLength>=sizeof(tmpSCA))return-
+(0xf09+2567-0x190f);nDstLength=Bytes2String(buf,pDst,(0x1500+517-0x1703));
 nDstLength+=InvertNumbers(tmpSCA,&pDst[nDstLength],nLength);
-#if (0xf76+811-0x12a0)
+#if (0xc38+1548-0x1243)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x33\x3a\x25\x73" "\n",
 pDst);
 #endif

-if(pSrc->TPA[(0x22f7+64-0x2337)]==((char)(0x1fc+6127-0x19c0))){nLength=strlen(&(
-pSrc->TPA[(0x7d9+1279-0xcd7)]));}else{nLength=strlen(pSrc->TPA);}if(pSrc->
-TP_UDHI==(0x680+4678-0x18c6)){if(pSrc->TP_SRR==(0x2198+925-0x2535)){buf[
-(0x1328+3992-0x22c0)]=(0x171f+2481-0x20bf);}if(pSrc->TP_SRR==(0x1c28+225-0x1d08)
-){buf[(0xd6+2919-0xc3d)]=(0xfcb+271-0x10a9);}}if(pSrc->TP_UDHI==
-(0xc56+5880-0x234d)){if(pSrc->TP_SRR==(0x8ef+5477-0x1e54)){buf[
-(0x1c85+2199-0x251c)]=(0x1051+1003-0x13eb);}if(pSrc->TP_SRR==(0x562+2537-0xf4a))
-{buf[(0x35b+3079-0xf62)]=(0x11e4+1204-0x1627);}}buf[(0x882+1261-0xd6e)]=
-(0x177+3436-0xee3);buf[(0x14d+7730-0x1f7d)]=(char)nLength;if(pSrc->TPA[
-(0x28a+264-0x392)]==((char)(0x20d+1505-0x7c3))){buf[(0x3cb+4349-0x14c5)]=
-(0xb3f+5300-0x1f62);nDstLength+=Bytes2String(buf,&pDst[nDstLength],
-(0x94f+6024-0x20d3));nDstLength+=InvertNumbers(&(pSrc->TPA[(0x13b2+604-0x160d)])
+if(pSrc->TPA[(0xec9+4567-0x20a0)]==((char)(0x342+2826-0xe21))){nLength=strlen(&(
+pSrc->TPA[(0x1410+4759-0x26a6)]));}else{nLength=strlen(pSrc->TPA);}if(pSrc->
+TP_UDHI==(0x734+4664-0x196c)){if(pSrc->TP_SRR==(0x10fa+1376-0x165a)){buf[
+(0x40f+148-0x4a3)]=(0xd7d+2030-0x155a);}if(pSrc->TP_SRR==(0x485+954-0x83e)){buf[
+(0x79f+7318-0x2435)]=(0x2e2+3906-0x11f3);}}if(pSrc->TP_UDHI==(0x5c3+494-0x7b0)){
+if(pSrc->TP_SRR==(0xa7+5065-0x1470)){buf[(0x550+6911-0x204f)]=
+(0xa5b+5710-0x2058);}if(pSrc->TP_SRR==(0x1444+1296-0x1953)){buf[
+(0x3c4+8128-0x2384)]=(0x1af9+2612-0x24bc);}}buf[(0x124d+3035-0x1e27)]=
+(0x100+5244-0x157c);buf[(0x51c+554-0x744)]=(char)nLength;if(pSrc->TPA[
+(0x25e8+53-0x261d)]==((char)(0x8ef+493-0xab1))){buf[(0x11e5+2960-0x1d72)]=
+(0x16da+1106-0x1a9b);nDstLength+=Bytes2String(buf,&pDst[nDstLength],
+(0x570+7885-0x2439));nDstLength+=InvertNumbers(&(pSrc->TPA[(0x12f8+944-0x16a7)])
 ,&pDst[nDstLength],nLength);}else if(!(strncmp(pSrc->TPA,"\x30\x30\x38\x36",
-(0x1214+2126-0x1a5e)))){buf[(0xb91+3737-0x1a28)]=(char)nLength-
-(0x284+8171-0x226d);buf[(0x28+537-0x23e)]=(0x1970+2952-0x2467);nDstLength+=
-Bytes2String(buf,&pDst[nDstLength],(0xbd9+4847-0x1ec4));nDstLength+=
-InvertNumbers(&(pSrc->TPA[(0xb5f+741-0xe42)]),&pDst[nDstLength],nLength-
-(0x1761+3368-0x2487));}else{buf[(0x716+6906-0x220d)]=(0x1324+607-0x1502);
-nDstLength+=Bytes2String(buf,&pDst[nDstLength],(0x166+6813-0x1bff));nDstLength+=
-InvertNumbers(pSrc->TPA,&pDst[nDstLength],nLength);}
-#if (0x16ad+849-0x19fd)
+(0x147+1909-0x8b8)))){buf[(0x335+1127-0x79a)]=(char)nLength-(0x18+4648-0x123e);
+buf[(0xfe4+1350-0x1527)]=(0xb74+5338-0x1fbd);nDstLength+=Bytes2String(buf,&pDst[
+nDstLength],(0x211b+1423-0x26a6));nDstLength+=InvertNumbers(&(pSrc->TPA[
+(0xc38+1952-0x13d6)]),&pDst[nDstLength],nLength-(0xad2+1716-0x1184));}else{buf[
+(0x787+7997-0x26c1)]=(0x2415+478-0x2572);nDstLength+=Bytes2String(buf,&pDst[
+nDstLength],(0x1190+3827-0x207f));nDstLength+=InvertNumbers(pSrc->TPA,&pDst[
+nDstLength],nLength);}
+#if (0xeb2+3109-0x1ad6)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x34\x3a\x25\x73" "\n",
 pDst);
 #endif

-nLength=(int)pSrc->TP_UDLength;buf[(0x12f2+3132-0x1f2e)]=pSrc->TP_PID;buf[
-(0x751+425-0x8f9)]=pSrc->TP_DCS;buf[(0x3e1+3585-0x11e0)]=pSrc->TP_VP;if(pSrc->
+nLength=(int)pSrc->TP_UDLength;buf[(0xcd9+6661-0x26de)]=pSrc->TP_PID;buf[
+(0xacf+1795-0x11d1)]=pSrc->TP_DCS;buf[(0x296+391-0x41b)]=pSrc->TP_VP;if(pSrc->
 TP_DCS==CODE_GSM7){nLength=code_is_gsm7(pSrc,buf,nLength);}else if(pSrc->TP_DCS
 ==CODE_UCS2){nLength=code_is_ucs2(pSrc,buf,nLength);}else{nLength=strlen(pSrc->
-TP_UD);if(pSrc->TP_UDHI==(0x3d9+5268-0x186c)){buf[(0x516+3637-0x1348)]=(unsigned
- char)nLength;buf[(0x166f+453-0x1830)]=(unsigned char)pSrc->TP_UD[
-(0x1c78+1762-0x235a)];buf[(0xf0+7370-0x1db5)]=(0x22ff+855-0x2656);buf[
-(0x229+7610-0x1fdd)]=(unsigned char)pSrc->TP_UD[(0xa57+1263-0xf44)];buf[
-(0xd11+4280-0x1dc2)]=(unsigned char)pSrc->TP_UD[(0x1638+3123-0x2268)];buf[
-(0x1c66+1892-0x23c2)]=(unsigned char)pSrc->TP_UD[(0x3f9+628-0x669)];buf[
-(0x350+6253-0x1bb4)]=(unsigned char)pSrc->TP_UD[(0x315+6360-0x1be8)];if(nLength-
-(0x695+1021-0xa8c)<=(0x9d4+6929-0x24e5)||nLength-(0x1052+2522-0x1a26)>=sizeof(
-buf)-(0x2a5+6236-0x1af7))return-(0x790+849-0xae0);buf[(0x4b0+5049-0x1866)]=(
-unsigned char)(Encode8bit(&(pSrc->TP_UD[(0x625+7839-0x24be)]),&buf[
-(0x6cd+958-0xa81)],(unsigned short)(nLength-(0x17e8+2304-0x20e2)))+
-(0xc19+5381-0x2118));nLength=buf[(0x976+2197-0x1208)]+(0x1810+2353-0x213d);}else
-{if(nLength<=(0x2356+779-0x2661)||nLength>=sizeof(buf)-(0x42b+4382-0x1545))
-return-(0x16d+6275-0x19ef);buf[(0x1835+1070-0x1c60)]=Encode8bit(pSrc->TP_UD,&buf
-[(0x917+3454-0x1691)],nLength);nLength=buf[(0x1ea8+453-0x206a)]+
-(0xaec+3682-0x194a);}}check_udl=nLength-(0xd86+3568-0x1b72);nDstLength+=
+TP_UD);if(pSrc->TP_UDHI==(0x8e3+491-0xacd)){buf[(0x17ef+3537-0x25bd)]=(unsigned 
+char)nLength;buf[(0x16b2+864-0x1a0e)]=(unsigned char)pSrc->TP_UD[
+(0x190d+1027-0x1d10)];buf[(0x1bd9+312-0x1d0c)]=(0x4f0+5660-0x1b0c);buf[
+(0x5d3+3774-0x148b)]=(unsigned char)pSrc->TP_UD[(0x53f+7909-0x2422)];buf[
+(0x1a6b+3208-0x26ec)]=(unsigned char)pSrc->TP_UD[(0x9dd+3195-0x1655)];buf[
+(0xa48+6073-0x21f9)]=(unsigned char)pSrc->TP_UD[(0x1858+1895-0x1fbb)];buf[
+(0x1d5d+1397-0x22c9)]=(unsigned char)pSrc->TP_UD[(0xf45+5397-0x2455)];if(nLength
+-(0x930+6494-0x2288)<=(0x33+8098-0x1fd5)||nLength-(0x18c9+2380-0x220f)>=sizeof(
+buf)-(0x9c0+6132-0x21aa))return-(0x3d2+2196-0xc65);buf[(0x73+2954-0xbfa)]=(
+unsigned char)(Encode8bit(&(pSrc->TP_UD[(0xd5a+5358-0x2242)]),&buf[
+(0x2046+1170-0x24ce)],(unsigned short)(nLength-(0x1c9d+2053-0x249c)))+
+(0xa36+4166-0x1a76));nLength=buf[(0x1443+2687-0x1ebf)]+(0xcac+1498-0x1282);}else
+{if(nLength<=(0x1c2d+1763-0x2310)||nLength>=sizeof(buf)-(0x9f9+2665-0x145e))
+return-(0x86b+5427-0x1d9d);buf[(0x9d+3413-0xdef)]=Encode8bit(pSrc->TP_UD,&buf[
+(0x303+3608-0x1117)],nLength);nLength=buf[(0x1ac1+1385-0x2027)]+
+(0x1f85+1411-0x2504);}}check_udl=nLength-(0x1229+4302-0x22f3);nDstLength+=
 Bytes2String(buf,&pDst[nDstLength],nLength);sc_cfg_set(NV_CHECK_UDL,"");if(
-check_udl>(0x1e2d+2258-0x2673)){sc_cfg_set(NV_CHECK_UDL,"\x65\x72\x72\x6f\x72");
+check_udl>(0x1f12+1196-0x2332)){sc_cfg_set(NV_CHECK_UDL,"\x65\x72\x72\x6f\x72");
 }
-#if (0x23b5+208-0x2484)
+#if (0x5dd+3027-0x11af)
 printf(
 "\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"
 );printf(
 "\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"
 ,nDstLength,pSrc->TP_UD);
 #endif

-#if (0x168f+2106-0x1ec8)
+#if (0x528+7929-0x2420)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x70\x64\x73\x74\x35\x3a\x25\x73" "\n",
 pDst);
 #endif

 return nDstLength;}int Decode7bit(const unsigned char*pSrc,char*pDst,int 
 nSrcLength){int nSrc;int nDst;int nByte;unsigned char nLeft;if(pSrc==NULL||pDst
-==NULL||nSrcLength<(0x24f+4808-0x1517)){return-(0x13d+6573-0x1ae9);}nSrc=
-(0x9ff+146-0xa91);nDst=(0xa45+7345-0x26f6);nByte=(0x222+3600-0x1032);nLeft=
-(0xebc+681-0x1165);while(nSrc<nSrcLength){*pDst=((*pSrc<<nByte)|nLeft)&
-(0x19ec+265-0x1a76);nLeft=*pSrc>>((0xe35+3361-0x1b4f)-nByte);pDst++;nDst++;nByte
-++;if(nByte==(0x1888+2745-0x233a)){*pDst=nLeft;pDst++;nDst++;nByte=
-(0x707+1583-0xd36);nLeft=(0x10e9+522-0x12f3);}pSrc++;nSrc++;}*pDst='\0';return 
-nDst;}int DecodePushPdu(const char*pSrcPdu,SMS_PARAM*pDst){int nDstLength=
-(0x8d1+1176-0xd69);unsigned char tmp=(0x712+3311-0x1401);int ud_length=
-(0x70d+530-0x91f);unsigned char buf[(0xce1+2409-0x154a)]={(0x870+7790-0x26de)};
-char temp_num[(0xca2+6445-0x256b)]={(0x711+6103-0x1ee8)};unsigned char 
-first_octet=(0x6fd+2120-0xf45);unsigned char udhl=(0x143a+2117-0x1c7f);unsigned 
-int halftmp=(0x1347+4738-0x25c9);char tp_ra[(0x1087+1251-0x1567)]={
-(0x1c52+2072-0x246a)};int tmplen=(0x1360+1051-0x177b);unsigned char IEIDL;int 
-pushType=(0x1a02+2786-0x24e4);const char*pSrc=pSrcPdu;if(pSrcPdu==NULL||pDst==
+==NULL||nSrcLength<(0x5ab+8439-0x26a2)){return-(0x7b0+7243-0x23fa);}nSrc=
+(0x434+2007-0xc0b);nDst=(0x36b+8605-0x2508);nByte=(0x8c4+3740-0x1760);nLeft=
+(0x104a+4612-0x224e);while(nSrc<nSrcLength){*pDst=((*pSrc<<nByte)|nLeft)&
+(0x2173+1420-0x2680);nLeft=*pSrc>>((0x1064+2793-0x1b46)-nByte);pDst++;nDst++;
+nByte++;if(nByte==(0xe97+6014-0x260e)){*pDst=nLeft;pDst++;nDst++;nByte=
+(0x1f3d+450-0x20ff);nLeft=(0x1028+1184-0x14c8);}pSrc++;nSrc++;}*pDst='\0';return
+ nDst;}int DecodePushPdu(const char*pSrcPdu,SMS_PARAM*pDst){int nDstLength=
+(0x45c+820-0x790);unsigned char tmp=(0x1b5a+1496-0x2132);int ud_length=
+(0x924+1002-0xd0e);unsigned char buf[(0x532+4144-0x1462)]={(0x51d+4677-0x1762)};
+char temp_num[(0x12c4+1043-0x1673)]={(0x17a9+2105-0x1fe2)};unsigned char 
+first_octet=(0x370+3863-0x1287);unsigned char udhl=(0xd33+3164-0x198f);unsigned 
+int halftmp=(0xd62+1634-0x13c4);char tp_ra[(0x3d5+6659-0x1dd5)]={
+(0x161+6847-0x1c20)};int tmplen=(0xbf6+4588-0x1de2);unsigned char IEIDL;int 
+pushType=(0x153f+4315-0x261a);const char*pSrc=pSrcPdu;if(pSrcPdu==NULL||pDst==
 NULL){printf(
 "\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"
-);return-(0x1aff+2692-0x2582);}String2Bytes(pSrc,&tmp,(0x23+4105-0x102a));
+);return-(0x502+3192-0x1179);}String2Bytes(pSrc,&tmp,(0xab1+1341-0xfec));
 at_print(LOG_DEBUG,
 "\x44\x65\x63\x6f\x64\x65\x50\x75\x73\x68\x50\x64\x75\x20\x74\x6d\x70\x20\x3d\x20\x25\x64\x2e" "\n"
-,tmp);if(tmp==(0x1147+4367-0x2256)){pSrc+=(0xe89+4903-0x21ae);}else{tmp=(tmp-
-(0xc98+2424-0x160f))*(0x7b8+870-0xb1c);pSrc+=(0x10f6+2010-0x18cc);if(tmp>
-(0xc8d+1790-0x136b)){SerializeNumbers_sms(pSrc,pDst->SCA,(0x13f3+2874-0x1f0d));
-tmp=(0x5d+7514-0x1d97);}else{SerializeNumbers_sms(pSrc,pDst->SCA,tmp);}pSrc+=tmp
-;}String2Bytes(pSrc,&tmp,(0x18dd+3196-0x2557));first_octet=tmp;pSrc+=
-(0x460+192-0x51e);String2Bytes(pSrc,&tmp,(0x171c+846-0x1a68));halftmp=tmp;if(tmp
-&(0xda8+3474-0x1b39))tmp+=(0x182c+1921-0x1fac);pSrc+=(0x53c+4428-0x1686);memset(
-tp_ra,(0xa4f+5612-0x203b),sizeof(tp_ra));String2Bytes(pSrc,tp_ra,
-(0xa9d+5469-0x1ff8));pSrc+=(0x1848+1313-0x1d67);if((tp_ra[(0xc0+1112-0x518)]&
-(0xa0c+6421-0x22d1))==(0x8d8+4977-0x1bf9)){char tempra[(0x2d5+6935-0x1d6c)];char
- acAsc[(0x104+6711-0x1abb)];if(halftmp>=(0x2c9+3922-0x120d)){halftmp=(tmp/
-(0x1309+2695-0x1d8e))/(0xe2b+3145-0x1a6d)+(tmp/(0x1745+1042-0x1b55));}else{
-halftmp=tmp/(0x788+6870-0x225c);}memset(tempra,(0x9ab+5190-0x1df1),sizeof(tempra
-));memcpy(tempra,pSrc,tmp);memset(acAsc,(0xa78+2444-0x1404),sizeof(acAsc));
-nDstLength=String2Bytes(tempra,buf,halftmp&(0x31c+232-0x3fd)?(int)halftmp*
-(0x6bd+3529-0x147f)/(0xc15+1633-0x1272)+(0x4ca+4329-0x15b1):(int)halftmp*
-(0x389+3894-0x12b8)/(0x737+4793-0x19ec));halftmp=Decode7bit(buf,acAsc,nDstLength
-);memset(pDst->TPA,(0x32a+2886-0xe70),sizeof(pDst->TPA));if(halftmp>
-(0x460+5348-0x1924)){memcpy(pDst->TPA,acAsc,(0xf6+8656-0x22a6));tmp=
-(0xf40+987-0x12fb);}else{memcpy(pDst->TPA,acAsc,halftmp);}}else{if(tmp>
-(0xc76+1511-0x123d)){SerializeNumbers_sms(pSrc,pDst->TPA,(0x1c0a+2737-0x269b));}
-else{SerializeNumbers_sms(pSrc,pDst->TPA,tmp);}if((tp_ra[(0x2145+644-0x23c9)]&
-(0x2258+1243-0x26a2))==(0x37f+3237-0xf93)){memset(temp_num,(0xfb1+282-0x10cb),
-sizeof(temp_num));if(pDst->TPA[(0x1410+1277-0x190d)]!=
-((char)(0xaf5+3874-0x19ec))){snprintf(temp_num,sizeof(temp_num),
-"\x25\x73\x25\x73","\x2b",pDst->TPA);if(strlen(temp_num)>(0xb89+1758-0x1247)){
-snprintf(pDst->TPA,sizeof(pDst->TPA),"\x25\x33\x32\x73",temp_num);}else{snprintf
-(pDst->TPA,sizeof(pDst->TPA),"\x25\x73",temp_num);}}}}pSrc+=tmp;String2Bytes(
-pSrc,(unsigned char*)&pDst->TP_PID,(0x16fb+2972-0x2295));pSrc+=
-(0xeb0+5116-0x22aa);String2Bytes(pSrc,(unsigned char*)&pDst->TP_DCS,
-(0x36b+7166-0x1f67));pSrc+=(0x1956+29-0x1971);SerializeNumbers_sms(pSrc,pDst->
-TP_SCTS,(0x1c1+2745-0xc6c));pSrc+=(0xae2+1171-0xf67);String2Bytes(pSrc,&tmp,
-(0x12d6+2147-0x1b37));pSrc+=(0x243c+321-0x257b);memset(pDst->TP_UD,
-(0xf1f+45-0xf4c),sizeof(pDst->TP_UD));at_print(LOG_DEBUG,
+,tmp);if(tmp==(0x2fd+5888-0x19fd)){pSrc+=(0x5e7+780-0x8f1);}else{tmp=(tmp-
+(0x18d6+3521-0x2696))*(0x199+7524-0x1efb);pSrc+=(0x295+108-0x2fd);if(tmp>
+(0x433+6795-0x1e9e)){SerializeNumbers_sms(pSrc,pDst->SCA,(0x773+5465-0x1cac));
+tmp=(0x11ed+4337-0x22be);}else{SerializeNumbers_sms(pSrc,pDst->SCA,tmp);}pSrc+=
+tmp;}String2Bytes(pSrc,&tmp,(0x13e2+3970-0x2362));first_octet=tmp;pSrc+=
+(0x187+3007-0xd44);String2Bytes(pSrc,&tmp,(0x287+5993-0x19ee));halftmp=tmp;if(
+tmp&(0x6e2+3899-0x161c))tmp+=(0x324+3764-0x11d7);pSrc+=(0xb2c+6096-0x22fa);
+memset(tp_ra,(0xf73+2381-0x18c0),sizeof(tp_ra));String2Bytes(pSrc,tp_ra,
+(0x3ba+6202-0x1bf2));pSrc+=(0xb2b+5398-0x203f);if((tp_ra[(0x616+1572-0xc3a)]&
+(0x1269+1634-0x187b))==(0x3f6+7189-0x1fbb)){char tempra[(0x66f+511-0x7ee)];char 
+acAsc[(0xb62+5644-0x20ee)];if(halftmp>=(0x7d0+6231-0x2019)){halftmp=(tmp/
+(0xf67+3654-0x1dab))/(0x169b+342-0x17ea)+(tmp/(0xfca+1238-0x149e));}else{halftmp
+=tmp/(0x1549+943-0x18f6);}memset(tempra,(0x14a5+3032-0x207d),sizeof(tempra));
+memcpy(tempra,pSrc,tmp);memset(acAsc,(0x3b2+6002-0x1b24),sizeof(acAsc));
+nDstLength=String2Bytes(tempra,buf,halftmp&(0x1ae6+860-0x1e3b)?(int)halftmp*
+(0x41a+8019-0x2366)/(0x363+305-0x490)+(0x122b+2421-0x1b9e):(int)halftmp*
+(0xd5a+6349-0x2620)/(0x1677+212-0x1747));halftmp=Decode7bit(buf,acAsc,nDstLength
+);memset(pDst->TPA,(0x195c+1547-0x1f67),sizeof(pDst->TPA));if(halftmp>
+(0xd6a+2624-0x178a)){memcpy(pDst->TPA,acAsc,(0x143+7367-0x1dea));tmp=
+(0xce0+5234-0x2132);}else{memcpy(pDst->TPA,acAsc,halftmp);}}else{if(tmp>
+(0x710+6973-0x222d)){SerializeNumbers_sms(pSrc,pDst->TPA,(0x1d5b+1576-0x2363));}
+else{SerializeNumbers_sms(pSrc,pDst->TPA,tmp);}if((tp_ra[(0x1834+2577-0x2245)]&
+(0x10b1+3770-0x1eda))==(0x4c9+2112-0xc78)){memset(temp_num,(0x66b+594-0x8bd),
+sizeof(temp_num));if(pDst->TPA[(0x1f83+524-0x218f)]!=((char)(0x2013+923-0x2383))
+){snprintf(temp_num,sizeof(temp_num),"\x25\x73\x25\x73","\x2b",pDst->TPA);if(
+strlen(temp_num)>(0x1dec+540-0x1fe8)){snprintf(pDst->TPA,sizeof(pDst->TPA),
+"\x25\x33\x32\x73",temp_num);}else{snprintf(pDst->TPA,sizeof(pDst->TPA),
+"\x25\x73",temp_num);}}}}pSrc+=tmp;String2Bytes(pSrc,(unsigned char*)&pDst->
+TP_PID,(0xc3d+4907-0x1f66));pSrc+=(0x106c+1323-0x1595);String2Bytes(pSrc,(
+unsigned char*)&pDst->TP_DCS,(0xd91+1597-0x13cc));pSrc+=(0xcd2+751-0xfbf);
+SerializeNumbers_sms(pSrc,pDst->TP_SCTS,(0xf6c+4518-0x2104));pSrc+=
+(0xfaf+3570-0x1d93);String2Bytes(pSrc,&tmp,(0x11fa+107-0x1263));pSrc+=
+(0xa90+2998-0x1644);memset(pDst->TP_UD,(0x20e9+1132-0x2555),sizeof(pDst->TP_UD))
+;at_print(LOG_DEBUG,
 "\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"
-,first_octet);if(first_octet&(0x1cd+7002-0x1ce7)){const char*temp=pSrc;unsigned 
-char pduType;unsigned char wspLen;unsigned char udhLen;unsigned char DestPort1;
+,first_octet);if(first_octet&(0x1249+4494-0x2397)){const char*temp=pSrc;unsigned
+ char pduType;unsigned char wspLen;unsigned char udhLen;unsigned char DestPort1;
 unsigned char DestPort2;unsigned char RefNum1;unsigned char RefNum2;pushType=
-SMS_NO_PUSH;String2Bytes(temp,&udhl,(0x187c+1567-0x1e99));temp+=
-(0x51f+1069-0x94a);tmplen=String2Bytes(temp,&pDst->TP_IEI,(0x607+1147-0xa80));
+SMS_NO_PUSH;String2Bytes(temp,&udhl,(0xb12+5751-0x2187));temp+=
+(0x1651+2787-0x2132);tmplen=String2Bytes(temp,&pDst->TP_IEI,(0x416+121-0x48d));
 at_print(LOG_DEBUG,
 "\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"
-,pDst->TP_IEI);if(pDst->TP_IEI==(0x17d4+895-0x1b4e)){temp+=(0x750+8030-0x26ac)*
-tmplen+(0x1526+1079-0x195b);tmplen=String2Bytes(temp,&DestPort1,
-(0xf56+1309-0x1471));at_print(LOG_DEBUG,
+,pDst->TP_IEI);if(pDst->TP_IEI==(0x216+6670-0x1c1f)){temp+=(0x10d+1169-0x59c)*
+tmplen+(0x739+482-0x919);tmplen=String2Bytes(temp,&DestPort1,(0x911+1959-0x10b6)
+);at_print(LOG_DEBUG,
 "\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"
-,DestPort1);temp+=(0x1d9f+1314-0x22bf)*tmplen;tmplen=String2Bytes(temp,&
-DestPort2,(0x1df+7653-0x1fc2));at_print(LOG_DEBUG,
+,DestPort1);temp+=(0x357+7367-0x201c)*tmplen;tmplen=String2Bytes(temp,&DestPort2
+,(0x1f23+405-0x20b6));at_print(LOG_DEBUG,
 "\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"
-,DestPort2);if((DestPort1==(0x620+2218-0xebf))&&((DestPort2==(0xd81+4279-0x1db4)
-)||(DestPort2==(0x17d5+3850-0x265a)))){pushType=SMS_PUSH;}}if(SMS_PUSH!=pushType
-){return pushType;}temp=pSrc+udhl*(0x1470+4060-0x244a)+(0xcd7+3398-0x1a19);
-tmplen=String2Bytes(temp,&pduType,(0x1018+4165-0x205b));if(pduType==
-(0x74d+4326-0x182d)){pushType=SMS_PUSH;temp+=(0x1a8b+2302-0x2385);tmplen=
-String2Bytes(temp,&pduType,(0x72d+1510-0xd11));if(pduType==(0x1a9+1246-0x5c3)){
-pushType=SMS_NOTIFICATION;}else{temp+=(0xdfc+784-0x1108);tmplen=String2Bytes(
-temp,&pduType,(0xbff+2016-0x13dd));if((pduType==(0xcb6+5454-0x2142))||(pduType==
-(0x8e4+284-0x94a))){pushType=SMS_BOOTSTRAP;}}}if((pDst->TP_IEI==
-(0x19b+6285-0x1a24))||(pDst->TP_IEI==(0x1c77+1393-0x21e3))||(pDst->TP_IEI==
-(0x1465+4352-0x255d))){temp=pSrc+(0x123+1018-0x519);tmplen=String2Bytes(temp,&
-IEIDL,(0xb1c+1228-0xfe6));if(IEIDL==(udhl-(0x13+7739-0x1e4c))){}else{temp+=
-(0x1e1f+252-0x1f19)*(0x1a2f+7-0x1a30);tmplen=String2Bytes(temp,&udhLen,
-(0xe72+3730-0x1d02));if(udhLen==(0x111+1744-0x7de)){temp+=(0x1756+1836-0x1e80)*
-tmplen;tmplen=String2Bytes(temp,&RefNum1,(0xa8a+6224-0x22d8));pDst->TP_ReferNum=
-RefNum1;temp+=(0xb29+4197-0x1b8c)*tmplen;tmplen=String2Bytes(temp,&pDst->
-TP_AllPieceNum,(0x16c7+3836-0x25c1));temp+=(0x1393+2158-0x1bff)*tmplen;tmplen=
-String2Bytes(temp,&pDst->TP_CurrentPieceNum,(0x637+3676-0x1491));temp+=
-(0x8a2+3653-0x16e5)*tmplen;}else if(udhLen==(0xa42+3986-0x19d0)){temp+=
-(0x12ef+4363-0x23f8)*tmplen;tmplen=String2Bytes(temp,&RefNum1,
-(0xfbd+4195-0x201e));temp+=(0x11b8+4098-0x21b8)*tmplen;tmplen=String2Bytes(temp,
-&RefNum2,(0x1ed9+646-0x215d));int ReferNum=RefNum2+RefNum1*(0xcc8+2201-0x1461);
-pDst->TP_ReferNum=ReferNum;temp+=(0x1d6d+1150-0x21e9)*tmplen;tmplen=String2Bytes
-(temp,&pDst->TP_AllPieceNum,(0x7cd+5815-0x1e82));temp+=(0x3ab+2637-0xdf6)*tmplen
-;tmplen=String2Bytes(temp,&pDst->TP_CurrentPieceNum,(0x5f4+2679-0x1069));temp+=
-(0xdab+2043-0x15a4)*tmplen;}}}at_print(LOG_DEBUG,
+,DestPort2);if((DestPort1==(0x188f+424-0x1a2c))&&((DestPort2==
+(0x813+5834-0x1e59))||(DestPort2==(0x3a6+579-0x564)))){pushType=SMS_PUSH;}}if(
+SMS_PUSH!=pushType){return pushType;}temp=pSrc+udhl*(0x1ac8+1547-0x20d1)+
+(0x110f+4669-0x2348);tmplen=String2Bytes(temp,&pduType,(0x45b+4636-0x1675));if(
+pduType==(0x1e55+2232-0x2707)){pushType=SMS_PUSH;temp+=(0xd1c+1253-0x11fd);
+tmplen=String2Bytes(temp,&pduType,(0xfe8+2093-0x1813));if(pduType==
+(0x1c9+6824-0x1bad)){pushType=SMS_NOTIFICATION;}else{temp+=(0xfd5+2887-0x1b18);
+tmplen=String2Bytes(temp,&pduType,(0x170c+780-0x1a16));if((pduType==
+(0x990+2421-0x1243))||(pduType==(0x1862+3497-0x2555))){pushType=SMS_BOOTSTRAP;}}
+}if((pDst->TP_IEI==(0x60d+3420-0x1365))||(pDst->TP_IEI==(0xa6f+4210-0x1adc))||(
+pDst->TP_IEI==(0x8f7+427-0xa9a))){temp=pSrc+(0x633+5677-0x1c5c);tmplen=
+String2Bytes(temp,&IEIDL,(0xfd3+4308-0x20a5));if(IEIDL==(udhl-
+(0x11a1+754-0x1491))){}else{temp+=(0xe32+4110-0x1e3e)*(0xf71+5370-0x2465);tmplen
+=String2Bytes(temp,&udhLen,(0x2531+438-0x26e5));if(udhLen==(0x57f+7369-0x2245)){
+temp+=(0x1eb+7146-0x1dd3)*tmplen;tmplen=String2Bytes(temp,&RefNum1,
+(0x1ef+1234-0x6bf));pDst->TP_ReferNum=RefNum1;temp+=(0xaab+2610-0x14db)*tmplen;
+tmplen=String2Bytes(temp,&pDst->TP_AllPieceNum,(0x26f+9164-0x2639));temp+=
+(0x175f+816-0x1a8d)*tmplen;tmplen=String2Bytes(temp,&pDst->TP_CurrentPieceNum,
+(0x1995+1888-0x20f3));temp+=(0x5ea+181-0x69d)*tmplen;}else if(udhLen==
+(0x17b4+222-0x188e)){temp+=(0x126+9605-0x26a9)*tmplen;tmplen=String2Bytes(temp,&
+RefNum1,(0x599+6102-0x1d6d));temp+=(0xc97+2256-0x1565)*tmplen;tmplen=
+String2Bytes(temp,&RefNum2,(0x11df+3083-0x1de8));int ReferNum=RefNum2+RefNum1*
+(0x2f7+8943-0x24e6);pDst->TP_ReferNum=ReferNum;temp+=(0x1c49+2167-0x24be)*tmplen
+;tmplen=String2Bytes(temp,&pDst->TP_AllPieceNum,(0x1c20+304-0x1d4e));temp+=
+(0x704+7441-0x2413)*tmplen;tmplen=String2Bytes(temp,&pDst->TP_CurrentPieceNum,
+(0xe6d+413-0x1008));temp+=(0xbd7+5242-0x204f)*tmplen;}}}at_print(LOG_DEBUG,
 "\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"
 ,pDst->TP_ReferNum,pDst->TP_AllPieceNum,pDst->TP_CurrentPieceNum);if(
-SMS_NOTIFICATION==pushType){temp=pSrc+udhl*(0x4b2+3608-0x12c8)+
-(0xa7b+2725-0x151a);tmplen=String2Bytes(temp,&wspLen,(0xbdf+773-0xee2));temp=
-temp+wspLen*(0x67f+2371-0xfc0)+(0xb05+70-0xb49);}else{temp=pSrc+udhl*
-(0x5e3+277-0x6f6)+(0x607+4048-0x15d5);}nDstLength=((strlen(temp)<sizeof(pDst->
-TP_UD))?strlen(temp):(sizeof(pDst->TP_UD)-(0x8c8+6955-0x23f2)));memcpy(pDst->
+SMS_NOTIFICATION==pushType){temp=pSrc+udhl*(0x172b+1995-0x1ef4)+
+(0x104b+2733-0x1af2);tmplen=String2Bytes(temp,&wspLen,(0x1129+4135-0x214e));temp
+=temp+wspLen*(0x2295+118-0x2309)+(0x7d8+4044-0x17a2);}else{temp=pSrc+udhl*
+(0x4ba+8435-0x25ab)+(0x1765+629-0x19d8);}nDstLength=((strlen(temp)<sizeof(pDst->
+TP_UD))?strlen(temp):(sizeof(pDst->TP_UD)-(0x1e3+2281-0xacb)));memcpy(pDst->
 TP_UD,temp,nDstLength);at_print(LOG_DEBUG,
 "\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"
 ,pDst->TP_UD);}at_print(LOG_DEBUG,
 "\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"
 ,pushType);return pushType;}static int SerializeNumbers_sms(const char*pSrc,char
-*pDst,int nSrcLength){int nDstLength;char ch;int i=(0xb39+1688-0x11d1);if(pSrc==
-NULL||pDst==NULL||nSrcLength<(0x1abb+1968-0x226b)){return-(0x15b3+3237-0x2257);}
-nDstLength=nSrcLength;for(i=(0xaa0+2964-0x1634);i<nSrcLength;i+=
-(0x372+1810-0xa82)){ch=*pSrc++;*pDst++=*pSrc++;*pDst++=ch;}if(*(pDst-
-(0x96d+4027-0x1927))==((char)(0x1145+5641-0x2708))){pDst--;nDstLength--;}*pDst=
-'\0';return nDstLength;}UINT16 wms_ts_pack_gw_7_bit_chars(const UINT8*in,UINT16 
-in_len,UINT16 shift,UINT16 out_len_max,UINT8*out){UINT16 i=(0x15fa+273-0x170b);
-UINT16 pos=(0xbfa+5052-0x1fb6);if(in==NULL||out==NULL){at_print(LOG_DEBUG,
+*pDst,int nSrcLength){int nDstLength;char ch;int i=(0xad3+4102-0x1ad9);if(pSrc==
+NULL||pDst==NULL||nSrcLength<(0xca5+554-0xecf)){return-(0x4ca+8412-0x25a5);}
+nDstLength=nSrcLength;for(i=(0xb52+3308-0x183e);i<nSrcLength;i+=
+(0x7c6+483-0x9a7)){ch=*pSrc++;*pDst++=*pSrc++;*pDst++=ch;}if(*(pDst-
+(0x1e4d+59-0x1e87))==((char)(0x341+3235-0xf9e))){pDst--;nDstLength--;}*pDst='\0'
+;return nDstLength;}UINT16 wms_ts_pack_gw_7_bit_chars(const UINT8*in,UINT16 
+in_len,UINT16 shift,UINT16 out_len_max,UINT8*out){UINT16 i=(0x1204+2996-0x1db8);
+UINT16 pos=(0xb54+3949-0x1ac1);if(in==NULL||out==NULL){at_print(LOG_DEBUG,
 "\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"
-);return(0x1b24+2076-0x2340);}shift%=(0x10a2+2088-0x18c3);if(shift!=
-(0xbcd+2666-0x1637)){out[pos]|=(UINT8)(in[i]<<shift);shift=((0x2065+1627-0x26b9)
--shift)+(0x1059+4325-0x213d);if(shift==(0xf79+4642-0x2194)){shift=
-(0xc22+5416-0x214a);i++;}pos++;}for(;pos<out_len_max&&i<in_len;pos++,i++){out[
-pos]=in[i]>>shift;if(i+(0x2569+341-0x26bd)<in_len){out[pos]|=(UINT8)(in[i+
-(0x92f+6563-0x22d1)]<<((0x1ea2+6-0x1ea1)-shift));shift++;if(shift==
-(0xf16+5565-0x24cc)){shift=(0x97a+128-0x9fa);i++;}}}return pos;}UINT8 
+);return(0x1b03+1101-0x1f50);}shift%=(0x8cd+6668-0x22d2);if(shift!=
+(0x63+1579-0x68e)){out[pos]|=(UINT8)(in[i]<<shift);shift=((0x6b5+3901-0x15eb)-
+shift)+(0xfc9+2901-0x1b1d);if(shift==(0x1f6+6416-0x1aff)){shift=
+(0x541+6096-0x1d11);i++;}pos++;}for(;pos<out_len_max&&i<in_len;pos++,i++){out[
+pos]=in[i]>>shift;if(i+(0x2c+1492-0x5ff)<in_len){out[pos]|=(UINT8)(in[i+
+(0x2295+26-0x22ae)]<<((0xab5+6740-0x2502)-shift));shift++;if(shift==
+(0x173+2543-0xb5b)){shift=(0xe12+1629-0x146f);i++;}}}return pos;}UINT8 
 wms_ts_encode_address(const wms_address_s_type*addr,UINT8*data){UINT8 i,pos=
-(0x107f+1161-0x1508);if(addr->number_of_digits>WMS_GW_ADDRESS_MAX){at_print(
+(0x228+6460-0x1b64);if(addr->number_of_digits>WMS_GW_ADDRESS_MAX){at_print(
 LOG_DEBUG,
 "\x41\x64\x64\x72\x20\x6c\x65\x6e\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x20\x25\x64"
-,addr->number_of_digits);return(0x928+5685-0x1f5d);}if(addr->number_type==
+,addr->number_of_digits);return(0xf49+4921-0x2282);}if(addr->number_type==
 WMS_NUMBER_ALPHANUMERIC){data[pos]=(UINT8)((addr->number_of_digits*
-(0x14fb+4352-0x25f4)+(0x1103+670-0x139e))/(0x17a0+429-0x1949));}else{data[pos]=
-addr->number_of_digits;}pos++;data[pos]=(0xac1+6844-0x24fd);data[pos]|=(UINT8)((
-UINT8)addr->number_type<<(0xc5c+1544-0x1260));data[pos]|=(UINT8)addr->
+(0x108a+4335-0x2172)+(0x50+2550-0xa43))/(0x23f+7877-0x2100));}else{data[pos]=
+addr->number_of_digits;}pos++;data[pos]=(0x15e2+1365-0x1ab7);data[pos]|=(UINT8)(
+(UINT8)addr->number_type<<(0x16a1+179-0x1750));data[pos]|=(UINT8)addr->
 number_plan;pos++;if(addr->number_type==WMS_NUMBER_ALPHANUMERIC){pos+=(UINT8)
 wms_ts_pack_gw_7_bit_chars(addr->digits,addr->number_of_digits,
-(0xbf0+6548-0x2584),WMS_GW_ADDRESS_MAX,&data[pos]);}else{for(i=
-(0xeb4+1088-0x12f4);i<addr->number_of_digits;i++){data[pos]=(UINT8)(addr->digits
-[i++]&(0x21b+6438-0x1b32));{data[pos]|=(UINT8)(addr->digits[i]<<
-(0x517+1731-0xbd6));}pos++;}}return pos;}UINT8 wms_ts_encode_dcs(const 
-wms_gw_dcs_s_type*dcs,UINT8*data){UINT8 pos=(0x17a5+2994-0x2357);if(dcs->
+(0x2e2+7422-0x1fe0),WMS_GW_ADDRESS_MAX,&data[pos]);}else{for(i=
+(0x805+5823-0x1ec4);i<addr->number_of_digits;i++){data[pos]=(UINT8)(addr->digits
+[i++]&(0x1ec5+796-0x21d2));{data[pos]|=(UINT8)(addr->digits[i]<<
+(0x2149+1379-0x26a8));}pos++;}}return pos;}UINT8 wms_ts_encode_dcs(const 
+wms_gw_dcs_s_type*dcs,UINT8*data){UINT8 pos=(0x1384+4931-0x26c7);if(dcs->
 msg_waiting==WMS_GW_MSG_WAITING_NONE){data[pos]=dcs->is_compressed?
-(0x497+3674-0x12d1):(0x191a+1017-0x1d13);data[pos]|=(dcs->msg_class!=
-WMS_MESSAGE_CLASS_NONE)?(0x635+1880-0xd7d):(0x19d0+2330-0x22ea);data[pos]|=dcs->
-alphabet<<(0x1674+2374-0x1fb8);data[pos]|=dcs->msg_class&(0x20ea+872-0x244f);}
+(0x38d+3810-0x124f):(0x7e9+6472-0x2131);data[pos]|=(dcs->msg_class!=
+WMS_MESSAGE_CLASS_NONE)?(0xda1+4051-0x1d64):(0xc3f+4992-0x1fbf);data[pos]|=dcs->
+alphabet<<(0x182d+2644-0x227f);data[pos]|=dcs->msg_class&(0x15b8+495-0x17a4);}
 else if(dcs->msg_waiting==WMS_GW_MSG_WAITING_NONE_1111){data[pos]=
-(0x1f6+4765-0x13a3);if(dcs->alphabet==WMS_GW_ALPHABET_8_BIT)data[pos]|=
-(0xc2d+2322-0x153b);data[pos]|=dcs->msg_class&(0x7d2+6223-0x201e);}else{if(dcs->
-msg_waiting==WMS_GW_MSG_WAITING_DISCARD){data[pos]=(0x436+6207-0x1bb5);}else if(
-dcs->msg_waiting==WMS_GW_MSG_WAITING_STORE&&dcs->alphabet==
-WMS_GW_ALPHABET_7_BIT_DEFAULT){data[pos]=(0x6e9+183-0x6d0);}else{data[pos]=
-(0x19bf+1712-0x1f8f);}data[pos]|=(dcs->msg_waiting_active==TRUE)?
-(0x5d+1768-0x73d):(0x1136+3395-0x1e79);data[pos]|=dcs->msg_waiting_kind&
-(0x211+7771-0x2069);}pos++;return pos;}UINT8 wms_ts_bcd_to_int(const UINT8 bcd,
-UINT8*result){unsigned char low_bit=(bcd&(0x1ddd+1889-0x252f));unsigned char 
-high_bit=((bcd&(0x1346+2342-0x1b7c))>>(0x805+3319-0x14f8));if(low_bit>
-(0xc0d+2247-0x14cb)||high_bit>(0x858+2432-0x11cf)){at_print(LOG_DEBUG,
+(0x126a+4849-0x246b);if(dcs->alphabet==WMS_GW_ALPHABET_8_BIT)data[pos]|=
+(0xc3a+1397-0x11ab);data[pos]|=dcs->msg_class&(0x16e5+1136-0x1b52);}else{if(dcs
+->msg_waiting==WMS_GW_MSG_WAITING_DISCARD){data[pos]=(0x1960+381-0x1a1d);}else 
+if(dcs->msg_waiting==WMS_GW_MSG_WAITING_STORE&&dcs->alphabet==
+WMS_GW_ALPHABET_7_BIT_DEFAULT){data[pos]=(0x189d+3787-0x2698);}else{data[pos]=
+(0x226b+1007-0x257a);}data[pos]|=(dcs->msg_waiting_active==TRUE)?
+(0x214+7996-0x2148):(0x1688+2096-0x1eb8);data[pos]|=dcs->msg_waiting_kind&
+(0x10b9+5695-0x26f5);}pos++;return pos;}UINT8 wms_ts_bcd_to_int(const UINT8 bcd,
+UINT8*result){unsigned char low_bit=(bcd&(0x1b3f+2820-0x2634));unsigned char 
+high_bit=((bcd&(0x6ca+4946-0x192c))>>(0x125+4775-0x13c8));if(low_bit>
+(0x1038+3847-0x1f36)||high_bit>(0x74b+7219-0x2375)){at_print(LOG_DEBUG,
 "\x49\x6e\x76\x61\x6c\x69\x64\x20\x42\x43\x44\x20\x64\x69\x67\x69\x74\x21");*
-result=(0x1b5f+2454-0x24f5);return FALSE;}else{*result=((bcd&(0x19d4+208-0x1a95)
-)+(((bcd&(0x164+5950-0x17b2))>>(0x664+4653-0x188d))*(0x10a2+3136-0x1cd8)));
-return TRUE;}}UINT8 wms_ts_encode_timestamp(const wms_timestamp_s_type*timestamp
-,UINT8*data){sint7 i;UINT8 pos=(0x1877+1484-0x1e43),j;if(!wms_ts_bcd_to_int(
-timestamp->year,&j)){return(0x66d+6065-0x1e1e);}data[pos]=((timestamp->year&
-(0x1440+2606-0x1e5f))<<(0x1070+3863-0x1f83))+((timestamp->year&
-(0xd66+5032-0x201e))>>(0x6ed+736-0x9c9));pos++;if(wms_ts_bcd_to_int(timestamp->
-month,&j)){if(j>(0x11c2+3693-0x2023)||j<(0x12d6+4207-0x2344)){at_print(LOG_DEBUG
+result=(0x2ea+8166-0x22d0);return FALSE;}else{*result=((bcd&(0x1cf+1384-0x728))+
+(((bcd&(0x16c3+89-0x162c))>>(0x18f2+1666-0x1f70))*(0xd78+366-0xedc)));return 
+TRUE;}}UINT8 wms_ts_encode_timestamp(const wms_timestamp_s_type*timestamp,UINT8*
+data){sint7 i;UINT8 pos=(0x3bf+778-0x6c9),j;if(!wms_ts_bcd_to_int(timestamp->
+year,&j)){return(0x1129+4784-0x23d9);}data[pos]=((timestamp->year&
+(0x1615+3761-0x24b7))<<(0x235+4504-0x13c9))+((timestamp->year&
+(0x7cd+3673-0x1536))>>(0x1126+4896-0x2442));pos++;if(wms_ts_bcd_to_int(timestamp
+->month,&j)){if(j>(0xb62+1757-0x1233)||j<(0x1c4d+787-0x1f5f)){at_print(LOG_DEBUG
 ,
 "\x4d\x6f\x6e\x74\x68\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
-,j);return(0x250+8731-0x246b);}}else{return(0x12b3+3549-0x2090);}data[pos]=((
-timestamp->month&(0x438+1495-0xa00))<<(0xb5a+188-0xc12))+((timestamp->month&
-(0x16c1+4186-0x262b))>>(0x4cc+6432-0x1de8));pos++;if(wms_ts_bcd_to_int(timestamp
-->day,&j)){if(j>(0x1077+3450-0x1dd2)||j<(0x914+1235-0xde6)){at_print(LOG_DEBUG,
+,j);return(0x1424+2867-0x1f57);}}else{return(0x219+2379-0xb64);}data[pos]=((
+timestamp->month&(0x16f9+3296-0x23ca))<<(0xb03+4088-0x1af7))+((timestamp->month&
+(0x474+4853-0x1679))>>(0x144d+3228-0x20e5));pos++;if(wms_ts_bcd_to_int(timestamp
+->day,&j)){if(j>(0x11b2+360-0x12fb)||j<(0x2144+632-0x23bb)){at_print(LOG_DEBUG,
 "\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);
-return(0xaa1+7069-0x263e);}}else{return(0x8dc+911-0xc6b);}data[pos]=((timestamp
-->day&(0xf38+119-0xfa0))<<(0x71+659-0x300))+((timestamp->day&(0x98a+367-0xa09))
->>(0x12b7+3382-0x1fe9));pos++;if(wms_ts_bcd_to_int(timestamp->hour,&j)){if(j>
-(0x108+6321-0x19a2)){at_print(LOG_DEBUG,
+return(0xf32+5266-0x23c4);}}else{return(0x8f0+2045-0x10ed);}data[pos]=((
+timestamp->day&(0xc3f+6411-0x253b))<<(0x50+4385-0x116d))+((timestamp->day&
+(0xf6a+3957-0x1def))>>(0x405+3192-0x1079));pos++;if(wms_ts_bcd_to_int(timestamp
+->hour,&j)){if(j>(0x1e2+4241-0x125c)){at_print(LOG_DEBUG,
 "\x48\x6f\x75\x72\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j
-);return(0x227+3338-0xf31);}}else{return(0xfd9+2327-0x18f0);}data[pos]=((
-timestamp->hour&(0x340+3127-0xf68))<<(0xf19+1620-0x1569))+((timestamp->hour&
-(0x2500+241-0x2501))>>(0x966+1300-0xe76));pos++;if(wms_ts_bcd_to_int(timestamp->
-minute,&j)){if(j>(0xda+6854-0x1b65)){at_print(LOG_DEBUG,
+);return(0x487+156-0x523);}}else{return(0x1250+2895-0x1d9f);}data[pos]=((
+timestamp->hour&(0x713+7596-0x24b0))<<(0x191b+296-0x1a3f))+((timestamp->hour&
+(0x3a1+5282-0x1753))>>(0xaba+5210-0x1f10));pos++;if(wms_ts_bcd_to_int(timestamp
+->minute,&j)){if(j>(0x1122+2344-0x1a0f)){at_print(LOG_DEBUG,
 "\x4d\x69\x6e\x75\x74\x65\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
-,j);return(0x1576+2887-0x20bd);}}else{return(0x1d0f+1239-0x21e6);}data[pos]=((
-timestamp->minute&(0x4e2+4241-0x1564))<<(0x37d+5598-0x1957))+((timestamp->minute
-&(0xb99+964-0xe6d))>>(0xf1c+5635-0x251b));pos++;if(wms_ts_bcd_to_int(timestamp->
-second,&j)){if(j>(0x1e55+759-0x2111)){at_print(LOG_DEBUG,
+,j);return(0xf34+1036-0x1340);}}else{return(0x2d2+457-0x49b);}data[pos]=((
+timestamp->minute&(0x564+903-0x8dc))<<(0xfa4+4671-0x21df))+((timestamp->minute&
+(0x1983+1470-0x1e51))>>(0xf0f+3076-0x1b0f));pos++;if(wms_ts_bcd_to_int(timestamp
+->second,&j)){if(j>(0x1132+1254-0x15dd)){at_print(LOG_DEBUG,
 "\x53\x65\x63\x6f\x6e\x64\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
-,j);return(0x20b+9096-0x2593);}}else{return(0xd90+3491-0x1b33);}data[pos]=((
-timestamp->second&(0x197+200-0x250))<<(0x30+3999-0xfcb))+((timestamp->second&
-(0x49f+6500-0x1d13))>>(0x83b+5917-0x1f54));pos++;i=(sint7)timestamp->timezone;if
-(i>(0x148a+4400-0x258a)||i<-(0x14fc+387-0x164f)){at_print(LOG_DEBUG,
+,j);return(0x12b2+1240-0x178a);}}else{return(0x1bb8+1287-0x20bf);}data[pos]=((
+timestamp->second&(0x479+3102-0x1088))<<(0xeb+7252-0x1d3b))+((timestamp->second&
+(0x5cf+3036-0x10bb))>>(0xd8f+3948-0x1cf7));pos++;i=(sint7)timestamp->timezone;if
+(i>(0x2098+787-0x237b)||i<-(0x6bc+6378-0x1f76)){at_print(LOG_DEBUG,
 "\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"
-,i);return(0x1a87+2013-0x2264);}if(i>=(0x14a5+413-0x1642)){data[pos]=(UINT8)(((
-UINT8)(i%(0x452+1208-0x900)))<<(0xc29+6215-0x246c));data[pos]|=(i/
-(0x5c+2111-0x891));}else{i*=(-(0x4ca+3616-0x12e9));data[pos]=(UINT8)(((UINT8)(i%
-(0x212+4911-0x1537)))<<(0x16f5+3779-0x25b4));data[pos]|=(i/(0x1495+321-0x15cc));
-data[pos]|=(0x7dc+1632-0xe34);}pos++;return pos;}UINT8 wms_ts_get_udh_length(
-const wms_udh_s_type*udh){UINT8 length=(0x796+860-0xaf2);if(udh!=NULL){switch(
-udh->header_id){case WMS_UDH_CONCAT_8:length=(0x213+6904-0x1d0a)+
-(0x105+5021-0x14a1)+WMS_UDH_OCTETS_CONCAT8;break;case WMS_UDH_CONCAT_16:length=
-(0xffb+2837-0x1b0f)+(0x1260+3881-0x2188)+WMS_UDH_OCTETS_CONCAT16;break;case 
-WMS_UDH_SPECIAL_SM:length=(0x7a+4284-0x1135)+(0xb3c+4125-0x1b58)+
-WMS_UDH_OCTETS_SPECIAL_SM;break;case WMS_UDH_PORT_8:length=(0xe78+3273-0x1b40)+
-(0x440+4299-0x150a)+WMS_UDH_OCTETS_PORT8;break;case WMS_UDH_PORT_16:length=
-(0x1b4f+789-0x1e63)+(0xb90+181-0xc44)+WMS_UDH_OCTETS_PORT16;break;case 
-WMS_UDH_SMSC_CONTROL:length=(0xa42+1430-0xfd7)+(0xe69+3694-0x1cd6)+udh->u.other.
-header_length;break;case WMS_UDH_SOURCE:length=(0x83c+3107-0x145e)+
-(0x18fa+1170-0x1d8b)+udh->u.other.header_length;break;case WMS_UDH_WCMP:length=
-(0x30f+1116-0x76a)+(0x11ab+4636-0x23c6)+udh->u.other.header_length;break;case 
+,i);return(0x176+4642-0x1398);}if(i>=(0x9ab+1062-0xdd1)){data[pos]=(UINT8)(((
+UINT8)(i%(0x19f8+2826-0x24f8)))<<(0x160+1809-0x86d));data[pos]|=(i/
+(0x778+515-0x971));}else{i*=(-(0x52+8534-0x21a7));data[pos]=(UINT8)(((UINT8)(i%
+(0xbe7+4977-0x1f4e)))<<(0x503+2106-0xd39));data[pos]|=(i/(0x1323+2395-0x1c74));
+data[pos]|=(0x1628+4060-0x25fc);}pos++;return pos;}UINT8 wms_ts_get_udh_length(
+const wms_udh_s_type*udh){UINT8 length=(0xfa9+4832-0x2289);if(udh!=NULL){switch(
+udh->header_id){case WMS_UDH_CONCAT_8:length=(0xb94+490-0xd7d)+
+(0xe08+4884-0x211b)+WMS_UDH_OCTETS_CONCAT8;break;case WMS_UDH_CONCAT_16:length=
+(0xdc6+1674-0x144f)+(0x2ff+1442-0x8a0)+WMS_UDH_OCTETS_CONCAT16;break;case 
+WMS_UDH_SPECIAL_SM:length=(0x1aaa+517-0x1cae)+(0x12c4+2179-0x1b46)+
+WMS_UDH_OCTETS_SPECIAL_SM;break;case WMS_UDH_PORT_8:length=(0x159b+1406-0x1b18)+
+(0x731+5784-0x1dc8)+WMS_UDH_OCTETS_PORT8;break;case WMS_UDH_PORT_16:length=
+(0x1a72+1993-0x223a)+(0x16fb+1457-0x1cab)+WMS_UDH_OCTETS_PORT16;break;case 
+WMS_UDH_SMSC_CONTROL:length=(0x2b6+2151-0xb1c)+(0x1148+5267-0x25da)+udh->u.other
+.header_length;break;case WMS_UDH_SOURCE:length=(0x37+367-0x1a5)+
+(0x2e0+1450-0x889)+udh->u.other.header_length;break;case WMS_UDH_WCMP:length=
+(0x472+1598-0xaaf)+(0x13ab+3874-0x22cc)+udh->u.other.header_length;break;case 
 WMS_UDH_TEXT_FORMATING:if(!udh->u.text_formating.is_color_present){length=
-(0xfcc+3858-0x1edd)+(0x21d6+510-0x23d3)+WMS_UDH_OCTETS_TEXT_FORMATTING;}else{
-length=(0x1ea5+1050-0x22be)+(0x354+4963-0x16b6)+WMS_UDH_OCTETS_TEXT_FORMATTING+
-(0xe1a+735-0x10f8);}break;case WMS_UDH_PRE_DEF_SOUND:length=(0x1a50+230-0x1b35)+
-(0x17cc+1867-0x1f16)+WMS_UDH_OCTETS_PRE_DEF;break;case WMS_UDH_USER_DEF_SOUND:
-length=(0x1c3d+532-0x1e50)+(0x3a+1900-0x7a5)+udh->u.user_def_sound.data_length+
-(0xbf4+2967-0x178a);break;case WMS_UDH_PRE_DEF_ANIM:length=(0x3d2+7034-0x1f4b)+
-(0xb4b+2760-0x1612)+WMS_UDH_OCTETS_PRE_DEF;break;case WMS_UDH_LARGE_ANIM:length=
-(0x1651+3829-0x2545)+(0x122b+3838-0x2128)+WMS_UDH_LARGE_BITMAP_SIZE*
-WMS_UDH_ANIM_NUM_BITMAPS+(0x11a3+927-0x1541);break;case WMS_UDH_SMALL_ANIM:
-length=(0xd45+4619-0x1f4f)+(0x1090+4491-0x221a)+WMS_UDH_SMALL_BITMAP_SIZE*
-WMS_UDH_ANIM_NUM_BITMAPS+(0x31a+2590-0xd37);break;case WMS_UDH_LARGE_PICTURE:
-length=(0x5cf+5667-0x1bf1)+(0xb50+4090-0x1b49)+WMS_UDH_LARGE_PIC_SIZE+
-(0x8a+9633-0x262a);break;case WMS_UDH_SMALL_PICTURE:length=(0x1476+1863-0x1bbc)+
-(0xa1c+5414-0x1f41)+WMS_UDH_SMALL_PIC_SIZE+(0x98a+1916-0x1105);break;case 
-WMS_UDH_VAR_PICTURE:length=(0x17fd+3821-0x26e9)+(0x263+6902-0x1d58)+(UINT8)(udh
-->u.var_picture.height*udh->u.var_picture.width/(0x98+1530-0x68a))+
-(0x4c1+4141-0x14eb);break;case WMS_UDH_RFC822:length=(0xd3f+207-0xe0d)+
-(0x1362+2467-0x1d04)+WMS_UDH_OCTETS_RFC822;break;case WMS_UDH_NAT_LANG_SS:length
-=(0x5db+7934-0x24d8)+(0x5e4+226-0x6c5)+WMS_UDH_OCTETS_NAT_LANG_SS;break;case 
-WMS_UDH_NAT_LANG_LS:length=(0xbf4+4104-0x1bfb)+(0x885+77-0x8d1)+
-WMS_UDH_OCTETS_NAT_LANG_LS;break;case WMS_UDH_USER_PROMPT:length=
-(0xd7a+3309-0x1a66)+(0x3d+9587-0x25af)+WMS_UDH_OCTETS_USER_PROMPT;break;case 
-WMS_UDH_EXTENDED_OBJECT:length=(0xba1+2797-0x168d)+(0x1c45+1516-0x2230)+udh->u.
-eo.content.length;if(udh->u.eo.first_segment==TRUE){length+=
-WMS_UDH_OCTETS_EO_HEADER;}break;default:length=(0x1ed+3771-0x10a7)+
-(0x1e6a+1643-0x24d4)+udh->u.other.header_length;break;}}return length;}uint32 
-wms_ts_compute_user_data_header_length(const UINT8 num_headers,const 
-wms_udh_s_type*headers){uint32 length=(0x3c4+276-0x4d8);uint32 i;if(headers==
-NULL){at_print(LOG_DEBUG,
+(0x8bf+5244-0x1d3a)+(0x3f6+7609-0x21ae)+WMS_UDH_OCTETS_TEXT_FORMATTING;}else{
+length=(0x197+6011-0x1911)+(0xb96+3588-0x1999)+WMS_UDH_OCTETS_TEXT_FORMATTING+
+(0xfba+872-0x1321);}break;case WMS_UDH_PRE_DEF_SOUND:length=(0xbb2+593-0xe02)+
+(0x1947+1963-0x20f1)+WMS_UDH_OCTETS_PRE_DEF;break;case WMS_UDH_USER_DEF_SOUND:
+length=(0x135a+3697-0x21ca)+(0x16d1+476-0x18ac)+udh->u.user_def_sound.
+data_length+(0xf25+4245-0x1fb9);break;case WMS_UDH_PRE_DEF_ANIM:length=
+(0x348+6155-0x1b52)+(0xa17+6858-0x24e0)+WMS_UDH_OCTETS_PRE_DEF;break;case 
+WMS_UDH_LARGE_ANIM:length=(0xdd1+1489-0x13a1)+(0x15e2+1537-0x1be2)+
+WMS_UDH_LARGE_BITMAP_SIZE*WMS_UDH_ANIM_NUM_BITMAPS+(0x1ba9+1303-0x20bf);break;
+case WMS_UDH_SMALL_ANIM:length=(0x197+6500-0x1afa)+(0x17ba+1126-0x1c1f)+
+WMS_UDH_SMALL_BITMAP_SIZE*WMS_UDH_ANIM_NUM_BITMAPS+(0xadb+365-0xc47);break;case 
+WMS_UDH_LARGE_PICTURE:length=(0x4f1+5733-0x1b55)+(0x2333+317-0x246f)+
+WMS_UDH_LARGE_PIC_SIZE+(0x1f44+1090-0x2385);break;case WMS_UDH_SMALL_PICTURE:
+length=(0x7da+354-0x93b)+(0x6e2+1180-0xb7d)+WMS_UDH_SMALL_PIC_SIZE+
+(0x14b7+651-0x1741);break;case WMS_UDH_VAR_PICTURE:length=(0x111+5573-0x16d5)+
+(0x285+400-0x414)+(UINT8)(udh->u.var_picture.height*udh->u.var_picture.width/
+(0x72+2978-0xc0c))+(0x11c4+828-0x14fd);break;case WMS_UDH_RFC822:length=
+(0x452+7819-0x22dc)+(0x807+5284-0x1caa)+WMS_UDH_OCTETS_RFC822;break;case 
+WMS_UDH_NAT_LANG_SS:length=(0x2f+1161-0x4b7)+(0x15b8+3746-0x2459)+
+WMS_UDH_OCTETS_NAT_LANG_SS;break;case WMS_UDH_NAT_LANG_LS:length=
+(0x211+4164-0x1254)+(0x31d+7883-0x21e7)+WMS_UDH_OCTETS_NAT_LANG_LS;break;case 
+WMS_UDH_USER_PROMPT:length=(0xa43+2878-0x1580)+(0xb1+8856-0x2348)+
+WMS_UDH_OCTETS_USER_PROMPT;break;case WMS_UDH_EXTENDED_OBJECT:length=
+(0xb1b+3915-0x1a65)+(0xb5b+4181-0x1baf)+udh->u.eo.content.length;if(udh->u.eo.
+first_segment==TRUE){length+=WMS_UDH_OCTETS_EO_HEADER;}break;default:length=
+(0x1c1f+2070-0x2434)+(0x14cd+2148-0x1d30)+udh->u.other.header_length;break;}}
+return length;}uint32 wms_ts_compute_user_data_header_length(const UINT8 
+num_headers,const wms_udh_s_type*headers){uint32 length=(0x3e3+62-0x421);uint32 
+i;if(headers==NULL){at_print(LOG_DEBUG,
 "\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"
-);return(0x1cc+5074-0x159e);}if(num_headers>(0x19fa+3275-0x26c5)){length+=
-(0x12e2+3455-0x2060);for(i=(0x1096+5176-0x24ce);i<num_headers&&i<
+);return(0x1a07+2749-0x24c4);}if(num_headers>(0x1a49+1162-0x1ed3)){length+=
+(0x19a9+1247-0x1e87);for(i=(0x91d+5703-0x1f64);i<num_headers&&i<
 WMS_MAX_UD_HEADERS;i++){length+=(uint32)wms_ts_get_udh_length(&headers[i]);}}
 return length;}uint32 wms_ts_compute_gw_user_data_length(const wms_gw_dcs_s_type
-*dcs,const wms_gw_user_data_s_type*user_data){uint32 length=(0xb9+2634-0xb03);if
-(dcs==NULL||user_data==NULL){at_print(LOG_DEBUG,
+*dcs,const wms_gw_user_data_s_type*user_data){uint32 length=(0xd7f+2806-0x1875);
+if(dcs==NULL||user_data==NULL){at_print(LOG_DEBUG,
 "\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"
-);return(0x5ec+2538-0xfd6);}length+=wms_ts_compute_user_data_header_length(
+);return(0x22dd+538-0x24f7);}length+=wms_ts_compute_user_data_header_length(
 user_data->num_headers,user_data->headers);if(dcs->alphabet==
-WMS_GW_ALPHABET_7_BIT_DEFAULT){length+=((user_data->sm_len*(0x170+5554-0x171b))+
-(0x1978+1714-0x2023))/(0x5aa+7751-0x23e9);}else{length+=user_data->sm_len;}
+WMS_GW_ALPHABET_7_BIT_DEFAULT){length+=((user_data->sm_len*(0x433+4440-0x1584))+
+(0x3a8+7809-0x2222))/(0x10cf+2887-0x1c0e);}else{length+=user_data->sm_len;}
 return length;}static int wms_ts_encode_udh_concat_8(UINT8*udh){int pos=
-(0xea2+4071-0x1e89);if(const_header->u.concat_8.total_sm==(0xfd5+1343-0x1514)||
-const_header->u.concat_8.seq_num==(0x5dd+7561-0x2366)||const_header->u.concat_8.
-seq_num>const_header->u.concat_8.total_sm){at_print(LOG_DEBUG,
+(0x854+5542-0x1dfa);if(const_header->u.concat_8.total_sm==(0x1ccf+981-0x20a4)||
+const_header->u.concat_8.seq_num==(0x1d68+1132-0x21d4)||const_header->u.concat_8
+.seq_num>const_header->u.concat_8.total_sm){at_print(LOG_DEBUG,
 "\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"
-,const_header->header_id);return(0x1534+3497-0x22dd);}udh[pos++]=(UINT8)
+,const_header->header_id);return(0x10d8+5009-0x2469);}udh[pos++]=(UINT8)
 WMS_UDH_CONCAT_8;udh[pos++]=(UINT8)WMS_UDH_OCTETS_CONCAT8;udh[pos++]=
 const_header->u.concat_8.msg_ref;udh[pos++]=const_header->u.concat_8.total_sm;
 udh[pos++]=const_header->u.concat_8.seq_num;return pos;}static int 
-wms_ts_encode_udh_concat16(UINT8*udh){int pos=(0x11d4+3924-0x2128);if(
-const_header->u.concat_16.total_sm==(0xdb8+5785-0x2451)||const_header->u.
-concat_16.seq_num==(0x11b+6732-0x1b67)||const_header->u.concat_16.seq_num>
+wms_ts_encode_udh_concat16(UINT8*udh){int pos=(0x111f+4481-0x22a0);if(
+const_header->u.concat_16.total_sm==(0x297+7295-0x1f16)||const_header->u.
+concat_16.seq_num==(0x3f2+3195-0x106d)||const_header->u.concat_16.seq_num>
 const_header->u.concat_16.total_sm){at_print(LOG_DEBUG,
 "\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"
-,const_header->header_id);return(0x1a98+2402-0x23fa);}udh[pos++]=(UINT8)
+,const_header->header_id);return(0x150a+1763-0x1bed);}udh[pos++]=(UINT8)
 WMS_UDH_CONCAT_16;udh[pos++]=(UINT8)WMS_UDH_OCTETS_CONCAT16;udh[pos++]=(UINT8)((
-const_header->u.concat_16.msg_ref&65280)>>(0x3fd+4566-0x15cb));udh[pos++]=(UINT8
-)(const_header->u.concat_16.msg_ref&(0x14f4+1243-0x18d0));udh[pos++]=
-const_header->u.concat_16.total_sm;udh[pos++]=const_header->u.concat_16.seq_num;
-return pos;}int wms_ts_encode_udh_nat_lang_ss(UINT8*udh){int pos=
-(0x3ed+5439-0x192c);udh[pos++]=(UINT8)WMS_UDH_NAT_LANG_SS;udh[pos++]=(UINT8)
-WMS_UDH_OCTETS_NAT_LANG_SS;udh[pos++]=(UINT8)const_header->u.nat_lang_ss.
-nat_lang_id;return pos;}int wms_ts_encode_udh_nat_lang_ls(UINT8*udh){int pos=
-(0x17c7+2813-0x22c4);udh[pos++]=(UINT8)WMS_UDH_NAT_LANG_LS;udh[pos++]=(UINT8)
-WMS_UDH_OCTETS_NAT_LANG_LS;udh[pos++]=(UINT8)const_header->u.nat_lang_ls.
-nat_lang_id;return pos;}int wms_ts_encode_udh_other(UINT8*udh,wms_udh_id_e_type 
-header_id){int i=(0x1398+3831-0x228f);int pos=(0x28f+2250-0xb59);udh[pos++]=(
-UINT8)const_header->u.other.header_id;udh[pos++]=const_header->u.other.
-header_length;for(i=(0x1256+125-0x12d3);i<const_header->u.other.header_length;i
-++){udh[pos++]=const_header->u.other.data[i];}return pos;}UINT8 
-wms_ts_encode_user_data_header(UINT8 num_headers,const wms_udh_s_type*headers,
-UINT8*data){int i,pos=(0xa91+1126-0xef7);if(num_headers==(0x423+5246-0x18a1))
-return(0x2039+754-0x232b);++pos;for(i=(0x2c8+5553-0x1879);i<WMS_MAX_UD_HEADERS&&
-i<num_headers;i++){const_header=&headers[i];switch(const_header->header_id){case
- WMS_UDH_CONCAT_8:pos+=wms_ts_encode_udh_concat_8(data+pos);break;case 
+const_header->u.concat_16.msg_ref&65280)>>(0x88f+3868-0x17a3));udh[pos++]=(UINT8
+)(const_header->u.concat_16.msg_ref&(0xf99+3779-0x1d5d));udh[pos++]=const_header
+->u.concat_16.total_sm;udh[pos++]=const_header->u.concat_16.seq_num;return pos;}
+int wms_ts_encode_udh_nat_lang_ss(UINT8*udh){int pos=(0x1c95+961-0x2056);udh[pos
+++]=(UINT8)WMS_UDH_NAT_LANG_SS;udh[pos++]=(UINT8)WMS_UDH_OCTETS_NAT_LANG_SS;udh[
+pos++]=(UINT8)const_header->u.nat_lang_ss.nat_lang_id;return pos;}int 
+wms_ts_encode_udh_nat_lang_ls(UINT8*udh){int pos=(0x1f5+2690-0xc77);udh[pos++]=(
+UINT8)WMS_UDH_NAT_LANG_LS;udh[pos++]=(UINT8)WMS_UDH_OCTETS_NAT_LANG_LS;udh[pos++
+]=(UINT8)const_header->u.nat_lang_ls.nat_lang_id;return pos;}int 
+wms_ts_encode_udh_other(UINT8*udh,wms_udh_id_e_type header_id){int i=
+(0xfc0+5898-0x26ca);int pos=(0xb65+3218-0x17f7);udh[pos++]=(UINT8)const_header->
+u.other.header_id;udh[pos++]=const_header->u.other.header_length;for(i=
+(0x8b9+6303-0x2158);i<const_header->u.other.header_length;i++){udh[pos++]=
+const_header->u.other.data[i];}return pos;}UINT8 wms_ts_encode_user_data_header(
+UINT8 num_headers,const wms_udh_s_type*headers,UINT8*data){int i,pos=
+(0x127d+2971-0x1e18);if(num_headers==(0x59+4912-0x1389))return
+(0x14f9+3235-0x219c);++pos;for(i=(0x11d2+1801-0x18db);i<WMS_MAX_UD_HEADERS&&i<
+num_headers;i++){const_header=&headers[i];switch(const_header->header_id){case 
+WMS_UDH_CONCAT_8:pos+=wms_ts_encode_udh_concat_8(data+pos);break;case 
 WMS_UDH_CONCAT_16:pos+=wms_ts_encode_udh_concat16(data+pos);break;
-#if (0x917+518-0xb1d)

+#if (0x7a5+1958-0xf4b)

 case WMS_UDH_SPECIAL_SM:pos+=wms_ts_encode_udh_special_sm(data+pos);break;case 
 WMS_UDH_PORT_8:pos+=wms_ts_encode_udh_port_8(data+pos);break;case 
 WMS_UDH_PORT_16:pos+=wms_ts_encode_udh_port16(data+pos);break;case 
@@ -1314,104 +1314,104 @@
 case WMS_UDH_NAT_LANG_SS:pos+=wms_ts_encode_udh_nat_lang_ss(data+pos);break;case
  WMS_UDH_NAT_LANG_LS:pos+=wms_ts_encode_udh_nat_lang_ls(data+pos);break;default:
 pos+=wms_ts_encode_udh_other(data+pos,const_header->header_id);}}data[
-(0x67b+3862-0x1591)]=(UINT8)(pos-(0x24f+8982-0x2564));return((UINT8)(pos-
-(0xf18+5238-0x238d)));}UINT8 wms_ts_encode_gw_user_data(const wms_gw_dcs_s_type*
+(0x155b+2175-0x1dda)]=(UINT8)(pos-(0x130a+171-0x13b4));return((UINT8)(pos-
+(0x6d3+7597-0x247f)));}UINT8 wms_ts_encode_gw_user_data(const wms_gw_dcs_s_type*
 dcs,const wms_gw_user_data_s_type*user_data,UINT8*data){UINT16 i,pos=
-(0x1304+622-0x1572);UINT8 fill_bits=(0x175+304-0x2a5);UINT16 total_bits_occupied
-;UINT8 user_data_header_length;UINT16 user_data_length;data[pos]=(UINT8)
-user_data->sm_len;pos++;if(dcs->alphabet==WMS_GW_ALPHABET_7_BIT_DEFAULT){if(
-user_data->num_headers>(0x39c+4269-0x1449)){if(
-wms_ts_compute_user_data_header_length(user_data->num_headers,user_data->headers
-)<=WMS_SMS_UDL_MAX_8_BIT){user_data_header_length=wms_ts_encode_user_data_header
-(user_data->num_headers,user_data->headers,data+pos);pos+=
-user_data_header_length+(0x780+3100-0x139b);total_bits_occupied=(
-user_data_header_length+(0x47+9154-0x2408))*(0x624+1809-0xd2d);fill_bits=(
-total_bits_occupied%(0x24c4+586-0x2707));if(fill_bits!=(0x41d+5139-0x1830)){
-fill_bits=(0x7ad+2778-0x1280)-fill_bits;}user_data_length=(total_bits_occupied+
-fill_bits+(user_data->sm_len*(0x65+2141-0x8bb)))/(0x1bc+533-0x3ca);data[
-(0x325+2848-0xe45)]=(UINT8)user_data_length;data[(0x1231+3433-0x1f99)]=
+(0xb45+1849-0x127e);UINT8 fill_bits=(0xcf3+6062-0x24a1);UINT16 
+total_bits_occupied;UINT8 user_data_header_length;UINT16 user_data_length;data[
+pos]=(UINT8)user_data->sm_len;pos++;if(dcs->alphabet==
+WMS_GW_ALPHABET_7_BIT_DEFAULT){if(user_data->num_headers>(0x11ff+3155-0x1e52)){
+if(wms_ts_compute_user_data_header_length(user_data->num_headers,user_data->
+headers)<=WMS_SMS_UDL_MAX_8_BIT){user_data_header_length=
+wms_ts_encode_user_data_header(user_data->num_headers,user_data->headers,data+
+pos);pos+=user_data_header_length+(0x258+8162-0x2239);total_bits_occupied=(
+user_data_header_length+(0x1355+393-0x14dd))*(0x1b0+5895-0x18af);fill_bits=(
+total_bits_occupied%(0x9c6+5276-0x1e5b));if(fill_bits!=(0x2295+527-0x24a4)){
+fill_bits=(0x121d+5117-0x2613)-fill_bits;}user_data_length=(total_bits_occupied+
+fill_bits+(user_data->sm_len*(0x22+2287-0x90a)))/(0x1c1a+1213-0x20d0);data[
+(0x45c+2707-0xeef)]=(UINT8)user_data_length;data[(0x8f6+143-0x984)]=
 user_data_header_length;}else{at_print(LOG_DEBUG,
 "\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"
 );}}i=wms_ts_pack_gw_7_bit_chars(user_data->sm_data,user_data->sm_len,fill_bits,
 (UINT16)(WMS_MAX_LEN-pos),&data[pos]);pos+=i;}else{if(user_data->num_headers>
-(0x318+3548-0x10f4)){if(wms_ts_compute_user_data_header_length(user_data->
+(0x67b+6683-0x2096)){if(wms_ts_compute_user_data_header_length(user_data->
 num_headers,user_data->headers)<=WMS_SMS_UDL_MAX_8_BIT){user_data_header_length=
 wms_ts_encode_user_data_header(user_data->num_headers,user_data->headers,data+
-pos);data[(0x71a+6205-0x1f57)]=(UINT8)(user_data->sm_len+user_data_header_length
-+(0x55a+2241-0xe1a));pos+=user_data_header_length+(0x1279+808-0x15a0);}else{
+pos);data[(0x5bb+844-0x907)]=(UINT8)(user_data->sm_len+user_data_header_length+
+(0xae8+540-0xd03));pos+=user_data_header_length+(0x22a1+820-0x25d4);}else{
 at_print(LOG_DEBUG,
 "\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"
 );}}memcpy(&data[pos],user_data->sm_data,user_data->sm_len);pos+=user_data->
 sm_len;}return(UINT8)pos;}wms_status_e_type wms_ts_encode_deliver(const 
 wms_gw_deliver_s_type*deliver,T_zUfiSms_RawTsData*raw_ts_data_ptr){
-wms_status_e_type st=WMS_OK_S;UINT8*data;UINT8 pos=(0xc2b+6680-0x2643),i;if(
+wms_status_e_type st=WMS_OK_S;UINT8*data;UINT8 pos=(0xbd3+2682-0x164d),i;if(
 deliver==NULL||raw_ts_data_ptr==NULL){at_print(LOG_DEBUG,
 "\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"
 );return WMS_NULL_PTR_S;}data=raw_ts_data_ptr->data;(void)memset(data,
-(0x94d+4798-0x1c0b),WMS_MAX_LEN);data[pos]=(0xdfa+5616-0x23ea);data[pos]|=
-deliver->more?(0x87c+7757-0x26c9):(0x4e4+2776-0xfb8);data[pos]|=deliver->
-status_report_enabled?(0x1255+2931-0x1da8):(0x457+4908-0x1783);data[pos]|=
-deliver->user_data_header_present?(0x4b+7017-0x1b74):(0xd60+1279-0x125f);data[
-pos]|=deliver->reply_path_present?(0xe72+4403-0x1f25):(0x218a+208-0x225a);pos++;
-i=wms_ts_encode_address(&deliver->address,&data[pos]);if(i==(0x1a5f+1366-0x1fb5)
-){return WMS_INVALID_PARM_SIZE_S;}pos+=i;data[pos]=deliver->pid;pos++;pos+=
-wms_ts_encode_dcs(&deliver->dcs,data+pos);i=wms_ts_encode_timestamp(&deliver->
-timestamp,data+pos);if(i==(0x149b+1616-0x1aeb)){return WMS_INVALID_PARM_VALUE_S;
-}pos+=i;if(wms_ts_compute_gw_user_data_length(&deliver->dcs,&deliver->user_data)
->WMS_SMS_UDL_MAX_8_BIT){at_print(LOG_DEBUG,
+(0x345+6752-0x1da5),WMS_MAX_LEN);data[pos]=(0x1db+8975-0x24ea);data[pos]|=
+deliver->more?(0x108d+3305-0x1d76):(0x22c+7498-0x1f72);data[pos]|=deliver->
+status_report_enabled?(0xa21+2408-0x1369):(0x1962+3268-0x2626);data[pos]|=
+deliver->user_data_header_present?(0xc03+4741-0x1e48):(0x1c1+7711-0x1fe0);data[
+pos]|=deliver->reply_path_present?(0x1a82+1233-0x1ed3):(0x1eb+4686-0x1439);pos++
+;i=wms_ts_encode_address(&deliver->address,&data[pos]);if(i==
+(0x10e3+4405-0x2218)){return WMS_INVALID_PARM_SIZE_S;}pos+=i;data[pos]=deliver->
+pid;pos++;pos+=wms_ts_encode_dcs(&deliver->dcs,data+pos);i=
+wms_ts_encode_timestamp(&deliver->timestamp,data+pos);if(i==(0x8ea+1260-0xdd6)){
+return WMS_INVALID_PARM_VALUE_S;}pos+=i;if(wms_ts_compute_gw_user_data_length(&
+deliver->dcs,&deliver->user_data)>WMS_SMS_UDL_MAX_8_BIT){at_print(LOG_DEBUG,
 "\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"
 );st=WMS_INVALID_USER_DATA_SIZE_S;}else{i=wms_ts_encode_gw_user_data(&deliver->
 dcs,&deliver->user_data,data+pos);pos+=i;}raw_ts_data_ptr->tpdu_type=
 WMS_TPDU_DELIVER;raw_ts_data_ptr->len=pos;return st;}UINT8 
 wms_ts_encode_relative_time(const wms_timestamp_s_type*timestamp){uint32 i;UINT8
- v=(0x371+5886-0x1a6f),j;if(timestamp!=NULL){if(!wms_ts_bcd_to_int(timestamp->
+ v=(0x47b+8152-0x2453),j;if(timestamp!=NULL){if(!wms_ts_bcd_to_int(timestamp->
 year,&j)){at_print(LOG_DEBUG,
 "\x59\x65\x61\x72\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j
-);}i=j*(0xeb5+3689-0x1bb1);if(!wms_ts_bcd_to_int(timestamp->month,&j)){at_print(
+);}i=j*(0xb29+3519-0x177b);if(!wms_ts_bcd_to_int(timestamp->month,&j)){at_print(
 LOG_DEBUG,
 "\x4d\x6f\x6e\x74\x68\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
-,j);}i=i+j*(0x4e9+7001-0x2024);if(!wms_ts_bcd_to_int(timestamp->day,&j)){
+,j);}i=i+j*(0x87d+710-0xb25);if(!wms_ts_bcd_to_int(timestamp->day,&j)){at_print(
+LOG_DEBUG,
+"\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);}i
++=j;if(i>(0x15dc+338-0x1710)){v=(UINT8)((i+(0x2ab+1201-0x756))/
+(0xe4c+2498-0x1807)+(0x641+1632-0xbe1));}else if(i>=(0x811+7433-0x2519)){v=(
+UINT8)(i+(0x1d0+9455-0x2619));}else{if(!wms_ts_bcd_to_int(timestamp->day,&j)){
 at_print(LOG_DEBUG,
 "\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);}i
-+=j;if(i>(0x685+1256-0xb4f)){v=(UINT8)((i+(0x1096+5593-0x2669))/
-(0x12e8+1555-0x18f4)+(0x171+8549-0x2216));}else if(i>=(0xd89+3159-0x19df)){v=(
-UINT8)(i+(0x8b5+3525-0x15d4));}else{if(!wms_ts_bcd_to_int(timestamp->day,&j)){
-at_print(LOG_DEBUG,
-"\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);}i
-=j*(0xd41+1572-0x134d)*(0x35c+2762-0xdea);if(!wms_ts_bcd_to_int(timestamp->hour,
-&j)){at_print(LOG_DEBUG,
+=j*(0x434+2408-0xd84)*(0x14a+2735-0xbbd);if(!wms_ts_bcd_to_int(timestamp->hour,&
+j)){at_print(LOG_DEBUG,
 "\x48\x6f\x75\x72\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j
-);}i=i+j*(0x132+8189-0x20f3);if(!wms_ts_bcd_to_int(timestamp->minute,&j)){
-at_print(LOG_DEBUG,
+);}i=i+j*(0x1bb+579-0x3c2);if(!wms_ts_bcd_to_int(timestamp->minute,&j)){at_print
+(LOG_DEBUG,
 "\x4d\x69\x6e\x75\x74\x65\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
-,j);}i+=j;if(i>(0x12c6+3010-0x1e7c)*(0x1aa8+39-0x1a93)){v=(UINT8)((i-((
-(0xe2c+2252-0x16ec)*(0x4c9+3056-0x107d))+(0x1a91+1511-0x205b)))/
-(0xa74+2742-0x150c)+(0x444+4994-0x1737));}else{v=(UINT8)((i+(0x2e7+3260-0xf9f))/
-(0x1d7+7856-0x2082)-(0x20c8+206-0x2195));}}}else{at_print(LOG_DEBUG,
+,j);}i+=j;if(i>(0x3fd+7386-0x20cb)*(0xb4a+2939-0x1689)){v=(UINT8)((i-((
+(0x758+53-0x781)*(0x333+257-0x3f8))+(0x1242+2559-0x1c24)))/(0x679+5261-0x1ae8)+
+(0x1932+3115-0x24ce));}else{v=(UINT8)((i+(0xaaa+6445-0x23d3))/
+(0x74b+2792-0x122e)-(0x65+5120-0x1464));}}}else{at_print(LOG_DEBUG,
 "\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"
 );}return v;}UINT8 wms_ts_encode_gw_validity(const wms_gw_validity_s_type*
-validity,UINT8*data){UINT8 i,pos=(0x14fd+4397-0x262a);switch(validity->format){
+validity,UINT8*data){UINT8 i,pos=(0xc50+6327-0x2507);switch(validity->format){
 case WMS_GW_VALIDITY_NONE:break;case WMS_GW_VALIDITY_RELATIVE:data[pos]=
 wms_ts_encode_relative_time(&validity->u.time);pos++;break;case 
 WMS_GW_VALIDITY_ABSOLUTE:i=wms_ts_encode_timestamp(&validity->u.time,data+pos);
-if(i==(0x325+8489-0x244e)){at_print(LOG_DEBUG,
+if(i==(0x1f4c+1398-0x24c2)){at_print(LOG_DEBUG,
 "\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"
 );}pos+=i;break;case WMS_GW_VALIDITY_ENHANCED:break;default:break;}return pos;}
 wms_status_e_type wms_ts_encode_submit(const wms_gw_submit_s_type*submit,
 T_zUfiSms_RawTsData*raw_ts_data_ptr){wms_status_e_type st=WMS_OK_S;UINT8*data;
-UINT8 pos=(0x1b24+2877-0x2661),i;if(submit==NULL||raw_ts_data_ptr==NULL){
-at_print(LOG_DEBUG,
+UINT8 pos=(0x1f63+123-0x1fde),i;if(submit==NULL||raw_ts_data_ptr==NULL){at_print
+(LOG_DEBUG,
 "\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"
 );return WMS_NULL_PTR_S;}data=raw_ts_data_ptr->data;(void)memset(data,
-(0xbfd+953-0xfb6),WMS_MAX_LEN);data[pos]=(0x82+8284-0x20dd);data[pos]|=submit->
-reject_duplicates?(0x1855+2529-0x2232):(0x1352+3168-0x1fb2);if(submit->validity.
-format>(0x128d+879-0x15f9)){return st=WMS_INVALID_VALIDITY_FORMAT_S;}data[pos]|=
-submit->validity.format<<(0x17a8+400-0x1935);data[pos]|=submit->
-status_report_enabled?(0x2223+151-0x229a):(0x7d0+6541-0x215d);data[pos]|=submit
-->user_data_header_present?(0xc13+4506-0x1d6d):(0x1987+79-0x19d6);data[pos]|=
-submit->reply_path_present?(0x1125+4087-0x209c):(0x12f1+3612-0x210d);pos++;data[
-pos]=(UINT8)submit->message_reference;pos++;i=wms_ts_encode_address(&submit->
-address,&data[pos]);if(i==(0xbfc+600-0xe54)){return WMS_INVALID_PARM_SIZE_S;}pos
+(0x8d6+3367-0x15fd),WMS_MAX_LEN);data[pos]=(0xc84+2558-0x1681);data[pos]|=submit
+->reject_duplicates?(0x675+4270-0x171f):(0x3a9+5749-0x1a1e);if(submit->validity.
+format>(0x1c7b+1403-0x21f3)){return st=WMS_INVALID_VALIDITY_FORMAT_S;}data[pos]
+|=submit->validity.format<<(0x38b+523-0x593);data[pos]|=submit->
+status_report_enabled?(0xcdf+2546-0x16b1):(0x1575+3643-0x23b0);data[pos]|=submit
+->user_data_header_present?(0x3d3+8486-0x24b9):(0x650+6777-0x20c9);data[pos]|=
+submit->reply_path_present?(0x179c+1652-0x1d90):(0x323+999-0x70a);pos++;data[pos
+]=(UINT8)submit->message_reference;pos++;i=wms_ts_encode_address(&submit->
+address,&data[pos]);if(i==(0x148+623-0x3b7)){return WMS_INVALID_PARM_SIZE_S;}pos
 +=i;data[pos]=submit->pid;pos++;pos+=wms_ts_encode_dcs(&submit->dcs,data+pos);
 pos+=wms_ts_encode_gw_validity(&submit->validity,data+pos);if(
 wms_ts_compute_gw_user_data_length(&submit->dcs,&submit->user_data)>
@@ -1422,21 +1422,21 @@
 WMS_TPDU_SUBMIT;raw_ts_data_ptr->len=pos;return st;}wms_status_e_type 
 wms_ts_encode_status_report(const wms_gw_status_report_s_type*status_report,
 T_zUfiSms_RawTsData*raw_ts_data_ptr){wms_status_e_type st=WMS_OK_S;UINT8*data;
-UINT8 pos=(0x8c+8659-0x225f),i;if(status_report==NULL||raw_ts_data_ptr==NULL){
+UINT8 pos=(0x1e1a+950-0x21d0),i;if(status_report==NULL||raw_ts_data_ptr==NULL){
 at_print(LOG_DEBUG,
 "\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"
 );return WMS_NULL_PTR_S;}data=raw_ts_data_ptr->data;(void)memset(data,
-(0xc50+432-0xe00),WMS_MAX_LEN);data[pos]=(0x1060+360-0x11b8);data[pos]|=
-status_report->more?(0xc19+1122-0x107b):(0x1d02+2037-0x24f3);data[pos]|=
-status_report->status_report_qualifier?(0x92a+6946-0x242c):(0xde3+659-0x1076);
-data[pos]|=status_report->user_data_header_present?(0x2eb+6333-0x1b68):
-(0x1237+4591-0x2426);pos++;data[pos]=(UINT8)status_report->message_reference;pos
+(0x856+5843-0x1f29),WMS_MAX_LEN);data[pos]=(0x418+2577-0xe19);data[pos]|=
+status_report->more?(0x10a9+2310-0x19af):(0x562+4840-0x1846);data[pos]|=
+status_report->status_report_qualifier?(0x1b1+4609-0x1392):(0x1bd0+523-0x1ddb);
+data[pos]|=status_report->user_data_header_present?(0x25a+1300-0x72e):
+(0x1333+3432-0x209b);pos++;data[pos]=(UINT8)status_report->message_reference;pos
 ++;i=wms_ts_encode_address(&status_report->address,&data[pos]);if(i==
-(0x663+5153-0x1a84)){return WMS_INVALID_PARM_SIZE_S;}pos+=i;i=
+(0x1770+3084-0x237c)){return WMS_INVALID_PARM_SIZE_S;}pos+=i;i=
 wms_ts_encode_timestamp(&status_report->timestamp,data+pos);if(i==
-(0x15e5+2485-0x1f9a)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;i=
+(0xf8d+2184-0x1815)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;i=
 wms_ts_encode_timestamp(&status_report->discharge_time,data+pos);if(i==
-(0x67+724-0x33b)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;data[pos]=
+(0xb85+6573-0x2532)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;data[pos]=
 status_report->tp_status;pos++;data[pos]=(UINT8)status_report->mask;pos++;if(
 status_report->mask&WMS_TPDU_MASK_PID){data[pos]=status_report->pid;pos++;}if(
 status_report->mask&WMS_TPDU_MASK_DCS){pos+=wms_ts_encode_dcs(&status_report->
@@ -1451,7 +1451,7 @@
 T_zUfiSms_RawTsData*ptRawTsData){wms_status_e_type st=WMS_OK_S;const 
 wms_gw_pp_ts_data_s_type*msg;if(ptClientTsData==NULL||ptRawTsData==NULL){return 
 WMS_NULL_PTR_S;}msg=&ptClientTsData->u.gw_pp;switch(ptClientTsData->format){
-#if (0xd77+5655-0x238e)

+#if (0x16f2+3137-0x2333)

 case WMS_FORMAT_CDMA:case WMS_FORMAT_ANALOG_AWISMS:case WMS_FORMAT_ANALOG_CLI:
 case WMS_FORMAT_ANALOG_VOICE_MAIL:case WMS_FORMAT_ANALOG_SMS:case WMS_FORMAT_MWI
 :st=wms_ts_encode_bearer_data(&ptClientTsData->u.cdma,ptRawTsData);break;
@@ -1461,7 +1461,7 @@
 ptRawTsData);break;case WMS_TPDU_SUBMIT:st=wms_ts_encode_submit(&msg->u.submit,
 ptRawTsData);break;case WMS_TPDU_STATUS_REPORT:st=wms_ts_encode_status_report(&
 msg->u.status_report,ptRawTsData);break;
-#if (0xb39+1320-0x1061)

+#if (0x14cd+4505-0x2666)

 case WMS_TPDU_SUBMIT_REPORT_ACK:st=wms_ts_encode_submit_report_ack(&msg->u.
 submit_report_ack,ptRawTsData);break;case WMS_TPDU_SUBMIT_REPORT_ERROR:st=
 wms_ts_encode_submit_report_error(&msg->u.submit_report_error,ptRawTsData);break
@@ -1478,358 +1478,358 @@
 "\x49\x6e\x76\x61\x6c\x69\x64\x20\x66\x6f\x72\x6d\x61\x74\x3a\x20\x25\x64",
 ptClientTsData->format);break;}ptRawTsData->format=ptClientTsData->format;return
  st;}UINT8 wms_ts_unpack_gw_7_bit_chars(const UINT8*in,UINT8 in_len,UINT8 
-out_len_max,UINT16 shift,UINT8*out){int i=(0x90+789-0x3a5);UINT16 pos=
-(0xd08+6064-0x24b8);if(in==NULL||out==NULL){at_print(LOG_DEBUG,
+out_len_max,UINT16 shift,UINT8*out){int i=(0x1142+1279-0x1641);UINT16 pos=
+(0x300+9020-0x263c);if(in==NULL||out==NULL){at_print(LOG_DEBUG,
 "\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"
-);return(0xc9f+5297-0x2150);}if(shift!=(0x1582+106-0x15ec))pos=pos+
-(0x1588+627-0x17fa);if(shift==(0xd2a+6490-0x267d)){out[(0x860+7555-0x25e3)]=in[
-(0xd4f+4924-0x208b)]>>(0x17d0+2877-0x230c);shift=(0x14aa+3108-0x20ce);i=
-(0x22c+5671-0x1852);}for(i=i;i<out_len_max&&i<in_len;i++,pos++){out[i]=(in[pos]
-<<shift)&(0x15d+1866-0x828);if(pos!=(0x17fc+3836-0x26f8)){
-#if (0x641+107-0x6ab)       
-if(shift==(0x3bc+7602-0x216e)){out[i]|=(0xdec+1514-0x13d6);}else{out[i]|=in[pos-
-(0x1b5d+1987-0x231f)]>>((0x1978+1056-0x1d90)-shift);}
+);return(0x36d+6832-0x1e1d);}if(shift!=(0x1605+2169-0x1e7e))pos=pos+
+(0x151f+1146-0x1998);if(shift==(0xf61+660-0x11ee)){out[(0xed+1327-0x61c)]=in[
+(0x8a9+7561-0x2632)]>>(0xb68+3357-0x1884);shift=(0x17f8+1604-0x1e3c);i=
+(0x1538+2920-0x209f);}for(i=i;i<out_len_max&&i<in_len;i++,pos++){out[i]=(in[pos]
+<<shift)&(0x8dd+1320-0xd86);if(pos!=(0xf4d+1448-0x14f5)){
+#if (0x24c0+389-0x2644)       
+if(shift==(0xa2c+3956-0x19a0)){out[i]|=(0xda+802-0x3fc);}else{out[i]|=in[pos-
+(0x226c+1109-0x26c0)]>>((0x5ad+3765-0x145a)-shift);}
 #else

-out[i]|=in[pos-(0xd22+4695-0x1f78)]>>((0x1b63+1208-0x2013)-shift);
+out[i]|=in[pos-(0x12d9+2651-0x1d33)]>>((0x3c5+3140-0x1001)-shift);
 #endif

-}shift++;if(shift==(0x1233+4812-0x24f8)){shift=(0xa21+6100-0x21f5);i++;if(i>=
+}shift++;if(shift==(0x544+2798-0x102b)){shift=(0xfc4+947-0x1377);i++;if(i>=
 out_len_max){at_print(LOG_DEBUG,
 "\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"
-);break;}out[i]=in[pos]>>(0xc95+3077-0x1899);}}return(UINT8)(pos);}UINT8 
+);break;}out[i]=in[pos]>>(0xb9a+4851-0x1e8c);}}return(UINT8)(pos);}UINT8 
 wms_ts_decode_address(const UINT8*data,wms_address_s_type*addr){UINT8 i,pos=
-(0x27c+9241-0x2695);i=data[pos];if(i>WMS_GW_ADDRESS_MAX){at_print(LOG_DEBUG,
+(0xb5d+2391-0x14b4);i=data[pos];if(i>WMS_GW_ADDRESS_MAX){at_print(LOG_DEBUG,
 "\x41\x64\x64\x72\x20\x6c\x65\x6e\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x20\x25\x64"
-,i);return(0x4e3+2396-0xe3f);}addr->number_of_digits=i;pos++;addr->digit_mode=
+,i);return(0x6c0+5846-0x1d96);}addr->number_of_digits=i;pos++;addr->digit_mode=
 WMS_DIGIT_MODE_4_BIT;addr->number_type=(wms_number_type_e_type)((data[pos]&
-(0x226+794-0x4d0))>>(0x351+6421-0x1c62));addr->number_plan=(
-wms_number_plan_e_type)(data[pos]&(0x490+2207-0xd20));pos++;if(addr->number_type
-==WMS_NUMBER_ALPHANUMERIC){UINT8 bytes_increment=(0x11d6+4980-0x254a);addr->
-digit_mode=WMS_DIGIT_MODE_8_BIT;bytes_increment=(addr->number_of_digits+
-(0x129+4300-0x11f4))/(0x17e2+645-0x1a65);addr->number_of_digits=(UINT8)(addr->
-number_of_digits*(0x2224+878-0x258e)/(0x1520+1295-0x1a28));(void)
+(0x16b6+1927-0x1dcd))>>(0x17b0+2252-0x2078));addr->number_plan=(
+wms_number_plan_e_type)(data[pos]&(0x195+6240-0x19e6));pos++;if(addr->
+number_type==WMS_NUMBER_ALPHANUMERIC){UINT8 bytes_increment=(0xe06+1406-0x1384);
+addr->digit_mode=WMS_DIGIT_MODE_8_BIT;bytes_increment=(addr->number_of_digits+
+(0x2202+688-0x24b1))/(0xacd+5712-0x211b);addr->number_of_digits=(UINT8)(addr->
+number_of_digits*(0x112+9008-0x243e)/(0x1532+1-0x152c));(void)
 wms_ts_unpack_gw_7_bit_chars(&data[pos],addr->number_of_digits,
-WMS_GW_ADDRESS_MAX,(0x2ff+2610-0xd31),addr->digits);pos+=bytes_increment;}else{
-for(i=(0xda7+5222-0x220d);i<addr->number_of_digits;i++){addr->digits[i++]=data[
-pos]&(0x19ba+3014-0x2571);addr->digits[i]=(data[pos]&(0xe2b+4645-0x1f60))>>
-(0x733+6840-0x21e7);pos++;}}return pos;}UINT8 wms_ts_decode_dcs(const UINT8*data
-,wms_gw_dcs_s_type*dcs){UINT8 pos=(0xa3d+6442-0x2367);UINT8 i;if(data==NULL||dcs
-==NULL){at_print(LOG_DEBUG,
+WMS_GW_ADDRESS_MAX,(0x1c50+335-0x1d9f),addr->digits);pos+=bytes_increment;}else{
+for(i=(0x1202+2206-0x1aa0);i<addr->number_of_digits;i++){addr->digits[i++]=data[
+pos]&(0x13f+1062-0x556);addr->digits[i]=(data[pos]&(0x81a+5996-0x1e96))>>
+(0x1618+3577-0x240d);pos++;}}return pos;}UINT8 wms_ts_decode_dcs(const UINT8*
+data,wms_gw_dcs_s_type*dcs){UINT8 pos=(0x1c98+224-0x1d78);UINT8 i;if(data==NULL
+||dcs==NULL){at_print(LOG_DEBUG,
 "\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"
-);return(0x174d+2856-0x2275);}dcs->msg_class=WMS_MESSAGE_CLASS_NONE;dcs->
+);return(0x8b8+7614-0x2676);}dcs->msg_class=WMS_MESSAGE_CLASS_NONE;dcs->
 msg_waiting=WMS_GW_MSG_WAITING_NONE;dcs->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;
-dcs->is_compressed=FALSE;i=(data[pos]&(0x293+4886-0x14e9))>>(0x59f+6913-0x209a);
-switch(i){case(0xcc1+3236-0x1965):dcs->is_compressed=data[pos]&
-(0x929+7669-0x26fe);if(data[pos]&(0x79f+4593-0x1980)){dcs->msg_class=(
-wms_message_class_e_type)(data[pos]&(0x1558+314-0x168f));}else{dcs->msg_class=
+dcs->is_compressed=FALSE;i=(data[pos]&(0xdd9+3087-0x1928))>>(0x3a4+5684-0x19d2);
+switch(i){case(0xb88+437-0xd3d):dcs->is_compressed=data[pos]&
+(0x1040+5860-0x2704);if(data[pos]&(0x1f25+1485-0x24e2)){dcs->msg_class=(
+wms_message_class_e_type)(data[pos]&(0x1751+130-0x17d0));}else{dcs->msg_class=
 WMS_MESSAGE_CLASS_NONE;}dcs->alphabet=(wms_gw_alphabet_e_type)((data[pos]&
-(0x6da+4669-0x190b))>>(0x2a4+6546-0x1c34));break;case(0xb92+4577-0x1d70):if((
-data[pos]&(0x814+2213-0x1089))==(0x47f+3785-0x1318)){dcs->alphabet=(data[pos]&
-(0x1c49+1381-0x21aa))?WMS_GW_ALPHABET_8_BIT:WMS_GW_ALPHABET_7_BIT_DEFAULT;dcs->
-msg_class=(wms_message_class_e_type)(data[pos]&(0xe64+1318-0x1387));dcs->
+(0x132c+1517-0x190d))>>(0x1c8+1504-0x7a6));break;case(0x1bb1+1319-0x20d5):if((
+data[pos]&(0x14db+4489-0x2634))==(0x3bc+3142-0xfd2)){dcs->alphabet=(data[pos]&
+(0x1999+1425-0x1f26))?WMS_GW_ALPHABET_8_BIT:WMS_GW_ALPHABET_7_BIT_DEFAULT;dcs->
+msg_class=(wms_message_class_e_type)(data[pos]&(0x1b3+2773-0xc85));dcs->
 is_compressed=FALSE;dcs->msg_waiting=WMS_GW_MSG_WAITING_NONE_1111;}else{dcs->
 is_compressed=FALSE;dcs->msg_class=WMS_MESSAGE_CLASS_NONE;if((data[pos]&
-(0x79a+2107-0xfa5))==(0x1171+5308-0x262d)){dcs->msg_waiting=
+(0x15dd+3979-0x2538))==(0x278+1031-0x67f)){dcs->msg_waiting=
 WMS_GW_MSG_WAITING_DISCARD;dcs->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;}else if(
-(data[pos]&(0x1742+3229-0x23af))==(0xdbb+4142-0x1dd9)){dcs->msg_waiting=
+(data[pos]&(0xa59+6455-0x2360))==(0xec3+17-0xec4)){dcs->msg_waiting=
 WMS_GW_MSG_WAITING_STORE;dcs->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;}else{dcs->
 msg_waiting=WMS_GW_MSG_WAITING_STORE;dcs->alphabet=WMS_GW_ALPHABET_UCS2;}dcs->
-msg_waiting_active=(data[pos]&(0x8c1+5406-0x1dd7))?TRUE:FALSE;dcs->
-msg_waiting_kind=(wms_gw_msg_waiting_kind_e_type)(data[pos]&(0xac6+1854-0x1201))
+msg_waiting_active=(data[pos]&(0x575+5778-0x1bff))?TRUE:FALSE;dcs->
+msg_waiting_kind=(wms_gw_msg_waiting_kind_e_type)(data[pos]&(0x676+6003-0x1de6))
 ;}break;default:at_print(LOG_DEBUG,
 "\x49\x6e\x76\x61\x6c\x69\x64\x20\x44\x43\x53\x3a\x20\x25\x78",data[pos]);dcs->
 alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;dcs->is_compressed=FALSE;dcs->msg_waiting
 =WMS_GW_MSG_WAITING_NONE;dcs->msg_class=WMS_MESSAGE_CLASS_NONE;break;}if(dcs->
 alphabet>WMS_GW_ALPHABET_UCS2){dcs->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;}dcs
 ->raw_dcs_data=data[pos];pos++;return pos;}UINT8 wms_ts_decode_timestamp(const 
-UINT8*data,wms_timestamp_s_type*timestamp){UINT8 pos=(0xeb1+1667-0x1534),i,j;if(
-data==NULL||timestamp==NULL){at_print(LOG_DEBUG,
+UINT8*data,wms_timestamp_s_type*timestamp){UINT8 pos=(0x2166+1316-0x268a),i,j;if
+(data==NULL||timestamp==NULL){at_print(LOG_DEBUG,
 "\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"
-);return(0x6f5+5991-0x1e5c);}i=((data[pos]&(0x7c5+5447-0x1cfd))<<
-(0xc40+89-0xc95))+((data[pos]&(0x1945+1244-0x1d31))>>(0x159f+2820-0x209f));if(!
-wms_ts_bcd_to_int(i,&j)){at_print(LOG_DEBUG,
+);return(0xa0+6922-0x1baa);}i=((data[pos]&(0xaed+478-0xcbc))<<
+(0x1a05+993-0x1de2))+((data[pos]&(0xe21+2479-0x16e0))>>(0x1064+4257-0x2101));if(
+!wms_ts_bcd_to_int(i,&j)){at_print(LOG_DEBUG,
 "\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"
-,data[pos]);i=(0xa+6430-0x1928);}timestamp->year=i;pos++;i=((data[pos]&
-(0x1644+2911-0x2194))<<(0x16df+2153-0x1f44))+((data[pos]&(0x2f3+6679-0x1c1a))>>
-(0x28f+5525-0x1820));if(wms_ts_bcd_to_int(i,&j)){if(j>(0xe15+1053-0x1226)||j<
-(0xcbf+6062-0x246c)){at_print(LOG_DEBUG,
+,data[pos]);i=(0x340+1363-0x893);}timestamp->year=i;pos++;i=((data[pos]&
+(0x789+830-0xab8))<<(0x145+8088-0x20d9))+((data[pos]&(0xd41+2049-0x1452))>>
+(0x798+2935-0x130b));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x126+3559-0xf01)||j<
+(0x134c+2921-0x1eb4)){at_print(LOG_DEBUG,
 "\x4d\x6f\x6e\x74\x68\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64"
-,j);i=(0x15e6+1572-0x1c09);}}else{at_print(LOG_DEBUG,
+,j);i=(0x8f1+2962-0x1482);}}else{at_print(LOG_DEBUG,
 "\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"
-,data[pos]);i=(0x62d+1384-0xb94);}timestamp->month=i;pos++;i=((data[pos]&
-(0x1e8+7664-0x1fc9))<<(0x1f69+873-0x22ce))+((data[pos]&(0x851+889-0xada))>>
-(0x13a4+902-0x1726));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x110b+2362-0x1a26)||j<
-(0xc2d+2781-0x1709)){at_print(LOG_DEBUG,
+,data[pos]);i=(0xbb2+49-0xbe2);}timestamp->month=i;pos++;i=((data[pos]&
+(0x86+418-0x219))<<(0x1200+3022-0x1dca))+((data[pos]&(0x148c+1914-0x1b16))>>
+(0x49a+295-0x5bd));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x159d+2457-0x1f17)||j<
+(0x5b8+3838-0x14b5)){at_print(LOG_DEBUG,
 "\x44\x61\x79\x20\x69\x73\x20\x69\x6e\x76\x61\x6c\x69\x64\x3a\x20\x25\x64",j);i=
-(0xfd4+2410-0x193d);}}else{at_print(LOG_DEBUG,
+(0xc82+2056-0x1489);}}else{at_print(LOG_DEBUG,
 "\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"
-,data[pos]);i=(0x611+886-0x986);}timestamp->day=i;pos++;i=((data[pos]&
-(0x15d4+508-0x17c1))<<(0xf7a+4621-0x2183))+((data[pos]&(0x10a6+2935-0x1b2d))>>
-(0x1942+2354-0x2270));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x1479+1653-0x1ad7)){
+,data[pos]);i=(0x1c54+2648-0x26ab);}timestamp->day=i;pos++;i=((data[pos]&
+(0x348+4060-0x1315))<<(0x5e4+748-0x8cc))+((data[pos]&(0x656+8563-0x26d9))>>
+(0x864+373-0x9d5));if(wms_ts_bcd_to_int(i,&j)){if(j>(0xa05+2676-0x1462)){
 at_print(LOG_DEBUG,
 "\x48\x6f\x75\x72\x20\x69\x73\x20\x74\x6f\x6f\x20\x6c\x61\x72\x67\x65\x3a\x20\x25\x64"
-,j);i=(0x1023+1855-0x1762);}}else{at_print(LOG_DEBUG,
+,j);i=(0xba+3912-0x1002);}}else{at_print(LOG_DEBUG,
 "\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"
-,data[pos]);i=(0x7b6+5194-0x1c00);}timestamp->hour=i;pos++;i=((data[pos]&
-(0x4a6+461-0x664))<<(0x14b+1256-0x62f))+((data[pos]&(0x66b+5941-0x1cb0))>>
-(0xc68+4360-0x1d6c));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x164a+176-0x16bf)){
+,data[pos]);i=(0xc9+5566-0x1687);}timestamp->hour=i;pos++;i=((data[pos]&
+(0x1608+2821-0x20fe))<<(0x1455+1828-0x1b75))+((data[pos]&(0x1461+3810-0x2253))>>
+(0x24d+497-0x43a));if(wms_ts_bcd_to_int(i,&j)){if(j>(0xd97+3704-0x1bd4)){
 at_print(LOG_DEBUG,
 "\x4d\x69\x6e\x75\x74\x65\x20\x69\x73\x20\x74\x6f\x6f\x20\x6c\x61\x72\x67\x65\x3a\x20\x25\x64"
-,j);i=(0xfd3+4417-0x2114);}}else{at_print(LOG_DEBUG,
+,j);i=(0x17b1+936-0x1b59);}}else{at_print(LOG_DEBUG,
 "\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"
-,data[pos]);i=(0x13ef+1788-0x1aeb);}timestamp->minute=i;pos++;i=((data[pos]&
-(0xbfb+2766-0x16ba))<<(0x1555+3946-0x24bb))+((data[pos]&(0x104a+5410-0x247c))>>
-(0x1591+3277-0x225a));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x41c+6031-0x1b70)){
+,data[pos]);i=(0x1ef3+431-0x20a2);}timestamp->minute=i;pos++;i=((data[pos]&
+(0x383+700-0x630))<<(0xa7d+250-0xb73))+((data[pos]&(0x553+439-0x61a))>>
+(0x2118+1248-0x25f4));if(wms_ts_bcd_to_int(i,&j)){if(j>(0x6bb+4325-0x1765)){
 at_print(LOG_DEBUG,
 "\x53\x65\x63\x6f\x6e\x64\x20\x69\x73\x20\x74\x6f\x6f\x20\x6c\x61\x72\x67\x65\x3a\x20\x25\x64"
-,i);i=(0x25a+8968-0x2562);}}else{at_print(LOG_DEBUG,
+,i);i=(0x1133+4769-0x23d4);}}else{at_print(LOG_DEBUG,
 "\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"
-,data[pos]);i=(0x21f+9079-0x2596);}timestamp->second=i;pos++;if(data[pos]&
-(0xb65+1273-0x1056)){timestamp->timezone=(data[pos]&(0x1761+1100-0x1ba6))*
-(0xee9+5196-0x232b)+((data[pos]&(0x1061+646-0x11f7))>>(0xb76+1205-0x1027));
-timestamp->timezone*=(-(0xa93+535-0xca9));}else{timestamp->timezone=(sint7)((
-data[pos]&(0xad2+3989-0x1a58))*(0x86c+1266-0xd54)+((data[pos]&(0xe7d+340-0xee1))
->>(0xb8f+1428-0x111f)));}if(timestamp->timezone>(0xdc8+5902-0x24a6)||timestamp->
-timezone<-(0x135c+1978-0x1ae6)){at_print(LOG_DEBUG,
+,data[pos]);i=(0x165+8026-0x20bf);}timestamp->second=i;pos++;if(data[pos]&
+(0x915+349-0xa6a)){timestamp->timezone=(data[pos]&(0x83+3024-0xc4c))*
+(0x1b12+1865-0x2251)+((data[pos]&(0x1a90+3079-0x25a7))>>(0x1948+2811-0x243f));
+timestamp->timezone*=(-(0x834+2905-0x138c));}else{timestamp->timezone=(sint7)((
+data[pos]&(0x559+5145-0x1963))*(0x8ed+1449-0xe8c)+((data[pos]&
+(0xc3d+3159-0x17a4))>>(0xa6+5724-0x16fe)));}if(timestamp->timezone>
+(0x2fd+4766-0x156b)||timestamp->timezone<-(0x84d+5297-0x1cce)){at_print(
+LOG_DEBUG,
 "\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"
-,timestamp->timezone);timestamp->timezone=(0x845+5001-0x1bce);}pos++;return pos;
+,timestamp->timezone);timestamp->timezone=(0x1713+467-0x18e6);}pos++;return pos;
 }static UINT8 wms_ts_decode_udh_concat_8(const UINT8*udh,wms_udh_s_type*
-header_ptr){UINT8 pos=(0xe39+4725-0x20ae);if(udh==NULL||header_ptr==NULL){
+header_ptr){UINT8 pos=(0xdc7+4563-0x1f9a);if(udh==NULL||header_ptr==NULL){
 at_print(LOG_DEBUG,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return
-(0x35f+452-0x523);}if(udh[pos]<(0xaf+4798-0x136a)){at_print(LOG_DEBUG,
+(0x338+6140-0x1b34);}if(udh[pos]<(0x7c9+6678-0x21dc)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x101+5859-0x17e4);}if(udh[pos+(0x18df+1830-0x2003)]==
-(0x122c+3524-0x1ff0)||udh[pos+(0x19+5990-0x177c)]>udh[pos+(0x35c+816-0x68a)]){
+,udh[pos]);return(0x1351+2117-0x1b96);}if(udh[pos+(0x7b4+907-0xb3d)]==
+(0x20b+2356-0xb3f)||udh[pos+(0xd45+5751-0x23b9)]>udh[pos+(0x4e4+7248-0x2132)]){
 at_print(LOG_DEBUG,
 "\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"
-);return(0x89+8986-0x23a3);}pos++;header_ptr->header_id=WMS_UDH_CONCAT_8;
+);return(0xeb5+866-0x1217);}pos++;header_ptr->header_id=WMS_UDH_CONCAT_8;
 header_ptr->u.concat_8.msg_ref=udh[pos++];header_ptr->u.concat_8.total_sm=udh[
-pos++];header_ptr->u.concat_8.seq_num=udh[pos++];return(udh[(0xbbc+2475-0x1567)]
-+(0x401+7124-0x1fd4));}static UINT8 wms_ts_decode_udh_concat16(const UINT8*udh,
-wms_udh_s_type*header_ptr){UINT8 pos=(0x1742+3885-0x266f);if(udh==NULL||
-header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xa5b+7157-0x2650);}if(
-udh[pos]<(0xe9+7387-0x1dc0)){at_print(LOG_DEBUG,
+pos++];header_ptr->u.concat_8.seq_num=udh[pos++];return(udh[(0xc48+3115-0x1873)]
++(0x7ff+4146-0x1830));}static UINT8 wms_ts_decode_udh_concat16(const UINT8*udh,
+wms_udh_s_type*header_ptr){UINT8 pos=(0x6d+2293-0x962);if(udh==NULL||header_ptr
+==NULL){at_print(LOG_DEBUG,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");
+return(0xb00+5081-0x1ed9);}if(udh[pos]<(0x1321+1048-0x1735)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0xe5b+2711-0x18f2);}if(udh[pos+(0x15a+8726-0x236d)]==
-(0x85a+1371-0xdb5)||udh[pos+(0x6d+8421-0x214e)]==(0x82b+7129-0x2404)||udh[pos+
-(0xd6c+4637-0x1f85)]>udh[pos+(0x852+6322-0x2101)])return(0x717+7209-0x2340);
+,udh[pos]);return(0x115f+3051-0x1d4a);}if(udh[pos+(0x16c+245-0x25e)]==
+(0x8a7+1855-0xfe6)||udh[pos+(0x993+5839-0x205e)]==(0x88c+6366-0x216a)||udh[pos+
+(0x5f3+7017-0x2158)]>udh[pos+(0x43+88-0x98)])return(0x18d4+2040-0x20cc);
 header_ptr->header_id=WMS_UDH_CONCAT_16;pos++;header_ptr->u.concat_16.msg_ref=
 udh[pos++];header_ptr->u.concat_16.msg_ref=(UINT16)(header_ptr->u.concat_16.
-msg_ref<<(0x209d+888-0x240d))|udh[pos++];header_ptr->u.concat_16.total_sm=udh[
-pos++];header_ptr->u.concat_16.seq_num=udh[pos++];return(udh[(0x1ac+1827-0x8cf)]
-+(0x761+1927-0xee7));}static UINT8 wms_ts_udh_decode_first_seg_check(const UINT8
- len,const UINT8*data,UINT8*is_first_segment_ptr){UINT8 pos=(0x1138+3018-0x1d02)
-;UINT8 num_headers=(0x1973+359-0x1ada);UINT8 udhl=(0xc73+213-0xd48);UINT8 iedl=
-(0x5b7+4184-0x160f);UINT8 iei=(0x1314+4301-0x23e1);*is_first_segment_ptr=TRUE;if
-(data==NULL||data[pos]==(0x1565+265-0x166e)||len==(0x940+5622-0x1f36)){at_print(
-LOG_DEBUG,
+msg_ref<<(0x429+5540-0x19c5))|udh[pos++];header_ptr->u.concat_16.total_sm=udh[
+pos++];header_ptr->u.concat_16.seq_num=udh[pos++];return(udh[
+(0x1e3f+1021-0x223c)]+(0x16b7+3923-0x2609));}static UINT8 
+wms_ts_udh_decode_first_seg_check(const UINT8 len,const UINT8*data,UINT8*
+is_first_segment_ptr){UINT8 pos=(0x756+7434-0x2460);UINT8 num_headers=
+(0xc21+274-0xd33);UINT8 udhl=(0x6d0+4796-0x198c);UINT8 iedl=(0x16f6+2439-0x207d)
+;UINT8 iei=(0x1f9+4560-0x13c9);*is_first_segment_ptr=TRUE;if(data==NULL||data[
+pos]==(0x148b+3751-0x2332)||len==(0xaf+6348-0x197b)){at_print(LOG_DEBUG,
 "\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"
 );return FALSE;}udhl=data[pos];pos++;while((pos<udhl)&&(num_headers<
-WMS_MAX_UD_HEADERS)){iei=data[pos];iedl=data[pos+(0x1d13+1526-0x2308)];if(iei==
-WMS_UDH_CONCAT_16){if(data[pos+(0x1a88+2010-0x225d)]!=(0x975+2790-0x145a)){
+WMS_MAX_UD_HEADERS)){iei=data[pos];iedl=data[pos+(0x3ff+2688-0xe7e)];if(iei==
+WMS_UDH_CONCAT_16){if(data[pos+(0x5b4+2276-0xe93)]!=(0x1488+3349-0x219c)){
 at_print(LOG_DEBUG,
 "\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"
 );*is_first_segment_ptr=FALSE;return TRUE;}else{return TRUE;}}else{num_headers++
-;pos+=((0x19ac+772-0x1cae)+iedl);}}return TRUE;}static UINT8 
+;pos+=((0x405+5576-0x19cb)+iedl);}}return TRUE;}static UINT8 
 wms_ts_decode_udh_special_sm(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 
-pos=(0x2ea+131-0x36d);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x132+39-0x159);}if(udh[
-pos]<(0xae7+1890-0x1247)){at_print(LOG_DEBUG,
+pos=(0x7c9+4260-0x186d);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x13b1+3065-0x1faa);}if(
+udh[pos]<(0x137a+4116-0x238c)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x1d4f+127-0x1dce);}pos++;header_ptr->header_id=
+,udh[pos]);return(0x1342+1841-0x1a73);}pos++;header_ptr->header_id=
 WMS_UDH_SPECIAL_SM;header_ptr->u.special_sm.msg_waiting=(
-wms_gw_msg_waiting_e_type)((udh[pos]>>(0x38c+4539-0x1540)==(0x332+6284-0x1bbe))?
-WMS_GW_MSG_WAITING_DISCARD:WMS_GW_MSG_WAITING_STORE);header_ptr->u.special_sm.
-msg_waiting_kind=(wms_gw_msg_waiting_kind_e_type)(udh[pos++]&(0x87c+5309-0x1cba)
-);header_ptr->u.special_sm.message_count=udh[pos++];return(udh[(0x3c1+387-0x544)
-]+(0x1934+3285-0x2608));}static UINT8 wms_ts_decode_udh_port_8(const UINT8*udh,
-wms_udh_s_type*header_ptr){UINT8 pos=(0x1cd5+2232-0x258d);if(udh==NULL||
-header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x117d+274-0x128f);}if(
-udh[pos]<(0x13f3+4110-0x23ff)){at_print(LOG_DEBUG,
+wms_gw_msg_waiting_e_type)((udh[pos]>>(0x10bb+1610-0x16fe)==(0x14d9+151-0x1570))
+?WMS_GW_MSG_WAITING_DISCARD:WMS_GW_MSG_WAITING_STORE);header_ptr->u.special_sm.
+msg_waiting_kind=(wms_gw_msg_waiting_kind_e_type)(udh[pos++]&(0x250+2100-0xa05))
+;header_ptr->u.special_sm.message_count=udh[pos++];return(udh[
+(0xb48+1975-0x12ff)]+(0x18a3+2896-0x23f2));}static UINT8 
+wms_ts_decode_udh_port_8(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=
+(0xcac+4221-0x1d29);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x675+7202-0x2297);}if(
+udh[pos]<(0x19f+1497-0x776)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x1deb+2319-0x26fa);}pos++;header_ptr->header_id=
-WMS_UDH_PORT_8;header_ptr->u.wap_8.dest_port=udh[pos++];header_ptr->u.wap_8.
-orig_port=udh[pos++];return(udh[(0x252+487-0x439)]+(0x45c+204-0x527));}static 
-UINT8 wms_ts_decode_udh_port16(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 
-pos=(0x7e6+6350-0x20b4);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xb13+882-0xe85);}if(udh[
-pos]<(0x18df+61-0x1918)){at_print(LOG_DEBUG,
+,udh[pos]);return(0x421+4686-0x166f);}pos++;header_ptr->header_id=WMS_UDH_PORT_8
+;header_ptr->u.wap_8.dest_port=udh[pos++];header_ptr->u.wap_8.orig_port=udh[pos
+++];return(udh[(0x863+6630-0x2249)]+(0x45c+6504-0x1dc3));}static UINT8 
+wms_ts_decode_udh_port16(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=
+(0x67+609-0x2c8);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x83c+5161-0x1c65);}if(
+udh[pos]<(0x1594+260-0x1694)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x83+7663-0x1e72);}header_ptr->header_id=WMS_UDH_PORT_16;pos++
+,udh[pos]);return(0x32+5827-0x16f5);}header_ptr->header_id=WMS_UDH_PORT_16;pos++
 ;header_ptr->u.wap_16.dest_port=udh[pos++];header_ptr->u.wap_16.dest_port=(
-UINT16)(header_ptr->u.wap_16.dest_port<<(0x234+5271-0x16c3))|udh[pos++];
+UINT16)(header_ptr->u.wap_16.dest_port<<(0x106a+4566-0x2238))|udh[pos++];
 header_ptr->u.wap_16.orig_port=udh[pos++];header_ptr->u.wap_16.orig_port=(UINT16
-)(header_ptr->u.wap_16.orig_port<<(0x148+8352-0x21e0))|udh[pos++];return(udh[
-(0xcc3+5595-0x229e)]+(0x154+7562-0x1edd));}static UINT8 
+)(header_ptr->u.wap_16.orig_port<<(0x6d2+5354-0x1bb4))|udh[pos++];return(udh[
+(0x182a+1981-0x1fe7)]+(0xb76+284-0xc91));}static UINT8 
 wms_ts_decode_udh_text_formatting(const UINT8*udh,wms_udh_s_type*header_ptr){
-UINT8 pos=(0xb2f+1145-0xfa8);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xe5f+5815-0x2516);}if(
-udh[pos]<(0x156d+2345-0x1e93)){at_print(LOG_DEBUG,
+UINT8 pos=(0x3f9+4067-0x13dc);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG
+,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x10b+6415-0x1a1a);}if(
+udh[pos]<(0xadf+2608-0x150c)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x1ca2+143-0x1d31);}if(udh[pos]>=(0xb21+3662-0x196b)){
+,udh[pos]);return(0x1188+608-0x13e8);}if(udh[pos]>=(0x1e7+9039-0x2532)){
 header_ptr->u.text_formating.is_color_present=TRUE;}else{header_ptr->u.
 text_formating.is_color_present=FALSE;}pos++;header_ptr->header_id=
 WMS_UDH_TEXT_FORMATING;header_ptr->u.text_formating.start_position=udh[pos++];
 header_ptr->u.text_formating.text_formatting_length=udh[pos++];header_ptr->u.
 text_formating.alignment_type=(wms_udh_alignment_e_type)(udh[pos]&
-(0xb2+6773-0x1b24));header_ptr->u.text_formating.font_size=(
-wms_udh_font_size_e_type)((udh[pos]&(0x1d4b+2097-0x2570))>>(0xad7+6843-0x2590));
-header_ptr->u.text_formating.style_bold=(udh[pos]&(0x845+4346-0x192f))>>
-(0x3b1+7349-0x2062);header_ptr->u.text_formating.style_italic=(udh[pos]&
-(0x254+3211-0xebf))>>(0x2e8+637-0x560);header_ptr->u.text_formating.
-style_underlined=(udh[pos]&(0xa5c+4013-0x19c9))>>(0xe7b+5035-0x2220);header_ptr
-->u.text_formating.style_strikethrough=(udh[pos]&(0x1841+3157-0x2416))>>
-(0x10f7+3977-0x2079);pos++;if(header_ptr->u.text_formating.is_color_present){
+(0x1655+3384-0x238a));header_ptr->u.text_formating.font_size=(
+wms_udh_font_size_e_type)((udh[pos]&(0x1104+3046-0x1cde))>>(0x20+5526-0x15b4));
+header_ptr->u.text_formating.style_bold=(udh[pos]&(0xd9d+93-0xdea))>>
+(0xd08+1568-0x1324);header_ptr->u.text_formating.style_italic=(udh[pos]&
+(0x1037+1440-0x15b7))>>(0x12b0+3125-0x1ee0);header_ptr->u.text_formating.
+style_underlined=(udh[pos]&(0x279+9268-0x266d))>>(0xe1c+3689-0x1c7f);header_ptr
+->u.text_formating.style_strikethrough=(udh[pos]&(0x1ce2+1704-0x230a))>>
+(0x8e8+3800-0x17b9);pos++;if(header_ptr->u.text_formating.is_color_present){
 header_ptr->u.text_formating.text_color_foreground=(wms_udh_text_color_e_type)(
-udh[pos]&(0x754+3057-0x1336));header_ptr->u.text_formating.text_color_background
-=(wms_udh_text_color_e_type)((udh[pos]&(0xe90+6166-0x25b6))>>(0x8d9+5802-0x1f7f)
-);pos++;}return(udh[(0x212+8776-0x245a)]+(0x6d2+5931-0x1dfc));}static UINT8 
+udh[pos]&(0xb8+796-0x3c5));header_ptr->u.text_formating.text_color_background=(
+wms_udh_text_color_e_type)((udh[pos]&(0xbb2+1669-0x1147))>>(0x1d4+9492-0x26e4));
+pos++;}return(udh[(0x1856+2247-0x211d)]+(0x7f6+7613-0x25b2));}static UINT8 
 wms_ts_decode_udh_pre_def_sound(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8
- pos=(0x512+2569-0xf1b);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x635+4326-0x171b);}if(
-udh[pos]<(0x186a+2326-0x217e)){at_print(LOG_DEBUG,
+ pos=(0xbaf+5830-0x2275);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x14b2+1149-0x192f);}if(
+udh[pos]<(0x1a8f+2201-0x2326)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0xd07+4279-0x1dbe);}pos++;header_ptr->header_id=
+,udh[pos]);return(0x141b+3447-0x2192);}pos++;header_ptr->header_id=
 WMS_UDH_PRE_DEF_SOUND;header_ptr->u.pre_def_sound.position=udh[pos++];header_ptr
-->u.pre_def_sound.snd_number=udh[pos++];return(udh[(0xe04+1165-0x1291)]+
-(0x1ef2+1860-0x2635));}static UINT8 wms_ts_decode_udh_user_def_sound(const UINT8
-*udh,wms_udh_s_type*header_ptr){UINT8 pos=(0x897+649-0xb20),j;if(udh==NULL||
+->u.pre_def_sound.snd_number=udh[pos++];return(udh[(0x1057+4760-0x22ef)]+
+(0x1170+4331-0x225a));}static UINT8 wms_ts_decode_udh_user_def_sound(const UINT8
+*udh,wms_udh_s_type*header_ptr){UINT8 pos=(0xed3+5356-0x23bf),j;if(udh==NULL||
 header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xd22+3083-0x192d);}if(
-udh[pos]==(0x6f2+8027-0x264d)){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xc83+5038-0x2031);}if(
+udh[pos]==(0x2383+892-0x26ff)){at_print(LOG_DEBUG,
 "\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"
-);return(0xb92+5827-0x2255);}header_ptr->header_id=WMS_UDH_USER_DEF_SOUND;
-header_ptr->u.user_def_sound.data_length=udh[pos++]-(0x3ea+342-0x53f);header_ptr
+);return(0x12a7+1375-0x1806);}header_ptr->header_id=WMS_UDH_USER_DEF_SOUND;
+header_ptr->u.user_def_sound.data_length=udh[pos++]-(0x8d4+489-0xabc);header_ptr
 ->u.user_def_sound.position=udh[pos++];if(header_ptr->u.user_def_sound.
 data_length>WMS_UDH_MAX_SND_SIZE){at_print(LOG_DEBUG,
 "\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"
-,header_ptr->header_id);return(0x9c0+1723-0x107b);}memset(header_ptr->u.
-user_def_sound.user_def_sound,(0x1902+3233-0x24a4),WMS_UDH_MAX_SND_SIZE);for(j=
-(0xf8a+4453-0x20ef);j<header_ptr->u.user_def_sound.data_length;j++)header_ptr->u
+,header_ptr->header_id);return(0x19a6+1951-0x2145);}memset(header_ptr->u.
+user_def_sound.user_def_sound,(0x33a+6367-0x1b1a),WMS_UDH_MAX_SND_SIZE);for(j=
+(0xdd6+1667-0x1459);j<header_ptr->u.user_def_sound.data_length;j++)header_ptr->u
 .user_def_sound.user_def_sound[j]=udh[pos++];return pos;}static UINT8 
 wms_ts_decode_udh_pre_def_anim(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 
-pos=(0xc67+2327-0x157e);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x122d+1447-0x17d4);}if(
-udh[pos]!=(0x5a1+725-0x874)){at_print(LOG_DEBUG,
+pos=(0xceb+942-0x1099);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x1201+1293-0x170e);}if(
+udh[pos]!=(0x1e93+1483-0x245c)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x3b3+1212-0x86f);}pos++;header_ptr->header_id=
+,udh[pos]);return(0x956+1213-0xe13);}pos++;header_ptr->header_id=
 WMS_UDH_PRE_DEF_ANIM;header_ptr->u.pre_def_anim.position=udh[pos++];header_ptr->
 u.pre_def_anim.animation_number=udh[pos++];return pos;}static UINT8 
 wms_ts_decode_udh_large_anim(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 
-pos=(0xb3a+3023-0x1709),j,k;if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xf9d+1654-0x1613);}if(
-udh[pos]!=(WMS_UDH_ANIM_NUM_BITMAPS*WMS_UDH_LARGE_BITMAP_SIZE+(0x32d+165-0x3d1))
-){at_print(LOG_DEBUG,
+pos=(0x1b18+896-0x1e98),j,k;if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xe4a+569-0x1083);}if(udh
+[pos]!=(WMS_UDH_ANIM_NUM_BITMAPS*WMS_UDH_LARGE_BITMAP_SIZE+(0xb85+2850-0x16a6)))
+{at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x1395+3011-0x1f58);}header_ptr->header_id=WMS_UDH_LARGE_ANIM;
-pos++;header_ptr->u.large_anim.position=udh[pos++];for(j=(0x2dd+6347-0x1ba8);j<
-WMS_UDH_ANIM_NUM_BITMAPS;j++)for(k=(0x50a+620-0x776);k<WMS_UDH_LARGE_BITMAP_SIZE
-;k++)header_ptr->u.large_anim.data[j][k]=udh[pos++];return pos;}static UINT8 
-wms_ts_decode_udh_small_anim(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 
-pos=(0x93+7966-0x1fb1),j,k;if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x1c80+2405-0x25e5);}if(
+,udh[pos]);return(0x1182+5434-0x26bc);}header_ptr->header_id=WMS_UDH_LARGE_ANIM;
+pos++;header_ptr->u.large_anim.position=udh[pos++];for(j=(0x10b+595-0x35e);j<
+WMS_UDH_ANIM_NUM_BITMAPS;j++)for(k=(0xc70+4910-0x1f9e);k<
+WMS_UDH_LARGE_BITMAP_SIZE;k++)header_ptr->u.large_anim.data[j][k]=udh[pos++];
+return pos;}static UINT8 wms_ts_decode_udh_small_anim(const UINT8*udh,
+wms_udh_s_type*header_ptr){UINT8 pos=(0x415+2553-0xe0e),j,k;if(udh==NULL||
+header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xe3d+2425-0x17b6);}if(
 udh[pos]!=(WMS_UDH_ANIM_NUM_BITMAPS*WMS_UDH_SMALL_BITMAP_SIZE+
-(0xd49+6067-0x24fb))){at_print(LOG_DEBUG,
+(0xa87+5853-0x2163))){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x19c+8936-0x2484);}header_ptr->header_id=WMS_UDH_SMALL_ANIM;
-pos++;header_ptr->u.small_anim.position=udh[pos++];for(j=(0xeba+2174-0x1738);j<
-WMS_UDH_ANIM_NUM_BITMAPS;j++)for(k=(0x78d+6547-0x2120);k<
-WMS_UDH_SMALL_BITMAP_SIZE;k++)header_ptr->u.small_anim.data[j][k]=udh[pos++];
-return pos;}static UINT8 wms_ts_decode_udh_large_picture(const UINT8*udh,
-wms_udh_s_type*header_ptr){UINT8 pos=(0x1b90+2431-0x250f),j;if(udh==NULL||
-header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x55a+3049-0x1143);}if(
-udh[pos]!=WMS_UDH_LARGE_PIC_SIZE+(0x107d+1511-0x1663)){at_print(LOG_DEBUG,
+,udh[pos]);return(0x12b8+5053-0x2675);}header_ptr->header_id=WMS_UDH_SMALL_ANIM;
+pos++;header_ptr->u.small_anim.position=udh[pos++];for(j=(0xbcf+695-0xe86);j<
+WMS_UDH_ANIM_NUM_BITMAPS;j++)for(k=(0x25+3632-0xe55);k<WMS_UDH_SMALL_BITMAP_SIZE
+;k++)header_ptr->u.small_anim.data[j][k]=udh[pos++];return pos;}static UINT8 
+wms_ts_decode_udh_large_picture(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8
+ pos=(0x1b97+1693-0x2234),j;if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x1056+1313-0x1577);}if(
+udh[pos]!=WMS_UDH_LARGE_PIC_SIZE+(0x4d9+2865-0x1009)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x11c1+5327-0x2690);}header_ptr->header_id=
+,udh[pos]);return(0x16b5+2442-0x203f);}header_ptr->header_id=
 WMS_UDH_LARGE_PICTURE;pos++;header_ptr->u.large_picture.position=udh[pos++];for(
-j=(0x13d+2284-0xa29);j<WMS_UDH_LARGE_PIC_SIZE;j++)header_ptr->u.large_picture.
+j=(0x244+3695-0x10b3);j<WMS_UDH_LARGE_PIC_SIZE;j++)header_ptr->u.large_picture.
 data[j]=udh[pos++];return pos;}static UINT8 wms_ts_decode_udh_small_picture(
-const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=(0x138d+1790-0x1a8b),j;if(
+const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=(0x12c1+2200-0x1b59),j;if(
 udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x5f6+2470-0xf9c);}if(udh
-[pos]!=WMS_UDH_SMALL_PIC_SIZE+(0x1f4+7829-0x2088)){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x2397+447-0x2556);}if(
+udh[pos]!=WMS_UDH_SMALL_PIC_SIZE+(0x1bb+1068-0x5e6)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x49d+2144-0xcfd);}header_ptr->header_id=WMS_UDH_SMALL_PICTURE
-;pos++;header_ptr->u.small_picture.position=udh[pos++];for(j=(0x42a+1964-0xbd6);
-j<WMS_UDH_SMALL_PIC_SIZE;j++)header_ptr->u.small_picture.data[j]=udh[pos++];
-return pos;}static UINT8 wms_ts_decode_udh_var_picture(const UINT8*udh,
-wms_udh_s_type*header_ptr){UINT8 pos=(0x13e8+4165-0x242d),j,pic_size;if(udh==
-NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x237+143-0x2c6);}if(udh[
-pos]>WMS_UDH_VAR_PIC_SIZE+(0xa38+4998-0x1dbb)){at_print(LOG_DEBUG,
+,udh[pos]);return(0x2c1+9075-0x2634);}header_ptr->header_id=
+WMS_UDH_SMALL_PICTURE;pos++;header_ptr->u.small_picture.position=udh[pos++];for(
+j=(0x5f7+2929-0x1168);j<WMS_UDH_SMALL_PIC_SIZE;j++)header_ptr->u.small_picture.
+data[j]=udh[pos++];return pos;}static UINT8 wms_ts_decode_udh_var_picture(const 
+UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=(0x1b70+1835-0x229b),j,pic_size;
+if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x58d+3511-0x1344);}if(
+udh[pos]>WMS_UDH_VAR_PIC_SIZE+(0x1020+5446-0x2563)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x1+780-0x30d);}if((udh[pos]-(0x95f+6782-0x23da))!=(udh[pos+
-(0x667+3900-0x15a1)]*udh[pos+(0x4e9+683-0x791)])){at_print(LOG_DEBUG,
+,udh[pos]);return(0x806+5673-0x1e2f);}if((udh[pos]-(0x7e6+686-0xa91))!=(udh[pos+
+(0x1062+3797-0x1f35)]*udh[pos+(0x5e2+7477-0x2314)])){at_print(LOG_DEBUG,
 "\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"
-);return(0xc6d+3120-0x189d);}pic_size=udh[pos++]-(0x1716+2303-0x2012);header_ptr
+);return(0xcd8+1359-0x1227);}pic_size=udh[pos++]-(0xe10+1420-0x1399);header_ptr
 ->header_id=WMS_UDH_VAR_PICTURE;header_ptr->u.var_picture.position=udh[pos++];
-header_ptr->u.var_picture.width=(UINT8)(udh[pos++]*(0x1706+1271-0x1bf5));
-header_ptr->u.var_picture.height=udh[pos++];for(j=(0x1b89+2232-0x2441);j<
-pic_size&&j<WMS_UDH_VAR_PIC_SIZE;j++)header_ptr->u.var_picture.data[j]=udh[pos++
-];return pos;}static UINT8 wms_ts_decode_udh_user_prompt(const UINT8*udh,
-wms_udh_s_type*header_ptr){UINT8 pos=(0x915+6782-0x2393);if(udh==NULL||
-header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x378+2689-0xdf9);}if(udh
-[pos]<(0x4bb+8553-0x2623)){at_print(LOG_DEBUG,
+header_ptr->u.var_picture.width=(UINT8)(udh[pos++]*(0x27d+1507-0x858));
+header_ptr->u.var_picture.height=udh[pos++];for(j=(0xf24+3801-0x1dfd);j<pic_size
+&&j<WMS_UDH_VAR_PIC_SIZE;j++)header_ptr->u.var_picture.data[j]=udh[pos++];return
+ pos;}static UINT8 wms_ts_decode_udh_user_prompt(const UINT8*udh,wms_udh_s_type*
+header_ptr){UINT8 pos=(0x17f2+3557-0x25d7);if(udh==NULL||header_ptr==NULL){
+at_print(LOG_DEBUG,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return
+(0x949+1466-0xf03);}if(udh[pos]<(0x1efd+1547-0x2507)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0x1ed7+1037-0x22e4);}pos++;header_ptr->header_id=
+,udh[pos]);return(0x322+1296-0x832);}pos++;header_ptr->header_id=
 WMS_UDH_USER_PROMPT;header_ptr->u.user_prompt.number_of_objects=udh[pos++];
-return(udh[(0x22f+3153-0xe80)]+(0x572+1305-0xa8a));}static UINT8 
+return(udh[(0x61f+6676-0x2033)]+(0x438+6028-0x1bc3));}static UINT8 
 wms_ts_decode_udh_eo(const UINT8*udh,UINT8 first_segment,wms_udh_s_type*
-header_ptr){UINT8 pos=(0x539+453-0x6fe),udh_length;if(udh==NULL||header_ptr==
+header_ptr){UINT8 pos=(0x1499+659-0x172c),udh_length;if(udh==NULL||header_ptr==
 NULL){at_print(LOG_DEBUG,"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return
-(0x22a8+958-0x2666);}if(udh[pos]==(0x720+7572-0x24b4)){at_print(LOG_DEBUG,
+(0xadb+4272-0x1b8b);}if(udh[pos]==(0x601+7093-0x21b6)){at_print(LOG_DEBUG,
 "\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"
-);return(0x846+143-0x8d5);}udh_length=udh[pos++];header_ptr->header_id=
+);return(0x320+7846-0x21c6);}udh_length=udh[pos++];header_ptr->header_id=
 WMS_UDH_EXTENDED_OBJECT;header_ptr->u.eo.first_segment=first_segment;if(
 first_segment==TRUE){if(udh_length<WMS_UDH_OCTETS_EO_HEADER){return
-(0x6a4+4617-0x18ad);}header_ptr->u.eo.reference=udh[pos++];header_ptr->u.eo.
-length=udh[pos++]<<(0x1996+2754-0x2450);header_ptr->u.eo.length|=udh[pos++];
+(0xa2f+2497-0x13f0);}header_ptr->u.eo.reference=udh[pos++];header_ptr->u.eo.
+length=udh[pos++]<<(0x6d+6197-0x189a);header_ptr->u.eo.length|=udh[pos++];
 header_ptr->u.eo.control=udh[pos++];header_ptr->u.eo.type=(wms_udh_eo_id_e_type)
-udh[pos++];header_ptr->u.eo.position=udh[pos++]<<(0x1874+3377-0x259d);header_ptr
+udh[pos++];header_ptr->u.eo.position=udh[pos++]<<(0xb0f+5384-0x200f);header_ptr
 ->u.eo.position|=udh[pos++];}header_ptr->u.eo.content.length=(udh_length-pos)+
-(0xee5+2338-0x1806);memcpy(header_ptr->u.eo.content.data,udh+pos,header_ptr->u.
+(0x30d+4122-0x1326);memcpy(header_ptr->u.eo.content.data,udh+pos,header_ptr->u.
 eo.content.length);pos+=header_ptr->u.eo.content.length;return pos;}static UINT8
  wms_ts_decode_udh_rfc822(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=
-(0x2354+874-0x26be);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xca+5081-0x14a3);}if(udh
-[pos]<(0xb7c+3681-0x19dc)){at_print(LOG_DEBUG,
+(0xc99+6577-0x264a);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x1d22+1566-0x2340);}if(
+udh[pos]<(0x526+46-0x553)){at_print(LOG_DEBUG,
 "\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"
-,udh[pos]);return(0xe12+5916-0x252e);}pos++;header_ptr->header_id=WMS_UDH_RFC822
-;header_ptr->u.rfc822.header_length=udh[pos++];return(udh[(0xf3d+2414-0x18ab)]+
-(0xae2+6704-0x2511));}static UINT8 wms_ts_decode_udh_nat_lang_ss(const UINT8*udh
-,wms_udh_s_type*header_ptr){UINT8 pos=(0x29b+2988-0xe47);if(udh==NULL||
-header_ptr==NULL){return(0x701+1419-0xc8c);}if(udh[pos]!=
-WMS_UDH_OCTETS_NAT_LANG_SS){return(0x1e9a+1882-0x25f4);}pos++;header_ptr->
+,udh[pos]);return(0x54c+5339-0x1a27);}pos++;header_ptr->header_id=WMS_UDH_RFC822
+;header_ptr->u.rfc822.header_length=udh[pos++];return(udh[(0x45f+7047-0x1fe6)]+
+(0x2b3+8032-0x2212));}static UINT8 wms_ts_decode_udh_nat_lang_ss(const UINT8*udh
+,wms_udh_s_type*header_ptr){UINT8 pos=(0x870+2543-0x125f);if(udh==NULL||
+header_ptr==NULL){return(0x4b8+3236-0x115c);}if(udh[pos]!=
+WMS_UDH_OCTETS_NAT_LANG_SS){return(0xbb+4505-0x1254);}pos++;header_ptr->
 header_id=WMS_UDH_NAT_LANG_SS;if((WMS_UDH_NAT_LANG_TURKISH>udh[pos])||(
-WMS_UDH_NAT_LANG_PORTUGUESE<udh[pos])){return(0xde2+4545-0x1fa3);}header_ptr->u.
+WMS_UDH_NAT_LANG_PORTUGUESE<udh[pos])){return(0x9e8+605-0xc45);}header_ptr->u.
 nat_lang_ss.nat_lang_id=(wms_udh_nat_lang_id_e_type)udh[pos++];return(udh[
-(0x735+1323-0xc60)]+(0x768+2035-0xf5a));}static UINT8 
+(0x2d4+4520-0x147c)]+(0x43+8940-0x232e));}static UINT8 
 wms_ts_decode_udh_nat_lang_ls(const UINT8*udh,wms_udh_s_type*header_ptr){UINT8 
-pos=(0x21f+883-0x592);if(udh==NULL||header_ptr==NULL){return(0x1db2+1372-0x230e)
-;}if(udh[pos]!=WMS_UDH_OCTETS_NAT_LANG_LS){return(0xdac+534-0xfc2);}pos++;
-header_ptr->header_id=WMS_UDH_NAT_LANG_LS;if((WMS_UDH_NAT_LANG_TURKISH>udh[pos])
-||(WMS_UDH_NAT_LANG_PORTUGUESE<udh[pos])){return(0xd97+2264-0x166f);}header_ptr
-->u.nat_lang_ls.nat_lang_id=(wms_udh_nat_lang_id_e_type)udh[pos++];return(udh[
-(0x1a7+4467-0x131a)]+(0xab+28-0xc6));}static UINT8 wms_ts_decode_udh_other(const
- UINT8*udh,wms_udh_s_type*header_ptr){UINT8 pos=(0x951+6593-0x2312),i=
-(0x3fb+3139-0x103e);if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
-"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0x140a+620-0x1676);}if(
-udh[pos+(0x1a4+3897-0x10dc)]>WMS_UDH_OTHER_SIZE){at_print(LOG_DEBUG,
+pos=(0x18d2+2052-0x20d6);if(udh==NULL||header_ptr==NULL){return
+(0x10b+1598-0x749);}if(udh[pos]!=WMS_UDH_OCTETS_NAT_LANG_LS){return
+(0x1f5+6414-0x1b03);}pos++;header_ptr->header_id=WMS_UDH_NAT_LANG_LS;if((
+WMS_UDH_NAT_LANG_TURKISH>udh[pos])||(WMS_UDH_NAT_LANG_PORTUGUESE<udh[pos])){
+return(0xd9c+2998-0x1952);}header_ptr->u.nat_lang_ls.nat_lang_id=(
+wms_udh_nat_lang_id_e_type)udh[pos++];return(udh[(0x10ba+5565-0x2677)]+
+(0x1de4+1299-0x22f6));}static UINT8 wms_ts_decode_udh_other(const UINT8*udh,
+wms_udh_s_type*header_ptr){UINT8 pos=(0x4d4+3918-0x1422),i=(0x21e2+489-0x23cb);
+if(udh==NULL||header_ptr==NULL){at_print(LOG_DEBUG,
+"\x75\x64\x68\x20\x69\x73\x20\x4e\x55\x4c\x4c");return(0xbe7+4629-0x1dfc);}if(
+udh[pos+(0xeb8+5665-0x24d8)]>WMS_UDH_OTHER_SIZE){at_print(LOG_DEBUG,
 "\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"
-);return(0x1e35+1931-0x25c0);}header_ptr->header_id=(wms_udh_id_e_type)udh[pos];
+);return(0x597+7115-0x2162);}header_ptr->header_id=(wms_udh_id_e_type)udh[pos];
 header_ptr->u.other.header_id=(wms_udh_id_e_type)udh[pos++];header_ptr->u.other.
-header_length=udh[pos++];for(i=(0x9db+1793-0x10dc);i<header_ptr->u.other.
+header_length=udh[pos++];for(i=(0x188b+1379-0x1dee);i<header_ptr->u.other.
 header_length;i++){header_ptr->u.other.data[i]=udh[pos++];}return pos;}UINT8 
 wms_ts_decode_user_data_header(const UINT8 len,const UINT8*data,UINT8*
-num_headers_ptr,wms_udh_s_type*udh_ptr){UINT8 pos=(0x1bc1+985-0x1f9a);UINT8 
-header_length=(0x1995+3163-0x25f0),num_headers=(0x278+8721-0x2489);UINT8 udhl;
-UINT8 first_segment=TRUE;if(data==NULL||len==(0xe59+2920-0x19c1)||data[pos]==
-(0x33b+1260-0x827)||num_headers_ptr==NULL||udh_ptr==NULL){at_print(LOG_DEBUG,
+num_headers_ptr,wms_udh_s_type*udh_ptr){UINT8 pos=(0xb1c+6212-0x2360);UINT8 
+header_length=(0x4b7+4106-0x14c1),num_headers=(0x94a+5948-0x2086);UINT8 udhl;
+UINT8 first_segment=TRUE;if(data==NULL||len==(0x2a5+3367-0xfcc)||data[pos]==
+(0x1d92+244-0x1e86)||num_headers_ptr==NULL||udh_ptr==NULL){at_print(LOG_DEBUG,
 "\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"
-);return(0x655+4688-0x18a5);}udhl=data[pos];pos++;while((pos<udhl)&&(num_headers
+);return(0x235+8551-0x239c);}udhl=data[pos];pos++;while((pos<udhl)&&(num_headers
 <WMS_MAX_UD_HEADERS)){switch(data[pos++]){case WMS_UDH_CONCAT_8:header_length=
 wms_ts_decode_udh_concat_8(data+pos,&udh_ptr[num_headers]);break;case 
 WMS_UDH_CONCAT_16:header_length=wms_ts_decode_udh_concat16(data+pos,&udh_ptr[
@@ -1863,66 +1863,66 @@
 data+pos,&udh_ptr[num_headers]);break;}if((UINT16)pos+(UINT16)header_length>
 WMS_MAX_LEN){at_print(LOG_DEBUG,
 "\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"
-,udhl);return(0x839+7331-0x24dc);}else if(header_length!=(0x18a5+1369-0x1dfe)){
+,udhl);return(0x65b+8190-0x2659);}else if(header_length!=(0x166a+2446-0x1ff8)){
 pos+=header_length;num_headers++;}else{at_print(LOG_DEBUG,
 "\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"
-,pos,data[pos]);*num_headers_ptr=(0x11f4+3190-0x1e6a);return(0x1edd+788-0x21f1);
-}}if(num_headers>=WMS_MAX_UD_HEADERS){at_print(LOG_DEBUG,
+,pos,data[pos]);*num_headers_ptr=(0x382+611-0x5e5);return(0x74+8625-0x2225);}}if
+(num_headers>=WMS_MAX_UD_HEADERS){at_print(LOG_DEBUG,
 "\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"
-);pos=udhl+(0xf09+4595-0x20fb);}if(pos!=(udhl+(0x21d+3770-0x10d6))){at_print(
+);pos=udhl+(0x10a+4890-0x1423);}if(pos!=(udhl+(0x1bc+2186-0xa45))){at_print(
 LOG_DEBUG,
 "\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"
-);num_headers=(0x199a+3050-0x2584);udhl=(0xfd+2630-0xb43);}if(num_headers>
-(0x9e0+4344-0x1ad8)){*num_headers_ptr=num_headers;}return udhl;}UINT8 
+);num_headers=(0x607+7115-0x21d2);udhl=(0x1b0a+787-0x1e1d);}if(num_headers>
+(0x56b+7075-0x210e)){*num_headers_ptr=num_headers;}return udhl;}UINT8 
 wms_ts_decode_gw_user_data(const wms_gw_dcs_s_type*dcs,const UINT8 len,const 
 UINT8*data,const UINT8 user_data_header_present,wms_gw_user_data_s_type*
-user_data){UINT8 i,pos=(0xf9f+4492-0x212b);UINT8 fill_bits=(0xd56+357-0xebb);
-UINT8 user_data_length;UINT8 user_data_header_length=(0x22d+4049-0x11fe);if(dcs
+user_data){UINT8 i,pos=(0x22b6+935-0x265d);UINT8 fill_bits=(0xc62+2097-0x1493);
+UINT8 user_data_length;UINT8 user_data_header_length=(0x140d+3672-0x2265);if(dcs
 ==NULL||data==NULL||user_data==NULL){at_print(LOG_DEBUG,
 "\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"
-);return(0x1f37+814-0x2265);}(void)memset(user_data,(0xa9f+2411-0x140a),sizeof(
-wms_gw_user_data_s_type));if(len==(0x4e8+2252-0xdb4)){return(0x164+5906-0x1876);
-}if(dcs->alphabet==WMS_GW_ALPHABET_7_BIT_DEFAULT){if(len>WMS_SMS_UDL_MAX_7_BIT){
-at_print(LOG_DEBUG,
+);return(0x640+1349-0xb85);}(void)memset(user_data,(0xe04+4275-0x1eb7),sizeof(
+wms_gw_user_data_s_type));if(len==(0x150+3541-0xf25)){return(0x136a+2737-0x1e1b)
+;}if(dcs->alphabet==WMS_GW_ALPHABET_7_BIT_DEFAULT){if(len>WMS_SMS_UDL_MAX_7_BIT)
+{at_print(LOG_DEBUG,
 "\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"
-);return(0x1d86+615-0x1fed);}user_data_length=len;if(user_data_header_present){
+);return(0xdb5+1689-0x144e);}user_data_length=len;if(user_data_header_present){
 user_data_header_length=wms_ts_decode_user_data_header(data[pos],data+pos,&
 user_data->num_headers,user_data->headers);}if(user_data_header_length>len){
 at_print(LOG_DEBUG,
 "\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"
-);return(0x1df4+499-0x1fe7);}if(user_data_header_length>(0x8c7+3666-0x1719)){
-fill_bits=((len*(0x887+5362-0x1d72))-((user_data_header_length+
-(0x145f+3544-0x2236))*(0x871+5103-0x1c58)))%(0xb5b+4069-0x1b39);user_data_length
-=(UINT8)(((len*(0x1f6+1906-0x961))-((user_data_header_length+(0x1241+799-0x155f)
-)*(0x875+2491-0x1228)))/(0x13b1+954-0x1764));pos=user_data_header_length+
-(0x4f9+5556-0x1aac);if(fill_bits!=(0x2d3+8146-0x22a5)){fill_bits=
-(0x5bf+542-0x7d5)-fill_bits;}}i=wms_ts_unpack_gw_7_bit_chars(&data[pos],
-user_data_length,WMS_MAX_LEN,fill_bits,user_data->sm_data);user_data->sm_len=
-user_data_length;}else{if(len>WMS_SMS_UDL_MAX_8_BIT){at_print(LOG_DEBUG,
+);return(0x1780+152-0x1818);}if(user_data_header_length>(0xbf6+5217-0x2057)){
+fill_bits=((len*(0x1caf+194-0x1d6a))-((user_data_header_length+
+(0x1db4+2127-0x2602))*(0xf73+3293-0x1c48)))%(0x63f+4736-0x18b8);user_data_length
+=(UINT8)(((len*(0x117+5963-0x185b))-((user_data_header_length+
+(0x1b78+1455-0x2126))*(0x6e8+7708-0x24fc)))/(0x10fb+4994-0x2476));pos=
+user_data_header_length+(0x1e98+328-0x1fdf);if(fill_bits!=(0x14e8+1420-0x1a74)){
+fill_bits=(0x1266+3316-0x1f52)-fill_bits;}}i=wms_ts_unpack_gw_7_bit_chars(&data[
+pos],user_data_length,WMS_MAX_LEN,fill_bits,user_data->sm_data);user_data->
+sm_len=user_data_length;}else{if(len>WMS_SMS_UDL_MAX_8_BIT){at_print(LOG_DEBUG,
 "\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"
-);return(0x199+3928-0x10f1);}user_data_length=len;if(user_data_header_present){
+);return(0x510+465-0x6e1);}user_data_length=len;if(user_data_header_present){
 user_data_header_length=wms_ts_decode_user_data_header(data[pos],data+pos,&
 user_data->num_headers,user_data->headers);if(user_data_header_length>len){
 at_print(LOG_DEBUG,
 "\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"
-);return(0xe28+4035-0x1deb);}pos+=user_data_header_length+(0x171+9244-0x258c);
-user_data_length=(len-user_data_header_length)-(0xc44+487-0xe2a);}memcpy(
+);return(0x301+6867-0x1dd4);}pos+=user_data_header_length+(0x17e6+2697-0x226e);
+user_data_length=(len-user_data_header_length)-(0x79b+4125-0x17b7);}memcpy(
 user_data->sm_data,data+pos,user_data_length);user_data->sm_len=user_data_length
 ;i=(UINT8)user_data->sm_len;}pos+=i;return pos;}wms_status_e_type 
 wms_ts_decode_deliver(const T_zUfiSms_RawTsData*ptRawTsData,
 wms_gw_deliver_s_type*deliver){wms_status_e_type st=WMS_OK_S;uint32 pos=
-(0x4e5+5957-0x1c2a),i;const UINT8*data=ptRawTsData->data;if(ptRawTsData==NULL||
+(0x13b3+1251-0x1896),i;const UINT8*data=ptRawTsData->data;if(ptRawTsData==NULL||
 deliver==NULL){printf(
 "\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"
-);return WMS_NULL_PTR_S;}else if((data[pos]&(0xadc+2189-0x1366))!=
-(0x1b2+7539-0x1f25)){printf(
+);return WMS_NULL_PTR_S;}else if((data[pos]&(0x50a+5909-0x1c1c))!=
+(0x1a56+2961-0x25e7)){printf(
 "\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"
 );return WMS_INVALID_TPDU_TYPE_S;}else{deliver->more=(data[pos]&
-(0x1634+3809-0x2511))?FALSE:TRUE;deliver->status_report_enabled=(data[pos]&
-(0x1699+1764-0x1d5d))?TRUE:FALSE;deliver->user_data_header_present=(data[pos]&
-(0x32b+6688-0x1d0b))?TRUE:FALSE;deliver->reply_path_present=(data[pos]&
-(0x5d4+4700-0x17b0))?TRUE:FALSE;pos++;i=wms_ts_decode_address(&data[pos],&
-deliver->address);if(i==(0xf7c+5919-0x269b)){printf(
+(0x1799+678-0x1a3b))?FALSE:TRUE;deliver->status_report_enabled=(data[pos]&
+(0xff1+1066-0x13fb))?TRUE:FALSE;deliver->user_data_header_present=(data[pos]&
+(0x590+3527-0x1317))?TRUE:FALSE;deliver->reply_path_present=(data[pos]&
+(0x1181+5056-0x24c1))?TRUE:FALSE;pos++;i=wms_ts_decode_address(&data[pos],&
+deliver->address);if(i==(0xa0+4546-0x1262)){printf(
 "\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"
 );return WMS_INVALID_PARM_SIZE_S;}pos+=i;deliver->pid=(wms_pid_e_type)data[pos];
 pos++;pos+=wms_ts_decode_dcs(data+pos,&deliver->dcs);if(deliver->dcs.
@@ -1930,75 +1930,74 @@
 WMS_PID_RETURN_CALL){deliver->dcs.msg_waiting=WMS_GW_MSG_WAITING_STORE;deliver->
 dcs.msg_waiting_active=TRUE;deliver->dcs.msg_waiting_kind=
 WMS_GW_MSG_WAITING_VOICEMAIL;}}i=wms_ts_decode_timestamp(data+pos,&deliver->
-timestamp);if(i==(0x48d+5127-0x1894)){printf(
+timestamp);if(i==(0xa11+905-0xd9a)){printf(
 "\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"
 );return WMS_INVALID_PARM_VALUE_S;}pos+=i;pos++;i=wms_ts_decode_gw_user_data(&
-deliver->dcs,data[pos-(0x1866+281-0x197e)],data+pos,deliver->
+deliver->dcs,data[pos-(0xc1d+4330-0x1d06)],data+pos,deliver->
 user_data_header_present,&deliver->user_data);if(i>WMS_SMS_UDL_MAX_8_BIT){printf
 (
 "\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"
 ,i);st=WMS_INVALID_USER_DATA_SIZE_S;}pos+=i;return st;}}UINT8 
 wms_ts_decode_gw_validity(const UINT8*data,wms_gw_validity_s_type*validity){
-UINT8 i,pos=(0x1b74+671-0x1e13);if(data==NULL||validity==NULL){at_print(
+UINT8 i,pos=(0x1dc5+1604-0x2409);if(data==NULL||validity==NULL){at_print(
 LOG_DEBUG,
 "\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"
-);return(0x1b96+1829-0x22bb);}else{switch(validity->format){case 
-WMS_GW_VALIDITY_NONE:memset(validity,(0x10ea+3398-0x1e30),sizeof(
+);return(0x512+3922-0x1464);}else{switch(validity->format){case 
+WMS_GW_VALIDITY_NONE:memset(validity,(0x17e4+3089-0x23f5),sizeof(
 wms_gw_validity_s_type));break;case WMS_GW_VALIDITY_RELATIVE:
 zUfiSms_DecodeRelativeTime(data[pos],&validity->u.time);pos++;break;case 
 WMS_GW_VALIDITY_ABSOLUTE:i=wms_ts_decode_timestamp(data+pos,&validity->u.time);
 pos+=i;break;case WMS_GW_VALIDITY_ENHANCED:break;default:break;}return pos;}}
 wms_status_e_type wms_ts_decode_submit(const T_zUfiSms_RawTsData*ptRawTsData,
 wms_gw_submit_s_type*submit){wms_status_e_type st=WMS_OK_S;uint32 pos=
-(0xf72+761-0x126b),i;const UINT8*data;if(ptRawTsData==NULL||submit==NULL){printf
-(
+(0xa3b+2209-0x12dc),i;const UINT8*data;if(ptRawTsData==NULL||submit==NULL){
+printf(
 "\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"
 );return WMS_NULL_PTR_S;}data=ptRawTsData->data;submit->reject_duplicates=(data[
-pos]&(0x749+6766-0x21b3))?TRUE:FALSE;submit->validity.format=(
-wms_gw_validity_format_e_type)((data[pos]&(0x1843+582-0x1a71))>>
-(0xa8b+3710-0x1906));submit->status_report_enabled=(data[pos]&
-(0x7bb+7604-0x254f))?TRUE:FALSE;submit->user_data_header_present=(data[pos]&
-(0x510+5152-0x18f0))?TRUE:FALSE;submit->reply_path_present=(data[pos]&
-(0x2260+1042-0x25f2))?TRUE:FALSE;pos++;submit->message_reference=data[pos];pos++
-;i=wms_ts_decode_address(&data[pos],&submit->address);if(i==(0x15cd+2049-0x1dce)
-){return WMS_INVALID_PARM_SIZE_S;}pos+=i;submit->pid=(wms_pid_e_type)data[pos];
-pos++;pos+=wms_ts_decode_dcs(data+pos,&submit->dcs);i=wms_ts_decode_gw_validity(
-data+pos,&submit->validity);if((submit->validity.format!=WMS_GW_VALIDITY_NONE)&&
-(i==(0x10b0+4535-0x2267))){return WMS_INVALID_PARM_VALUE_S;}pos+=i;pos++;i=
-wms_ts_decode_gw_user_data(&submit->dcs,data[pos-(0x20db+403-0x226d)],data+pos,
-submit->user_data_header_present,&submit->user_data);if(i>WMS_SMS_UDL_MAX_8_BIT)
-{printf(
+pos]&(0xda9+3593-0x1bae))?TRUE:FALSE;submit->validity.format=(
+wms_gw_validity_format_e_type)((data[pos]&(0x1001+3424-0x1d49))>>
+(0x4af+2498-0xe6e));submit->status_report_enabled=(data[pos]&(0x383+3898-0x129d)
+)?TRUE:FALSE;submit->user_data_header_present=(data[pos]&(0xaab+6383-0x235a))?
+TRUE:FALSE;submit->reply_path_present=(data[pos]&(0x69a+4734-0x1898))?TRUE:FALSE
+;pos++;submit->message_reference=data[pos];pos++;i=wms_ts_decode_address(&data[
+pos],&submit->address);if(i==(0xef1+1436-0x148d)){return WMS_INVALID_PARM_SIZE_S
+;}pos+=i;submit->pid=(wms_pid_e_type)data[pos];pos++;pos+=wms_ts_decode_dcs(data
++pos,&submit->dcs);i=wms_ts_decode_gw_validity(data+pos,&submit->validity);if((
+submit->validity.format!=WMS_GW_VALIDITY_NONE)&&(i==(0xcd4+5745-0x2345))){return
+ WMS_INVALID_PARM_VALUE_S;}pos+=i;pos++;i=wms_ts_decode_gw_user_data(&submit->
+dcs,data[pos-(0xc6f+5476-0x21d2)],data+pos,submit->user_data_header_present,&
+submit->user_data);if(i>WMS_SMS_UDL_MAX_8_BIT){printf(
 "\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"
 ,i);st=WMS_INVALID_USER_DATA_SIZE_S;}pos+=i;return st;}wms_status_e_type 
 wms_ts_decode_status_report(const T_zUfiSms_RawTsData*ptRawTsData,
 wms_gw_status_report_s_type*status_report){wms_status_e_type st=WMS_OK_S;uint32 
-pos=(0xd8b+3038-0x1969),i;const UINT8*data;if(ptRawTsData==NULL||status_report==
+pos=(0xa5a+6229-0x22af),i;const UINT8*data;if(ptRawTsData==NULL||status_report==
 NULL){printf(
 "\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"
 );return WMS_NULL_PTR_S;}data=ptRawTsData->data;status_report->more=data[pos]&
-(0x4c8+5162-0x18ee)?FALSE:TRUE;status_report->status_report_qualifier=data[pos]&
-(0x390+1677-0x9fd)?TRUE:FALSE;status_report->user_data_header_present=(data[pos]
-&(0x664+4758-0x18ba))?TRUE:FALSE;pos++;status_report->message_reference=data[pos
-];pos++;i=wms_ts_decode_address(&data[pos],&status_report->address);if(i==
-(0x84+125-0x101)){return WMS_INVALID_PARM_SIZE_S;}pos+=i;i=
+(0x3e4+4581-0x15c5)?FALSE:TRUE;status_report->status_report_qualifier=data[pos]&
+(0x490+3275-0x113b)?TRUE:FALSE;status_report->user_data_header_present=(data[pos
+]&(0xa11+4912-0x1d01))?TRUE:FALSE;pos++;status_report->message_reference=data[
+pos];pos++;i=wms_ts_decode_address(&data[pos],&status_report->address);if(i==
+(0x652+2345-0xf7b)){return WMS_INVALID_PARM_SIZE_S;}pos+=i;i=
 wms_ts_decode_timestamp(data+pos,&status_report->timestamp);if(i==
-(0x360+2745-0xe19)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;i=
+(0x5d3+2031-0xdc2)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;i=
 wms_ts_decode_timestamp(data+pos,&status_report->discharge_time);if(i==
-(0x165f+4085-0x2654)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;status_report->
+(0x36b+2959-0xefa)){return WMS_INVALID_PARM_VALUE_S;}pos+=i;status_report->
 tp_status=(wms_tp_status_e_type)data[pos];pos++;status_report->mask=data[pos];
-status_report->pid=(wms_pid_e_type)(0x1096+481-0x1277);status_report->user_data.
-sm_len=(0xf62+5476-0x24c6);status_report->mask&=(0x6f8+438-0x7af);if((
-status_report->mask!=(0x175+3266-0xd38))&&(status_report->mask!=
-(0x21d+2049-0xa1e))){pos++;if(status_report->mask&WMS_TPDU_MASK_PID){
+status_report->pid=(wms_pid_e_type)(0x79+7858-0x1f2b);status_report->user_data.
+sm_len=(0x673+3387-0x13ae);status_report->mask&=(0x7c6+7878-0x258d);if((
+status_report->mask!=(0x1ad9+647-0x1c61))&&(status_report->mask!=
+(0x14+8459-0x211f))){pos++;if(status_report->mask&WMS_TPDU_MASK_PID){
 status_report->pid=(wms_pid_e_type)data[pos];pos++;}if(status_report->mask&
 WMS_TPDU_MASK_DCS){pos+=wms_ts_decode_dcs(data+pos,&status_report->dcs);}if(
 status_report->mask&WMS_TPDU_MASK_USER_DATA){pos++;i=wms_ts_decode_gw_user_data(
-&status_report->dcs,data[pos-(0x13e2+1294-0x18ef)],data+pos,status_report->
+&status_report->dcs,data[pos-(0x628+7586-0x23c9)],data+pos,status_report->
 user_data_header_present,&status_report->user_data);if(i>WMS_SMS_UDL_MAX_8_BIT){
 printf(
 "\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"
 ,i);st=WMS_INVALID_USER_DATA_SIZE_S;}pos+=i;}}else{status_report->mask=
-(0x62d+166-0x6d3);}return st;}wms_status_e_type wms_ts_decode(const 
+(0x1efd+99-0x1f60);}return st;}wms_status_e_type wms_ts_decode(const 
 T_zUfiSms_RawTsData*ptRawTsData,T_zUfiSms_ClientTsData*ptClientTsData){
 wms_status_e_type st=WMS_OK_S;wms_gw_pp_ts_data_s_type*msg;if(ptRawTsData==NULL
 ||ptClientTsData==NULL){return WMS_NULL_PTR_S;}msg=&ptClientTsData->u.gw_pp;
diff --git a/ap/app/zte_comm/sms/src/sms_db.c b/ap/app/zte_comm/sms/src/sms_db.c
index 93e6c4c..3be03ae 100755
--- a/ap/app/zte_comm/sms/src/sms_db.c
+++ b/ap/app/zte_comm/sms/src/sms_db.c
@@ -101,83 +101,83 @@
 #define OUTDATEINTERVAL 7776000

 typedef struct{char*buf_addr;int buf_len;}T_zUfiSms_BufInfo;typedef struct{int 
 valid;char*strSQL;}T_zUfiSms_SQLMap;sqlite3*g_zUfiSms_DbPointer=
-(0x1492+3042-0x2074);extern T_zUfiSms_ParaInfo g_zUfiSms_CurSmsPara;extern 
+(0x157+8481-0x2278);extern T_zUfiSms_ParaInfo g_zUfiSms_CurSmsPara;extern 
 unsigned long g_zUfiSms_StoreCapablity[ZTE_WMS_MEMORY_MAX];extern 
 T_zUfiSms_DelSms g_zUfiSms_DelMsg;static int isSucess(T_zUfiSms_DbResult dbRst){
 return dbRst==ZTE_WMS_DB_OK?ZUFI_SUCC:ZUFI_FAIL;}time_t zte_getsecond(
-T_zUfiSms_Date date){time_t timet;struct tm tmtime={(0x6f7+1739-0xdc2)};int 
-tmp_i=(0x97c+7441-0x268d);
-#if (0x49d+5988-0x1c01)

-if(atoi(date.year)>(0x9d8+5507-0x1ef8)||atoi(date.year)<(0x1115+5021-0x24b2)){
+T_zUfiSms_Date date){time_t timet;struct tm tmtime={(0x704+3711-0x1583)};int 
+tmp_i=(0x14cc+1981-0x1c89);
+#if (0x2021+138-0x20ab)

+if(atoi(date.year)>(0x1e33+1832-0x24f8)||atoi(date.year)<(0x19d0+552-0x1bf8)){
 printf("[SMS] getsecond error, year out of range: %d!!!",atoi(date.year));return
-(0x152c+4360-0x2634);}
+(0x87f+7141-0x2464);}
 #endif

-tmp_i=atoi(date.year);if(tmp_i<(0x8f+9222-0x2495)||tmp_i>INT_MAX-
-(0x10f+1002-0x4f8)){at_print(LOG_ERR,
+tmp_i=atoi(date.year);if(tmp_i<(0xe2+660-0x376)||tmp_i>INT_MAX-
+(0xefc+2762-0x19c5)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x64\x61\x74\x65\x2e\x79\x65\x61\x72\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);return(0xc99+1812-0x13ad);}tmtime.tm_year=tmp_i+(0x1d6c+89-0x15f5)-
-(0x18d0+3701-0x1fd9);tmp_i=atoi(date.month);if(tmp_i<(0x1b36+706-0x1df8)||tmp_i>
-INT_MAX-(0x135b+1528-0x1952)){at_print(LOG_ERR,
+,tmp_i);return(0xb47+7044-0x26cb);}tmtime.tm_year=tmp_i+(0x10fb+1673-0xfb4)-
+(0x1ebd+3863-0x2668);tmp_i=atoi(date.month);if(tmp_i<(0xb7d+5472-0x20dd)||tmp_i>
+INT_MAX-(0x189+3848-0x1090)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x64\x61\x74\x65\x2e\x6d\x6f\x6e\x74\x68\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);return(0x1d90+2155-0x25fb);}tmtime.tm_mon=tmp_i-(0x164a+3921-0x259a);
-tmp_i=atoi(date.day);if(tmp_i<(0xcb3+5289-0x215c)||tmp_i>INT_MAX-
-(0xd96+4047-0x1d64)){at_print(LOG_ERR,
+,tmp_i);return(0x92d+3487-0x16cc);}tmtime.tm_mon=tmp_i-(0x1d74+489-0x1f5c);tmp_i
+=atoi(date.day);if(tmp_i<(0x13d0+2556-0x1dcc)||tmp_i>INT_MAX-(0x12d3+221-0x13af)
+){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x64\x61\x74\x65\x2e\x64\x61\x79\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);return(0x61b+2025-0xe04);}tmtime.tm_mday=tmp_i;tmp_i=atoi(date.hour);if(
-tmp_i<(0x26a+1163-0x6f5)||tmp_i>INT_MAX-(0x5a+7977-0x1f82)){at_print(LOG_ERR,
+,tmp_i);return(0x652+2731-0x10fd);}tmtime.tm_mday=tmp_i;tmp_i=atoi(date.hour);if
+(tmp_i<(0x1d20+231-0x1e07)||tmp_i>INT_MAX-(0x405+4098-0x1406)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x64\x61\x74\x65\x2e\x68\x6f\x75\x72\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);return(0x11b3+1161-0x163c);}tmtime.tm_hour=tmp_i;tmp_i=atoi(date.min);if
-(tmp_i<(0x20bb+123-0x2136)||tmp_i>INT_MAX-(0x1db+4222-0x1258)){at_print(LOG_ERR,
+,tmp_i);return(0x1948+3339-0x2653);}tmtime.tm_hour=tmp_i;tmp_i=atoi(date.min);if
+(tmp_i<(0x712+5828-0x1dd6)||tmp_i>INT_MAX-(0x2141+519-0x2347)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x64\x61\x74\x65\x2e\x6d\x69\x6e\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);return(0x1491+1219-0x1954);}tmtime.tm_min=tmp_i;tmp_i=atoi(date.sec);if(
-tmp_i<(0xeca+1473-0x148b)||tmp_i>INT_MAX-(0xa3f+1177-0xed7)){at_print(LOG_ERR,
+,tmp_i);return(0x1bac+1864-0x22f4);}tmtime.tm_min=tmp_i;tmp_i=atoi(date.sec);if(
+tmp_i<(0xad4+6223-0x2323)||tmp_i>INT_MAX-(0x5cd+3575-0x13c3)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x64\x61\x74\x65\x2e\x73\x65\x63\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);return(0x1307+3747-0x21aa);}tmtime.tm_sec=tmp_i;timet=mktime(&tmtime);
+,tmp_i);return(0x33b+8444-0x2437);}tmtime.tm_sec=tmp_i;timet=mktime(&tmtime);
 return timet;}T_zUfiSms_DbResult zUfiSms_OpenDb(void){int retry_times=
-(0x982+2416-0x12f2);int open_rst=SQLITE_ERROR;if(g_zUfiSms_DbPointer!=NULL){
+(0x64b+6684-0x2067);int open_rst=SQLITE_ERROR;if(g_zUfiSms_DbPointer!=NULL){
 sqlite3_close(g_zUfiSms_DbPointer);g_zUfiSms_DbPointer=NULL;}do{open_rst=
 sqlite3_open(ZTE_WMS_DB_PATH,&g_zUfiSms_DbPointer);}while(open_rst==
-SQLITE_CANTOPEN&&retry_times++<(0x9b6+5942-0x20e2));printf(
+SQLITE_CANTOPEN&&retry_times++<(0x841+46-0x865));printf(
 "\x7a\x55\x66\x69\x53\x6d\x73\x5f\x4f\x70\x65\x6e\x44\x62\x3a\x20\x72\x65\x74\x72\x79\x5f\x74\x69\x6d\x65\x73\x20\x3d\x20\x25\x64\x2c\x20\x6f\x70\x65\x6e\x5f\x72\x73\x74\x20\x3d\x20\x25\x64" "\n"
 ,retry_times,open_rst);return open_rst==SQLITE_OK?ZTE_WMS_DB_OK:
 ZTE_SMS_DB_ERROR_NOT_OPEN_DB;}T_zUfiSms_DbResult zUfiSms_CloseDb(void){if(
 sqlite3_close(g_zUfiSms_DbPointer)!=SQLITE_OK){return ZTE_SMS_DB_ERROR;}
 g_zUfiSms_DbPointer=NULL;return ZTE_WMS_DB_OK;}T_zUfiSms_DbResult 
 zUfiSms_ExecSql(const char*exec_sql,zte_wms_db_callback callback,void*fvarg){int
- try_times=(0x129c+3044-0x1e80);int sqlRst=SQLITE_ERROR;while(try_times++<
-(0x420+2790-0xefc)){sqlRst=sqlite3_exec(g_zUfiSms_DbPointer,exec_sql,callback,
+ try_times=(0x565+5742-0x1bd3);int sqlRst=SQLITE_ERROR;while(try_times++<
+(0x15f6+383-0x176b)){sqlRst=sqlite3_exec(g_zUfiSms_DbPointer,exec_sql,callback,
 fvarg,NULL);if(sqlRst!=SQLITE_BUSY&&sqlRst!=SQLITE_LOCKED&&sqlRst!=SQLITE_IOERR)
 {break;}printf(
 "\x7a\x55\x66\x69\x53\x6d\x73\x5f\x45\x78\x65\x63\x53\x71\x6c\x3a\x20\x74\x72\x79\x5f\x74\x69\x6d\x65\x73\x3d\x25\x64\x2c\x20\x53\x51\x4c\x3d\x25\x73\x2c\x20\x45\x72\x72\x6d\x73\x67\x3d\x25\x73" "\n"
 ,try_times,exec_sql,sqlite3_errmsg(g_zUfiSms_DbPointer));sleep(
-(0x1eff+1853-0x263b));}if(sqlRst!=SQLITE_OK){printf(
+(0x2c6+7779-0x2128));}if(sqlRst!=SQLITE_OK){printf(
 "\x7a\x55\x66\x69\x53\x6d\x73\x5f\x45\x78\x65\x63\x53\x71\x6c\x3a\x20\x74\x72\x79\x5f\x74\x69\x6d\x65\x73\x3d\x25\x64\x2c\x20\x53\x51\x4c\x3d\x25\x73\x2c\x20\x45\x72\x72\x6d\x73\x67\x3d\x25\x73" "\n"
 ,try_times,exec_sql,sqlite3_errmsg(g_zUfiSms_DbPointer));return ZTE_SMS_DB_ERROR
 ;}else{
 #ifdef WEBS_SECURITY

-if(access(ZTE_WMS_TMP1_PATH,F_OK)==(0x3fa+2660-0xe5e)){slog(PB_PRINT,SLOG_ERR,
+if(access(ZTE_WMS_TMP1_PATH,F_OK)==(0x75+3729-0xf06)){slog(PB_PRINT,SLOG_ERR,
 "\x7a\x55\x66\x69\x53\x6d\x73\x5f\x45\x78\x65\x63\x53\x71\x6c\x20\x64\x62\x20\x73\x74\x61\x79"
-);if(remove(ZTE_WMS_TMP1_PATH)!=(0x1b93+1350-0x20d9)){slog(SMS_PRINT,SLOG_ERR,
+);if(remove(ZTE_WMS_TMP1_PATH)!=(0x7c9+4877-0x1ad6)){slog(SMS_PRINT,SLOG_ERR,
 "\x72\x65\x6d\x6f\x76\x65\x20\x57\x4d\x53\x5f\x54\x4d\x50\x31\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c"
-);}}{char rnum_buf[(0x891+2720-0x1319)]={(0x4b1+2366-0xdef)};char cmd[
-(0xb5c+2425-0x1455)]={(0x50d+353-0x66e)};sc_cfg_get(
+);}}{char rnum_buf[(0xf85+5998-0x26db)]={(0x8f7+1147-0xd72)};char cmd[
+(0x25a+1483-0x7a5)]={(0xef4+1732-0x15b8)};sc_cfg_get(
 "\x72\x6e\x75\x6d\x5f\x61\x74",rnum_buf,sizeof(rnum_buf));snprintf(cmd,sizeof(
 cmd),
 "\x2f\x62\x69\x6e\x2f\x6f\x70\x65\x6e\x73\x73\x6c\x20\x65\x6e\x63\x20\x2d\x65\x20\x2d\x61\x65\x73\x32\x35\x36\x20\x2d\x73\x61\x6c\x74\x20\x2d\x69\x6e\x20\x25\x73\x20\x2d\x6f\x75\x74\x20\x25\x73\x20\x2d\x70\x61\x73\x73\x20\x70\x61\x73\x73\x3a\x25\x73"
 ,ZTE_WMS_DB_PATH,ZTE_WMS_TMP1_PATH,rnum_buf);zxic_system(cmd);if(access(
-ZTE_WMS_TMP1_PATH,F_OK)==(0x1672+1642-0x1cdc)){if(remove(ZTE_WMS_SEC_PATH)!=
-(0xd76+2206-0x1614)){slog(SMS_PRINT,SLOG_ERR,
+ZTE_WMS_TMP1_PATH,F_OK)==(0x146a+51-0x149d)){if(remove(ZTE_WMS_SEC_PATH)!=
+(0x279+3787-0x1144)){slog(SMS_PRINT,SLOG_ERR,
 "\x72\x65\x6d\x6f\x76\x65\x20\x57\x4d\x53\x5f\x53\x45\x43\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c"
-);}if(rename(ZTE_WMS_TMP1_PATH,ZTE_WMS_SEC_PATH)!=(0xd61+1227-0x122c)){slog(
+);}if(rename(ZTE_WMS_TMP1_PATH,ZTE_WMS_SEC_PATH)!=(0x12a0+804-0x15c4)){slog(
 SMS_PRINT,SLOG_ERR,
 "\x72\x65\x6e\x61\x6d\x65\x20\x57\x4d\x53\x5f\x54\x4d\x50\x31\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c"
 );}}}
 #endif	

 return ZTE_WMS_DB_OK;}}int zUfiSms_GetFirstColumnInt(void*fvarg,int columns,char
-**zresult,char**lname){if(columns>=(0x924+6197-0x2158)){if(zresult[
-(0xdfc+1947-0x1597)]==NULL){*(int*)fvarg=(0x124+3063-0xd1b);}else{*(int*)fvarg=
-atoi(zresult[(0xee8+98-0xf4a)]);}return SQLITE_OK;}else{return SQLITE_ERROR;}}
-int zUfiSms_SetCmdStatus(T_zUfiSms_StatusInfo*ptSetStatus){T_zUfiSms_DbResult 
+**zresult,char**lname){if(columns>=(0x1853+2666-0x22bc)){if(zresult[
+(0xa72+265-0xb7b)]==NULL){*(int*)fvarg=(0xfd6+3232-0x1c76);}else{*(int*)fvarg=
+atoi(zresult[(0xec9+1318-0x13ef)]);}return SQLITE_OK;}else{return SQLITE_ERROR;}
+}int zUfiSms_SetCmdStatus(T_zUfiSms_StatusInfo*ptSetStatus){T_zUfiSms_DbResult 
 result=ZTE_WMS_DB_OK;char*strSQL=NULL;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x74\x43\x6d\x64\x53\x74\x61\x74\x75\x73\x20\x65\x6e\x74\x65\x72\x2e" "\n"
 );strSQL=sqlite3_mprintf(
@@ -187,28 +187,28 @@
 ptSetStatus->err_code,ptSetStatus->send_failed_count,ptSetStatus->
 delete_failed_count);result=zUfiSms_ExecSql(strSQL,NULL,NULL);sqlite3_free(
 strSQL);return isSucess(result);}void zUfiSms_SetParameterNv(T_zUfiSms_ParaInfo*
-para){if((0xb06+4383-0x1c25)==(int)para->status_report_on){sc_cfg_set(
+para){if((0x67b+2173-0xef8)==(int)para->status_report_on){sc_cfg_set(
 NV_REPORT_ENABLE,"\x30");}else{sc_cfg_set(NV_REPORT_ENABLE,"\x31");}if(
-(0xffa+1218-0x14bc)==(int)para->sendfail_retry_on){sc_cfg_set(NV_SENDFAIL_RETRY,
-"\x30");}else{sc_cfg_set(NV_SENDFAIL_RETRY,"\x31");}if((0x9+501-0x1fe)==(int)
-para->outdate_delete_on){sc_cfg_set(NV_OUTDATE_DELETE,"\x30");}else{sc_cfg_set(
+(0xaf5+1853-0x1232)==(int)para->sendfail_retry_on){sc_cfg_set(NV_SENDFAIL_RETRY,
+"\x30");}else{sc_cfg_set(NV_SENDFAIL_RETRY,"\x31");}if((0x132a+216-0x1402)==(int
+)para->outdate_delete_on){sc_cfg_set(NV_OUTDATE_DELETE,"\x30");}else{sc_cfg_set(
 NV_OUTDATE_DELETE,"\x31");}if(*(para->default_store)!='\0'){sc_cfg_set(
-NV_DEFAULT_STORE,(char*)para->default_store);}if((0x1cf2+1872-0x2442)==(int)para
+NV_DEFAULT_STORE,(char*)para->default_store);}if((0x1ad5+181-0x1b8a)==(int)para
 ->mem_store){sc_cfg_set(NV_PRA_MEMSTORE,"\x30");}else{sc_cfg_set(NV_PRA_MEMSTORE
-,"\x31");}if((0x1ac3+930-0x1d66)==(int)para->tp_validity_period){sc_cfg_set(
-NV_SMS_VP,"\x6c\x6f\x6e\x67\x65\x73\x74");}else if((0xce1+3722-0x1abe)==(int)
-para->tp_validity_period){sc_cfg_set(NV_SMS_VP,"\x6f\x6e\x65\x77\x65\x65\x6b");}
-else if((0x1ebf+2221-0x26c5)==(int)para->tp_validity_period){sc_cfg_set(
-NV_SMS_VP,"\x6f\x6e\x65\x5f\x64\x61\x79");}else if((0x1912+1645-0x1ef0)==(int)
-para->tp_validity_period){sc_cfg_set(NV_SMS_VP,"\x74\x77\x65\x6c\x76\x65\x68");}
-printf(
+,"\x31");}if((0xfaa+3077-0x1ab0)==(int)para->tp_validity_period){sc_cfg_set(
+NV_SMS_VP,"\x6c\x6f\x6e\x67\x65\x73\x74");}else if((0x286+2587-0xbf4)==(int)para
+->tp_validity_period){sc_cfg_set(NV_SMS_VP,"\x6f\x6e\x65\x77\x65\x65\x6b");}else
+ if((0x1362+2153-0x1b24)==(int)para->tp_validity_period){sc_cfg_set(NV_SMS_VP,
+"\x6f\x6e\x65\x5f\x64\x61\x79");}else if((0xbc8+2856-0x1661)==(int)para->
+tp_validity_period){sc_cfg_set(NV_SMS_VP,"\x74\x77\x65\x6c\x76\x65\x68");}printf
+(
 "\x77\x6d\x73\x5f\x64\x62\x5f\x73\x65\x74\x5f\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73\x20\x3a\x3a\x20\x73\x65\x74\x20\x74\x70\x5f\x76\x61\x6c\x69\x64\x69\x74\x79\x5f\x70\x65\x72\x69\x6f\x64\x20\x25\x64" "\n"
 ,(int)para->tp_validity_period);}int zUfiSms_SetDbParameters(T_zUfiSms_ParaInfo*
 para){T_zUfiSms_DbResult result=ZTE_WMS_DB_OK;char*strSQL=NULL;int count=
-(0x53d+4817-0x180e);if(NULL==para){return-(0x3d0+8053-0x2344);}zUfiSms_ExecSql(
+(0xaf4+4709-0x1d59);if(NULL==para){return-(0x10f3+980-0x14c6);}zUfiSms_ExecSql(
 "\x53\x45\x4c\x45\x43\x54\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x46\x52\x4f\x4d\x20"
  ZTE_WMS_DB_PARAMETER_TABLE"\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x31\x3b",
-zUfiSms_GetFirstColumnInt,&count);if(count>(0x13b8+492-0x15a4)){strSQL=
+zUfiSms_GetFirstColumnInt,&count);if(count>(0x1cf1+1387-0x225c)){strSQL=
 sqlite3_mprintf(
 "\x55\x50\x44\x41\x54\x45\x20\x25\x73\x20\x53\x45\x54\x20\x53\x6d\x73\x5f\x52\x65\x70\x6f\x72\x74\x3d\x27\x25\x64\x27\x2c\x53\x6d\x73\x5f\x53\x63\x61\x3d\x27\x25\x71\x27\x2c\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x64\x27\x2c\x54\x70\x5f\x56\x61\x6c\x69\x64\x69\x74\x79\x3d\x27\x25\x64\x27\x2c\x53\x65\x6e\x64\x5f\x52\x65\x74\x72\x79\x3d\x27\x25\x64\x27\x2c\x4f\x75\x74\x64\x61\x74\x65\x5f\x44\x65\x6c\x65\x74\x65\x3d\x27\x25\x64\x27\x2c\x44\x65\x66\x61\x75\x6c\x74\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x71\x27\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x31\x3b"
 ,ZTE_WMS_DB_PARAMETER_TABLE,(int)para->status_report_on,para->sca,(int)para->
@@ -221,13 +221,13 @@
 mem_store,(int)para->tp_validity_period,(int)para->sendfail_retry_on,(int)para->
 outdate_delete_on,para->default_store);}result=zUfiSms_ExecSql(strSQL,NULL,NULL)
 ;sqlite3_free(strSQL);if(result==ZTE_WMS_DB_OK){zUfiSms_SetParameterNv(para);
-return(0x452+4335-0x1541);}return-(0x1764+2670-0x21d1);}int 
+return(0xc04+2556-0x1600);}return-(0x102b+1723-0x16e5);}int 
 zUfiSms_GetTotalCount(const char*pDbTable,int*pTotalCount){T_zUfiSms_DbResult 
 result=ZTE_WMS_DB_OK;char*strSQL=NULL;strSQL=sqlite3_mprintf(
 "\x53\x45\x4c\x45\x43\x54\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x71\x27\x3b"
 ,pDbTable);result=zUfiSms_ExecSql(strSQL,zUfiSms_GetFirstColumnInt,pTotalCount);
 sqlite3_free(strSQL);return isSucess(result);}int zUfiSms_GetSmsMaxReferInDb(
-void){int max_sms_ref=-(0x5f8+7997-0x2534);zUfiSms_ExecSql(
+void){int max_sms_ref=-(0x1638+683-0x18e2);zUfiSms_ExecSql(
 "\x53\x45\x4c\x45\x43\x54\x20\x4d\x61\x78\x5f\x53\x6d\x73\x5f\x52\x65\x66\x20\x46\x52\x4f\x4d\x20"
  ZTE_WMS_DB_PARAMETER_TABLE
 "\x20\x57\x48\x45\x52\x45\x20\x69\x64\x20\x3d\x20\x31\x3b",
@@ -236,19 +236,19 @@
 content,int len){sqlite3_stmt*stmt=NULL;char*strSQL=sqlite3_mprintf(
 "\x53\x45\x4c\x45\x43\x54\x20\x69\x6e\x64\x2c\x43\x63\x5f\x53\x65\x71\x2c\x43\x63\x5f\x43\x6f\x6e\x74\x65\x6e\x74\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x71\x27\x3b"
 ,id,mem_store);(void)sqlite3_prepare(g_zUfiSms_DbPointer,strSQL,-
-(0x7d1+6054-0x1f76),&stmt,(0xa3b+3247-0x16ea));while(SQLITE_ROW==sqlite3_step(
-stmt)){char*column_text=NULL;memset(pac->IndStr,(0x2c+7953-0x1f3d),sizeof(pac->
-IndStr));memset(pac->Seg_Seq,(0x4fc+6604-0x1ec8),sizeof(pac->Seg_Seq));if((
-column_text=sqlite3_column_text(stmt,(0x467+524-0x673)))!=NULL)strncpy(pac->
-IndStr,column_text,sizeof(pac->FormatInd)-(0x11ba+3247-0x1e68));if((column_text=
-sqlite3_column_text(stmt,(0x919+4-0x91c)))!=NULL)strncpy(pac->Seg_Seq,
-column_text,sizeof(pac->FormatSeq)-(0xac5+6185-0x22ed));if((column_text=
-sqlite3_column_text(stmt,(0xb1d+1111-0xf72)))!=NULL)strncpy(content,column_text,
-len-(0xde2+4042-0x1dab));printf(
+(0x587+3410-0x12d8),&stmt,(0x1bad+644-0x1e31));while(SQLITE_ROW==sqlite3_step(
+stmt)){char*column_text=NULL;memset(pac->IndStr,(0x64+8226-0x2086),sizeof(pac->
+IndStr));memset(pac->Seg_Seq,(0x1c8+8961-0x24c9),sizeof(pac->Seg_Seq));if((
+column_text=sqlite3_column_text(stmt,(0x1200+1302-0x1716)))!=NULL)strncpy(pac->
+IndStr,column_text,sizeof(pac->FormatInd)-(0xc58+1484-0x1223));if((column_text=
+sqlite3_column_text(stmt,(0x131+3275-0xdfb)))!=NULL)strncpy(pac->Seg_Seq,
+column_text,sizeof(pac->FormatSeq)-(0x1abd+2650-0x2516));if((column_text=
+sqlite3_column_text(stmt,(0x70a+5528-0x1ca0)))!=NULL)strncpy(content,column_text
+,len-(0xb3b+2258-0x140c));printf(
 "\x5b\x53\x4d\x53\x5d\x20\x74\x65\x65\x74\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x47\x65\x74\x43\x6f\x6e\x63\x61\x74\x49\x6e\x66\x6f\x3a\x25\x73\x2c\x25\x73" "\n"
 ,pac->IndStr,pac->Seg_Seq);}(void)sqlite3_finalize(stmt);sqlite3_free(strSQL);
-return(0x790+110-0x7fe);}int zUfiSms_UpdateConcatSmsToDb(T_zUfiSms_DbStoreData*
-db_data,const char*mem_store,char*format_concat,char*content,
+return(0x98a+5017-0x1d23);}int zUfiSms_UpdateConcatSmsToDb(T_zUfiSms_DbStoreData
+*db_data,const char*mem_store,char*format_concat,char*content,
 T_zUfiSms_DbStoreStr*pac,int concat_num,long id){char*sql=NULL;
 T_zUfiSms_DbResult result=ZTE_WMS_DB_OK;sql=sqlite3_mprintf(
 "\x55\x50\x44\x41\x54\x45\x20\x73\x6d\x73\x20\x53\x45\x54\x20\x69\x6e\x64\x3d\x27\x25\x73\x27\x2c\x54\x61\x67\x3d\x27\x25\x64\x27\x2c\x43\x63\x5f\x53\x65\x71\x3d\x27\x25\x73\x27\x2c\x43\x63\x5f\x4e\x75\x6d\x3d\x27\x25\x64\x27\x2c\x20"
@@ -269,30 +269,31 @@
 "\x43\x6f\x6e\x74\x65\x6e\x74\x2c\x53\x6d\x73\x5f\x52\x65\x70\x6f\x72\x74\x5f\x52\x65\x63\x69\x76\x65\x64\x2c\x44\x72\x61\x66\x74\x5f\x47\x72\x6f\x75\x70\x5f\x49\x64\x2c\x59\x65\x61\x72\x2c\x4d\x6f\x6e\x74\x68\x2c\x44\x61\x79\x2c\x48\x6f\x75\x72\x2c\x4d\x69\x6e\x75\x74\x65\x2c\x53\x65\x63\x6f\x6e\x64\x2c\x54\x69\x6d\x65\x5a\x6f\x6e\x65\x2c\x4d\x6b\x74\x69\x6d\x65\x2c\x44\x69\x73\x70\x6c\x61\x79\x4d\x6f\x64\x65\x29\x20"
 "\x56\x41\x4c\x55\x45\x53\x28" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c\x20\x27\x25\x64\x27\x2c" "\'" "\x25\x71" "\'" "\x2c\x27\x25\x64\x27\x2c\x27\x25\x64\x27\x2c\x27\x25\x64\x27\x2c" "\'" "\x25\x71" "\'" "\x2c\x27\x25\x64\x27\x2c" "\'" "\x25\x71" "\'" "\x2c\x27\x25\x64\x27\x2c\x20\x27\x25\x64\x27\x2c" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c\x20" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c" "\'" "\x25\x71" "\'" "\x2c\x27\x25\x64\x27\x2c\x20\x27\x25\x64\x27\x29\x3b"
 ,pac->FormatInd,mem_store,db_data->tag,db_data->number,db_data->concat_sms,
-db_data->concat_info[(0xa0+5340-0x157c)],db_data->concat_info[(0x339+3083-0xf43)
-],pac->FormatSeq,concat_num,format_concat,db_data->tp_dcs,db_data->msg_ref,
-content,"\x30",db_data->draft_group_id,db_data->julian_date.year,db_data->
-julian_date.month,db_data->julian_date.day,db_data->julian_date.hour,db_data->
-julian_date.min,db_data->julian_date.sec,db_data->julian_date.timezone,(unsigned
- int)zte_getsecond(db_data->julian_date),db_data->msg_displaymode);printf(
+db_data->concat_info[(0xe42+1850-0x157c)],db_data->concat_info[
+(0x768+4385-0x1888)],pac->FormatSeq,concat_num,format_concat,db_data->tp_dcs,
+db_data->msg_ref,content,"\x30",db_data->draft_group_id,db_data->julian_date.
+year,db_data->julian_date.month,db_data->julian_date.day,db_data->julian_date.
+hour,db_data->julian_date.min,db_data->julian_date.sec,db_data->julian_date.
+timezone,(unsigned int)zte_getsecond(db_data->julian_date),db_data->
+msg_displaymode);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x49\x6e\x73\x65\x72\x74\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x54\x6f\x44\x62\x20\x73\x71\x6c\x3d\x25\x73\x2e" "\n"
 ,sql);result=zUfiSms_ExecSql(sql,NULL,NULL);sqlite3_free(sql);return isSucess(
 result);}int zUfiSms_GetConcatMaxReferInDb(void){int ConcatMaxRefer=
-(0xef3+2924-0x1a5f);int result=(0x1078+4162-0x20ba);result=zUfiSms_ExecSql(
+(0x7e5+181-0x89a);int result=(0x962+954-0xd1c);result=zUfiSms_ExecSql(
 "\x53\x45\x4c\x45\x43\x54\x20\x4d\x61\x78\x5f\x43\x63\x5f\x52\x65\x66\x20\x46\x52\x4f\x4d\x20"
  ZTE_WMS_DB_PARAMETER_TABLE
 "\x20\x57\x48\x45\x52\x45\x20\x69\x64\x20\x3d\x20\x31\x3b",
 zUfiSms_GetFirstColumnInt,&ConcatMaxRefer);if(ZTE_WMS_DB_OK!=result){return-
-(0x1b99+2806-0x268e);}return ConcatMaxRefer;}int zUfiSms_CreateTables(){int iMap
-=(0x17ca+1786-0x1ec4);const T_zUfiSms_SQLMap SQL_MAP[]={{(0x12a0+3870-0x21bd),
-ZTE_WMS_CREATE_TABLE_SMS_SQL},{(0x7f3+2509-0x11bf),ZTE_WMS_DEL_SIM_SQL},{
-(0xc65+3574-0x1a5a),ZTE_WMS_CREATE_CMD_STATUS_SQL},{(0xeb3+4780-0x215e),
-ZTE_WMS_CREATE_SMS_REP_SQL},{(0x2491+52-0x24c4),ZTE_WMS_CREATE_PAR_SQL},{
-(0x56c+7668-0x235f),ZTE_WMS_CREATE_INFO_SQL},{(0x2b9+3220-0xf4c),
-ZTE_WMS_CREATE_CELL_BRO_SQL},{(0x77f+7386-0x2458),
-ZTE_WMS_CREATE_SEND_CONTENT_SQL},};for(iMap=(0x6a3+6315-0x1f4e);iMap<sizeof(
+(0x842+609-0xaa2);}return ConcatMaxRefer;}int zUfiSms_CreateTables(){int iMap=
+(0xb6d+3009-0x172e);const T_zUfiSms_SQLMap SQL_MAP[]={{(0x325+4851-0x1617),
+ZTE_WMS_CREATE_TABLE_SMS_SQL},{(0x698+3345-0x13a8),ZTE_WMS_DEL_SIM_SQL},{
+(0xe01+915-0x1193),ZTE_WMS_CREATE_CMD_STATUS_SQL},{(0x1169+3504-0x1f18),
+ZTE_WMS_CREATE_SMS_REP_SQL},{(0xb31+227-0xc13),ZTE_WMS_CREATE_PAR_SQL},{
+(0x9ab+1079-0xde1),ZTE_WMS_CREATE_INFO_SQL},{(0x1cb2+368-0x1e21),
+ZTE_WMS_CREATE_CELL_BRO_SQL},{(0x371+3407-0x10bf),
+ZTE_WMS_CREATE_SEND_CONTENT_SQL},};for(iMap=(0x936+2685-0x13b3);iMap<sizeof(
 SQL_MAP)/sizeof(T_zUfiSms_SQLMap);iMap++){if(SQL_MAP[iMap].valid==
-(0xfa2+2481-0x1952)){if(zUfiSms_ExecSql(SQL_MAP[iMap].strSQL,NULL,NULL)!=
+(0x863+94-0x8c0)){if(zUfiSms_ExecSql(SQL_MAP[iMap].strSQL,NULL,NULL)!=
 ZTE_WMS_DB_OK){return ZUFI_FAIL;}}}return ZUFI_SUCC;}int zUfiSms_CreateAllTable(
 void){if(ZTE_WMS_DB_OK!=zUfiSms_OpenDb()){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x63\x61\x6e\x20\x6e\x6f\x74\x20\x6f\x70\x65\x6e\x20\x64\x61\x74\x61\x62\x61\x73\x65\x2e\x72\x65\x74\x75\x72\x6e\x2e" "\n"
@@ -323,9 +324,9 @@
 "\x27\x25\x64\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x64\x27\x2c\x27\x25\x64\x27\x2c\x27\x25\x64\x27\x2c\x27\x25\x64\x27\x2c\x27\x25\x64\x27\x2c\x27\x25\x64\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x71\x27\x2c\x20"
 "\x27\x25\x71\x27\x2c\x27\x25\x71\x27\x2c\x27\x25\x75\x27\x2c\x20\x27\x25\x64\x27\x29\x3b"
 ,ptDbSaveData->index,pStorePos,ptDbSaveData->tag,ptDbSaveData->number,
-ptDbSaveData->concat_sms,ptDbSaveData->concat_info[(0x21b+6611-0x1bee)],
-ptDbSaveData->concat_info[(0xbc3+4114-0x1bd4)],ptDbSaveData->concat_info[
-(0x282+1345-0x7c1)],ptDbSaveData->tp_dcs,ptDbSaveData->msg_ref,pContent,"\x30",
+ptDbSaveData->concat_sms,ptDbSaveData->concat_info[(0x4cb+7108-0x208f)],
+ptDbSaveData->concat_info[(0x515+5106-0x1906)],ptDbSaveData->concat_info[
+(0xadc+6136-0x22d2)],ptDbSaveData->tp_dcs,ptDbSaveData->msg_ref,pContent,"\x30",
 ptDbSaveData->draft_group_id,ptDbSaveData->julian_date.year,ptDbSaveData->
 julian_date.month,ptDbSaveData->julian_date.day,ptDbSaveData->julian_date.hour,
 ptDbSaveData->julian_date.min,ptDbSaveData->julian_date.sec,ptDbSaveData->
@@ -347,25 +348,25 @@
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x55\x70\x64\x61\x74\x65\x4e\x6f\x72\x6d\x61\x6c\x53\x6d\x73\x54\x6f\x44\x62\x20\x73\x71\x6c\x3d\x25\x73" "\n"
 ,strSQL);result=zUfiSms_ExecSql(strSQL,NULL,NULL);sqlite3_free(strSQL);return 
 isSucess(result);}int zUfiSms_GetFirstColumnStr(void*fvarg,int columns,char**
-zresult,char**lname){if(columns>=(0x1ea9+140-0x1f34)&&fvarg!=NULL){if(zresult[
-(0xfa3+4922-0x22dd)]!=NULL){T_zUfiSms_BufInfo*para=(T_zUfiSms_BufInfo*)fvarg;
-strncpy(para->buf_addr,zresult[(0x8c5+1092-0xd09)],para->buf_len-
-(0xc25+3630-0x1a52));return SQLITE_OK;}}return SQLITE_ERROR;}int 
+zresult,char**lname){if(columns>=(0x278+2169-0xaf0)&&fvarg!=NULL){if(zresult[
+(0xe83+5308-0x233f)]!=NULL){T_zUfiSms_BufInfo*para=(T_zUfiSms_BufInfo*)fvarg;
+strncpy(para->buf_addr,zresult[(0x60d+5752-0x1c85)],para->buf_len-
+(0x3cd+771-0x6cf));return SQLITE_OK;}}return SQLITE_ERROR;}int 
 zUfiSms_GetStorePosById(char*item,char*item_data,int item_len,int id){
 T_zUfiSms_DbResult result=ZTE_WMS_DB_OK;T_zUfiSms_BufInfo buf_info={
-(0xb40+387-0xcc3)};char*strSQL=NULL;if(NULL==item||NULL==item_data){return 
+(0x2bb+5780-0x194f)};char*strSQL=NULL;if(NULL==item||NULL==item_data){return 
 ZUFI_FAIL;}buf_info.buf_addr=item_data;buf_info.buf_len=item_len;strSQL=
 sqlite3_mprintf(
 "\x53\x45\x4c\x45\x43\x54\x20\x25\x71\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x27\x25\x64\x27\x3b"
 ,item,id);result=zUfiSms_ExecSql(strSQL,zUfiSms_GetFirstColumnStr,&buf_info);
-sqlite3_free(strSQL);if((ZTE_WMS_DB_OK!=result)||((0x912+6310-0x21b8)==strcmp(
+sqlite3_free(strSQL);if((ZTE_WMS_DB_OK!=result)||((0x13ca+524-0x15d6)==strcmp(
 item_data,""))){at_print(LOG_ERR,
 "\x67\x65\x74\x20\x74\x61\x62\x6c\x65\x5f\x6d\x65\x6d\x62\x65\x72\x20\x62\x79\x20\x69\x64\x20\x66\x61\x69\x6c\x65\x64\x2e" "\n"
 );return ZUFI_FAIL;}return ZUFI_SUCC;}int zUfiSms_DeleteSmsInDb(void){char sql[
-(0x13e3+3805-0x2240)]={(0x10a9+3128-0x1ce1)};snprintf(sql,sizeof(sql),
+(0x23c7+416-0x24e7)]={(0x2291+1064-0x26b9)};snprintf(sql,sizeof(sql),
 "\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x73\x27\x20\x61\x6e\x64\x20\x69\x64\x3d\x27\x25\x64\x27\x3b"
 ,ZTE_WMS_DB_SIM_TABLE,g_zUfiSms_DelMsg.sim_id[g_zUfiSms_DelMsg.sim_index-
-(0x555+4791-0x180b)]);return isSucess(zUfiSms_ExecSql(sql,NULL,NULL));}int 
+(0xcc4+3392-0x1a03)]);return isSucess(zUfiSms_ExecSql(sql,NULL,NULL));}int 
 zUfiSms_DeleteAllSimSmsInDb(void){return isSucess(zUfiSms_ExecSql(
 "\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27"
  ZTE_WMS_DB_SIM_TABLE"\x27\x3b",NULL,NULL));}int zUfiSms_DeleteNvSms(void){if(
@@ -374,10 +375,10 @@
 "\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27"
  ZTE_WMS_DB_NV_TABLE"\x27\x3b",NULL,NULL)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x4e\x76\x53\x6d\x73\x3a\x64\x65\x6c\x65\x74\x65\x20\x66\x61\x69\x6c" "\n"
-);return WMS_CMD_FAILED;}}else{int i=(0x882+1620-0xed6);printf(
+);return WMS_CMD_FAILED;}}else{int i=(0x592+6756-0x1ff6);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x4e\x76\x53\x6d\x73\x3a\x64\x65\x6c\x65\x74\x65\x20\x6e\x76\x5f\x63\x6f\x75\x6e\x74\x3d\x25\x64" "\n"
-,g_zUfiSms_DelMsg.nv_count);for(i=(0x2355+384-0x24d5);i<g_zUfiSms_DelMsg.
-nv_count;i++){char sql[(0x497+4382-0x1535)]={(0xbfb+1753-0x12d4)};snprintf(sql,
+,g_zUfiSms_DelMsg.nv_count);for(i=(0x1885+1214-0x1d43);i<g_zUfiSms_DelMsg.
+nv_count;i++){char sql[(0x618+5334-0x1a6e)]={(0x22d+9253-0x2652)};snprintf(sql,
 sizeof(sql),
 "\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x73\x27\x20\x61\x6e\x64\x20\x69\x64\x3d\x27\x25\x64\x27\x3b"
 ,ZTE_WMS_DB_NV_TABLE,g_zUfiSms_DelMsg.nv_id[i]);if(ZTE_WMS_DB_OK!=
@@ -386,39 +387,38 @@
 ,i);return WMS_CMD_FAILED;}}}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x4e\x76\x53\x6d\x73\x3a\x64\x65\x6c\x65\x74\x65\x20\x73\x75\x63\x63\x65\x73\x73" "\n"
 );return WMS_CMD_SUCCESS;}int zUfiSms_GetSmsIndex(int id,T_zUfiSms_ModifyTag*
-ptModifyTag,int is_cc){char sql[(0x132+1949-0x84f)]={(0x8f2+2693-0x1377)};
-T_zUfiSms_BufInfo buf_info={(0x2e8+8176-0x22d8)};char str_index[
-(0x1180+3907-0x20c1)*WMS_MESSAGE_LIST_MAX]={(0x13c6+1801-0x1acf)};buf_info.
+ptModifyTag,int is_cc){char sql[(0xe50+3478-0x1b66)]={(0xfbb+1657-0x1634)};
+T_zUfiSms_BufInfo buf_info={(0x1089+1378-0x15eb)};char str_index[
+(0x1326+300-0x1450)*WMS_MESSAGE_LIST_MAX]={(0x1cf1+865-0x2052)};buf_info.
 buf_addr=str_index;buf_info.buf_len=sizeof(str_index);snprintf(sql,sizeof(sql),
 "\x53\x45\x4c\x45\x43\x54\x20\x69\x6e\x64\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x27\x25\x64\x27\x3b"
 ,id);if(zUfiSms_ExecSql(sql,zUfiSms_GetFirstColumnStr,&buf_info)!=ZTE_WMS_DB_OK)
 {at_print(LOG_ERR,
 "\x6f\x70\x65\x6e\x20\x74\x61\x62\x6c\x65\x20\x73\x6d\x73\x20\x66\x61\x69\x6c\x65\x64"
-);return ZUFI_FAIL;}if((0x7df+5935-0x1f0d)==is_cc){int i=(0x454+4018-0x1406);int
- j=(0x5bb+6236-0x1e17);int count=(0x1303+132-0x1387);char**out_result=NULL;count
-=zUfiSms_SplitString(str_index,&out_result,((char)(0x29d+1764-0x946)));for(i=
-(0x1dcd+2366-0x270b);i<count;i++){if((0x13ac+4945-0x26fd)!=strcmp(out_result[i],
-"")){ptModifyTag->indices[j++]=atoi(out_result[i]);}}ptModifyTag->num_of_indices
-=j;free(out_result);}else{ptModifyTag->indices[(0x5d8+5402-0x1af2)]=atoi(
-str_index);ptModifyTag->num_of_indices=(0xfb5+4834-0x2296);}ptModifyTag->
+);return ZUFI_FAIL;}if((0x2a2+9009-0x25d2)==is_cc){int i=(0x210f+853-0x2464);int
+ j=(0x442+962-0x804);int count=(0x97f+4181-0x19d4);char**out_result=NULL;count=
+zUfiSms_SplitString(str_index,&out_result,((char)(0x1105+593-0x131b)));for(i=
+(0xa63+6821-0x2508);i<count;i++){if((0x1aa+6691-0x1bcd)!=strcmp(out_result[i],""
+)){ptModifyTag->indices[j++]=atoi(out_result[i]);}}ptModifyTag->num_of_indices=j
+;free(out_result);}else{ptModifyTag->indices[(0x1654+2966-0x21ea)]=atoi(
+str_index);ptModifyTag->num_of_indices=(0x1d9f+1430-0x2334);}ptModifyTag->
 total_indices=ptModifyTag->num_of_indices;printf(
 "\x6d\x6f\x64\x69\x66\x79\x5f\x74\x61\x67\x5f\x70\x74\x72\x2d\x3e\x74\x6f\x74\x61\x6c\x5f\x69\x6e\x64\x69\x63\x65\x73\x3d\x25\x64" "\n"
 ,ptModifyTag->total_indices);return ZUFI_SUCC;}int zUfiSms_IsConcatSms(int id){
-char sql[(0x562+7591-0x2289)]={(0x1549+3621-0x236e)};int is_cc=
-(0x13f+2240-0x9ff);T_zUfiSms_DbResult result=ZTE_WMS_DB_OK;snprintf(sql,sizeof(
-sql),
+char sql[(0x48f+3858-0x1321)]={(0x45c+56-0x494)};int is_cc=(0xa93+420-0xc37);
+T_zUfiSms_DbResult result=ZTE_WMS_DB_OK;snprintf(sql,sizeof(sql),
 "\x53\x45\x4c\x45\x43\x54\x20\x43\x63\x5f\x53\x6d\x73\x20\x46\x52\x4f\x4d\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x27\x25\x64\x27\x3b"
 ,ZTE_WMS_DB_SMS_TABLE,id);result=zUfiSms_ExecSql(sql,zUfiSms_GetFirstColumnInt,&
 is_cc);if(ZTE_WMS_DB_OK!=result){at_print(LOG_ERR,
 "\x6f\x70\x65\x6e\x20\x74\x61\x62\x6c\x65\x20\x25\x73\x20\x66\x61\x69\x6c\x65\x64"
-,ZTE_WMS_DB_SMS_TABLE);return-(0x114f+2916-0x1cb2);}return is_cc;}int 
+,ZTE_WMS_DB_SMS_TABLE);return-(0x2c1+6517-0x1c35);}return is_cc;}int 
 zUfiSms_UpdateSmsTagInDb(unsigned long id,unsigned int tags){char sql[
-(0x1705+899-0x1a08)]={(0xbb2+1290-0x10bc)};snprintf(sql,sizeof(sql),
+(0x302+5317-0x1747)]={(0x2134+1260-0x2620)};snprintf(sql,sizeof(sql),
 "\x55\x50\x44\x41\x54\x45\x20\x25\x73\x20\x53\x45\x54\x20\x54\x61\x67\x3d\x27\x25\x64\x27\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x27\x25\x64\x27\x3b"
 ,ZTE_WMS_DB_SMS_TABLE,tags,id);return isSucess(zUfiSms_ExecSql(sql,NULL,NULL));}
 int zUfiSms_GetTagCountInDb(T_zUfiSms_MemoryType mem_store,unsigned int tags,int
 *pTotalCount){T_zUfiSms_DbResult result=ZTE_WMS_DB_OK;char sql[
-(0x13b5+674-0x15d7)]={(0x1537+1138-0x19a9)};if(pTotalCount==NULL){return 
+(0xf6c+1391-0x145b)]={(0x545+4489-0x16ce)};if(pTotalCount==NULL){return 
 ZUFI_FAIL;}if(mem_store==ZTE_WMS_MEMORY_MAX){snprintf(sql,sizeof(sql),
 "\x53\x45\x4c\x45\x43\x54\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x46\x52\x4f\x4d\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x54\x61\x67\x3d\x27\x25\x64\x27\x3b"
 ,ZTE_WMS_DB_SMS_TABLE,tags);}else if(mem_store==ZTE_WMS_MEMORY_NV){snprintf(sql,
@@ -428,18 +428,18 @@
 "\x53\x45\x4c\x45\x43\x54\x20\x63\x6f\x75\x6e\x74\x28\x2a\x29\x20\x46\x52\x4f\x4d\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x73\x27\x20\x41\x4e\x44\x20\x54\x61\x67\x3d\x27\x25\x64\x27\x3b"
 ,ZTE_WMS_DB_SMS_TABLE,ZTE_WMS_DB_SIM_TABLE,tags);}result=zUfiSms_ExecSql(sql,(
 zte_wms_db_callback)zUfiSms_GetFirstColumnInt,pTotalCount);return isSucess(
-result);}int zUfiSms_DeleteDraftSms(long iSmsId){char sql[(0x4c7+2838-0xf5d)]={
-(0x915+930-0xcb7)};snprintf(sql,sizeof(sql),
+result);}int zUfiSms_DeleteDraftSms(long iSmsId){char sql[(0x112a+1944-0x1842)]=
+{(0x608+4501-0x179d)};snprintf(sql,sizeof(sql),
 "\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x27\x25\x6c\x64\x27\x3b"
 ,ZTE_WMS_DB_SMS_TABLE,iSmsId);return isSucess(zUfiSms_ExecSql(sql,NULL,NULL));}
-int zUfiSms_SetConcatMaxRefer(int ref){char sql[(0x1688+2311-0x1f0f)]={
-(0x223d+637-0x24ba)};if(ZTE_WMS_MAX_CONCAT_REF<ref){ref=(0x3ef+6824-0x1e97);}
+int zUfiSms_SetConcatMaxRefer(int ref){char sql[(0x1594+3634-0x2346)]={
+(0x1b22+2099-0x2355)};if(ZTE_WMS_MAX_CONCAT_REF<ref){ref=(0x14a+7163-0x1d45);}
 snprintf(sql,sizeof(sql),
 "\x55\x50\x44\x41\x54\x45\x20\x25\x73\x20\x53\x45\x54\x20\x4d\x61\x78\x5f\x43\x63\x5f\x52\x65\x66\x3d\x27\x25\x64\x27\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x31\x3b"
 ,ZTE_WMS_DB_PARAMETER_TABLE,ref);return isSucess(zUfiSms_ExecSql(sql,NULL,NULL))
-;}int zUfiSms_SetMaxReference(int ref){char sql[(0x150+192-0x190)]={
-(0xf6+5151-0x1515)};if(ZTE_WMS_MAX_SMS_REF<ref){ref=(0x1d19+147-0x1dac);}
-snprintf(sql,sizeof(sql),
+;}int zUfiSms_SetMaxReference(int ref){char sql[(0x1e17+1380-0x22fb)]={
+(0xad2+394-0xc5c)};if(ZTE_WMS_MAX_SMS_REF<ref){ref=(0x35f+2326-0xc75);}snprintf(
+sql,sizeof(sql),
 "\x55\x50\x44\x41\x54\x45\x20\x25\x73\x20\x53\x45\x54\x20\x4d\x61\x78\x5f\x53\x6d\x73\x5f\x52\x65\x66\x3d\x27\x25\x64\x27\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3d\x31\x3b"
 ,ZTE_WMS_DB_PARAMETER_TABLE,ref);return isSucess(zUfiSms_ExecSql(sql,NULL,NULL))
 ;}int zUfiSms_InsertReportStatusToDb(unsigned char*pNumber,T_zUfiSms_Date*
@@ -451,75 +451,75 @@
 ->hour,ptSmsDate->min,ptSmsDate->sec,ptSmsDate->timezone);result=zUfiSms_ExecSql
 (strSQL,NULL,NULL);sqlite3_free(strSQL);return isSucess(result);}int 
 zUfiSms_GetFirstColumnParaInfo(void*fvarg,int columns,char**zresult,char**lname)
-{if(columns>=(0x5a8+8437-0x269c)&&fvarg!=NULL){if(zresult[(0x84c+5210-0x1ca6)]!=
+{if(columns>=(0xb49+6909-0x2645)&&fvarg!=NULL){if(zresult[(0x608+3518-0x13c6)]!=
 NULL){T_zUfiSms_ParaInfo*para=(T_zUfiSms_ParaInfo*)fvarg;strncpy(para->sca,
-zresult[(0xd5+7154-0x1cc7)],sizeof(para->sca)-(0xbb3+5705-0x21fb));para->
-mem_store=atoi(zresult[(0x117b+2214-0x1a20)]);para->tp_validity_period=atoi(
-zresult[(0x261+4136-0x1287)]);para->status_report_on=atoi(zresult[
-(0x1e6f+218-0x1f46)]);para->sendfail_retry_on=atoi(zresult[(0xbb0+821-0xee1)]);
-para->outdate_delete_on=atoi(zresult[(0xbe5+6058-0x238a)]);(void)strncpy(para->
-default_store,zresult[(0xa17+457-0xbda)],sizeof(para->default_store)-
-(0x1181+1448-0x1728));return SQLITE_OK;}}return SQLITE_ERROR;}int 
+zresult[(0x1626+3828-0x251a)],sizeof(para->sca)-(0x1e3f+1511-0x2425));para->
+mem_store=atoi(zresult[(0x49+6851-0x1b0b)]);para->tp_validity_period=atoi(
+zresult[(0x1a2+1158-0x626)]);para->status_report_on=atoi(zresult[
+(0xbbc+4094-0x1bb7)]);para->sendfail_retry_on=atoi(zresult[(0x5b0+6994-0x20fe)])
+;para->outdate_delete_on=atoi(zresult[(0x17c+269-0x284)]);(void)strncpy(para->
+default_store,zresult[(0x421+3457-0x119c)],sizeof(para->default_store)-
+(0xabf+1832-0x11e6));return SQLITE_OK;}}return SQLITE_ERROR;}int 
 zUfiSms_GetDbParameters(void){char*strSQL=
 "\x53\x45\x4c\x45\x43\x54\x20\x53\x6d\x73\x5f\x53\x63\x61\x2c\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x2c\x54\x70\x5f\x56\x61\x6c\x69\x64\x69\x74\x79\x2c\x53\x6d\x73\x5f\x52\x65\x70\x6f\x72\x74\x2c\x53\x65\x6e\x64\x5f\x52\x65\x74\x72\x79\x2c\x4f\x75\x74\x64\x61\x74\x65\x5f\x44\x65\x6c\x65\x74\x65\x2c\x44\x65\x66\x61\x75\x6c\x74\x5f\x53\x74\x6f\x72\x65\x20\x46\x52\x4f\x4d\x20"
  ZTE_WMS_DB_PARAMETER_TABLE"\x3b";memset(&g_zUfiSms_CurSmsPara,
-(0x1158+2109-0x1995),sizeof(T_zUfiSms_ParaInfo));return isSucess(zUfiSms_ExecSql
+(0x19b9+3271-0x2680),sizeof(T_zUfiSms_ParaInfo));return isSucess(zUfiSms_ExecSql
 (strSQL,zUfiSms_GetFirstColumnParaInfo,&g_zUfiSms_CurSmsPara));}int 
 zUfiSms_GetSendContent(void*fvarg,int column,char**zresult,char**lname){
-T_zUfiSms_BufInfo*para=(T_zUfiSms_BufInfo*)fvarg;if(column>=(0x669+2319-0xf77)&&
-para!=NULL)(void)strncpy(para->buf_addr,zresult[(0x699+6440-0x1fc1)],para->
-buf_len-(0xd6f+3374-0x1a9c));return(0xa46+4603-0x1c41);}int 
+T_zUfiSms_BufInfo*para=(T_zUfiSms_BufInfo*)fvarg;if(column>=(0xcea+5135-0x20f8)
+&&para!=NULL)(void)strncpy(para->buf_addr,zresult[(0x629+1083-0xa64)],para->
+buf_len-(0x12bb+4691-0x250d));return(0x6cb+5699-0x1d0e);}int 
 zUfiSms_GetSmsContent(char*pSmsBuf,int len){T_zUfiSms_BufInfo buf_info={
-(0xd77+6533-0x26fc)};char*strSQL=
+(0xb04+2859-0x162f)};char*strSQL=
 "\x53\x45\x4c\x45\x43\x54\x20\x6d\x73\x67\x5f\x63\x6f\x6e\x74\x65\x6e\x74\x20\x46\x52\x4f\x4d\x20"
  ZTE_WMS_DB_SEND_CONTENT_TABLE"\x3b";buf_info.buf_addr=pSmsBuf;buf_info.buf_len=
-len;memset(buf_info.buf_addr,(0x1850+3649-0x2691),len);return isSucess(
+len;memset(buf_info.buf_addr,(0xb65+2606-0x1593),len);return isSucess(
 zUfiSms_ExecSql(strSQL,zUfiSms_GetSendContent,&buf_info));}int 
 zUfiSms_SearchConcatSmsInDb(T_zUfiSms_DbStoreData*ptDbSaveData,char*pMemStore){
-char*sql=NULL;sqlite3_stmt*stmt=NULL;int id=-(0x1008+5597-0x25e4);switch(
+char*sql=NULL;sqlite3_stmt*stmt=NULL;int id=-(0x4f1+2902-0x1046);switch(
 ptDbSaveData->tag){case WMS_TAG_TYPE_MO_SENT_V01:case 
 WMS_TAG_TYPE_MO_NOT_SENT_V01:{sql=sqlite3_mprintf(
 "\x53\x45\x4c\x45\x43\x54\x20\x43\x63\x5f\x53\x65\x71\x2c\x69\x64\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4e\x75\x6d\x62\x65\x72\x3d\x27\x25\x71\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x52\x65\x66\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x54\x6f\x74\x61\x6c\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x73\x27\x20\x41\x4e\x44\x20\x28\x54\x61\x67\x20\x3d\x20\x27\x25\x64\x27\x20\x4f\x52\x20\x54\x61\x67\x3d\x20\x27\x25\x64\x27\x29\x3b"
-,ptDbSaveData->number,ptDbSaveData->concat_info[(0x223+7419-0x1f1e)],
-ptDbSaveData->concat_info[(0x568+4064-0x1547)],pMemStore,
+,ptDbSaveData->number,ptDbSaveData->concat_info[(0xbd4+4664-0x1e0c)],
+ptDbSaveData->concat_info[(0xe04+1245-0x12e0)],pMemStore,
 WMS_TAG_TYPE_MO_SENT_V01,WMS_TAG_TYPE_MO_NOT_SENT_V01);break;}case
-(0xf72+3313-0x1c5f):{sql=sqlite3_mprintf(
+(0x67+3729-0xef4):{sql=sqlite3_mprintf(
 "\x53\x45\x4c\x45\x43\x54\x20\x43\x63\x5f\x53\x65\x71\x2c\x69\x64\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4e\x75\x6d\x62\x65\x72\x3d\x27\x25\x71\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x52\x65\x66\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x54\x6f\x74\x61\x6c\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x73\x27\x20\x41\x4e\x44\x20\x54\x61\x67\x20\x3d\x20\x27\x25\x64\x27\x3b"
-,ptDbSaveData->number,ptDbSaveData->concat_info[(0x135+4154-0x116f)],
-ptDbSaveData->concat_info[(0xca7+5367-0x219d)],pMemStore,(0x1bc2+2570-0x25c8));
+,ptDbSaveData->number,ptDbSaveData->concat_info[(0x1839+891-0x1bb4)],
+ptDbSaveData->concat_info[(0xa0a+1354-0xf53)],pMemStore,(0x8f+7220-0x1cbf));
 break;}case WMS_TAG_TYPE_MT_READ_V01:case WMS_TAG_TYPE_MT_NOT_READ_V01:{sql=
 sqlite3_mprintf(
 "\x53\x45\x4c\x45\x43\x54\x20\x43\x63\x5f\x53\x65\x71\x2c\x69\x64\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4e\x75\x6d\x62\x65\x72\x3d\x27\x25\x71\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x52\x65\x66\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x54\x6f\x74\x61\x6c\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x73\x27\x20\x41\x4e\x44\x20\x28\x54\x61\x67\x20\x3d\x20\x27\x25\x64\x27\x20\x4f\x52\x20\x54\x61\x67\x3d\x20\x27\x25\x64\x27\x29\x3b"
-,ptDbSaveData->number,ptDbSaveData->concat_info[(0xb8+7529-0x1e21)],ptDbSaveData
-->concat_info[(0x2bf+8893-0x257b)],pMemStore,WMS_TAG_TYPE_MT_READ_V01,
-WMS_TAG_TYPE_MT_NOT_READ_V01);break;}default:{sql=sqlite3_mprintf(
+,ptDbSaveData->number,ptDbSaveData->concat_info[(0x843+3691-0x16ae)],
+ptDbSaveData->concat_info[(0x3ab+1375-0x909)],pMemStore,WMS_TAG_TYPE_MT_READ_V01
+,WMS_TAG_TYPE_MT_NOT_READ_V01);break;}default:{sql=sqlite3_mprintf(
 "\x53\x45\x4c\x45\x43\x54\x20\x43\x63\x5f\x53\x65\x71\x2c\x69\x64\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x4e\x75\x6d\x62\x65\x72\x3d\x27\x25\x71\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x52\x65\x66\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x54\x6f\x74\x61\x6c\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x73\x27\x3b"
-,ptDbSaveData->number,ptDbSaveData->concat_info[(0x33c+2464-0xcdc)],ptDbSaveData
-->concat_info[(0x1741+2709-0x21d5)],pMemStore);at_print(LOG_ERR,
+,ptDbSaveData->number,ptDbSaveData->concat_info[(0x10e0+861-0x143d)],
+ptDbSaveData->concat_info[(0x5e0+3512-0x1397)],pMemStore);at_print(LOG_ERR,
 "\x74\x61\x67\x20\x25\x64\x20\x69\x73\x20\x75\x6e\x6b\x6e\x6f\x77\x6e",
 ptDbSaveData->tag);break;}}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x74\x65\x65\x74\x3a\x25\x73" "\n",sql);if(
-sqlite3_prepare(g_zUfiSms_DbPointer,sql,-(0x9ef+1983-0x11ad),&stmt,
-(0xa36+963-0xdf9))!=SQLITE_OK){at_print(LOG_ERR,
+sqlite3_prepare(g_zUfiSms_DbPointer,sql,-(0xc0+2797-0xbac),&stmt,
+(0x2f+4854-0x1325))!=SQLITE_OK){at_print(LOG_ERR,
 "\x63\x61\x6e\x20\x6e\x6f\x74\x20\x65\x78\x65\x63\x20\x73\x71\x6c\x2c\x73\x71\x6c\x69\x74\x65\x33\x5f\x65\x72\x72\x6d\x73\x67\x3a\x25\x73\x2e" "\n"
 ,sqlite3_errmsg(g_zUfiSms_DbPointer));sqlite3_free(sql);return-
-(0x1522+1691-0x1bbc);}while(SQLITE_ROW==sqlite3_step(stmt)){int j=
-(0x553+5990-0x1cb9);char**out_result=NULL;char*column_text=sqlite3_column_text(
-stmt,(0x936+3102-0x1554));int count=-(0x1eb+9209-0x25e3);if(column_text!=NULL)
-count=zUfiSms_SplitString(column_text,&out_result,((char)(0x973+6416-0x2248)));
-for(j=(0x18f9+21-0x190e);j<count;j++){if((0x60a+4839-0x18f1)==strcmp(out_result[
-j],"")){if(j+(0x1900+3416-0x2657)==ptDbSaveData->concat_info[
-(0x1542+4455-0x26a7)]){id=sqlite3_column_int(stmt,(0xbe6+392-0xd6d));break;}}}if
-(out_result!=NULL){free(out_result);out_result=NULL;}if(-(0x1fff+937-0x23a7)!=id
-){break;}}(void)sqlite3_finalize(stmt);sqlite3_free(sql);return id;}int 
+(0x9d8+2709-0x146c);}while(SQLITE_ROW==sqlite3_step(stmt)){int j=
+(0x8bf+4782-0x1b6d);char**out_result=NULL;char*column_text=sqlite3_column_text(
+stmt,(0x227+2980-0xdcb));int count=-(0x5ed+3850-0x14f6);if(column_text!=NULL)
+count=zUfiSms_SplitString(column_text,&out_result,((char)(0x819+1508-0xdc2)));
+for(j=(0xcb+9258-0x24f5);j<count;j++){if((0x19f8+2561-0x23f9)==strcmp(out_result
+[j],"")){if(j+(0x13a2+2450-0x1d33)==ptDbSaveData->concat_info[
+(0x16dc+1709-0x1d87)]){id=sqlite3_column_int(stmt,(0x318+1897-0xa80));break;}}}
+if(out_result!=NULL){free(out_result);out_result=NULL;}if(-(0x3f8+2462-0xd95)!=
+id){break;}}(void)sqlite3_finalize(stmt);sqlite3_free(sql);return id;}int 
 zUfiSms_CheckDbOutdateSms_Callback(void*fvarg,int columns,char**zresult,char**
-lname){if(fvarg!=NULL&&columns>=(0x1ed5+1222-0x239a)){if(zresult[
-(0x8e2+4515-0x1a85)]!=NULL){T_zUfiSms_DelReq*result=(T_zUfiSms_DelReq*)fvarg;
-result->id[result->all_or_count]=atoi(zresult[(0x21cf+104-0x2237)]);result->
+lname){if(fvarg!=NULL&&columns>=(0x4f8+6699-0x1f22)){if(zresult[
+(0xfc0+2014-0x179e)]!=NULL){T_zUfiSms_DelReq*result=(T_zUfiSms_DelReq*)fvarg;
+result->id[result->all_or_count]=atoi(zresult[(0x5b5+41-0x5de)]);result->
 all_or_count++;return SQLITE_OK;}}return SQLITE_ERROR;}VOID 
 zUfiSms_CheckDbOutdateSms(const char*pDbTable,T_zUfiSms_DelReq*pSmsDel){char 
-acSql[(0x1f2b+212-0x1f7f)]={(0x1c52+1622-0x22a8)};struct timeval tp;if(
-(0x1896+1549-0x1ea3)!=gettimeofday(&tp,NULL)){printf(
+acSql[(0x17eb+3613-0x2588)]={(0xa37+7044-0x25bb)};struct timeval tp;if(
+(0xc06+4215-0x1c7d)!=gettimeofday(&tp,NULL)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x67\x65\x74\x74\x69\x6d\x65\x6f\x66\x64\x61\x79\x20\x65\x72\x72\x6f\x72\x21\x21\x21"
 );return;}if(tp.tv_sec<=OUTDATEINTERVAL){return;}snprintf(acSql,sizeof(acSql),
 "\x53\x45\x4c\x45\x43\x54\x20\x69\x64\x20\x46\x52\x4f\x4d\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x4d\x6b\x74\x69\x6d\x65\x3c\x27\x25\x75\x27\x20\x41\x4e\x44\x20\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65\x3d\x27\x25\x73\x27\x3b"
@@ -529,21 +529,21 @@
 "\x6f\x70\x65\x6e\x20\x74\x61\x62\x6c\x65\x20\x25\x73\x20\x66\x61\x69\x6c\x65\x64"
 ,ZTE_WMS_DB_CMD_STATUS_TABLE);}return;}int 
 zUfiSms_GetCurrentRecvTotalSeq_Callback(void*fvarg,int column,char**zresult,char
-**lname){if(fvarg!=NULL&&column>=(0x9+8617-0x21b0)){if(zresult[(0x247+993-0x628)
-]!=NULL&&zresult[(0xe30+5138-0x2241)]!=NULL){SMS_MSG_INFO*msg=(SMS_MSG_INFO*)
-fvarg;memset(msg->id,(0x1711+390-0x1897),sizeof(msg->id));memset(msg->total_seq,
-(0x6a7+5753-0x1d20),sizeof(msg->total_seq));strncpy(msg->id,zresult[
-(0x1b56+559-0x1d85)],sizeof(msg->id)-(0x1a1c+917-0x1db0));strncpy(msg->total_seq
-,zresult[(0x1f1a+1578-0x2543)],sizeof(msg->total_seq)-(0x950+6411-0x225a));
-printf(
+**lname){if(fvarg!=NULL&&column>=(0xff9+5883-0x26f2)){if(zresult[
+(0x6d6+1613-0xd23)]!=NULL&&zresult[(0xd31+2676-0x17a4)]!=NULL){SMS_MSG_INFO*msg=
+(SMS_MSG_INFO*)fvarg;memset(msg->id,(0x8dd+3084-0x14e9),sizeof(msg->id));memset(
+msg->total_seq,(0xb3d+5239-0x1fb4),sizeof(msg->total_seq));strncpy(msg->id,
+zresult[(0x1aa+6736-0x1bfa)],sizeof(msg->id)-(0x346+2831-0xe54));strncpy(msg->
+total_seq,zresult[(0x12f0+4456-0x2457)],sizeof(msg->total_seq)-
+(0x68b+2428-0x1006));printf(
 "\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x47\x65\x74\x43\x75\x72\x72\x65\x6e\x74\x52\x65\x63\x76\x54\x6f\x74\x61\x6c\x53\x65\x71\x5f\x43\x61\x6c\x6c\x62\x61\x63\x6b\x20\x69\x64\x20\x3d\x20\x25\x73\x2c\x20\x74\x6f\x74\x61\x6c\x5f\x73\x65\x71\x20\x3d\x20\x25\x73" "\n"
 ,msg->id,msg->total_seq);return SQLITE_OK;}}return SQLITE_ERROR;}int 
 zUfiSms_GetCurrentRecvTotalSeq(T_zUfiSms_DbStoreData*ptDbSaveData,SMS_MSG_INFO*
 pmsg){T_zUfiSms_DbResult result=ZTE_WMS_DB_OK;char*strSQL=NULL;strSQL=
 sqlite3_mprintf(
 "\x53\x45\x4c\x45\x43\x54\x20\x69\x64\x2c\x20\x43\x63\x5f\x4e\x75\x6d\x20\x46\x52\x4f\x4d\x20\x73\x6d\x73\x20\x57\x48\x45\x52\x45\x20\x20\x6e\x75\x6d\x62\x65\x72\x3d\x27\x25\x71\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x52\x65\x66\x3d\x27\x25\x64\x27\x20\x41\x4e\x44\x20\x43\x63\x5f\x54\x6f\x74\x61\x6c\x3d\x27\x25\x64\x27\x3b"
-,ptDbSaveData->number,ptDbSaveData->concat_info[(0x18f8+402-0x1a8a)],
-ptDbSaveData->concat_info[(0x1eff+1930-0x2688)]);printf(
+,ptDbSaveData->number,ptDbSaveData->concat_info[(0xaaf+4974-0x1e1d)],
+ptDbSaveData->concat_info[(0xff+1562-0x718)]);printf(
 "\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x47\x65\x74\x43\x75\x72\x72\x65\x6e\x74\x52\x65\x63\x76\x54\x6f\x74\x61\x6c\x53\x65\x71\x20\x73\x71\x6c\x20\x3a\x20\x25\x73\x20" "\n"
 ,strSQL);result=zUfiSms_ExecSql(strSQL,zUfiSms_GetCurrentRecvTotalSeq_Callback,
 pmsg);sqlite3_free(strSQL);return isSucess(result);}
diff --git a/ap/app/zte_comm/sms/src/sms_fnc.c b/ap/app/zte_comm/sms/src/sms_fnc.c
index 3929624..47586de 100755
--- a/ap/app/zte_comm/sms/src/sms_fnc.c
+++ b/ap/app/zte_comm/sms/src/sms_fnc.c
@@ -8,22 +8,22 @@
 #include "sms_fnc.h"

 #include "sms_db.h"

 #include "sms_code.h"

-#define SMS_RETRY_COUNT (0x967+6001-0x20d5)

-#define SHORT_INT_LEN (0x406+6858-0x1eca)

+#define SMS_RETRY_COUNT (0x287+1089-0x6c5)

+#define SHORT_INT_LEN (0x2225+134-0x22a5)

 SMS_LOCATION g_zUfiSms_CurLocation=SMS_LOCATION_SIM;int 
-g_zUfiSms_ConcatSmsReference=(0x170c+1080-0x1b44);T_zUfiSms_ParaInfo 
+g_zUfiSms_ConcatSmsReference=(0xbf4+6112-0x23d4);T_zUfiSms_ParaInfo 
 g_zUfiSms_CurSmsPara={"",WMS_STORAGE_TYPE_UIM_V01,
-ZTE_WMS_SMS_DEFAULT_TP_VALIDITY_PERIOD_GW,(0x19eb+32-0x1a0b),(0x1ddd+256-0x1edd)
-,(0x1030+4906-0x235a),"\x6e\x76"};int g_zUfiSms_Language=NOT_DEFINE_LANGUAGE;int
- g_zUfiSms_Dcs=(0x1c5+5169-0x15f6);unsigned long g_zUfiSms_StoreCapablity[
-ZTE_WMS_MEMORY_MAX]={(0x11a2+4387-0x2261),ZTE_WMS_DB_MSG_COUNT_MAX};
-T_zSms_SendSmsReq g_zUfiSms_FinalCmgsBuf;SMS_PARAM g_zUfiSms_SendingSms;UINT16 
-g_zUfiSms_IsLanguageShift=(0x891+2174-0x110f);extern int g_zUfiSms_MsgRefer;
-extern T_zUfiSms_DelSms g_zUfiSms_DelMsg;extern T_zUfiSms_DelIndexInfo 
-g_deleteIndex;extern T_zUfiSms_ModifyIndexInfo g_modifyIndex;extern 
-T_zUfiSms_ModifySms g_zUfiSms_modifyMsg;extern UINT8 g_zUfiSms_MemFullFlag[
-ZTE_WMS_MEMORY_MAX];extern int g_zUfiSms_ConcatTotalNum;extern 
-T_zUfiSms_ConcatInfo g_zUfiSms_ConcatSms;extern T_zUfiSms_GroupInfo 
+ZTE_WMS_SMS_DEFAULT_TP_VALIDITY_PERIOD_GW,(0x6aa+7951-0x25b9),
+(0x1f4d+433-0x20fe),(0x779+7983-0x26a8),"\x6e\x76"};int g_zUfiSms_Language=
+NOT_DEFINE_LANGUAGE;int g_zUfiSms_Dcs=(0x595+7665-0x2386);unsigned long 
+g_zUfiSms_StoreCapablity[ZTE_WMS_MEMORY_MAX]={(0x1dd1+424-0x1f15),
+ZTE_WMS_DB_MSG_COUNT_MAX};T_zSms_SendSmsReq g_zUfiSms_FinalCmgsBuf;SMS_PARAM 
+g_zUfiSms_SendingSms;UINT16 g_zUfiSms_IsLanguageShift=(0x572+4038-0x1538);extern
+ int g_zUfiSms_MsgRefer;extern T_zUfiSms_DelSms g_zUfiSms_DelMsg;extern 
+T_zUfiSms_DelIndexInfo g_deleteIndex;extern T_zUfiSms_ModifyIndexInfo 
+g_modifyIndex;extern T_zUfiSms_ModifySms g_zUfiSms_modifyMsg;extern UINT8 
+g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_MAX];extern int g_zUfiSms_ConcatTotalNum;
+extern T_zUfiSms_ConcatInfo g_zUfiSms_ConcatSms;extern T_zUfiSms_GroupInfo 
 g_zUfiSms_GroupSms;extern int g_zUfiSms_UnitLen;extern UINT8 
 g_zUfiSms_IsConcatSendSuc;extern int g_zUfiSms_SendFailedCount;extern 
 T_zUfiSms_DbStoreData g_zUfiSms_DbStoreData[ZTE_WMS_CONCAT_SMS_COUNT_MAX];extern
@@ -31,16 +31,16 @@
 eLocation){switch(eLocation){case SMS_LOCATION_SIM:{g_zUfiSms_CurLocation=
 SMS_LOCATION_SIM;break;}case SMS_LOCATION_ME:{g_zUfiSms_CurLocation=
 SMS_LOCATION_ME;break;}default:{return;}}}int zUfiSms_SetDeleteInfo(
-T_zUfiSms_DelReq*ptDelMsg){char acStorePos[(0x1f13+1215-0x23a0)];int i=
-(0x14df+3476-0x2273);g_zUfiSms_DelMsg.nv_count=(0x640+282-0x75a);
-g_zUfiSms_DelMsg.nv_index=(0x635+6705-0x2066);g_zUfiSms_DelMsg.sim_count=
-(0xed6+4236-0x1f62);g_zUfiSms_DelMsg.sim_index=(0x917+7570-0x26a9);for(i=
-(0x2280+50-0x22b2);i<ptDelMsg->all_or_count;i++){memset(acStorePos,
-(0x366+4469-0x14db),sizeof(acStorePos));if(ZUFI_FAIL==zUfiSms_GetStorePosById(
+T_zUfiSms_DelReq*ptDelMsg){char acStorePos[(0x70b+7396-0x23bd)];int i=
+(0x1573+1836-0x1c9f);g_zUfiSms_DelMsg.nv_count=(0x860+1104-0xcb0);
+g_zUfiSms_DelMsg.nv_index=(0xb82+192-0xc42);g_zUfiSms_DelMsg.sim_count=
+(0xc5c+4145-0x1c8d);g_zUfiSms_DelMsg.sim_index=(0xd09+647-0xf90);for(i=
+(0x953+767-0xc52);i<ptDelMsg->all_or_count;i++){memset(acStorePos,
+(0xddb+6246-0x2641),sizeof(acStorePos));if(ZUFI_FAIL==zUfiSms_GetStorePosById(
 "Mem_Store",acStorePos,sizeof(acStorePos),ptDelMsg->id[i])){return ZUFI_FAIL;}if
-((0x130c+4861-0x2609)==strcmp(acStorePos,ZTE_WMS_DB_NV_TABLE)){g_zUfiSms_DelMsg.
+((0x2d0+7049-0x1e59)==strcmp(acStorePos,ZTE_WMS_DB_NV_TABLE)){g_zUfiSms_DelMsg.
 nv_id[g_zUfiSms_DelMsg.nv_count]=ptDelMsg->id[i];g_zUfiSms_DelMsg.nv_count++;
-g_zUfiSms_DelMsg.nv_index_count++;}else if((0x10cf+2461-0x1a6c)==strcmp(
+g_zUfiSms_DelMsg.nv_index_count++;}else if((0x380+8167-0x2367)==strcmp(
 acStorePos,ZTE_WMS_DB_SIM_TABLE)){g_zUfiSms_DelMsg.sim_id[g_zUfiSms_DelMsg.
 sim_count]=ptDelMsg->id[i];g_zUfiSms_DelMsg.sim_count++;g_zUfiSms_DelMsg.
 sim_index_count++;}}return ZUFI_SUCC;}void zUfiSms_ChangeMainState(
@@ -69,96 +69,94 @@
 SMS_STATE_RECVING:case SMS_STATE_RECVED:case SMS_STATE_DELSAVING:case 
 SMS_STATE_DELSAVED:{break;}default:{return;}}sc_cfg_set(NV_SMS_STATE,
 ptStrSmsState[iNewState]);}int zUfiSms_CheckStoreDir(void){if(-
-(0x1690+3658-0x24d9)==access(ZTE_WMS_DB_DIR,F_OK)){printf(
+(0xa13+4987-0x1d8d)==access(ZTE_WMS_DB_DIR,F_OK)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x6d\x73\x3a\x25\x73\x20\x64\x6f\x65\x73\x20\x6e\x6f\x74\x20\x65\x78\x69\x73\x74\x2c\x73\x6f\x63\x72\x65\x61\x74\x65\x20\x69\x74\x2e" "\n"
-,ZTE_WMS_DB_DIR);if(-(0x2375+642-0x25f6)==mkdir(ZTE_WMS_DB_DIR,
-(0xa81+3837-0x177f))){printf(
+,ZTE_WMS_DB_DIR);if(-(0x177f+1629-0x1ddb)==mkdir(ZTE_WMS_DB_DIR,
+(0xfb6+5383-0x22be))){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x6d\x73\x3a\x66\x61\x69\x6c\x65\x64\x20\x74\x6f\x20\x63\x72\x65\x61\x74\x65\x20\x64\x62\x20\x64\x69\x72\x2e" "\n"
 );return ZUFI_FAIL;}}return ZUFI_SUCC;}int zUfiSms_CheckSmsDb(void){if(-
-(0xd39+6066-0x24ea)==access(ZTE_WMS_DB_PATH,F_OK)){printf(
+(0x534+6233-0x1d8c)==access(ZTE_WMS_DB_PATH,F_OK)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x6d\x73\x3a\x25\x73\x20\x64\x6f\x65\x73\x20\x6e\x6f\x74\x20\x65\x78\x69\x73\x74\x2c\x73\x6f\x20\x67\x65\x74\x20\x64\x65\x66\x61\x75\x6c\x74\x20\x63\x6f\x6e\x66\x69\x67\x2e" "\n"
 ,ZTE_WMS_DB_PATH);return ZUFI_FAIL;}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x3d\x3d\x3d\x3d\x3d\x3d\x25\x73\x20\x65\x78\x69\x73\x74\x2e" "\n"
 ,ZTE_WMS_DB_PATH);return ZUFI_SUCC;}void zUfiSms_GetDefaultCfgPara(void){
-unsigned char sts_flag=(0xee7+2-0xee9);unsigned char mem_store_flag=
-(0x289+8400-0x2359);unsigned int tp_validity_period=(0x4f+7664-0x1e3f);char 
-Temp_sms_vp[(0x229+4116-0x1235)]={(0x1304+3736-0x219c)};CHAR reportEnable[
-(0x2c4+1210-0x74c)]={(0x16e1+1724-0x1d9d)};CHAR smsLocation[(0x1274+4790-0x24f8)
-]={(0xc42+6307-0x24e5)};CHAR sendfailRetry[(0x182f+347-0x1958)]={
-(0x53+4682-0x129d)};CHAR outdateDelete[(0x11df+1800-0x18b5)]={(0xea4+451-0x1067)
-};CHAR defaultStore[(0x8a4+1127-0xcd9)]={(0x1492+4262-0x2538)};sc_cfg_get(
-NV_REPORT_ENABLE,reportEnable,sizeof(reportEnable));sc_cfg_get(
-NV_SMS_LOCATION_SET,smsLocation,sizeof(smsLocation));sc_cfg_get(
-NV_SENDFAIL_RETRY,sendfailRetry,sizeof(sendfailRetry));sc_cfg_get(
-NV_OUTDATE_DELETE,outdateDelete,sizeof(outdateDelete));sc_cfg_get(
-NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));if((0x1e7a+1889-0x25db)==
-strcmp(reportEnable,"\x31")){sts_flag=(0x1797+216-0x186e);}g_zUfiSms_CurSmsPara.
-status_report_on=sts_flag;if((0x129b+3526-0x2061)==strcmp(smsLocation,"\x4d\x45"
-)){mem_store_flag=(0x134f+864-0x16af);}else{mem_store_flag=(0xb7a+1077-0xfae);}
-g_zUfiSms_CurSmsPara.mem_store=(unsigned int)((0x1809+2084-0x202d)==
-mem_store_flag?WMS_STORAGE_TYPE_NV_V01:WMS_STORAGE_TYPE_UIM_V01);sc_cfg_get(
-NV_SMS_VP,Temp_sms_vp,sizeof(Temp_sms_vp));tp_validity_period=
-(0x1a12+1970-0x20c5);if((0x882+2601-0x12ab)==strncmp(Temp_sms_vp,
-"\x6c\x6f\x6e\x67\x65\x73\x74",(0xb4+387-0x230))){tp_validity_period=
-(0x28b+9419-0x2657);}if((0xd8a+6317-0x2637)==strncmp(Temp_sms_vp,
-"\x6f\x6e\x65\x5f\x64\x61\x79",(0x1417+3131-0x204b))){tp_validity_period=
-(0x5a1+5308-0x19b6);}if((0xc50+5106-0x2042)==strncmp(Temp_sms_vp,
-"\x6f\x6e\x65\x77\x65\x65\x6b",(0x10a4+4001-0x203e))){tp_validity_period=
-(0xf38+4594-0x207d);}if((0x215+1179-0x6b0)==strncmp(Temp_sms_vp,
-"\x74\x77\x65\x6c\x76\x65\x68",(0x14+8741-0x2232))){tp_validity_period=
-(0x134f+4783-0x256f);}g_zUfiSms_CurSmsPara.tp_validity_period=tp_validity_period
-;if((0x13f0+4182-0x2446)==strcmp(sendfailRetry,"\x31")){g_zUfiSms_CurSmsPara.
-sendfail_retry_on=(0x12fc+999-0x16e2);}else{g_zUfiSms_CurSmsPara.
-sendfail_retry_on=(0xbad+351-0xd0c);}if((0x1f75+543-0x2194)==strcmp(
-outdateDelete,"\x31")){g_zUfiSms_CurSmsPara.outdate_delete_on=
-(0x1124+1616-0x1773);}else{g_zUfiSms_CurSmsPara.outdate_delete_on=
-(0x7cf+1638-0xe35);}if((0xa49+2456-0x13e1)==strcmp(defaultStore,"\x73\x69\x6d"))
-{strncpy(g_zUfiSms_CurSmsPara.default_store,"\x73\x69\x6d",sizeof(
-g_zUfiSms_CurSmsPara.default_store)-(0x1edf+1927-0x2665));}else{strncpy(
+unsigned char sts_flag=(0x1866+536-0x1a7e);unsigned char mem_store_flag=
+(0x8a7+6329-0x2160);unsigned int tp_validity_period=(0xbb0+4827-0x1e8b);char 
+Temp_sms_vp[(0x1b7a+623-0x1de1)]={(0x1c4f+751-0x1f3e)};CHAR reportEnable[
+(0xb4+425-0x22b)]={(0x387+3885-0x12b4)};CHAR smsLocation[(0x5e4+1908-0xd26)]={
+(0x17eb+3440-0x255b)};CHAR sendfailRetry[(0xa6+5553-0x1625)]={(0x355+71-0x39c)};
+CHAR outdateDelete[(0x768+4656-0x1966)]={(0x72b+5419-0x1c56)};CHAR defaultStore[
+(0x13f8+4191-0x2425)]={(0xb0d+3227-0x17a8)};sc_cfg_get(NV_REPORT_ENABLE,
+reportEnable,sizeof(reportEnable));sc_cfg_get(NV_SMS_LOCATION_SET,smsLocation,
+sizeof(smsLocation));sc_cfg_get(NV_SENDFAIL_RETRY,sendfailRetry,sizeof(
+sendfailRetry));sc_cfg_get(NV_OUTDATE_DELETE,outdateDelete,sizeof(outdateDelete)
+);sc_cfg_get(NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));if(
+(0x389+3261-0x1046)==strcmp(reportEnable,"\x31")){sts_flag=(0xb+2462-0x9a8);}
+g_zUfiSms_CurSmsPara.status_report_on=sts_flag;if((0xcfa+3890-0x1c2c)==strcmp(
+smsLocation,"\x4d\x45")){mem_store_flag=(0x11f8+2074-0x1a12);}else{
+mem_store_flag=(0x1+3553-0xde1);}g_zUfiSms_CurSmsPara.mem_store=(unsigned int)(
+(0x216+1405-0x793)==mem_store_flag?WMS_STORAGE_TYPE_NV_V01:
+WMS_STORAGE_TYPE_UIM_V01);sc_cfg_get(NV_SMS_VP,Temp_sms_vp,sizeof(Temp_sms_vp));
+tp_validity_period=(0x15a5+4430-0x25f4);if((0x4d2+5700-0x1b16)==strncmp(
+Temp_sms_vp,"\x6c\x6f\x6e\x67\x65\x73\x74",(0x257+4877-0x155d))){
+tp_validity_period=(0x259+8653-0x2327);}if((0x7d5+1094-0xc1b)==strncmp(
+Temp_sms_vp,"\x6f\x6e\x65\x5f\x64\x61\x79",(0xccc+4988-0x2041))){
+tp_validity_period=(0x1a11+1172-0x1dfe);}if((0x2308+855-0x265f)==strncmp(
+Temp_sms_vp,"\x6f\x6e\x65\x77\x65\x65\x6b",(0x64c+4053-0x161a))){
+tp_validity_period=(0x786+7462-0x23ff);}if((0x4b0+8441-0x25a9)==strncmp(
+Temp_sms_vp,"\x74\x77\x65\x6c\x76\x65\x68",(0x932+1657-0xfa4))){
+tp_validity_period=(0x1534+2753-0x1f66);}g_zUfiSms_CurSmsPara.tp_validity_period
+=tp_validity_period;if((0x54b+6261-0x1dc0)==strcmp(sendfailRetry,"\x31")){
+g_zUfiSms_CurSmsPara.sendfail_retry_on=(0x469+6792-0x1ef0);}else{
+g_zUfiSms_CurSmsPara.sendfail_retry_on=(0x2220+627-0x2493);}if((0xe22+9-0xe2b)==
+strcmp(outdateDelete,"\x31")){g_zUfiSms_CurSmsPara.outdate_delete_on=
+(0xefd+2258-0x17ce);}else{g_zUfiSms_CurSmsPara.outdate_delete_on=
+(0x1b71+2510-0x253f);}if((0xfe7+3079-0x1bee)==strcmp(defaultStore,"\x73\x69\x6d"
+)){strncpy(g_zUfiSms_CurSmsPara.default_store,"\x73\x69\x6d",sizeof(
+g_zUfiSms_CurSmsPara.default_store)-(0x926+4742-0x1bab));}else{strncpy(
 g_zUfiSms_CurSmsPara.default_store,"\x6e\x76",sizeof(g_zUfiSms_CurSmsPara.
-default_store)-(0xacd+4438-0x1c22));}}void zUfiSms_GetDefaultPara(void){memset(&
-g_zUfiSms_CurSmsPara,(0x333+286-0x451),sizeof(T_zUfiSms_ParaInfo));
-g_zUfiSms_CurSmsPara.status_report_on=(0x230+3687-0x1097);g_zUfiSms_CurSmsPara.
+default_store)-(0x1e46+132-0x1ec9));}}void zUfiSms_GetDefaultPara(void){memset(&
+g_zUfiSms_CurSmsPara,(0x17c+3644-0xfb8),sizeof(T_zUfiSms_ParaInfo));
+g_zUfiSms_CurSmsPara.status_report_on=(0xa00+167-0xaa7);g_zUfiSms_CurSmsPara.
 mem_store=WMS_STORAGE_TYPE_NV_V01;g_zUfiSms_CurSmsPara.tp_validity_period=
 ZTE_WMS_SMS_DEFAULT_TP_VALIDITY_PERIOD_GW;g_zUfiSms_CurSmsPara.sendfail_retry_on
-=(0x176+1309-0x693);g_zUfiSms_CurSmsPara.outdate_delete_on=(0xd68+4683-0x1fb3);
+=(0x173d+592-0x198d);g_zUfiSms_CurSmsPara.outdate_delete_on=(0xd60+165-0xe05);
 strncpy(g_zUfiSms_CurSmsPara.default_store,"\x6e\x76",sizeof(
-g_zUfiSms_CurSmsPara.default_store)-(0x16d1+473-0x18a9));}
-#if (0x1015+2236-0x18d1)

+g_zUfiSms_CurSmsPara.default_store)-(0x2186+151-0x221c));}
+#if (0x1f34+261-0x2039)

 T_zUfiSms_CmdStatus zUfiSms_SetParameters(T_zUfiSms_CmdMsgBuff*ptSmsBuffer){
 T_zUfiSms_ParaInfo*ptSmsParameter=NULL;T_zUfiSms_ParaInfo tNewSmsParameter={
-(0x1598+1023-0x1997)};if(NULL==ptSmsBuffer){return WMS_CMD_FAILED;}
-ptSmsParameter=(T_zUfiSms_ParaInfo*)(&(ptSmsBuffer->cmd_info.set_sms_para));
-memcpy((void*)&tNewSmsParameter,(void*)ptSmsParameter,sizeof(T_zUfiSms_ParaInfo)
-);
+(0x751+6759-0x21b8)};if(NULL==ptSmsBuffer){return WMS_CMD_FAILED;}ptSmsParameter
+=(T_zUfiSms_ParaInfo*)(&(ptSmsBuffer->cmd_info.set_sms_para));memcpy((void*)&
+tNewSmsParameter,(void*)ptSmsParameter,sizeof(T_zUfiSms_ParaInfo));
 #ifndef TSP_MODEL

 if((g_zUfiSms_CurSmsPara.mem_store!=ptSmsParameter->mem_store)){if(
 ZUFI_SMS_FAILURE==zUfiSms_SetCpms(ptSmsParameter)){at_print(LOG_ERR,
 "\x73\x65\x74\x20\x63\x66\x67\x20\x72\x6f\x75\x74\x65\x73\x20\x66\x61\x69\x6c\x65\x64\x2e"
 );return WMS_CMD_FAILED;}}
 #endif

-if(strlen(ptSmsParameter->sca)!=(0x8f1+2095-0x1120)){if(ZUFI_SMS_FAILURE==
+if(strlen(ptSmsParameter->sca)!=(0x3bf+3641-0x11f8)){if(ZUFI_SMS_FAILURE==
 zUfiSms_SetCsca(ptSmsParameter)){return WMS_CMD_FAILED;}}if(ZUFI_SMS_FAILURE==
 zUfiSms_SetDbParameters(ptSmsParameter)){return WMS_CMD_FAILED;}else{sc_cfg_set(
 "\x73\x6d\x73\x5f\x63\x65\x6e\x74\x65\x72\x5f\x6e\x75\x6d",ptSmsParameter->sca);
 }memcpy((void*)&g_zUfiSms_CurSmsPara,(void*)&tNewSmsParameter,sizeof(
 T_zUfiSms_ParaInfo));return WMS_CMD_SUCCESS;}
 #endif

-int zUfiSms_LoadSmsPara(){int count=(0x160+2085-0x985);if(ZUFI_SUCC!=
+int zUfiSms_LoadSmsPara(){int count=(0x1dad+19-0x1dc0);if(ZUFI_SUCC!=
 zUfiSms_IsDbEmpty(ZTE_WMS_DB_PARAMETER_TABLE,&count)){return ZUFI_FAIL;}if(count
-==(0x7e7+1520-0xdd7)){zUfiSms_GetDefaultCfgPara();if((0x649+3196-0x12c5)!=
+==(0x414+4355-0x1517)){zUfiSms_GetDefaultCfgPara();if((0x710+3445-0x1485)!=
 zUfiSms_SetDbParameters(&g_zUfiSms_CurSmsPara)){return ZUFI_FAIL;}}else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x68\x61\x76\x65\x20\x64\x65\x66\x61\x75\x6c\x74\x20\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x20\x69\x6e\x20\x64\x61\x74\x61\x62\x61\x73\x65\x2e" "\n"
 );if(ZUFI_SUCC!=zUfiSms_GetDbParameters()){return ZUFI_FAIL;}if(
 WMS_STORAGE_TYPE_NV_V01!=g_zUfiSms_CurSmsPara.mem_store&&
 WMS_STORAGE_TYPE_UIM_V01!=g_zUfiSms_CurSmsPara.mem_store){zUfiSms_GetDefaultPara
-();if((0xc3f+1808-0x134f)!=zUfiSms_SetDbParameters(&g_zUfiSms_CurSmsPara)){
+();if((0xe6d+1970-0x161f)!=zUfiSms_SetDbParameters(&g_zUfiSms_CurSmsPara)){
 printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x65\x74\x20\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73\x20\x66\x61\x69\x6c\x73\x20\x32\x2e" "\n"
 );return ZUFI_FAIL;}}}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x4c\x6f\x61\x64\x53\x6d\x73\x50\x61\x72\x61\x20\x73\x75\x63\x63\x2e" "\n"
 );return ZUFI_SUCC;}int zUfiSms_CheckMemoryFull(T_zUfiSms_MemoryType mem_store){
-int total_count=(0x1dc9+564-0x1ffd);if((ZTE_WMS_MEMORY_SIM==mem_store)||(
+int total_count=(0x112d+1371-0x1688);if((ZTE_WMS_MEMORY_SIM==mem_store)||(
 ZTE_WMS_MEMORY_MAX==mem_store)){if(ZUFI_FAIL==zUfiSms_GetTotalCount(
 ZTE_WMS_DB_SIM_TABLE,&total_count)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x6d\x73\x3a\x67\x65\x74\x20\x74\x61\x62\x6c\x65\x20\x74\x6f\x74\x61\x6c\x20\x63\x6f\x75\x6e\x74\x20\x66\x61\x69\x6c\x65\x64\x2e" "\n"
@@ -175,54 +173,54 @@
 ,total_count);if(total_count>=(int)g_zUfiSms_StoreCapablity[
 WMS_STORAGE_TYPE_NV_V01]){g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]=TRUE;}
 else{g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]=FALSE;}}return ZUFI_SUCC;}
-int zUfiSms_SetStorePara(char*mem_store){if((0x713+5987-0x1e76)==strcmp(
+int zUfiSms_SetStorePara(char*mem_store){if((0x1baf+924-0x1f4b)==strcmp(
 mem_store,"\x53\x4d")){g_zUfiSms_CurSmsPara.mem_store=(unsigned int)
 WMS_STORAGE_TYPE_UIM_V01;(void)sc_cfg_set(NV_SMS_LOCATION_SET,"\x30");}else if(
-(0xeb+7160-0x1ce3)==strcmp(mem_store,"\x4d\x45")){g_zUfiSms_CurSmsPara.mem_store
-=(unsigned int)WMS_STORAGE_TYPE_NV_V01;(void)sc_cfg_set(NV_SMS_LOCATION_SET,
-"\x31");}else if((0xe38+3512-0x1bf0)==strcmp(mem_store,"\x53\x52")){
-g_zUfiSms_CurSmsPara.mem_store=(unsigned int)(0x1efb+1730-0x25bb);(void)
-sc_cfg_set(NV_SMS_LOCATION_SET,"\x32");}else{g_zUfiSms_CurSmsPara.mem_store=(
-unsigned int)WMS_STORAGE_TYPE_NONE_V01;(void)sc_cfg_set(NV_SMS_LOCATION_SET,
+(0x1303+4006-0x22a9)==strcmp(mem_store,"\x4d\x45")){g_zUfiSms_CurSmsPara.
+mem_store=(unsigned int)WMS_STORAGE_TYPE_NV_V01;(void)sc_cfg_set(
+NV_SMS_LOCATION_SET,"\x31");}else if((0xa54+7240-0x269c)==strcmp(mem_store,
+"\x53\x52")){g_zUfiSms_CurSmsPara.mem_store=(unsigned int)(0x669+4683-0x18b2);(
+void)sc_cfg_set(NV_SMS_LOCATION_SET,"\x32");}else{g_zUfiSms_CurSmsPara.mem_store
+=(unsigned int)WMS_STORAGE_TYPE_NONE_V01;(void)sc_cfg_set(NV_SMS_LOCATION_SET,
 "\x2d\x31");}if(ZUFI_FAIL==zUfiSms_SetDbParameters(&g_zUfiSms_CurSmsPara)){
 at_print(LOG_ERR,
 "\x63\x61\x6e\x20\x6e\x6f\x74\x20\x73\x65\x74\x20\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73\x2e" "\n"
 );return ZUFI_FAIL;}return ZUFI_SUCC;}int zUfiSms_SetScaPara(char*sca){strncpy(
-g_zUfiSms_CurSmsPara.sca,sca,sizeof(g_zUfiSms_CurSmsPara.sca)-
-(0x3d7+5188-0x181a));if(ZUFI_FAIL==zUfiSms_SetDbParameters(&g_zUfiSms_CurSmsPara
-)){at_print(LOG_ERR,
+g_zUfiSms_CurSmsPara.sca,sca,sizeof(g_zUfiSms_CurSmsPara.sca)-(0x15d+1228-0x628)
+);if(ZUFI_FAIL==zUfiSms_SetDbParameters(&g_zUfiSms_CurSmsPara)){at_print(LOG_ERR
+,
 "\x63\x61\x6e\x20\x6e\x6f\x74\x20\x73\x65\x74\x20\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73\x2e" "\n"
 );return ZUFI_FAIL;}return ZUFI_SUCC;}void zUfiSms_SetGlobalDcsLang(unsigned 
-char cDcs){if(cDcs==(0xb24+2047-0x1322)){g_zUfiSms_Dcs=DCS_ASC;
-g_zUfiSms_Language=NOT_DEFINE_LANGUAGE;}else if(cDcs==(0xc14+3608-0x1a2a)){
+char cDcs){if(cDcs==(0x1af4+1880-0x224b)){g_zUfiSms_Dcs=DCS_ASC;
+g_zUfiSms_Language=NOT_DEFINE_LANGUAGE;}else if(cDcs==(0xb4d+1713-0x11fc)){
 g_zUfiSms_Dcs=DCS_USC;g_zUfiSms_Language=NOT_DEFINE_LANGUAGE;}else if(cDcs==
-(0x1a62+165-0x1b04)){g_zUfiSms_Dcs=DCS_ASC;g_zUfiSms_Language=DCS_GSM7_SPANISH;}
-else if(cDcs==(0x147c+1999-0x1c46)){g_zUfiSms_Dcs=DCS_ASC;g_zUfiSms_Language=
+(0xb14+4260-0x1bb5)){g_zUfiSms_Dcs=DCS_ASC;g_zUfiSms_Language=DCS_GSM7_SPANISH;}
+else if(cDcs==(0x1d6+1189-0x676)){g_zUfiSms_Dcs=DCS_ASC;g_zUfiSms_Language=
 DCS_GSM7_PORTUGUESE;}else{g_zUfiSms_Dcs=DCS_ASC;g_zUfiSms_Language=
 DCS_GSM7_DEFAULT;}}int zUfiSms_FillGroupSms(T_zUfiSms_SendReq*ptSendMsg,
 T_zUfiSms_GroupInfo*ptGroupSms){int i;if(NULL==ptSendMsg||NULL==ptGroupSms||
 ZTE_WMS_SEND_NUM_MAX<ptSendMsg->receiver_count){return ZUFI_FAIL;}ptGroupSms->
-total_receiver=ptSendMsg->receiver_count;for(i=(0x2d9+1133-0x746);i<ptGroupSms->
-total_receiver;i++){strncpy(ptGroupSms->receivers[i],ptSendMsg->dest_num[i],
+total_receiver=ptSendMsg->receiver_count;for(i=(0x2370+766-0x266e);i<ptGroupSms
+->total_receiver;i++){strncpy(ptGroupSms->receivers[i],ptSendMsg->dest_num[i],
 ZTE_WMS_ADDRESS_LEN_MAX);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x46\x69\x6c\x6c\x47\x72\x6f\x75\x70\x53\x6d\x73\x20\x72\x65\x63\x65\x69\x76\x65\x72\x73\x5b\x25\x64\x5d\x3d\x25\x73" "\n"
-,i,ptGroupSms->receivers[i]);}ptGroupSms->current_receiver=(0x327+7448-0x203f);
+,i,ptGroupSms->receivers[i]);}ptGroupSms->current_receiver=(0x685+7490-0x23c7);
 return ZUFI_SUCC;}int zUfiSms_FillConcatSms(T_zUfiSms_SendReq*pSendSrcMsg,
-T_zUfiSms_ConcatInfo*pDestConcatMsg){int iTotalLen=(0x3fa+7654-0x21e0);int 
-iUnitlen=(0x705+6107-0x1ee0);int iSegNo=(0x1cda+2485-0x268f);unsigned char*
+T_zUfiSms_ConcatInfo*pDestConcatMsg){int iTotalLen=(0x1e19+1266-0x230b);int 
+iUnitlen=(0xff9+4574-0x21d7);int iSegNo=(0x3e2+441-0x59b);unsigned char*
 pSmsConverted=NULL;unsigned char acConvertContent[
-ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX*ZTE_WMS_CONCAT_SMS_COUNT_MAX*
-(0x145f+3594-0x2265)+(0x587+766-0x881)]={(0x1721+370-0x1893)};unsigned char 
-acTmpContent[ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX*ZTE_WMS_CONCAT_SMS_COUNT_MAX*
-(0x122+6436-0x1a42)+(0x1cac+1563-0x22c3)]={(0x13f4+4148-0x2428)};int iTimeZone=
-(0x1bd0+30-0x1bee);int tmp_i=(0x1c03+2026-0x23ed);if(NULL==pSendSrcMsg||NULL==
-pDestConcatMsg){return-(0x1bd8+2035-0x23ca);}iTotalLen=pSendSrcMsg->msg_len;if(
-ZUFI_FAIL==zUfiSms_GetSmsContent(acTmpContent,sizeof(acTmpContent))){printf(
+ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX*ZTE_WMS_CONCAT_SMS_COUNT_MAX*(0x4bc+7611-0x2273)
++(0x89a+2908-0x13f2)]={(0x456+7064-0x1fee)};unsigned char acTmpContent[
+ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX*ZTE_WMS_CONCAT_SMS_COUNT_MAX*(0x9e8+4796-0x1ca0)
++(0xfdb+1311-0x14f6)]={(0x9d1+56-0xa09)};int iTimeZone=(0x58b+5250-0x1a0d);int 
+tmp_i=(0x130c+4148-0x2340);if(NULL==pSendSrcMsg||NULL==pDestConcatMsg){return-
+(0x752+4516-0x18f5);}iTotalLen=pSendSrcMsg->msg_len;if(ZUFI_FAIL==
+zUfiSms_GetSmsContent(acTmpContent,sizeof(acTmpContent))){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x47\x65\x74\x53\x6d\x73\x43\x6f\x6e\x74\x65\x6e\x74\x20\x46\x61\x69\x6c\x2e" "\n"
-);return-(0x1e81+1483-0x244b);}printf(
+);return-(0x6b4+3946-0x161d);}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x47\x65\x74\x53\x6d\x73\x43\x6f\x6e\x74\x65\x6e\x74\x3a\x25\x73\x2e" "\n"
 ,acTmpContent);(void)String2Bytes(acTmpContent,acConvertContent,(int)strlen(
-acTmpContent));memset(acTmpContent,(0xd7c+3862-0x1c92),sizeof(acTmpContent));if(
+acTmpContent));memset(acTmpContent,(0x1610+539-0x182b),sizeof(acTmpContent));if(
 DCS_USC==g_zUfiSms_Dcs){pSmsConverted=acConvertContent;}else{if(
 NOT_DEFINE_LANGUAGE==g_zUfiSms_Language){iTotalLen=
 zUfiSms_ConvertAsciiToGsmDefault(acConvertContent,acTmpContent,pSendSrcMsg->
@@ -232,55 +230,56 @@
 zUfiSms_ConvertUcs2ToPortuguese(acConvertContent,acTmpContent,pSendSrcMsg->
 msg_len);}else{iTotalLen=zUfiSms_ConvertUcs2ToGsmDefault(acConvertContent,
 acTmpContent,pSendSrcMsg->msg_len);}pSendSrcMsg->msg_len=iTotalLen;pSmsConverted
-=acTmpContent;}if(iTotalLen>(sizeof(acConvertContent)-(0x1671+985-0x1a49))){
-iTotalLen=sizeof(acConvertContent)-(0x1750+2679-0x21c6);}pDestConcatMsg->sms_len
+=acTmpContent;}if(iTotalLen>(sizeof(acConvertContent)-(0x1021+2965-0x1bb5))){
+iTotalLen=sizeof(acConvertContent)-(0x1a6a+2369-0x23aa);}pDestConcatMsg->sms_len
 =iTotalLen;if((iTotalLen>ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX)||(g_zUfiSms_Language==
-DCS_PORTUGUESE&&iTotalLen>(0x8d1+7791-0x26a5))||((g_zUfiSms_Dcs==DCS_USC)&&
+DCS_PORTUGUESE&&iTotalLen>(0xda2+3796-0x1bdb))||((g_zUfiSms_Dcs==DCS_USC)&&
 iTotalLen>ZTE_WMS_SMS_MSG_CHAR_MAX)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x3d\x3d\x3d\x3d\x3d\x73\x65\x6e\x64\x20\x63\x6f\x6e\x74\x61\x63\x74\x20\x73\x6d\x73\x2e" "\n"
 );if(g_zUfiSms_Dcs==DCS_USC){iUnitlen=ZTE_WMS_SMS_CONCAT_ELEMNT_UCS_LEN*
-(0x994+881-0xd03);}else{if(g_zUfiSms_Language==NOT_DEFINE_LANGUAGE||
+(0x3a+1916-0x7b4);}else{if(g_zUfiSms_Language==NOT_DEFINE_LANGUAGE||
 g_zUfiSms_Language==DCS_GSM7_DEFAULT){iUnitlen=ZTE_WMS_SMS_CONCAT_ELEMNT_ASC_LEN
 ;}else{iUnitlen=ZTE_WMS_SMS_CONCAT_ELEMNT_LANGUAGE_LEN;}}while(iTotalLen>
-(0x2111+671-0x23b0)&&iSegNo<ZTE_WMS_CONCAT_SMS_COUNT_MAX){memcpy(pDestConcatMsg
-->msg_contents[iSegNo],pSmsConverted,iUnitlen);iTotalLen-=iUnitlen;pSmsConverted
-+=iUnitlen;iSegNo++;}pDestConcatMsg->total_msg=iSegNo;}else{iUnitlen=iTotalLen;
-pDestConcatMsg->total_msg=(0x156a+2624-0x1fa9);memcpy(pDestConcatMsg->
-msg_contents[(0x15c0+4188-0x261c)],pSmsConverted,iTotalLen);printf(
+(0xda1+790-0x10b7)&&iSegNo<ZTE_WMS_CONCAT_SMS_COUNT_MAX){memcpy(pDestConcatMsg->
+msg_contents[iSegNo],pSmsConverted,iUnitlen);iTotalLen-=iUnitlen;pSmsConverted+=
+iUnitlen;iSegNo++;}pDestConcatMsg->total_msg=iSegNo;}else{iUnitlen=iTotalLen;
+pDestConcatMsg->total_msg=(0x8e0+369-0xa50);memcpy(pDestConcatMsg->msg_contents[
+(0x9cb+6309-0x2270)],pSmsConverted,iTotalLen);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x3d\x3d\x3d\x3d\x3d\x73\x65\x6e\x64\x20\x6e\x6f\x72\x6d\x61\x6c\x20\x73\x6d\x73\x2e\x6c\x65\x6e\x3a\x25\x64\x2e\x63\x6f\x6e\x74\x65\x6e\x74\x3a\x25\x73\x2e" "\n"
-,iUnitlen,pDestConcatMsg->msg_contents[(0x128a+3857-0x219b)]);}
+,iUnitlen,pDestConcatMsg->msg_contents[(0x1b69+2755-0x262c)]);}
 g_zUfiSms_ConcatTotalNum=pDestConcatMsg->total_msg;pDestConcatMsg->
-current_sending=(0x3e4+6088-0x1bac);memcpy(&(pDestConcatMsg->date),&(pSendSrcMsg
-->date),sizeof(T_zUfiSms_Date));tmp_i=atoi(pDestConcatMsg->date.timezone);if(
-tmp_i<INT_MIN+(0xdd9+3336-0x1ae0)||tmp_i>INT_MAX-(0x11ad+586-0x13f6)){printf(
+current_sending=(0x1397+1723-0x1a52);memcpy(&(pDestConcatMsg->date),&(
+pSendSrcMsg->date),sizeof(T_zUfiSms_Date));tmp_i=atoi(pDestConcatMsg->date.
+timezone);if(tmp_i<INT_MIN+(0x15a8+2750-0x2065)||tmp_i>INT_MAX-
+(0x626+4083-0x1618)){printf(
 "\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x70\x44\x65\x73\x74\x43\x6f\x6e\x63\x61\x74\x4d\x73\x67\x20\x74\x69\x6d\x65\x7a\x6f\x6e\x65\x3a\x25\x64\x2e" "\n"
-,tmp_i);return ZUFI_FAIL;}iTimeZone=tmp_i*(0x920+2275-0x11ff);memset(
-pDestConcatMsg->date.timezone,(0x1e0+3621-0x1005),sizeof(pDestConcatMsg->date.
-timezone));if(iTimeZone>(0x237d+758-0x2673)){snprintf(pDestConcatMsg->date.
+,tmp_i);return ZUFI_FAIL;}iTimeZone=tmp_i*(0x178b+846-0x1ad5);memset(
+pDestConcatMsg->date.timezone,(0x272+5430-0x17a8),sizeof(pDestConcatMsg->date.
+timezone));if(iTimeZone>(0x1913+2370-0x2255)){snprintf(pDestConcatMsg->date.
 timezone,sizeof(pDestConcatMsg->date.timezone),"\x2b\x25\x64",iTimeZone);}else{
 snprintf(pDestConcatMsg->date.timezone,sizeof(pDestConcatMsg->date.timezone),
 "\x25\x64",iTimeZone);}pSmsConverted=NULL;return iUnitlen;}void 
 zUfiSms_FillDateheader(T_zUfiSms_SubmitTpdu*ptSubmit,T_zUfiSms_ConcatInfo*
 ptConcatSms,T_zUfiSms_DbStoreData*ptDbSaveData){unsigned char iHeaderNum=
-(0x962+3114-0x158c);iHeaderNum=ptSubmit->user_data.num_headers;ptSubmit->
-user_data_header_present=TRUE;if((0x215f+948-0x2513)==ptConcatSms->
+(0x143f+2283-0x1d2a);iHeaderNum=ptSubmit->user_data.num_headers;ptSubmit->
+user_data_header_present=TRUE;if((0x854+1748-0xf28)==ptConcatSms->
 current_sending){g_zUfiSms_ConcatSmsReference++;(void)zUfiSms_SetConcatMaxRefer(
 g_zUfiSms_ConcatSmsReference);}ptSubmit->user_data.headers[iHeaderNum].header_id
 =WMS_UDH_CONCAT_8;ptSubmit->user_data.headers[iHeaderNum].u.concat_8.total_sm=
 ptConcatSms->total_msg;ptSubmit->user_data.headers[iHeaderNum].u.concat_8.
-seq_num=ptConcatSms->current_sending+(0x32a+320-0x469);ptSubmit->user_data.
+seq_num=ptConcatSms->current_sending+(0x151f+3786-0x23e8);ptSubmit->user_data.
 headers[iHeaderNum].u.concat_8.msg_ref=g_zUfiSms_ConcatSmsReference%
-(0x101+7667-0x1df5);ptSubmit->user_data.num_headers++;ptDbSaveData->concat_sms=
-(0x529+8309-0x259d);ptDbSaveData->concat_info[(0xd10+1828-0x1434)]=
+(0x93f+5424-0x1d70);ptSubmit->user_data.num_headers++;ptDbSaveData->concat_sms=
+(0xac0+6866-0x2591);ptDbSaveData->concat_info[(0x1635+3655-0x247c)]=
 g_zUfiSms_ConcatSmsReference;}int zUfiSms_MakeFinalCmgsBuf(){SMS_PARAM tSmsData;
-int iPduLength=(0x1686+2480-0x2036);int nSmscLength=(0xb41+606-0xd9f);char 
-Tempstrr[(0x345+4385-0x1464)]={(0x751+6939-0x226c)};char Temp_sms_vp[
-(0x18a0+170-0x1942)]={(0x386+3462-0x110c)};char tmpBuf1[(0x1864+3591-0x2668)]={
-(0x21e3+567-0x241a)};char tmpBuf2[(0x819+5675-0x1e3e)]={(0x1160+1485-0x172d)};
-CHAR smsCenter[(0x1678+1291-0x1b51)]={(0x19dc+589-0x1c29)};memset(&tSmsData,
-(0x8b2+4642-0x1ad4),sizeof(SMS_PARAM));memset(&g_zUfiSms_FinalCmgsBuf,
-(0xe14+1210-0x12ce),sizeof(T_zSms_SendSmsReq));if(CODE_GSM7==
-g_zUfiSms_SendingSms.TP_DCS){int i=(0x127+6901-0x1c1c);for(;i<
+int iPduLength=(0x1a71+891-0x1dec);int nSmscLength=(0x2240+242-0x2332);char 
+Tempstrr[(0x17b+1450-0x723)]={(0x1cd8+314-0x1e12)};char Temp_sms_vp[
+(0x621+4855-0x1910)]={(0x555+2624-0xf95)};char tmpBuf1[(0x479+1708-0xb22)]={
+(0x20d+8173-0x21fa)};char tmpBuf2[(0x12e6+905-0x1669)]={(0xb76+3343-0x1885)};
+CHAR smsCenter[(0x70f+618-0x947)]={(0x1b88+755-0x1e7b)};memset(&tSmsData,
+(0x1ac1+2302-0x23bf),sizeof(SMS_PARAM));memset(&g_zUfiSms_FinalCmgsBuf,
+(0x1b54+2415-0x24c3),sizeof(T_zSms_SendSmsReq));if(CODE_GSM7==
+g_zUfiSms_SendingSms.TP_DCS){int i=(0xd04+5842-0x23d6);for(;i<
 g_zUfiSms_SendingSms.TP_UDLength;i++){tSmsData.TP_UD[i]=g_zUfiSms_SendingSms.
 TP_UD[i];}tSmsData.TP_UDLength=g_zUfiSms_SendingSms.TP_UDLength;}else{snprintf(
 tSmsData.TP_UD,sizeof(tSmsData.TP_UD),"\x25\x73",g_zUfiSms_SendingSms.TP_UD);
@@ -288,40 +287,40 @@
 smsCenter,sizeof(smsCenter));snprintf(tSmsData.SCA,sizeof(tSmsData.SCA),
 "\x25\x73",smsCenter);snprintf(tSmsData.TPA,sizeof(tSmsData.TPA),"\x25\x73",
 g_zUfiSms_SendingSms.TPA);tSmsData.TP_DCS=g_zUfiSms_SendingSms.TP_DCS;sc_cfg_get
-(NV_REPORT_ENABLE,Tempstrr,sizeof(Tempstrr));if(((0x16a9+2818-0x21ab)==strncmp(
-Tempstrr,"\x31",(0x7f2+299-0x91c)))&&(g_zUfiSms_ConcatSms.current_sending==
-g_zUfiSms_ConcatSms.total_msg-(0x101a+3446-0x1d8f))){tSmsData.TP_SRR=
-(0xdf9+2881-0x1939);}else{tSmsData.TP_SRR=(0x205a+1353-0x25a3);}tSmsData.TP_UDHI
-=g_zUfiSms_SendingSms.TP_UDHI;tSmsData.TP_VP=(0x1827+1581-0x1d55);sc_cfg_get(
-NV_SMS_VP,Temp_sms_vp,sizeof(Temp_sms_vp));if((0x73+2036-0x867)==strncmp(
-Temp_sms_vp,"\x6c\x6f\x6e\x67\x65\x73\x74",(0xbf+1171-0x54b))){tSmsData.TP_VP=
-(0x5f2+4830-0x17d1);}else if((0xde5+1642-0x144f)==strncmp(Temp_sms_vp,
-"\x6f\x6e\x65\x5f\x64\x61\x79",(0x557+3570-0x1342))){tSmsData.TP_VP=
-(0x16b7+926-0x19ae);}else if((0x72b+1901-0xe98)==strncmp(Temp_sms_vp,
-"\x6f\x6e\x65\x77\x65\x65\x6b",(0xd71+4900-0x208e))){tSmsData.TP_VP=
-(0x1891+122-0x185e);}else if((0xb13+4550-0x1cd9)==strncmp(Temp_sms_vp,
-"\x74\x77\x65\x6c\x76\x65\x68",(0x9b8+616-0xc19))){tSmsData.TP_VP=
-(0x1e32+577-0x1fe4);}tSmsData.TP_PID=(0x1412+3419-0x216d);
-#if (0xde3+2093-0x160f)
+(NV_REPORT_ENABLE,Tempstrr,sizeof(Tempstrr));if(((0x81c+3537-0x15ed)==strncmp(
+Tempstrr,"\x31",(0x158+6808-0x1bef)))&&(g_zUfiSms_ConcatSms.current_sending==
+g_zUfiSms_ConcatSms.total_msg-(0x202d+927-0x23cb))){tSmsData.TP_SRR=
+(0xb5f+1152-0xfde);}else{tSmsData.TP_SRR=(0x1172+5191-0x25b9);}tSmsData.TP_UDHI=
+g_zUfiSms_SendingSms.TP_UDHI;tSmsData.TP_VP=(0x10fa+5641-0x2604);sc_cfg_get(
+NV_SMS_VP,Temp_sms_vp,sizeof(Temp_sms_vp));if((0x1ff+8281-0x2258)==strncmp(
+Temp_sms_vp,"\x6c\x6f\x6e\x67\x65\x73\x74",(0x1bc9+772-0x1ec6))){tSmsData.TP_VP=
+(0x84a+3259-0x1406);}else if((0x24ea+178-0x259c)==strncmp(Temp_sms_vp,
+"\x6f\x6e\x65\x5f\x64\x61\x79",(0x1514+4140-0x2539))){tSmsData.TP_VP=
+(0x8c1+1494-0xdf0);}else if((0x139c+112-0x140c)==strncmp(Temp_sms_vp,
+"\x6f\x6e\x65\x77\x65\x65\x6b",(0x12ad+1574-0x18cc))){tSmsData.TP_VP=
+(0x933+4405-0x19bb);}else if((0x259+3150-0xea7)==strncmp(Temp_sms_vp,
+"\x74\x77\x65\x6c\x76\x65\x68",(0xa79+3424-0x17d2))){tSmsData.TP_VP=
+(0x933+6713-0x22dd);}tSmsData.TP_PID=(0x76+5666-0x1698);
+#if (0x143d+3217-0x20cd)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x62\x65\x67\x69\x6e\x3a\x25\x73" "\n",
 g_zUfiSms_FinalCmgsBuf.pdu);
 #endif    
 iPduLength=EncodePdu_Submit(&tSmsData,g_zUfiSms_FinalCmgsBuf.pdu);
-#if (0x155d+1976-0x1d14)
+#if (0x9e3+6701-0x240f)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x4d\x61\x6b\x65\x46\x69\x6e\x61\x6c\x43\x6d\x67\x73\x42\x75\x66\x20\x6d\x61\x6b\x65\x20\x70\x64\x75\x20\x64\x61\x74\x61" "\n"
 );printf("\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x25\x73" "\n",
 g_zUfiSms_FinalCmgsBuf.pdu);
 #endif

-(void)String2Bytes(g_zUfiSms_FinalCmgsBuf.pdu,tmpBuf1,(0x22bd+781-0x25c8));
+(void)String2Bytes(g_zUfiSms_FinalCmgsBuf.pdu,tmpBuf1,(0x17f5+3126-0x2429));
 Bytes2String(tmpBuf1,tmpBuf2,strlen(tmpBuf1));nSmscLength=atoi(tmpBuf2);if(
-nSmscLength<(0x141c+3820-0x2308)||nSmscLength>INT_MAX-(0x123d+46-0x126a)){
+nSmscLength<(0x1b2b+1607-0x2172)||nSmscLength>INT_MAX-(0x94c+3714-0x17cd)){
 at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x6e\x53\x6d\x73\x63\x4c\x65\x6e\x67\x74\x68\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,nSmscLength);nSmscLength=(0xcda+4961-0x203b);;}nSmscLength++;
-g_zUfiSms_FinalCmgsBuf.length=iPduLength/(0xf4b+5780-0x25dd)-nSmscLength;
-#if (0xe29+570-0x1062)
+,nSmscLength);nSmscLength=(0xab3+1545-0x10bc);;}nSmscLength++;
+g_zUfiSms_FinalCmgsBuf.length=iPduLength/(0x633+4883-0x1944)-nSmscLength;
+#if (0x17f+7795-0x1ff1)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x4d\x61\x6b\x65\x46\x69\x6e\x61\x6c\x43\x6d\x67\x73\x42\x75\x66\x20\x6d\x61\x6b\x65\x20\x65\x6e\x64\x20\x70\x64\x75\x20\x64\x61\x74\x61" "\n"
 );printf(
@@ -331,22 +330,22 @@
 return ZUFI_SUCC;}int zUfiSms_FillSubmitTpdu(T_zUfiSms_ConcatInfo*ptConcatSms,
 T_zUfiSms_GroupInfo*ptGroupSms,int iSmsLen,T_zUfiSms_SubmitTpdu*ptSubmit,
 T_zUfiSms_DbStoreData*ptDbSaveData){if(NULL==ptSubmit||NULL==ptConcatSms||NULL==
-ptGroupSms||NULL==ptDbSaveData){return-(0x1eed+1480-0x24b4);}ptSubmit->
+ptGroupSms||NULL==ptDbSaveData){return-(0x113b+5403-0x2655);}ptSubmit->
 reject_duplicates=FALSE;ptSubmit->reply_path_present=FALSE;ptSubmit->
 user_data_header_present=FALSE;ptSubmit->status_report_enabled=
-g_zUfiSms_CurSmsPara.status_report_on;if(((0x730+1929-0xeb8)<ptConcatSms->
-total_msg)&&(ptConcatSms->current_sending+(0x243+5005-0x15cf)<ptConcatSms->
-total_msg)){ptSubmit->status_report_enabled=(0x7b2+6758-0x2218);}ptSubmit->
+g_zUfiSms_CurSmsPara.status_report_on;if(((0x1509+857-0x1861)<ptConcatSms->
+total_msg)&&(ptConcatSms->current_sending+(0x4e9+2641-0xf39)<ptConcatSms->
+total_msg)){ptSubmit->status_report_enabled=(0x339+22-0x34f);}ptSubmit->
 message_reference=g_zUfiSms_MsgRefer;ptSubmit->pid=WMS_PID_DEFAULT;ptSubmit->dcs
-.msg_class=(wms_message_class_e_type)(0x233d+432-0x24e9);ptSubmit->dcs.
-is_compressed=(0x1bb1+2337-0x24d2);ptSubmit->dcs.alphabet=(g_zUfiSms_Dcs==
-DCS_ASC)?WMS_GW_ALPHABET_7_BIT_DEFAULT:WMS_GW_ALPHABET_UCS2;ptSubmit->validity.
-format=WMS_GW_VALIDITY_RELATIVE;zUfiSms_DecodeRelativeTime(g_zUfiSms_CurSmsPara.
+.msg_class=(wms_message_class_e_type)(0xd52+274-0xe60);ptSubmit->dcs.
+is_compressed=(0xddb+2211-0x167e);ptSubmit->dcs.alphabet=(g_zUfiSms_Dcs==DCS_ASC
+)?WMS_GW_ALPHABET_7_BIT_DEFAULT:WMS_GW_ALPHABET_UCS2;ptSubmit->validity.format=
+WMS_GW_VALIDITY_RELATIVE;zUfiSms_DecodeRelativeTime(g_zUfiSms_CurSmsPara.
 tp_validity_period,&ptSubmit->validity.u.time);ptSubmit->user_data.num_headers=
-(0x782+248-0x87a);if(ptConcatSms->total_msg>(0x1ee5+994-0x22c6)){
+(0x162+4315-0x123d);if(ptConcatSms->total_msg>(0x17f1+1252-0x1cd4)){
 zUfiSms_FillDateheader(ptSubmit,ptConcatSms,ptDbSaveData);ptDbSaveData->
-concat_info[(0xd2a+1752-0x1400)]=ptConcatSms->current_sending+
-(0x4a6+6534-0x1e2b);ptDbSaveData->concat_info[(0xf04+5660-0x251f)]=ptConcatSms->
+concat_info[(0x1c4d+1408-0x21cb)]=ptConcatSms->current_sending+
+(0x589+7547-0x2303);ptDbSaveData->concat_info[(0xb35+912-0xec4)]=ptConcatSms->
 total_msg;}if(g_zUfiSms_Language==DCS_PORTUGUESE){UINT8 i=ptSubmit->user_data.
 num_headers;ptSubmit->user_data_header_present=TRUE;ptSubmit->user_data.headers[
 i].header_id=WMS_UDH_NAT_LANG_SS;ptSubmit->user_data.headers[ptSubmit->user_data
@@ -354,51 +353,52 @@
 user_data.num_headers++;g_zUfiSms_IsLanguageShift=WMS_UDH_NAT_LANG_SS;}ptSubmit
 ->user_data.sm_len=iSmsLen;memcpy(ptSubmit->user_data.sm_data,ptConcatSms->
 msg_contents[ptConcatSms->current_sending],iSmsLen);if(ptGroupSms->receivers[
-ptGroupSms->current_receiver][(0x76d+7410-0x245f)]==((char)(0x95a+6672-0x233f)))
-{(void)zUfiSms_CharToInt(ptGroupSms->receivers[ptGroupSms->current_receiver]+
-(0x14d1+1036-0x18dc),strlen(ptGroupSms->receivers[ptGroupSms->current_receiver])
--(0x54b+2074-0xd64),ptSubmit->address.digits);ptSubmit->address.number_type=
+ptGroupSms->current_receiver][(0x4a8+5857-0x1b89)]==((char)(0x3ba+2013-0xb6c))){
+(void)zUfiSms_CharToInt(ptGroupSms->receivers[ptGroupSms->current_receiver]+
+(0x1016+2031-0x1804),strlen(ptGroupSms->receivers[ptGroupSms->current_receiver])
+-(0x3ca+6135-0x1bc0),ptSubmit->address.digits);ptSubmit->address.number_type=
 WMS_NUMBER_INTERNATIONAL;ptSubmit->address.number_of_digits=strlen(ptGroupSms->
-receivers[ptGroupSms->current_receiver])-(0x10f+3108-0xd32);}else if(ptGroupSms
-->receivers[ptGroupSms->current_receiver][(0x214+4741-0x1499)]==
-((char)(0x2a9+4758-0x150f))&&ptGroupSms->receivers[ptGroupSms->current_receiver]
-[(0x8d6+3116-0x1501)]==((char)(0xb4c+2417-0x148d))){(void)zUfiSms_CharToInt(
-ptGroupSms->receivers[ptGroupSms->current_receiver]+(0x1922+42-0x194a),strlen(
-ptGroupSms->receivers[ptGroupSms->current_receiver])-(0x23cf+742-0x26b3),
-ptSubmit->address.digits);ptSubmit->address.number_type=WMS_NUMBER_INTERNATIONAL
-;ptSubmit->address.number_of_digits=strlen(ptGroupSms->receivers[ptGroupSms->
-current_receiver])-(0x41b+3011-0xfdc);}else{(void)zUfiSms_CharToInt(ptGroupSms->
-receivers[ptGroupSms->current_receiver],strlen(ptGroupSms->receivers[ptGroupSms
-->current_receiver]),ptSubmit->address.digits);ptSubmit->address.number_type=
-WMS_NUMBER_UNKNOWN;ptSubmit->address.number_of_digits=strlen(ptGroupSms->
-receivers[ptGroupSms->current_receiver]);}ptSubmit->address.digit_mode=(
-wms_digit_mode_e_type)(0xd21+3528-0x1ae9);ptSubmit->address.number_mode=(
-wms_number_mode_e_type)(0x794+1961-0xf3d);ptSubmit->address.number_plan=
-WMS_NUMBER_PLAN_TELEPHONY;memset(&g_zUfiSms_SendingSms,(0xafa+1545-0x1103),
-sizeof(SMS_PARAM));snprintf(g_zUfiSms_SendingSms.TPA,sizeof(g_zUfiSms_SendingSms
-.TPA),"\x25\x73",ptGroupSms->receivers[ptGroupSms->current_receiver]);if(
-g_zUfiSms_Language!=NOT_DEFINE_LANGUAGE){g_zUfiSms_SendingSms.TP_DCS=CODE_GSM7;}
-else{if(g_zUfiSms_Dcs==DCS_USC){g_zUfiSms_SendingSms.TP_DCS=CODE_UCS2;}else{
-g_zUfiSms_SendingSms.TP_DCS=CODE_GSM8;}}if(g_zUfiSms_SendingSms.TP_DCS==
-CODE_GSM7){zUfiSms_FillGlobalTpudGsm7(ptSubmit,ptConcatSms,ptDbSaveData);}else{
+receivers[ptGroupSms->current_receiver])-(0x1ca5+2346-0x25ce);}else if(
+ptGroupSms->receivers[ptGroupSms->current_receiver][(0x1a79+3152-0x26c9)]==
+((char)(0x1b7+2855-0xcae))&&ptGroupSms->receivers[ptGroupSms->current_receiver][
+(0x1e9f+1164-0x232a)]==((char)(0x1dcd+2129-0x25ee))){(void)zUfiSms_CharToInt(
+ptGroupSms->receivers[ptGroupSms->current_receiver]+(0xd46+2342-0x166a),strlen(
+ptGroupSms->receivers[ptGroupSms->current_receiver])-(0x9c+7188-0x1cae),ptSubmit
+->address.digits);ptSubmit->address.number_type=WMS_NUMBER_INTERNATIONAL;
+ptSubmit->address.number_of_digits=strlen(ptGroupSms->receivers[ptGroupSms->
+current_receiver])-(0xedf+2334-0x17fb);}else{(void)zUfiSms_CharToInt(ptGroupSms
+->receivers[ptGroupSms->current_receiver],strlen(ptGroupSms->receivers[
+ptGroupSms->current_receiver]),ptSubmit->address.digits);ptSubmit->address.
+number_type=WMS_NUMBER_UNKNOWN;ptSubmit->address.number_of_digits=strlen(
+ptGroupSms->receivers[ptGroupSms->current_receiver]);}ptSubmit->address.
+digit_mode=(wms_digit_mode_e_type)(0xd10+3661-0x1b5d);ptSubmit->address.
+number_mode=(wms_number_mode_e_type)(0xd74+1111-0x11cb);ptSubmit->address.
+number_plan=WMS_NUMBER_PLAN_TELEPHONY;memset(&g_zUfiSms_SendingSms,
+(0x8b5+6632-0x229d),sizeof(SMS_PARAM));snprintf(g_zUfiSms_SendingSms.TPA,sizeof(
+g_zUfiSms_SendingSms.TPA),"\x25\x73",ptGroupSms->receivers[ptGroupSms->
+current_receiver]);if(g_zUfiSms_Language!=NOT_DEFINE_LANGUAGE){
+g_zUfiSms_SendingSms.TP_DCS=CODE_GSM7;}else{if(g_zUfiSms_Dcs==DCS_USC){
+g_zUfiSms_SendingSms.TP_DCS=CODE_UCS2;}else{g_zUfiSms_SendingSms.TP_DCS=
+CODE_GSM8;}}if(g_zUfiSms_SendingSms.TP_DCS==CODE_GSM7){
+zUfiSms_FillGlobalTpudGsm7(ptSubmit,ptConcatSms,ptDbSaveData);}else{
 zUfiSms_FillGlobalTpudUcs2(ptSubmit,ptConcatSms,ptDbSaveData);}(void)
 zUfiSms_MakeFinalCmgsBuf();return ZUFI_SUCC;}void zUfiSms_FillSca(
 T_zUfiSms_ClientMsg*ptClientMsg){char sca[ZTE_WMS_SCA_LEN_MAX]={
-(0x1643+331-0x178e)};int i=(0x1e69+1644-0x24d5);if(NULL==ptClientMsg){return;}
+(0xe67+5799-0x250e)};int i=(0x104f+1752-0x1727);if(NULL==ptClientMsg){return;}
 memcpy((void*)sca,(void*)(g_zUfiSms_CurSmsPara.sca),sizeof(g_zUfiSms_CurSmsPara.
-sca));if(sca[(0x10cb+3799-0x1fa2)]==((char)(0x1373+1128-0x17b0))){ptClientMsg->u
-.gw_message.sc_address.number_type=WMS_NUMBER_INTERNATIONAL;}ptClientMsg->u.
+sca));if(sca[(0x21+3462-0xda7)]==((char)(0xa01+1497-0xfaf))){ptClientMsg->u.
+gw_message.sc_address.number_type=WMS_NUMBER_INTERNATIONAL;}ptClientMsg->u.
 gw_message.sc_address.digit_mode=WMS_DIGIT_MODE_8_BIT;ptClientMsg->u.gw_message.
 sc_address.number_plan=WMS_NUMBER_PLAN_TELEPHONY;ptClientMsg->u.gw_message.
-sc_address.number_of_digits=strlen(sca);if(sca[(0x873+830-0xbb1)]==
-((char)(0x9b1+850-0xcd8))){ptClientMsg->u.gw_message.sc_address.number_of_digits
---;for(i=(0x1505+185-0x15be);i<ptClientMsg->u.gw_message.sc_address.
-number_of_digits;i++){sca[i]=sca[i+(0xd6f+580-0xfb2)];}}else if(sca[
-(0x4e1+6070-0x1c97)]==((char)(0x166d+1006-0x1a2b))&&sca[(0xe46+5715-0x2498)]==
-((char)(0x605+6902-0x20cb))){ptClientMsg->u.gw_message.sc_address.
-number_of_digits-=(0x287+5116-0x1681);for(i=(0x11d+5996-0x1889);i<ptClientMsg->u
-.gw_message.sc_address.number_of_digits;i++){sca[i]=sca[i+(0x9b7+1238-0xe8b)];}}
-(void)zUfiSms_CharToInt(sca,ptClientMsg->u.gw_message.sc_address.
+sc_address.number_of_digits=strlen(sca);if(sca[(0x1ac4+2047-0x22c3)]==
+((char)(0x4da+7092-0x2063))){ptClientMsg->u.gw_message.sc_address.
+number_of_digits--;for(i=(0x6af+6392-0x1fa7);i<ptClientMsg->u.gw_message.
+sc_address.number_of_digits;i++){sca[i]=sca[i+(0x1f99+1587-0x25cb)];}}else if(
+sca[(0x105+5487-0x1674)]==((char)(0x3b8+8450-0x248a))&&sca[(0x3aa+8132-0x236d)]
+==((char)(0x1f20+367-0x205f))){ptClientMsg->u.gw_message.sc_address.
+number_of_digits-=(0x1a8d+2064-0x229b);for(i=(0x8c1+4179-0x1914);i<ptClientMsg->
+u.gw_message.sc_address.number_of_digits;i++){sca[i]=sca[i+(0xbf+6130-0x18af)];}
+}(void)zUfiSms_CharToInt(sca,ptClientMsg->u.gw_message.sc_address.
 number_of_digits,ptClientMsg->u.gw_message.sc_address.digits);}void 
 zUfiSms_FillDbSaveData(T_zUfiSms_ClientMsg*ptClientMsg,T_zUfiSms_ClientTsData*
 ptClientData,T_zUfiSms_ConcatInfo*ptConcatSms,T_zUfiSms_GroupInfo*ptGroupSms,int
@@ -408,12 +408,12 @@
 }ptDbSaveData->mem_store=ptClientMsg->msg_hdr.mem_store;ptDbSaveData->index=
 ptClientMsg->msg_hdr.index;ptDbSaveData->mode=ptClientMsg->msg_hdr.message_mode;
 ptDbSaveData->tag=ptClientMsg->msg_hdr.tag;memset(ptDbSaveData->number,
-(0x1d07+1210-0x21c1),ZTE_WMS_ADDRESS_LEN_MAX+(0xe9c+2975-0x1a3a));memcpy(
+(0x48d+6673-0x1e9e),ZTE_WMS_ADDRESS_LEN_MAX+(0x17f4+1599-0x1e32));memcpy(
 ptDbSaveData->number,ptGroupSms->receivers[ptGroupSms->current_receiver],strlen(
 ptGroupSms->receivers[ptGroupSms->current_receiver]));ptDbSaveData->tp_dcs=
 DCS_USC;ptDbSaveData->tp_pid=ptClientData->u.gw_pp.u.submit.pid;ptDbSaveData->
 msg_ref=ptClientData->u.gw_pp.u.submit.message_reference;memset(ptDbSaveData->
-sms_content,(0x112a+4226-0x21ac),sizeof(ptDbSaveData->sms_content));if(
+sms_content,(0x1833+685-0x1ae0),sizeof(ptDbSaveData->sms_content));if(
 g_zUfiSms_Dcs==DCS_USC){ptDbSaveData->alphabet=WMS_GW_ALPHABET_UCS2;}else if(
 g_zUfiSms_Dcs==DCS_ASC){ptDbSaveData->alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;}(
 void)zUfiSms_DispatchWtoi(ptConcatSms->msg_contents[ptConcatSms->current_sending
@@ -424,7 +424,7 @@
 ptDbSaveData){T_zUfiSms_ClientTsData tClientTsData;ptClientMsg->msg_hdr.
 mem_store=WMS_MEMORY_STORE_NV_GW;ptClientMsg->msg_hdr.tag=WMS_TAG_MO_NOT_SENT;
 ptClientMsg->msg_hdr.message_mode=WMS_MESSAGE_MODE_GW;ptClientMsg->u.gw_message.
-is_broadcast=FALSE;memset((void*)&tClientTsData,(0x22bd+701-0x257a),sizeof(
+is_broadcast=FALSE;memset((void*)&tClientTsData,(0x1995+609-0x1bf6),sizeof(
 wms_client_ts_data_s_type));tClientTsData.format=WMS_FORMAT_GW_PP;tClientTsData.
 u.gw_pp.tpdu_type=WMS_TPDU_SUBMIT;(void)zUfiSms_FillSubmitTpdu(&
 g_zUfiSms_ConcatSms,&g_zUfiSms_GroupSms,g_zUfiSms_UnitLen,&tClientTsData.u.gw_pp
@@ -433,95 +433,95 @@
 ptClientMsg,&tClientTsData,&g_zUfiSms_ConcatSms,&g_zUfiSms_GroupSms,
 g_zUfiSms_UnitLen,ptDbSaveData);}int zUfiSms_StoreNormalSmsToDb(
 T_zUfiSms_DbStoreData*ptDbSaveData,const char*pMemStore,long iSmsId){int result=
-ZUFI_SUCC;char*pContent=NULL;int iTotalCount=(0xefc+5121-0x22fd);pContent=(char*
-)malloc((0x177b+450-0x1939)*ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX);if(pContent==
-NULL){return ZUFI_FAIL;}memset(pContent,(0x54c+4304-0x161c),(0x1420+2952-0x1fa4)
-*ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX);if(WMS_GW_ALPHABET_7_BIT_DEFAULT==
-ptDbSaveData->alphabet){static char data[(0x12e2+1843-0x1a11)*
-ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX+(0x32b+5253-0x17af)]={(0xa8d+6445-0x23ba)};
-memset(data,(0xdc6+2614-0x17fc),(0x5ed+1311-0xb08)*
-ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX+(0x1770+2508-0x213b));(void)
-zUfiSms_DecodeContent((char*)ptDbSaveData->sms_content,strlen(ptDbSaveData->
-sms_content),FALSE,data);strncpy(pContent,data,(0x1eb6+450-0x2074)*
-ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX-(0xfb0+1509-0x1594));}else{strncpy(
-pContent,ptDbSaveData->sms_content,(0x245+1980-0x9fd)*
-ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX-(0x596+3741-0x1432));}ptDbSaveData->tp_dcs
-=(unsigned char)(0xe24+6363-0x26fd);if(-(0x1222+3237-0x1ec6)==iSmsId){if(
+ZUFI_SUCC;char*pContent=NULL;int iTotalCount=(0x13af+71-0x13f6);pContent=(char*)
+malloc((0xb03+2238-0x13bd)*ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX);if(pContent==
+NULL){return ZUFI_FAIL;}memset(pContent,(0x809+5799-0x1eb0),(0xb19+3989-0x1aaa)*
+ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX);if(WMS_GW_ALPHABET_7_BIT_DEFAULT==
+ptDbSaveData->alphabet){static char data[(0x1912+3369-0x2637)*
+ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX+(0x83f+40-0x866)]={(0x1538+579-0x177b)};memset(
+data,(0x7+4022-0xfbd),(0x14f4+3594-0x22fa)*ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX+
+(0x2e5+1786-0x9de));(void)zUfiSms_DecodeContent((char*)ptDbSaveData->sms_content
+,strlen(ptDbSaveData->sms_content),FALSE,data);strncpy(pContent,data,
+(0x386+487-0x569)*ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX-(0x6c2+8127-0x2680));}
+else{strncpy(pContent,ptDbSaveData->sms_content,(0x94f+3232-0x15eb)*
+ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX-(0x1090+1702-0x1735));}ptDbSaveData->
+tp_dcs=(unsigned char)(0xf52+2835-0x1a63);if(-(0x141c+106-0x1485)==iSmsId){if(
 ZUFI_FAIL==zUfiSms_GetTotalCount(pMemStore,&iTotalCount)){free(pContent);
 pContent=NULL;return ZUFI_FAIL;}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x74\x6f\x72\x65\x4e\x6f\x72\x6d\x61\x6c\x53\x6d\x73\x54\x6f\x44\x62\x20\x69\x54\x6f\x74\x61\x6c\x43\x6f\x75\x6e\x74\x3d\x25\x64" "\n"
 ,iTotalCount);if(iTotalCount>=g_zUfiSms_StoreCapablity[(strcmp(pMemStore,
 "\x6e\x76")?ZTE_WMS_MEMORY_SIM:ZTE_WMS_MEMORY_NV)]){free(pContent);pContent=NULL
-;return-(0x1786+3707-0x2600);}if(ZUFI_FAIL==zUfiSms_InsertNormalSmsToDb(
+;return-(0x13f5+3921-0x2345);}if(ZUFI_FAIL==zUfiSms_InsertNormalSmsToDb(
 ptDbSaveData,pMemStore,pContent)){result=ZUFI_FAIL;}}else{if(ZUFI_FAIL==
 zUfiSms_UpdateNormalSmsToDb(ptDbSaveData,pMemStore,pContent,iSmsId)){result=
 ZUFI_FAIL;}}free(pContent);pContent=NULL;return result;}static int 
 zUfiSms_ConcatDataFree(T_zUfiSms_DbStoreData*ptDbSaveData,int count,char**
-out_result){int i=(0x1441+680-0x16e9);for(i=(0x1f2a+1754-0x2604);i<count;i++){if
-(ptDbSaveData->concat_info[(0x5e0+647-0x865)]==i+(0x15c9+1536-0x1bc8)){free(
-out_result[i]);out_result[i]=NULL;break;}}return(0x4cf+2530-0xeb1);}int 
+out_result){int i=(0x56c+4274-0x161e);for(i=(0x1e44+2-0x1e46);i<count;i++){if(
+ptDbSaveData->concat_info[(0xa63+4120-0x1a79)]==i+(0x1b37+2089-0x235f)){free(
+out_result[i]);out_result[i]=NULL;break;}}return(0x733+6301-0x1fd0);}int 
 zUfiSms_AddNewSmsToConcatData(T_zUfiSms_DbStoreData*ptDbSaveData,char*
 pOldContent,char*pFormatNewContent,char*pRealNewContent,T_zUfiSms_DbStoreStr*pac
-,int*pConcatTotalNum,int len){int count=(0x835+388-0x9b9);char**out_result=NULL;
-char cSegChar=((char)(0x55a+7799-0x2396));int i=(0x1182+3903-0x20c1);int 
-iTotalSegNum=(0xe94+6212-0x26d8);char acContentSeg[(0x19b2+1572-0x1fd4)*
-ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX*ZTE_WMS_SMS_COUNT_MAX]={(0x575+88-0x5cd)};
-char*pCurConPos=acContentSeg;boolean isEsc=FALSE;if(NULL==pOldContent){return-
-(0x235+1448-0x7dc);}count=zUfiSms_SplitString(pOldContent,&out_result,cSegChar);
-for(i=(0x15b0+2598-0x1fd6);i<count;i++){if(ptDbSaveData->concat_info[
-(0x1086+2691-0x1b07)]==i+(0x12dd+812-0x1608)){out_result[i]=(char*)malloc(sizeof
-(ptDbSaveData->sms_content));memset(out_result[i],(0xbc0+1765-0x12a5),sizeof(
-ptDbSaveData->sms_content));if(WMS_GW_ALPHABET_7_BIT_DEFAULT==ptDbSaveData->
-alphabet){isEsc=zUfiSms_DecodeContent(ptDbSaveData->sms_content,strlen(
-ptDbSaveData->sms_content),isEsc,out_result[i]);}else{strncpy(out_result[i],
-ptDbSaveData->sms_content,sizeof(ptDbSaveData->sms_content)-(0x1612+489-0x17fa))
-;}break;}}for(i=(0x93+4151-0x10ca);i<count;i++){snprintf(acContentSeg+strlen(
-acContentSeg),sizeof(acContentSeg)-strlen(acContentSeg),"\x25\x73",out_result[i]
-);strcat(pFormatNewContent,out_result[i]);if(i!=count-(0x5cd+1443-0xb6f)){strcat
-(pFormatNewContent,"\x3b");}}strncpy(pRealNewContent,acContentSeg,len);
+,int*pConcatTotalNum,int len){int count=(0x122d+4718-0x249b);char**out_result=
+NULL;char cSegChar=((char)(0x188b+2857-0x2379));int i=(0x331+1438-0x8cf);int 
+iTotalSegNum=(0x550+3298-0x1232);char acContentSeg[(0x99+4121-0x10b0)*
+ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX*ZTE_WMS_SMS_COUNT_MAX]={
+(0x9f6+5659-0x2011)};char*pCurConPos=acContentSeg;boolean isEsc=FALSE;if(NULL==
+pOldContent){return-(0x2fb+3826-0x11ec);}count=zUfiSms_SplitString(pOldContent,&
+out_result,cSegChar);for(i=(0x348+1610-0x992);i<count;i++){if(ptDbSaveData->
+concat_info[(0x153c+2627-0x1f7d)]==i+(0x5fb+6510-0x1f68)){out_result[i]=(char*)
+malloc(sizeof(ptDbSaveData->sms_content));memset(out_result[i],
+(0x271+4927-0x15b0),sizeof(ptDbSaveData->sms_content));if(
+WMS_GW_ALPHABET_7_BIT_DEFAULT==ptDbSaveData->alphabet){isEsc=
+zUfiSms_DecodeContent(ptDbSaveData->sms_content,strlen(ptDbSaveData->sms_content
+),isEsc,out_result[i]);}else{strncpy(out_result[i],ptDbSaveData->sms_content,
+sizeof(ptDbSaveData->sms_content)-(0x70+396-0x1fb));}break;}}for(i=
+(0x49+3065-0xc42);i<count;i++){snprintf(acContentSeg+strlen(acContentSeg),sizeof
+(acContentSeg)-strlen(acContentSeg),"\x25\x73",out_result[i]);strcat(
+pFormatNewContent,out_result[i]);if(i!=count-(0x4c4+247-0x5ba)){strcat(
+pFormatNewContent,"\x3b");}}strncpy(pRealNewContent,acContentSeg,len);
 zUfiSms_ConcatDataFree(ptDbSaveData,count,out_result);free(out_result);
 out_result=NULL;count=zUfiSms_SplitString(pac->IndStr,&out_result,cSegChar);for(
-i=(0x23a7+73-0x23f0);i<count;i++){if(ptDbSaveData->concat_info[
-(0x81c+2740-0x12ce)]==i+(0xee5+6173-0x2701)){out_result[i]=(char*)malloc(
-SHORT_INT_LEN);memset(out_result[i],(0xd9+5464-0x1631),SHORT_INT_LEN);snprintf(
+i=(0x633+3585-0x1434);i<count;i++){if(ptDbSaveData->concat_info[
+(0x212+2414-0xb7e)]==i+(0x43a+7899-0x2314)){out_result[i]=(char*)malloc(
+SHORT_INT_LEN);memset(out_result[i],(0x5ad+8058-0x2527),SHORT_INT_LEN);snprintf(
 out_result[i],SHORT_INT_LEN,"\x25\x64",ptDbSaveData->index);break;}}for(i=
-(0xc87+665-0xf20);i<count;i++){snprintf(pac->FormatInd+strlen(pac->FormatInd),
+(0xef0+5208-0x2348);i<count;i++){snprintf(pac->FormatInd+strlen(pac->FormatInd),
 sizeof(pac->FormatInd)-strlen(pac->FormatInd),"\x25\x73",out_result[i]);if(i!=
-count-(0x157d+2935-0x20f3)){snprintf(pac->FormatInd+strlen(pac->FormatInd),
+count-(0x161b+1445-0x1bbf)){snprintf(pac->FormatInd+strlen(pac->FormatInd),
 sizeof(pac->FormatInd)-strlen(pac->FormatInd),"\x3b");}}zUfiSms_ConcatDataFree(
 ptDbSaveData,count,out_result);free(out_result);out_result=NULL;count=
-zUfiSms_SplitString(pac->Seg_Seq,&out_result,cSegChar);for(i=(0x193+6363-0x1a6e)
-;i<count;i++){if(ptDbSaveData->concat_info[(0xcf1+5428-0x2223)]==i+
-(0x1a6b+687-0x1d19)){out_result[i]=(char*)malloc(SHORT_INT_LEN);memset(
-out_result[i],(0x7ca+4512-0x196a),SHORT_INT_LEN);snprintf(out_result[i],
-SHORT_INT_LEN,"\x25\x64",ptDbSaveData->concat_info[(0x1e67+2147-0x26c8)]);break;
-}}for(i=(0xfda+1877-0x172f);i<count;i++){snprintf(pac->FormatSeq+strlen(pac->
+zUfiSms_SplitString(pac->Seg_Seq,&out_result,cSegChar);for(i=(0xc85+3414-0x19db)
+;i<count;i++){if(ptDbSaveData->concat_info[(0xdf8+2398-0x1754)]==i+
+(0x6c5+7126-0x229a)){out_result[i]=(char*)malloc(SHORT_INT_LEN);memset(
+out_result[i],(0x11ec+2277-0x1ad1),SHORT_INT_LEN);snprintf(out_result[i],
+SHORT_INT_LEN,"\x25\x64",ptDbSaveData->concat_info[(0x3af+1251-0x890)]);break;}}
+for(i=(0xfcd+391-0x1154);i<count;i++){snprintf(pac->FormatSeq+strlen(pac->
 FormatSeq),sizeof(pac->FormatSeq)-strlen(pac->FormatSeq),"\x25\x73",out_result[i
-]);if(i!=count-(0x1062+1919-0x17e0)){snprintf(pac->FormatSeq+strlen(pac->
+]);if(i!=count-(0x5a8+6354-0x1e79)){snprintf(pac->FormatSeq+strlen(pac->
 FormatSeq),sizeof(pac->FormatSeq)-strlen(pac->FormatSeq),"\x3b");}if(
-(0xc67+5249-0x20e8)!=strcmp(out_result[i],"")){iTotalSegNum++;}}*pConcatTotalNum
-=iTotalSegNum;zUfiSms_ConcatDataFree(ptDbSaveData,count,out_result);free(
-out_result);out_result=NULL;return(0x17f7+953-0x1bb0);}int 
+(0x1840+3546-0x261a)!=strcmp(out_result[i],"")){iTotalSegNum++;}}*
+pConcatTotalNum=iTotalSegNum;zUfiSms_ConcatDataFree(ptDbSaveData,count,
+out_result);free(out_result);out_result=NULL;return(0xb40+5663-0x215f);}int 
 zUfiSms_UpdateConcatSms(T_zUfiSms_DbStoreData*ptDbSaveData,const char*pStorePos,
-long iSmsId){T_zUfiSms_DbStoreStr ac={(0xa6a+7281-0x26db)};char*pOldContent=NULL
-;char*pFormatNewContent=NULL;char*pRealNewContent=NULL;int iTotalNum=
-(0x49f+95-0x4fe);int result=ZUFI_SUCC;int spaceLen=(0x1bd2+1395-0x2141)*
-ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX*ZTE_WMS_CONCAT_SMS_COUNT_MAX+
-(0x13df+1940-0x1b6f);pOldContent=(char*)malloc(spaceLen);pFormatNewContent=(char
-*)malloc(spaceLen);pRealNewContent=(char*)malloc(spaceLen);if(pOldContent==NULL
-||pFormatNewContent==NULL||pRealNewContent==NULL){if(pOldContent)free(
-pOldContent);if(pFormatNewContent)free(pFormatNewContent);if(pRealNewContent)
-free(pRealNewContent);return ZUFI_FAIL;}memset(pRealNewContent,
-(0x520+2241-0xde1),spaceLen);memset(pOldContent,(0x470+3020-0x103c),spaceLen);
-memset(pFormatNewContent,(0x485+3768-0x133d),spaceLen);(void)
-zUfiSms_GetConcatInfo(pStorePos,iSmsId,&ac,pOldContent,spaceLen);printf(
+long iSmsId){T_zUfiSms_DbStoreStr ac={(0x1237+3202-0x1eb9)};char*pOldContent=
+NULL;char*pFormatNewContent=NULL;char*pRealNewContent=NULL;int iTotalNum=
+(0x798+5090-0x1b7a);int result=ZUFI_SUCC;int spaceLen=(0xc5b+1501-0x1234)*
+ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX*ZTE_WMS_CONCAT_SMS_COUNT_MAX+(0x989+801-0xca6);
+pOldContent=(char*)malloc(spaceLen);pFormatNewContent=(char*)malloc(spaceLen);
+pRealNewContent=(char*)malloc(spaceLen);if(pOldContent==NULL||pFormatNewContent
+==NULL||pRealNewContent==NULL){if(pOldContent)free(pOldContent);if(
+pFormatNewContent)free(pFormatNewContent);if(pRealNewContent)free(
+pRealNewContent);return ZUFI_FAIL;}memset(pRealNewContent,(0x1b1+6921-0x1cba),
+spaceLen);memset(pOldContent,(0x1603+2254-0x1ed1),spaceLen);memset(
+pFormatNewContent,(0x10a9+3390-0x1de7),spaceLen);(void)zUfiSms_GetConcatInfo(
+pStorePos,iSmsId,&ac,pOldContent,spaceLen);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x74\x65\x65\x74\x20\x2d\x30\x20\x49\x6e\x64\x53\x74\x72\x3a\x25\x73\x2c\x53\x65\x67\x5f\x53\x65\x71\x3a\x25\x73\x2c\x46\x6f\x72\x6d\x61\x74\x49\x6e\x64\x3a\x25\x73\x2c\x46\x6f\x72\x6d\x61\x74\x53\x65\x71\x3a\x25\x73" "\n"
-,ac.IndStr,ac.Seg_Seq,ac.FormatInd,ac.FormatSeq);if(-(0xcc3+6204-0x24fe)==
+,ac.IndStr,ac.Seg_Seq,ac.FormatInd,ac.FormatSeq);if(-(0x1033+2737-0x1ae3)==
 zUfiSms_AddNewSmsToConcatData(ptDbSaveData,pOldContent,pFormatNewContent,
 pRealNewContent,&ac,&iTotalNum,spaceLen)){result=ZUFI_FAIL;}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x74\x65\x65\x74\x20\x30\x20\x49\x6e\x64\x53\x74\x72\x3a\x25\x73\x2c\x53\x65\x67\x5f\x53\x65\x71\x3a\x25\x73\x2c\x46\x6f\x72\x6d\x61\x74\x49\x6e\x64\x3a\x25\x73\x2c\x46\x6f\x72\x6d\x61\x74\x53\x65\x71\x3a\x25\x73" "\n"
 ,ac.IndStr,ac.Seg_Seq,ac.FormatInd,ac.FormatSeq);ptDbSaveData->tp_dcs=
-(0x4fd+3958-0x1471);if(ZUFI_FAIL==zUfiSms_UpdateConcatSmsToDb(ptDbSaveData,
+(0x8f+3088-0xc9d);if(ZUFI_FAIL==zUfiSms_UpdateConcatSmsToDb(ptDbSaveData,
 pStorePos,pFormatNewContent,pRealNewContent,&ac,iTotalNum,iSmsId)){result=
 ZUFI_FAIL;}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x74\x65\x65\x74\x20\x31\x20\x49\x6e\x64\x53\x74\x72\x3a\x25\x73\x2c\x53\x65\x67\x5f\x53\x65\x71\x3a\x25\x73\x2c\x46\x6f\x72\x6d\x61\x74\x49\x6e\x64\x3a\x25\x73\x2c\x46\x6f\x72\x6d\x61\x74\x53\x65\x71\x3a\x25\x73" "\n"
@@ -530,33 +530,34 @@
 pFormatNewContent=NULL;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x55\x70\x64\x61\x74\x65\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x20\x73\x75\x63\x63\x65\x73\x73\x2e" "\n"
 );return result;}int zUfiSms_InsertConcatSms(T_zUfiSms_DbStoreData*ptDbSaveData,
-const char*pStorePos){T_zUfiSms_DbStoreStr ac={(0xf0a+5380-0x240e)};int 
-iSms_TotalCount=(0x83a+4939-0x1b85);int i=(0x122b+4292-0x22ef);char acTmpContent
-[(0x318+5123-0x161b)];int iConcatNum=(0x1305+884-0x1679);char*pFormatConcat=NULL
-;char*pContent=NULL;int spaceLen=(0x1013+4695-0x2266)*
-ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX*ZTE_WMS_CONCAT_SMS_COUNT_MAX+(0x111+8153-0x20e6)
-;if(NULL==ptDbSaveData||NULL==pStorePos){return ZUFI_FAIL;}printf(
+const char*pStorePos){T_zUfiSms_DbStoreStr ac={(0x4b7+6780-0x1f33)};int 
+iSms_TotalCount=(0xeea+3546-0x1cc4);int i=(0x2260+604-0x24bc);char acTmpContent[
+(0x56f+8148-0x2443)];int iConcatNum=(0xf49+1233-0x141a);char*pFormatConcat=NULL;
+char*pContent=NULL;int spaceLen=(0x440+5954-0x1b7e)*
+ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX*ZTE_WMS_CONCAT_SMS_COUNT_MAX+
+(0x11a9+3044-0x1d89);if(NULL==ptDbSaveData||NULL==pStorePos){return ZUFI_FAIL;}
+printf(
 "\x5b\x53\x4d\x53\x5d\x20\x65\x6e\x74\x65\x72\x20\x49\x6e\x73\x65\x72\x74\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x2e" "\n"
-);memset(acTmpContent,(0x1810+294-0x1936),sizeof(acTmpContent));iSms_TotalCount=
-ptDbSaveData->concat_info[(0x2395+352-0x24f4)];for(i=(0xaba+3332-0x17bd);i<
+);memset(acTmpContent,(0xac+1188-0x550),sizeof(acTmpContent));iSms_TotalCount=
+ptDbSaveData->concat_info[(0xfe9+2363-0x1923)];for(i=(0x64c+5104-0x1a3b);i<
 iSms_TotalCount;i++){strcat(ac.IndStr,"\x3b");strcat(ac.Seg_Seq,"\x3b");strcat(
 acTmpContent,"\x3b");}pFormatConcat=(char*)malloc(spaceLen);if(NULL==
-pFormatConcat){return ZUFI_FAIL;}memset(pFormatConcat,(0x1d6c+1908-0x24e0),
+pFormatConcat){return ZUFI_FAIL;}memset(pFormatConcat,(0xf44+2856-0x1a6c),
 spaceLen);pContent=(char*)malloc(spaceLen);if(pContent==NULL){free(pFormatConcat
-);return ZUFI_FAIL;}memset(pContent,(0x147+474-0x321),spaceLen);if(-
-(0x705+469-0x8d9)==zUfiSms_AddNewSmsToConcatData(ptDbSaveData,acTmpContent,
+);return ZUFI_FAIL;}memset(pContent,(0x142c+3700-0x22a0),spaceLen);if(-
+(0x909+3613-0x1725)==zUfiSms_AddNewSmsToConcatData(ptDbSaveData,acTmpContent,
 pFormatConcat,pContent,&ac,&iConcatNum,spaceLen)){free(pFormatConcat);free(
 pContent);pFormatConcat=NULL;pContent=NULL;return ZUFI_FAIL;}ptDbSaveData->
-tp_dcs=(0x70a+7933-0x2605);if(ZUFI_FAIL==zUfiSms_InsertConcatSmsToDb(
+tp_dcs=(0xb51+3375-0x187e);if(ZUFI_FAIL==zUfiSms_InsertConcatSmsToDb(
 ptDbSaveData,pStorePos,pFormatConcat,pContent,&ac,iConcatNum)){free(
 pFormatConcat);free(pContent);pFormatConcat=NULL;pContent=NULL;return ZUFI_FAIL;
 }free(pFormatConcat);free(pContent);pFormatConcat=NULL;pContent=NULL;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x49\x6e\x73\x65\x72\x74\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x20\x73\x75\x63\x63\x65\x73\x73\x2e" "\n"
 );return ZUFI_SUCC;}int zUfiSms_StoreConcatSmsToDb(T_zUfiSms_DbStoreData*
-ptDbSaveData,char*pMemStore){long iSmsId=(0x1a1b+2012-0x21f7);int total_count=
-(0x235a+842-0x26a4);if(NULL==ptDbSaveData||NULL==pMemStore){return ZUFI_FAIL;}
+ptDbSaveData,char*pMemStore){long iSmsId=(0x290+2928-0xe00);int total_count=
+(0x362+634-0x5dc);if(NULL==ptDbSaveData||NULL==pMemStore){return ZUFI_FAIL;}
 iSmsId=zUfiSms_SearchConcatSmsInDb(ptDbSaveData,pMemStore);if(-
-(0x465+7144-0x204c)!=iSmsId){printf(
+(0x9e7+1942-0x117c)!=iSmsId){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x74\x6f\x72\x65\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x54\x6f\x44\x62\x20\x45\x6e\x74\x65\x72\x20\x55\x70\x64\x61\x74\x65\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x20\x53\x6d\x73\x49\x64\x3a\x25\x64\x2e" "\n"
 ,iSmsId);return zUfiSms_UpdateConcatSms(ptDbSaveData,pMemStore,iSmsId);}else{if(
 ZUFI_FAIL==zUfiSms_GetTotalCount(pMemStore,&total_count)){printf(
@@ -568,102 +569,103 @@
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x74\x6f\x72\x65\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x54\x6f\x44\x62\x20\x53\x6d\x73\x20\x6d\x65\x6d\x6f\x72\x79\x20\x69\x73\x20\x46\x75\x6c\x6c\x2e" "\n"
 );return ZUFI_FAIL;}return zUfiSms_InsertConcatSms(ptDbSaveData,pMemStore);}}int
  zUfiSms_WriteSmsToDb(T_zUfiSms_DbStoreData*ptDbSaveData,zUfiSms_StoreType 
-iMemStore,long iSmsId){char acDbMemStore[(0x2282+529-0x2489)];int iTotalCount=
-(0x196+2294-0xa8c);int id=(0x2346+244-0x243a);UINT8 needCheckMemory=
-(0xc92+6456-0x25c9);if(NULL==ptDbSaveData){return ZUFI_FAIL;}memset(acDbMemStore
-,(0x7fb+5266-0x1c8d),sizeof(acDbMemStore));if(WMS_STORAGE_TYPE_UIM_V01==
+iMemStore,long iSmsId){char acDbMemStore[(0x441+8647-0x25fe)];int iTotalCount=
+(0x821+3339-0x152c);int id=(0x45+7633-0x1e16);UINT8 needCheckMemory=
+(0xa6d+2213-0x1311);if(NULL==ptDbSaveData){return ZUFI_FAIL;}memset(acDbMemStore
+,(0x184c+2526-0x222a),sizeof(acDbMemStore));if(WMS_STORAGE_TYPE_UIM_V01==
 iMemStore){strncpy(acDbMemStore,ZTE_WMS_DB_SIM_TABLE,sizeof(acDbMemStore)-
-(0x7a6+1631-0xe04));}else{strncpy(acDbMemStore,ZTE_WMS_DB_NV_TABLE,sizeof(
-acDbMemStore)-(0x4f4+8555-0x265e));}if((0x119+8810-0x2382)==ptDbSaveData->
+(0x1424+2702-0x1eb1));}else{strncpy(acDbMemStore,ZTE_WMS_DB_NV_TABLE,sizeof(
+acDbMemStore)-(0xcd2+1363-0x1224));}if((0xdba+262-0xebf)==ptDbSaveData->
 concat_sms){id=zUfiSms_SearchConcatSmsInDb(ptDbSaveData,&acDbMemStore);if(-
-(0x3e7+6486-0x1d3c)!=id){needCheckMemory=(0x10a6+5509-0x262b);}}if(
-needCheckMemory==(0x997+1487-0xf65)){if(ZUFI_FAIL==zUfiSms_GetTotalCount(
+(0x16ad+339-0x17ff)!=id){needCheckMemory=(0x1147+1688-0x17df);}}if(
+needCheckMemory==(0x1f2+6770-0x1c63)){if(ZUFI_FAIL==zUfiSms_GetTotalCount(
 acDbMemStore,&iTotalCount)){return ZUFI_FAIL;}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x53\x6d\x73\x54\x6f\x44\x62\x20\x69\x54\x6f\x74\x61\x6c\x43\x6f\x75\x6e\x74\x3d\x25\x64\x28\x6e\x65\x65\x64\x43\x68\x65\x63\x6b\x4d\x65\x6d\x6f\x72\x79\x3d\x3d\x31\x29" "\n"
 ,iTotalCount);if(iTotalCount>=g_zUfiSms_StoreCapablity[(strcmp(acDbMemStore,
 "\x6e\x76")?ZTE_WMS_MEMORY_SIM:ZTE_WMS_MEMORY_NV)]){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x53\x6d\x73\x54\x6f\x44\x62\x20\x6d\x65\x6d\x6f\x72\x79\x20\x66\x75\x6c\x6c\x2c\x20\x65\x72\x72\x6f\x72" "\n"
-);return ZTE_WMS_NV_MEMORY_FULL;}}if(ptDbSaveData->concat_info[(0xb2+2481-0xa61)
-]==(0x170f+3184-0x237f)||ptDbSaveData->concat_info[(0x7f8+7100-0x23b2)]>
-ptDbSaveData->concat_info[(0xb02+3228-0x179d)]){ptDbSaveData->concat_sms=
-(0x122a+3909-0x216f);}printf(
+);return ZTE_WMS_NV_MEMORY_FULL;}}if(ptDbSaveData->concat_info[(0x785+190-0x841)
+]==(0x7eb+643-0xa6e)||ptDbSaveData->concat_info[(0x9b2+5994-0x211a)]>
+ptDbSaveData->concat_info[(0x3a0+6061-0x1b4c)]){ptDbSaveData->concat_sms=
+(0xb2+7287-0x1d29);}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x53\x6d\x73\x54\x6f\x44\x62\x20\x54\x6f\x74\x61\x6c\x43\x6f\x75\x6e\x74\x3a\x25\x64\x2e\x63\x6f\x6e\x63\x61\x74\x5f\x73\x6d\x73\x3a\x25\x64\x2e\x63\x6f\x6e\x63\x61\x74\x5f\x69\x6e\x66\x6f\x5b\x31\x5d\x3a\x25\x64" "\n"
 ,iTotalCount,ptDbSaveData->concat_sms,ptDbSaveData->concat_info[
-(0x878+1736-0xf3f)]);if((0x510+968-0x8d7)==ptDbSaveData->concat_sms){if(
-ZTE_WMS_CONCAT_SMS_COUNT_MAX<ptDbSaveData->concat_info[(0x677+4907-0x19a1)]){
+(0x21f+7968-0x213e)]);if((0x21a5+732-0x2480)==ptDbSaveData->concat_sms){if(
+ZTE_WMS_CONCAT_SMS_COUNT_MAX<ptDbSaveData->concat_info[(0x528+6144-0x1d27)]){
 return ZUFI_FAIL;}else{return zUfiSms_StoreConcatSmsToDb(ptDbSaveData,
 acDbMemStore);}}else{return zUfiSms_StoreNormalSmsToDb(ptDbSaveData,acDbMemStore
 ,iSmsId);}}T_zUfiSms_CmdStatus zUfiSms_SendOutSms(T_zUfiSms_DbStoreData*
-ptDbSaveData,int cid){int atRes=(0x15d0+2736-0x2080);if(NULL==ptDbSaveData){
-return WMS_CMD_FAILED;}if(!g_zUfiSms_IsConcatSendSuc){ptDbSaveData->tag=
+ptDbSaveData,int cid){int atRes=(0x1f28+69-0x1f6d);if(NULL==ptDbSaveData){return
+ WMS_CMD_FAILED;}if(!g_zUfiSms_IsConcatSendSuc){ptDbSaveData->tag=
 WMS_TAG_TYPE_MO_NOT_SENT_V01;if(ZUFI_SUCC==zUfiSms_WriteSmsToDb(ptDbSaveData,
-WMS_STORAGE_TYPE_NV_V01,-(0xf07+4102-0x1f0c))){g_zUfiSms_MsgRefer++;ptDbSaveData
-->msg_ref=g_zUfiSms_MsgRefer;(void)zUfiSms_SetMaxReference(g_zUfiSms_MsgRefer);}
-}else{CHAR sendfailRetry[(0x642+7072-0x21b0)]={(0x1088+2047-0x1887)};sc_cfg_get(
-NV_SENDFAIL_RETRY,sendfailRetry,sizeof(sendfailRetry));if((0x2af+3301-0xf94)==
-strcmp("\x31",sendfailRetry)){g_zUfiSms_SendFailedRetry=(0x879+7738-0x26b0);}
-atRes=zSms_SendCmgsReq();if(atRes!=ZSMS_RESULT_OK){zSms_RecvCmgsErr();}else{
-zSms_RecvCmgsOk();}}return WMS_CMD_SUCCESS;}int zUfiSms_SendConcatSms(int cid){
-int atRes=(0x6b4+7995-0x25ef);T_zUfiSms_ClientMsg tClientMsg;
-T_zUfiSms_DbStoreData tDbSaveData;int result=ZUFI_FAIL;if(g_zUfiSms_ConcatSms.
-current_sending>=g_zUfiSms_ConcatSms.total_msg){return ZUFI_FAIL;}memset((void*)
-&tClientMsg,(0x1cb3+1626-0x230d),sizeof(T_zUfiSms_ClientMsg));memset((void*)&
-tDbSaveData,(0x163a+1958-0x1de0),sizeof(tDbSaveData));zUfiSms_SetPduData(&
-tClientMsg,&tDbSaveData);if(!g_zUfiSms_IsConcatSendSuc){tDbSaveData.tag=
+WMS_STORAGE_TYPE_NV_V01,-(0x1fb7+1358-0x2504))){g_zUfiSms_MsgRefer++;
+ptDbSaveData->msg_ref=g_zUfiSms_MsgRefer;(void)zUfiSms_SetMaxReference(
+g_zUfiSms_MsgRefer);}}else{CHAR sendfailRetry[(0x2153+1415-0x26a8)]={
+(0x71+3513-0xe2a)};sc_cfg_get(NV_SENDFAIL_RETRY,sendfailRetry,sizeof(
+sendfailRetry));if((0xd7d+5496-0x22f5)==strcmp("\x31",sendfailRetry)){
+g_zUfiSms_SendFailedRetry=(0x168c+1261-0x1b76);}atRes=zSms_SendCmgsReq();if(
+atRes!=ZSMS_RESULT_OK){zSms_RecvCmgsErr();}else{zSms_RecvCmgsOk();}}return 
+WMS_CMD_SUCCESS;}int zUfiSms_SendConcatSms(int cid){int atRes=
+(0x1aa+4650-0x13d4);T_zUfiSms_ClientMsg tClientMsg;T_zUfiSms_DbStoreData 
+tDbSaveData;int result=ZUFI_FAIL;if(g_zUfiSms_ConcatSms.current_sending>=
+g_zUfiSms_ConcatSms.total_msg){return ZUFI_FAIL;}memset((void*)&tClientMsg,
+(0xd87+4610-0x1f89),sizeof(T_zUfiSms_ClientMsg));memset((void*)&tDbSaveData,
+(0x26+5196-0x1472),sizeof(tDbSaveData));zUfiSms_SetPduData(&tClientMsg,&
+tDbSaveData);if(!g_zUfiSms_IsConcatSendSuc){tDbSaveData.tag=
 WMS_TAG_TYPE_MO_NOT_SENT_V01;(void)zUfiSms_WriteSmsToDb(&tDbSaveData,
-WMS_STORAGE_TYPE_NV_V01,-(0x475+3222-0x110a));g_zUfiSms_SendFailedCount++;}else{
-CHAR sendfailRetry[(0x23f+2519-0xbe4)]={(0x111a+321-0x125b)};sc_cfg_get(
-NV_SENDFAIL_RETRY,sendfailRetry,sizeof(sendfailRetry));if((0x560+5426-0x1a92)==
-strcmp("\x31",sendfailRetry)){g_zUfiSms_SendFailedRetry=(0x938+5237-0x1daa);}
+WMS_STORAGE_TYPE_NV_V01,-(0x1c8b+1379-0x21ed));g_zUfiSms_SendFailedCount++;}else
+{CHAR sendfailRetry[(0x86b+3994-0x17d3)]={(0x1032+5616-0x2622)};sc_cfg_get(
+NV_SENDFAIL_RETRY,sendfailRetry,sizeof(sendfailRetry));if((0xa3a+1161-0xec3)==
+strcmp("\x31",sendfailRetry)){g_zUfiSms_SendFailedRetry=(0x1319+3617-0x2137);}
 atRes=zSms_SendCmgsReq();if(atRes!=ZSMS_RESULT_OK){zSms_RecvCmgsErr();}else{
 zSms_RecvCmgsOk();}}g_zUfiSms_ConcatSms.current_sending++;if(g_zUfiSms_ConcatSms
 .current_sending<g_zUfiSms_ConcatSms.total_msg){if(g_zUfiSms_ConcatSms.sms_len<
-g_zUfiSms_UnitLen*(g_zUfiSms_ConcatSms.current_sending+(0x191+3777-0x1051))){
+g_zUfiSms_UnitLen*(g_zUfiSms_ConcatSms.current_sending+(0x1be6+2163-0x2458))){
 g_zUfiSms_UnitLen=g_zUfiSms_ConcatSms.sms_len-g_zUfiSms_UnitLen*
 g_zUfiSms_ConcatSms.current_sending;}}if(g_zUfiSms_ConcatSms.current_sending==
 g_zUfiSms_ConcatSms.total_msg&&!g_zUfiSms_IsConcatSendSuc){T_zUfiSms_StatusInfo 
-tSendStatus;memset((void*)&tSendStatus,(0x6c8+6493-0x2025),sizeof(
+tSendStatus;memset((void*)&tSendStatus,(0x19af+2270-0x228d),sizeof(
 T_zUfiSms_StatusInfo));tSendStatus.err_code=ZTE_SMS_CMS_NONE;tSendStatus.
 send_failed_count=g_zUfiSms_SendFailedCount;tSendStatus.delete_failed_count=
-(0xa8d+4750-0x1d1b);tSendStatus.cmd_status=WMS_CMD_FAILED;tSendStatus.cmd=
+(0x4e4+1838-0xc12);tSendStatus.cmd_status=WMS_CMD_FAILED;tSendStatus.cmd=
 WMS_SMS_CMD_MSG_SEND;(void)zUfiSms_SetCmdStatus(&tSendStatus);sc_cfg_set(
 NV_SMS_SEND_RESULT,"\x66\x61\x69\x6c");sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");
 return ZUFI_FAIL;}if(!g_zUfiSms_IsConcatSendSuc){zUfiSms_SendConcatSms(cid);}
-return result;}int zSvr_sendCmgs(VOID){int atRes=(0x2053+943-0x2402);int i=
-(0x111f+386-0x12a1);atRes=zSms_SendCmgsReq();if(atRes!=ZSMS_RESULT_OK){CHAR 
-sendfailRetry[(0x1afa+267-0x1bd3)]={(0x8cc+5205-0x1d21)};sc_cfg_get(
-NV_SENDFAIL_RETRY,sendfailRetry,sizeof(sendfailRetry));if((0xd30+3148-0x197c)==
-strcmp("\x31",sendfailRetry)){for(i=(0x283+6502-0x1be9);i<SMS_RETRY_COUNT;i++){
+return result;}int zSvr_sendCmgs(VOID){int atRes=(0x414+996-0x7f8);int i=
+(0x100+8650-0x22ca);atRes=zSms_SendCmgsReq();if(atRes!=ZSMS_RESULT_OK){CHAR 
+sendfailRetry[(0x356+4285-0x13e1)]={(0x104a+290-0x116c)};sc_cfg_get(
+NV_SENDFAIL_RETRY,sendfailRetry,sizeof(sendfailRetry));if((0x193+3334-0xe99)==
+strcmp("\x31",sendfailRetry)){for(i=(0x2d1+2051-0xad4);i<SMS_RETRY_COUNT;i++){
 atRes=zSms_SendCmgsReq();if(atRes==ZSMS_RESULT_OK){break;}}}}return atRes;}
 T_zUfiSms_CmdStatus zUfiSms_SendSms(VOID){T_zUfiSms_ClientMsg tClientMsg;
-T_zUfiSms_DbStoreData tDbSaveData;int res=(0xfe3+5070-0x23b1);if(-
-(0x1428+3767-0x22de)==g_zUfiSms_UnitLen){printf(
+T_zUfiSms_DbStoreData tDbSaveData;int res=(0x494+1604-0xad8);if(-
+(0x56d+1083-0x9a7)==g_zUfiSms_UnitLen){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x21\x21\x21\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x53\x6d\x73\x3a\x20\x4e\x6f\x20\x63\x6f\x6e\x74\x65\x6e\x74\x21\x2e" "\n"
 );return WMS_CMD_FAILED;}while(g_zUfiSms_ConcatSms.current_sending<
-g_zUfiSms_ConcatSms.total_msg){memset((void*)&tClientMsg,(0xb9a+855-0xef1),
-sizeof(T_zUfiSms_ClientMsg));memset((void*)&tDbSaveData,(0x3b2+6393-0x1cab),
+g_zUfiSms_ConcatSms.total_msg){memset((void*)&tClientMsg,(0xc03+4933-0x1f48),
+sizeof(T_zUfiSms_ClientMsg));memset((void*)&tDbSaveData,(0x75a+4621-0x1967),
 sizeof(tDbSaveData));zUfiSms_SetPduData(&tClientMsg,&tDbSaveData);if(!
 g_zUfiSms_IsConcatSendSuc){tDbSaveData.tag=WMS_TAG_TYPE_MO_NOT_SENT_V01;(void)
-zUfiSms_WriteSmsToDb(&tDbSaveData,WMS_STORAGE_TYPE_NV_V01,-(0xe91+1598-0x14ce));
+zUfiSms_WriteSmsToDb(&tDbSaveData,WMS_STORAGE_TYPE_NV_V01,-(0x5b6+7972-0x24d9));
 g_zUfiSms_SendFailedCount++;}else{res=zSvr_sendCmgs();if(res!=ZSMS_RESULT_OK){
 zSms_RecvCmgsErr();}else{zSms_RecvCmgsOk();}}g_zUfiSms_ConcatSms.current_sending
 ++;if(g_zUfiSms_ConcatSms.current_sending<g_zUfiSms_ConcatSms.total_msg){if(
 g_zUfiSms_ConcatSms.sms_len<g_zUfiSms_UnitLen*(g_zUfiSms_ConcatSms.
-current_sending+(0x9a6+6174-0x21c3))){g_zUfiSms_UnitLen=g_zUfiSms_ConcatSms.
+current_sending+(0xa37+6783-0x24b5))){g_zUfiSms_UnitLen=g_zUfiSms_ConcatSms.
 sms_len-g_zUfiSms_UnitLen*g_zUfiSms_ConcatSms.current_sending;}}if(
 g_zUfiSms_ConcatSms.current_sending==g_zUfiSms_ConcatSms.total_msg&&!
 g_zUfiSms_IsConcatSendSuc){T_zUfiSms_StatusInfo tSendStatus;memset((void*)&
-tSendStatus,(0x1e44+967-0x220b),sizeof(T_zUfiSms_StatusInfo));tSendStatus.
+tSendStatus,(0x747+3381-0x147c),sizeof(T_zUfiSms_StatusInfo));tSendStatus.
 err_code=ZTE_SMS_CMS_NONE;tSendStatus.send_failed_count=
-g_zUfiSms_SendFailedCount;tSendStatus.delete_failed_count=(0x766+5141-0x1b7b);
+g_zUfiSms_SendFailedCount;tSendStatus.delete_failed_count=(0x437+3937-0x1398);
 tSendStatus.cmd_status=WMS_CMD_FAILED;tSendStatus.cmd=WMS_SMS_CMD_MSG_SEND;(void
 )zUfiSms_SetCmdStatus(&tSendStatus);sc_cfg_set(NV_SMS_SEND_RESULT,
 "\x66\x61\x69\x6c");sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");}}
-#if (0x419+8704-0x2619)	

-if(g_zUfiSms_ConcatSms.total_msg>(0x974+5410-0x1e95)){printf(
+#if (0x5cc+2999-0x1183)	

+if(g_zUfiSms_ConcatSms.total_msg>(0xa9c+4694-0x1cf1)){printf(
 "\x3d\x3d\x3d\x3d\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x2e" "\n"
-);zUfiSms_SendConcatSms(cid);}else{memset((void*)&tClientMsg,(0x869+1626-0xec3),
-sizeof(T_zUfiSms_ClientMsg));memset((void*)&tDbSaveData,(0xb53+4328-0x1c3b),
+);zUfiSms_SendConcatSms(cid);}else{memset((void*)&tClientMsg,(0x158+2576-0xb68),
+sizeof(T_zUfiSms_ClientMsg));memset((void*)&tDbSaveData,(0x12e0+3529-0x20a9),
 sizeof(tDbSaveData));zUfiSms_SetPduData(&tClientMsg,&tDbSaveData);printf(
 "\x3d\x3d\x3d\x3d\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x6e\x6f\x72\x61\x6d\x6c\x53\x6d\x73\x2e" "\n"
 );if(WMS_CMD_FAILED==zUfiSms_SendOutSms(&tDbSaveData,cid)){printf(
@@ -671,78 +673,78 @@
 );g_zUfiSms_SendFailedCount++;return WMS_CMD_FAILED;}}
 #endif

 return WMS_CMD_SUCCESS;}int zUfiSms_FormatDeliverTimestamp(T_zUfiSms_Date tData,
-T_zUfiSms_TimeStamp*ptTimestamp){unsigned char tTimeZone[(0x970+4626-0x1b7d)]={
-(0x150f+223-0x15ee)};int tmp_i=(0x1746+840-0x1a8e);memset(ptTimestamp,
-(0x2cb+2285-0xbb8),sizeof(T_zUfiSms_TimeStamp));if(strlen(tData.year)==
-(0xa62+4-0xa65)){ptTimestamp->year=zUfiSms_atohex(((char)(0x760+5672-0x1d58)))*
-(0xe9c+4403-0x1fbf)+zUfiSms_atohex(tData.year[(0xe76+2415-0x17e5)]);}else if(
-strlen(tData.year)==(0x1fa9+1856-0x26e7)){ptTimestamp->year=zUfiSms_atohex(tData
-.year[(0x4f2+738-0x7d4)])*(0x539+2183-0xdb0)+zUfiSms_atohex(tData.year[
-(0xfd0+2511-0x199e)]);}else if(strlen(tData.year)==(0x131f+2500-0x1cdf)){
-ptTimestamp->year=zUfiSms_atohex(tData.year[(0x820+878-0xb8c)])*
-(0x92a+2418-0x128c)+zUfiSms_atohex(tData.year[(0x456+1422-0x9e1)]);}else{printf(
-"\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x79\x65\x61\x72\x2e");return ZUFI_FAIL;}if(
-strlen(tData.month)==(0x20b5+701-0x2371)){ptTimestamp->month=zUfiSms_atohex(
-((char)(0x11d3+5042-0x2555)))*(0x2e0+2285-0xbbd)+zUfiSms_atohex(tData.month[
-(0xe56+1440-0x13f6)]);}else if(strlen(tData.month)==(0x310+8913-0x25df)){
-ptTimestamp->month=zUfiSms_atohex(tData.month[(0x64f+1657-0xcc8)])*
-(0x1990+3282-0x2652)+zUfiSms_atohex(tData.month[(0x21ca+556-0x23f5)]);}else{
+T_zUfiSms_TimeStamp*ptTimestamp){unsigned char tTimeZone[(0xa50+5949-0x2188)]={
+(0xcf5+1960-0x149d)};int tmp_i=(0x68c+7987-0x25bf);memset(ptTimestamp,
+(0x1122+5221-0x2587),sizeof(T_zUfiSms_TimeStamp));if(strlen(tData.year)==
+(0x1072+2959-0x1c00)){ptTimestamp->year=zUfiSms_atohex(((char)(0xc1+2822-0xb97))
+)*(0xefd+2110-0x172b)+zUfiSms_atohex(tData.year[(0xaf3+6548-0x2487)]);}else if(
+strlen(tData.year)==(0xf35+3092-0x1b47)){ptTimestamp->year=zUfiSms_atohex(tData.
+year[(0x1d4+5049-0x158d)])*(0x204a+825-0x2373)+zUfiSms_atohex(tData.year[
+(0x184d+2175-0x20cb)]);}else if(strlen(tData.year)==(0x118c+2435-0x1b0b)){
+ptTimestamp->year=zUfiSms_atohex(tData.year[(0x191f+2825-0x2426)])*
+(0x1c15+860-0x1f61)+zUfiSms_atohex(tData.year[(0x246+4025-0x11fc)]);}else{printf
+("\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x79\x65\x61\x72\x2e");return ZUFI_FAIL;}if(
+strlen(tData.month)==(0xf4+3371-0xe1e)){ptTimestamp->month=zUfiSms_atohex(
+((char)(0x91f+498-0xae1)))*(0x492+7828-0x2316)+zUfiSms_atohex(tData.month[
+(0x2269+790-0x257f)]);}else if(strlen(tData.month)==(0x1ed0+1031-0x22d5)){
+ptTimestamp->month=zUfiSms_atohex(tData.month[(0x186a+2700-0x22f6)])*
+(0x797+4798-0x1a45)+zUfiSms_atohex(tData.month[(0x19b1+2748-0x246c)]);}else{
 printf("\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x64\x61\x79\x2e");}if(strlen(tData.day)
-==(0x1bd9+77-0x1c25)){ptTimestamp->day=zUfiSms_atohex(
-((char)(0x194c+121-0x1995)))*(0x88+474-0x252)+zUfiSms_atohex(tData.day[
-(0x1452+63-0x1491)]);}else if(strlen(tData.day)==(0x1726+2027-0x1f0f)){
-ptTimestamp->day=zUfiSms_atohex(tData.day[(0x68b+7020-0x21f7)])*
-(0x182c+1908-0x1f90)+zUfiSms_atohex(tData.day[(0x1500+1807-0x1c0e)]);}else{
-printf("\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x64\x61\x79\x2e");}if(strlen(tData.hour
-)==(0x385+5275-0x181f)){ptTimestamp->hour=zUfiSms_atohex(
-((char)(0xfb4+691-0x1237)))*(0x4c4+6871-0x1f8b)+zUfiSms_atohex(tData.hour[
-(0xd3f+4082-0x1d31)]);}else if(strlen(tData.hour)==(0x5a5+6819-0x2046)){
-ptTimestamp->hour=zUfiSms_atohex(tData.hour[(0x607+2554-0x1001)])*
-(0x1bb9+935-0x1f50)+zUfiSms_atohex(tData.hour[(0x1cd0+1830-0x23f5)]);}else{
-printf("\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x68\x6f\x75\x72\x2e");}if(strlen(tData.
-min)==(0xadc+5138-0x1eed)){ptTimestamp->minute=zUfiSms_atohex(
-((char)(0x3d0+7104-0x1f60)))*(0x1d02+2155-0x255d)+zUfiSms_atohex(tData.min[
-(0x165c+2461-0x1ff9)]);}else if(strlen(tData.min)==(0x22b+5531-0x17c4)){
-ptTimestamp->minute=zUfiSms_atohex(tData.min[(0x151d+2292-0x1e11)])*
-(0xb70+3931-0x1abb)+zUfiSms_atohex(tData.min[(0x17dc+3788-0x26a7)]);}else{printf
-("\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x6d\x69\x6e\x75\x74\x65\x2e");}if(strlen(
-tData.sec)==(0xa74+6117-0x2258)){ptTimestamp->second=zUfiSms_atohex(
-((char)(0xf5b+2751-0x19ea)))*(0x1339+3875-0x224c)+zUfiSms_atohex(tData.sec[
-(0xcf5+1799-0x13fc)]);}else if(strlen(tData.sec)==(0x5c7+1932-0xd51)){
-ptTimestamp->second=zUfiSms_atohex(tData.sec[(0xcab+5712-0x22fb)])*
-(0x114+2879-0xc43)+zUfiSms_atohex(tData.sec[(0x1b46+756-0x1e39)]);}else{printf(
-"\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x73\x65\x63\x6f\x6e\x64\x2e");}tmp_i=atoi(
-tData.timezone);if(tmp_i<INT_MIN+(0x14b2+3217-0x2142)||tmp_i>INT_MAX-
-(0x1100+4334-0x21ed)){printf(
+==(0x1bff+2593-0x261f)){ptTimestamp->day=zUfiSms_atohex(
+((char)(0xa20+391-0xb77)))*(0xd02+1887-0x1451)+zUfiSms_atohex(tData.day[
+(0x55c+3368-0x1284)]);}else if(strlen(tData.day)==(0x7c6+5443-0x1d07)){
+ptTimestamp->day=zUfiSms_atohex(tData.day[(0xe86+808-0x11ae)])*
+(0x21c+3809-0x10ed)+zUfiSms_atohex(tData.day[(0xbd5+2470-0x157a)]);}else{printf(
+"\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x64\x61\x79\x2e");}if(strlen(tData.hour)==
+(0x16bc+790-0x19d1)){ptTimestamp->hour=zUfiSms_atohex(((char)(0x41c+818-0x71e)))
+*(0x1310+3611-0x211b)+zUfiSms_atohex(tData.hour[(0x2368+883-0x26db)]);}else if(
+strlen(tData.hour)==(0x147+7377-0x1e16)){ptTimestamp->hour=zUfiSms_atohex(tData.
+hour[(0x1337+4135-0x235e)])*(0x4c4+4044-0x1480)+zUfiSms_atohex(tData.hour[
+(0x859+7386-0x2532)]);}else{printf(
+"\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x68\x6f\x75\x72\x2e");}if(strlen(tData.min)==
+(0x4+8473-0x211c)){ptTimestamp->minute=zUfiSms_atohex(
+((char)(0x149f+1109-0x18c4)))*(0x15f+892-0x4cb)+zUfiSms_atohex(tData.min[
+(0xa13+2578-0x1425)]);}else if(strlen(tData.min)==(0x1583+3888-0x24b1)){
+ptTimestamp->minute=zUfiSms_atohex(tData.min[(0x1316+174-0x13c4)])*
+(0x930+2087-0x1147)+zUfiSms_atohex(tData.min[(0xfb3+3058-0x1ba4)]);}else{printf(
+"\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x6d\x69\x6e\x75\x74\x65\x2e");}if(strlen(tData
+.sec)==(0x193b+281-0x1a53)){ptTimestamp->second=zUfiSms_atohex(
+((char)(0x129c+1728-0x192c)))*(0xc1f+1047-0x1026)+zUfiSms_atohex(tData.sec[
+(0x2f8+3396-0x103c)]);}else if(strlen(tData.sec)==(0x5ac+5741-0x1c17)){
+ptTimestamp->second=zUfiSms_atohex(tData.sec[(0x66c+4904-0x1994)])*
+(0x11b5+2688-0x1c25)+zUfiSms_atohex(tData.sec[(0xd1c+4447-0x1e7a)]);}else{printf
+("\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x73\x65\x63\x6f\x6e\x64\x2e");}tmp_i=atoi(
+tData.timezone);if(tmp_i<INT_MIN+(0xcd+4530-0x127e)||tmp_i>INT_MAX-
+(0x488+2912-0xfe7)){printf(
 "\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x74\x44\x61\x74\x61\x20\x74\x69\x6d\x65\x7a\x6f\x6e\x65\x3a\x25\x64\x2e" "\n"
-,tmp_i);return ZUFI_FAIL;}memset(tTimeZone,(0xd6a+2409-0x16d3),sizeof(tTimeZone)
-);snprintf(tTimeZone,sizeof(tTimeZone),"\x25\x64",tmp_i*(0x16d1+3237-0x2372));if
-(tData.timezone[(0xefd+281-0x1016)]==((char)(0xcdd+3069-0x18ad))){if(strlen(
-tTimeZone)==(0x385+507-0x57e)){ptTimestamp->timezone=zUfiSms_atohex(
-((char)(0x17d+3048-0xd35)))*(0x4b6+4074-0x1490)+zUfiSms_atohex(tTimeZone[
-(0x1c78+1922-0x23f9)]);}else if(strlen(tTimeZone)==(0x93+1923-0x813)){
-ptTimestamp->timezone=zUfiSms_atohex(tTimeZone[(0x2315+664-0x25ac)])*
-(0x1c69+690-0x1f11)+zUfiSms_atohex(tTimeZone[(0x496+2411-0xdff)]);}else{printf(
+,tmp_i);return ZUFI_FAIL;}memset(tTimeZone,(0x2e3+984-0x6bb),sizeof(tTimeZone));
+snprintf(tTimeZone,sizeof(tTimeZone),"\x25\x64",tmp_i*(0x60b+257-0x708));if(
+tData.timezone[(0x1dc8+1357-0x2315)]==((char)(0x181+6474-0x1a9e))){if(strlen(
+tTimeZone)==(0x1902+3572-0x26f4)){ptTimestamp->timezone=zUfiSms_atohex(
+((char)(0x1ff+1115-0x62a)))*(0x659+4394-0x1773)+zUfiSms_atohex(tTimeZone[
+(0xb20+566-0xd55)]);}else if(strlen(tTimeZone)==(0xae0+1219-0xfa0)){ptTimestamp
+->timezone=zUfiSms_atohex(tTimeZone[(0xe2f+2799-0x191d)])*(0x985+5014-0x1d11)+
+zUfiSms_atohex(tTimeZone[(0x4a4+8120-0x245a)]);}else{printf(
 "\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x2d\x74\x69\x6d\x65\x7a\x6f\x6e\x65\x2e");}
-ptTimestamp->timezone=(0xe52+1601-0x1493)-ptTimestamp->timezone;}else{if(strlen(
-tTimeZone)==(0x204d+1388-0x25b8)){ptTimestamp->timezone=zUfiSms_atohex(
-((char)(0x457+6437-0x1d4c)))*(0x409+7935-0x22f8)+zUfiSms_atohex(tTimeZone[
-(0xb81+3597-0x198e)]);}else if(strlen(tTimeZone)==(0x637+1110-0xa8b)){
-ptTimestamp->timezone=zUfiSms_atohex(tTimeZone[(0x13f8+652-0x1684)])*
-(0x18fc+1232-0x1dc2)+zUfiSms_atohex(tTimeZone[(0x891+2946-0x1412)]);}else{printf
-("\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x2b\x74\x69\x6d\x65\x7a\x6f\x6e\x65\x2e");}}
+ptTimestamp->timezone=(0xd52+5728-0x23b2)-ptTimestamp->timezone;}else{if(strlen(
+tTimeZone)==(0x846+5309-0x1d02)){ptTimestamp->timezone=zUfiSms_atohex(
+((char)(0x856+2043-0x1021)))*(0x45d+1952-0xbed)+zUfiSms_atohex(tTimeZone[
+(0x956+5594-0x1f30)]);}else if(strlen(tTimeZone)==(0xf0f+2505-0x18d6)){
+ptTimestamp->timezone=zUfiSms_atohex(tTimeZone[(0x1165+3849-0x206e)])*
+(0x7bb+4045-0x177e)+zUfiSms_atohex(tTimeZone[(0x856+184-0x90d)]);}else{printf(
+"\x75\x6e\x6b\x6e\x6f\x77\x6e\x20\x2b\x74\x69\x6d\x65\x7a\x6f\x6e\x65\x2e");}}
 return ZUFI_SUCC;}void zUfiSms_FillDeliver(T_zUfiSms_DeliverPdu*deliver,
 T_zUfiSms_ConcatInfo*concat_sms,T_zUfiSms_DbStoreData*ptDbSaveData){static 
-UINT16 msg_ref=(0x9bd+5215-0x1e1c);deliver->user_data_header_present=TRUE;if(
-(0x13e5+976-0x17b5)==concat_sms->current_sending){g_zUfiSms_ConcatSmsReference++
+UINT16 msg_ref=(0xfe4+3300-0x1cc8);deliver->user_data_header_present=TRUE;if(
+(0xdd9+6135-0x25d0)==concat_sms->current_sending){g_zUfiSms_ConcatSmsReference++
 ;(void)zUfiSms_SetConcatMaxRefer(g_zUfiSms_ConcatSmsReference);}deliver->
-user_data_header_present=TRUE;deliver->user_data.num_headers=(0x70b+4383-0x1829)
-;deliver->user_data.headers[(0x779+6988-0x22c5)].header_id=WMS_UDH_CONCAT_8;
-deliver->user_data.headers[(0x529+8178-0x251b)].u.concat_8.msg_ref=msg_ref;
-deliver->user_data.headers[(0x294+1622-0x8ea)].u.concat_8.total_sm=concat_sms->
-total_msg;deliver->user_data.headers[(0x89d+6007-0x2014)].u.concat_8.seq_num=
-concat_sms->current_sending+(0x99+2811-0xb93);ptDbSaveData->concat_sms=
-(0x1029+5049-0x23e1);ptDbSaveData->concat_info[(0xcc6+5169-0x20f7)]=msg_ref;}
+user_data_header_present=TRUE;deliver->user_data.num_headers=(0xdb2+2489-0x176a)
+;deliver->user_data.headers[(0xb39+2187-0x13c4)].header_id=WMS_UDH_CONCAT_8;
+deliver->user_data.headers[(0x599+1756-0xc75)].u.concat_8.msg_ref=msg_ref;
+deliver->user_data.headers[(0x6a1+4039-0x1668)].u.concat_8.total_sm=concat_sms->
+total_msg;deliver->user_data.headers[(0x53+6613-0x1a28)].u.concat_8.seq_num=
+concat_sms->current_sending+(0x463+7938-0x2364);ptDbSaveData->concat_sms=
+(0x18c5+1539-0x1ec7);ptDbSaveData->concat_info[(0xe3b+2473-0x17e4)]=msg_ref;}
 void zUfiSms_FillDeliverPdu(T_zUfiSms_DeliverPdu*ptDeliver,T_zUfiSms_ConcatInfo*
 concat_sms,T_zUfiSms_GroupInfo*group_sms,int iSmsLen,T_zUfiSms_DbStoreData*
 ptDbSaveData){if(NULL==concat_sms||NULL==group_sms){return;}ptDeliver->more=
@@ -751,35 +753,34 @@
 dcs.msg_class=WMS_MESSAGE_CLASS_NONE;ptDeliver->dcs.is_compressed=FALSE;if(
 g_zUfiSms_Dcs==DCS_ASC){ptDeliver->dcs.alphabet=WMS_GW_ALPHABET_7_BIT_DEFAULT;}
 else{ptDeliver->dcs.alphabet=WMS_GW_ALPHABET_UCS2;}if(concat_sms->total_msg>
-(0x190f+2481-0x22bf)){zUfiSms_FillDeliver(ptDeliver,concat_sms,ptDbSaveData);
-ptDbSaveData->concat_sms=(0x150+499-0x342);ptDbSaveData->concat_info[
-(0x69b+547-0x8bc)]=concat_sms->current_sending+(0x1106+5165-0x2532);ptDbSaveData
-->concat_info[(0xd83+1858-0x14c4)]=concat_sms->total_msg;ptDbSaveData->
-concat_info[(0x4ab+4658-0x16dd)]=ptDeliver->user_data.headers[
-(0xf2d+5503-0x24ac)].u.concat_8.msg_ref;}else{ptDeliver->
-user_data_header_present=FALSE;ptDeliver->user_data.num_headers=
-(0x1418+4072-0x2400);}ptDeliver->user_data.sm_len=iSmsLen;memcpy(ptDeliver->
-user_data.sm_data,concat_sms->msg_contents[concat_sms->current_sending],iSmsLen)
-;if(group_sms->receivers[group_sms->current_receiver][(0xf55+5630-0x2553)]==
-((char)(0xebd+4206-0x1f00))){(void)zUfiSms_CharToInt(group_sms->receivers[
-group_sms->current_receiver]+(0x1e14+375-0x1f8a),strlen(group_sms->receivers[
-group_sms->current_receiver])-(0x1307+4416-0x2446),ptDeliver->address.digits);
-ptDeliver->address.number_type=WMS_NUMBER_INTERNATIONAL;ptDeliver->address.
+(0x67c+1772-0xd67)){zUfiSms_FillDeliver(ptDeliver,concat_sms,ptDbSaveData);
+ptDbSaveData->concat_sms=(0x110f+2220-0x19ba);ptDbSaveData->concat_info[
+(0x620+8270-0x266c)]=concat_sms->current_sending+(0x15a6+4044-0x2571);
+ptDbSaveData->concat_info[(0x64f+6859-0x2119)]=concat_sms->total_msg;
+ptDbSaveData->concat_info[(0x1bc6+1259-0x20b1)]=ptDeliver->user_data.headers[
+(0x35f+1660-0x9db)].u.concat_8.msg_ref;}else{ptDeliver->user_data_header_present
+=FALSE;ptDeliver->user_data.num_headers=(0x100f+737-0x12f0);}ptDeliver->
+user_data.sm_len=iSmsLen;memcpy(ptDeliver->user_data.sm_data,concat_sms->
+msg_contents[concat_sms->current_sending],iSmsLen);if(group_sms->receivers[
+group_sms->current_receiver][(0xaf2+5438-0x2030)]==((char)(0x860+2793-0x131e))){
+(void)zUfiSms_CharToInt(group_sms->receivers[group_sms->current_receiver]+
+(0x1c8b+112-0x1cfa),strlen(group_sms->receivers[group_sms->current_receiver])-
+(0x1d50+1178-0x21e9),ptDeliver->address.digits);ptDeliver->address.number_type=
+WMS_NUMBER_INTERNATIONAL;ptDeliver->address.number_of_digits=(UINT8)strlen(
+group_sms->receivers[group_sms->current_receiver])-(0x2fd+6414-0x1c0a);}else{(
+void)zUfiSms_CharToInt(group_sms->receivers[group_sms->current_receiver],strlen(
+group_sms->receivers[group_sms->current_receiver]),ptDeliver->address.digits);
+ptDeliver->address.number_type=WMS_NUMBER_UNKNOWN;ptDeliver->address.
 number_of_digits=(UINT8)strlen(group_sms->receivers[group_sms->current_receiver]
-)-(0xd8+110-0x145);}else{(void)zUfiSms_CharToInt(group_sms->receivers[group_sms
-->current_receiver],strlen(group_sms->receivers[group_sms->current_receiver]),
-ptDeliver->address.digits);ptDeliver->address.number_type=WMS_NUMBER_UNKNOWN;
-ptDeliver->address.number_of_digits=(UINT8)strlen(group_sms->receivers[group_sms
-->current_receiver]);}ptDeliver->address.digit_mode=WMS_DIGIT_MODE_4_BIT;
-ptDeliver->address.number_mode=WMS_NUMBER_MODE_NONE_DATA_NETWORK;ptDeliver->
-address.number_plan=WMS_NUMBER_PLAN_TELEPHONY;}T_zUfiSms_CmdStatus 
-zUfiSms_SaveConcatSms(T_zUfiSms_SaveReq*ptSaveSms,T_zUfiSms_ConcatInfo*
-ptConcatSms,T_zUfiSms_GroupInfo*ptGroupSms,T_zUfiSms_DbStoreData*ptDbSaveData,
-int iSmsLen){printf(
+);}ptDeliver->address.digit_mode=WMS_DIGIT_MODE_4_BIT;ptDeliver->address.
+number_mode=WMS_NUMBER_MODE_NONE_DATA_NETWORK;ptDeliver->address.number_plan=
+WMS_NUMBER_PLAN_TELEPHONY;}T_zUfiSms_CmdStatus zUfiSms_SaveConcatSms(
+T_zUfiSms_SaveReq*ptSaveSms,T_zUfiSms_ConcatInfo*ptConcatSms,T_zUfiSms_GroupInfo
+*ptGroupSms,T_zUfiSms_DbStoreData*ptDbSaveData,int iSmsLen){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x61\x76\x65\x43\x6f\x6e\x63\x61\x74\x53\x6d\x73\x20\x6d\x65\x6d\x5f\x73\x74\x6f\x72\x65\x3d\x25\x64\x28\x4e\x56\x3d\x3d\x30\x31\x29" "\n"
 ,ptSaveSms->mem_store);if(ptSaveSms->mem_store==WMS_STORAGE_TYPE_NV_V01){if(
 ZUFI_FAIL==zUfiSms_WriteSmsToDb(ptDbSaveData,WMS_STORAGE_TYPE_NV_V01,-
-(0x1108+1725-0x17c4))){at_print(LOG_ERR,
+(0x1db1+1623-0x2407))){at_print(LOG_ERR,
 "\x77\x72\x69\x74\x65\x20\x73\x6d\x73\x20\x74\x6f\x20\x6e\x76\x20\x66\x61\x69\x6c\x65\x64\x2e"
 );return WMS_CMD_FAILED;}}else{return WMS_CMD_FAILED;}g_zUfiSms_MsgRefer++;
 ptDbSaveData->msg_ref=g_zUfiSms_MsgRefer;(void)zUfiSms_SetMaxReference(
@@ -794,20 +795,20 @@
 zUfiSms_SaveSmsToDb(T_zUfiSms_SaveReq*ptSaveSms,T_zUfiSms_ConcatInfo*ptConcatSms
 ,T_zUfiSms_GroupInfo*ptGroupSms,int iSmsLength){T_zUfiSms_ClientTsData 
 tClientTsData;T_zUfiSms_ClientMsg tClientMsg;T_zUfiSms_DbStoreData tDbSaveData;
-T_zUfiSms_CmdStatus result=WMS_CMD_SUCCESS;int current_sending=
-(0xe34+4544-0x1ff4);if(NULL==ptSaveSms||NULL==ptConcatSms||NULL==ptGroupSms||(-
-(0x647+6872-0x211e)==iSmsLength)){return WMS_CMD_FAILED;}for(ptConcatSms->
-current_sending=(0xb0+9743-0x26bf);ptConcatSms->current_sending<ptConcatSms->
-total_msg;ptConcatSms->current_sending++){memset((void*)&tClientMsg,
-(0x57c+4379-0x1697),sizeof(T_zUfiSms_ClientMsg));memset((void*)&tClientTsData,
-(0x1deb+1699-0x248e),sizeof(T_zUfiSms_ClientTsData));memset((void*)&tDbSaveData,
-(0x1972+3227-0x260d),sizeof(T_zUfiSms_DbStoreData));tClientMsg.msg_hdr.mem_store
-=(ptSaveSms->mem_store==WMS_STORAGE_TYPE_UIM_V01)?WMS_STORAGE_TYPE_UIM_V01:
+T_zUfiSms_CmdStatus result=WMS_CMD_SUCCESS;int current_sending=(0x85+41-0xae);if
+(NULL==ptSaveSms||NULL==ptConcatSms||NULL==ptGroupSms||(-(0x932+5102-0x1d1f)==
+iSmsLength)){return WMS_CMD_FAILED;}for(ptConcatSms->current_sending=
+(0x1777+2856-0x229f);ptConcatSms->current_sending<ptConcatSms->total_msg;
+ptConcatSms->current_sending++){memset((void*)&tClientMsg,(0x15a4+4341-0x2699),
+sizeof(T_zUfiSms_ClientMsg));memset((void*)&tClientTsData,(0x1479+2659-0x1edc),
+sizeof(T_zUfiSms_ClientTsData));memset((void*)&tDbSaveData,(0x354+3508-0x1108),
+sizeof(T_zUfiSms_DbStoreData));tClientMsg.msg_hdr.mem_store=(ptSaveSms->
+mem_store==WMS_STORAGE_TYPE_UIM_V01)?WMS_STORAGE_TYPE_UIM_V01:
 WMS_STORAGE_TYPE_NV_V01;tClientMsg.msg_hdr.tag=(T_zUfiSms_SmsTag)ptSaveSms->tags
 ;tClientMsg.msg_hdr.message_mode=WMS_MESSAGE_MODE_GW;tClientMsg.u.gw_message.
 is_broadcast=FALSE;tClientTsData.format=WMS_FORMAT_GW_PP;switch(ptSaveSms->tags)
 {case WMS_TAG_TYPE_MO_SENT_V01:case WMS_TAG_TYPE_MO_NOT_SENT_V01:case
-(0x5a3+2729-0x1048):{tClientTsData.u.gw_pp.tpdu_type=WMS_TPDU_SUBMIT;(void)
+(0x715+3858-0x1623):{tClientTsData.u.gw_pp.tpdu_type=WMS_TPDU_SUBMIT;(void)
 zUfiSms_FillSubmitTpdu(ptConcatSms,ptGroupSms,iSmsLength,&tClientTsData.u.gw_pp.
 u.submit,&tDbSaveData);break;}case WMS_TAG_TYPE_MT_READ_V01:case 
 WMS_TAG_TYPE_MT_NOT_READ_V01:{tClientTsData.u.gw_pp.tpdu_type=WMS_TPDU_DELIVER;(
@@ -819,42 +820,42 @@
 zUfiSms_FillSca(&tClientMsg);zUfiSms_FillDbSaveData(&tClientMsg,&tClientTsData,
 ptConcatSms,ptGroupSms,iSmsLength,&tDbSaveData);strncpy(tDbSaveData.
 draft_group_id,ptSaveSms->draft_group_id,sizeof(tDbSaveData.draft_group_id)-
-(0x583+3142-0x11c8));if(TRUE==g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_NV]){result=
+(0x1955+3201-0x25d5));if(TRUE==g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_NV]){result=
 WMS_CMD_FAILED;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x61\x76\x65\x53\x6d\x73\x54\x6f\x44\x62\x20\x4e\x56\x20\x6d\x65\x6d\x6f\x72\x79\x20\x69\x73\x20\x66\x75\x6c\x6c\x2c\x73\x61\x76\x65\x20\x65\x72\x72\x6f\x72" "\n"
-);}else{if(tDbSaveData.concat_sms==(0xfd9+1617-0x1629)){result=
+);}else{if(tDbSaveData.concat_sms==(0x8d5+5268-0x1d68)){result=
 zUfiSms_SaveConcatSms(ptSaveSms,ptConcatSms,ptGroupSms,&tDbSaveData,iSmsLength);
-current_sending=ptConcatSms->current_sending+(0x985+7374-0x2652);if(ptConcatSms
-->sms_len<iSmsLength*(current_sending+(0x495+8695-0x268b))){iSmsLength=
+current_sending=ptConcatSms->current_sending+(0x113+5141-0x1527);if(ptConcatSms
+->sms_len<iSmsLength*(current_sending+(0x406+3452-0x1181))){iSmsLength=
 ptConcatSms->sms_len-iSmsLength*current_sending;}}else{result=
 zUfiSms_SaveNormalSms(ptSaveSms,&tDbSaveData);}}}return result;}int 
-zUfiSms_DeleteSmsInSim(){char str_index[(0x1c84+2649-0x265d)]={
-(0x6f5+3832-0x15ed)};int index=(0x43a+158-0x4d8);int is_cc=(0xeb3+2465-0x1854);
-int iSmsId=(0x1293+3129-0x1ecc);T_zUfiSms_ModifyTag tDeleteInfo={
-(0x1070+1682-0x1702)};char StrValue[(0x20da+929-0x2471)]={(0x16a0+1151-0x1b1f)};
-memset(&tDeleteInfo,(0x340+7147-0x1f2b),sizeof(T_zUfiSms_ModifyTag));iSmsId=
-g_zUfiSms_DelMsg.sim_id[g_zUfiSms_DelMsg.sim_index];if(-(0x364+6837-0x1e18)==(
+zUfiSms_DeleteSmsInSim(){char str_index[(0x517+7094-0x204d)]={
+(0x1173+944-0x1523)};int index=(0x629+6414-0x1f37);int is_cc=(0x242c+371-0x259f)
+;int iSmsId=(0x81f+5934-0x1f4d);T_zUfiSms_ModifyTag tDeleteInfo={
+(0xb7+8368-0x2167)};char StrValue[(0x545+7142-0x2121)]={(0x1172+3808-0x2052)};
+memset(&tDeleteInfo,(0x1418+4664-0x2650),sizeof(T_zUfiSms_ModifyTag));iSmsId=
+g_zUfiSms_DelMsg.sim_id[g_zUfiSms_DelMsg.sim_index];if(-(0x1ec0+28-0x1edb)==(
 is_cc=zUfiSms_IsConcatSms(iSmsId))){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x6d\x73\x49\x6e\x53\x69\x6d\x20\x63\x68\x65\x63\x6b\x20\x63\x6f\x6e\x63\x61\x74\x20\x66\x61\x69\x6c\x65\x64\x2e" "\n"
 );return ZUFI_FAIL;}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x6d\x73\x49\x6e\x53\x69\x6d\x20\x69\x73\x5f\x63\x63\x3a\x25\x64\x2c\x20\x69\x64\x3d\x25\x64" "\n"
-,is_cc,iSmsId);if((0x229+3917-0x1175)==is_cc){if(ZUFI_FAIL==zUfiSms_GetSmsIndex(
+,is_cc,iSmsId);if((0x8f6+7552-0x2675)==is_cc){if(ZUFI_FAIL==zUfiSms_GetSmsIndex(
 iSmsId,&tDeleteInfo,is_cc)){return ZUFI_FAIL;}g_zUfiSms_DelMsg.sim_index++;
 g_zUfiSms_DelMsg.sim_index_count--;while(tDeleteInfo.num_of_indices>
-(0x1811+24-0x1829)){index=tDeleteInfo.indices[tDeleteInfo.id_index];
+(0x14c9+733-0x17a6)){index=tDeleteInfo.indices[tDeleteInfo.id_index];
 g_deleteIndex.index[g_deleteIndex.total]=index;g_deleteIndex.total++;tDeleteInfo
 .id_index++;tDeleteInfo.num_of_indices--;}}else{memset(str_index,
-(0xab4+6156-0x22c0),sizeof(str_index));if(ZUFI_FAIL==zUfiSms_GetStorePosById(
+(0x229d+1137-0x270e),sizeof(str_index));if(ZUFI_FAIL==zUfiSms_GetStorePosById(
 "\x69\x6e\x64",str_index,sizeof(str_index),iSmsId)){at_print(LOG_ERR,
 "\x67\x65\x74\x20\x69\x6e\x64\x65\x78\x20\x66\x72\x6f\x6d\x20\x64\x62\x20\x66\x61\x69\x6c\x64\x2e"
 );return ZUFI_FAIL;}index=atoi(str_index);g_deleteIndex.index[g_deleteIndex.
 total]=index;g_deleteIndex.total++;g_zUfiSms_DelMsg.sim_index++;g_zUfiSms_DelMsg
 .sim_index_count--;}(void)zUfiSms_DeleteSmsInDb();return ZUFI_SUCC;}
-T_zUfiSms_CmdStatus zUfiSms_DeleteSimSms(VOID){int atRes=(0xb14+157-0xbb1);char 
-StrValue[(0x13fc+3215-0x2081)]={(0x175b+3769-0x2614)};zUfiSms_SetSmsLocation(
-SMS_LOCATION_SIM);memset(&g_deleteIndex,(0x1cf4+199-0x1dbb),sizeof(
+T_zUfiSms_CmdStatus zUfiSms_DeleteSimSms(VOID){int atRes=(0xa84+5700-0x20c8);
+char StrValue[(0x29c+6739-0x1ce5)]={(0x374+5703-0x19bb)};zUfiSms_SetSmsLocation(
+SMS_LOCATION_SIM);memset(&g_deleteIndex,(0x1c04+1175-0x209b),sizeof(
 T_zUfiSms_DelIndexInfo));while(g_zUfiSms_DelMsg.sim_index_count>
-(0x13f0+733-0x16cd)){if(ZUFI_FAIL==zUfiSms_DeleteSmsInSim()){printf(
+(0x1d04+287-0x1e23)){if(ZUFI_FAIL==zUfiSms_DeleteSmsInSim()){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x69\x6d\x53\x6d\x73\x20\x64\x65\x6c\x65\x74\x65\x20\x61\x6c\x6c\x3a\x25\x64\x20\x73\x6d\x73\x20\x66\x61\x69\x6c\x65\x64" "\n"
 ,WMS_STORAGE_TYPE_UIM_V01);return WMS_CMD_FAILED;}}while(g_deleteIndex.cur_index
 <g_deleteIndex.total){atRes=zSms_SendCmgdReq(g_deleteIndex.index[g_deleteIndex.
@@ -863,69 +864,69 @@
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x69\x6d\x53\x6d\x73\x20\x73\x75\x63\x63\x65\x73\x73" "\n"
 );return WMS_CMD_SUCCESS;}void zUfiSms_GetReportStatus(char*pdu_tmp,int*stat){
 unsigned char tmp;unsigned char first_octet;if(pdu_tmp==NULL){return;}(void)
-String2Bytes(pdu_tmp,&tmp,(0x5ab+7294-0x2227));if(tmp==(0xa16+597-0xc6b)){
-pdu_tmp+=(0x6fc+39-0x721);}else{tmp=(tmp+(0x4c0+5747-0x1b32))*
-(0xb61+2915-0x16c2);pdu_tmp+=tmp;}(void)String2Bytes(pdu_tmp,&tmp,
-(0x4b2+8026-0x240a));first_octet=tmp;if(first_octet&(0x11b5+2294-0x1aa9)){*stat=
-(0x8d6+1447-0xe78);}}T_zUfiSms_TpduType zUfiSms_GetTpduType(UINT8*pData){
-T_zUfiSms_TpduType iTpduType;UINT8 mti=(0x1924+825-0x1c5d);mti=(
-T_zUfiSms_TpduType)(pData[(0xb55+4445-0x1cb2)]&(0x104b+4864-0x2348));switch(mti)
-{case(0x2020+1361-0x2571):iTpduType=WMS_TPDU_DELIVER;break;case
-(0x1138+4573-0x2314):iTpduType=WMS_TPDU_SUBMIT;break;case(0xde6+6055-0x258b):
-iTpduType=WMS_TPDU_STATUS_REPORT;break;default:iTpduType=WMS_TPDU_MAX;break;}
-return iTpduType;}static void zUfiSms_FormatDeliverNumber(wms_address_s_type 
-tAddress,unsigned char*pNumber){UINT8 number_type=(0x106d+1438-0x160b);memset(
-pNumber,(0xacd+7036-0x2649),ZTE_WMS_ADDRESS_LEN_MAX+(0x751+798-0xa6e));if(
-tAddress.number_type==WMS_NUMBER_INTERNATIONAL){pNumber[(0x1c58+937-0x2001)]=
-((char)(0x1ba+2975-0xd2e));pNumber++;}if(tAddress.digit_mode!=
+String2Bytes(pdu_tmp,&tmp,(0xcfb+2103-0x1530));if(tmp==(0xd0b+5100-0x20f7)){
+pdu_tmp+=(0x1da+785-0x4e9);}else{tmp=(tmp+(0xe6d+996-0x1250))*(0xac2+170-0xb6a);
+pdu_tmp+=tmp;}(void)String2Bytes(pdu_tmp,&tmp,(0x128c+5163-0x26b5));first_octet=
+tmp;if(first_octet&(0x171b+909-0x1aa6)){*stat=(0x177+7954-0x2084);}}
+T_zUfiSms_TpduType zUfiSms_GetTpduType(UINT8*pData){T_zUfiSms_TpduType iTpduType
+;UINT8 mti=(0x1aaf+1015-0x1ea6);mti=(T_zUfiSms_TpduType)(pData[
+(0x10e8+1159-0x156f)]&(0x576+1647-0xbe2));switch(mti){case(0x1035+3688-0x1e9d):
+iTpduType=WMS_TPDU_DELIVER;break;case(0x72c+2919-0x1292):iTpduType=
+WMS_TPDU_SUBMIT;break;case(0x1cfb+2106-0x2533):iTpduType=WMS_TPDU_STATUS_REPORT;
+break;default:iTpduType=WMS_TPDU_MAX;break;}return iTpduType;}static void 
+zUfiSms_FormatDeliverNumber(wms_address_s_type tAddress,unsigned char*pNumber){
+UINT8 number_type=(0x87b+4323-0x195e);memset(pNumber,(0x1c67+2325-0x257c),
+ZTE_WMS_ADDRESS_LEN_MAX+(0x64b+5661-0x1c67));if(tAddress.number_type==
+WMS_NUMBER_INTERNATIONAL){pNumber[(0x268+7253-0x1ebd)]=
+((char)(0xea4+1989-0x163e));pNumber++;}if(tAddress.digit_mode!=
 WMS_DIGIT_MODE_8_BIT){(void)zUfiSms_SmsiAddrToStr(tAddress,(byte*)pNumber,&
 number_type);}else{memcpy(pNumber,tAddress.digits,tAddress.number_of_digits*
-sizeof(tAddress.digits[(0x1f9f+1254-0x2485)]));}}byte*zUfiSms_UtilTimeStamp(
+sizeof(tAddress.digits[(0xb8+1719-0x76f)]));}}byte*zUfiSms_UtilTimeStamp(
 T_zUfiSms_TimeStamp zte_wms_time,byte*res_ptr,T_zUfiSms_Date*date){UINT8 tmp;if(
-NULL==date){return NULL;}*res_ptr++=((char)(0xe11+743-0x10d6));tmp=zte_wms_time.
-year;res_ptr=zUfiSms_SmsiUtilitoaFill((tmp&(0x7d8+1081-0xc02))+((tmp>>
-(0x27a+9051-0x25d1))*(0x6bd+7464-0x23db)),res_ptr);zUfiSms_SprintfTime(date->
-year,sizeof(date->year),zte_wms_time.year);*res_ptr++=((char)(0x37+1104-0x458));
-tmp=zte_wms_time.month;res_ptr=zUfiSms_SmsiUtilitoaFill((tmp&(0x943+6915-0x2437)
-)+((tmp>>(0x1f5b+183-0x200e))*(0x961+3896-0x188f)),res_ptr);zUfiSms_SprintfTime(
+NULL==date){return NULL;}*res_ptr++=((char)(0x2cd+86-0x301));tmp=zte_wms_time.
+year;res_ptr=zUfiSms_SmsiUtilitoaFill((tmp&(0x390+2443-0xd0c))+((tmp>>
+(0x1c72+110-0x1cdc))*(0x81f+7657-0x25fe)),res_ptr);zUfiSms_SprintfTime(date->
+year,sizeof(date->year),zte_wms_time.year);*res_ptr++=((char)(0x666+242-0x729));
+tmp=zte_wms_time.month;res_ptr=zUfiSms_SmsiUtilitoaFill((tmp&(0x12c2+378-0x142d)
+)+((tmp>>(0xcc4+6474-0x260a))*(0xa1a+6146-0x2212)),res_ptr);zUfiSms_SprintfTime(
 date->month,sizeof(date->month),zte_wms_time.month);*res_ptr++=
-((char)(0x1065+1967-0x17e5));tmp=zte_wms_time.day;res_ptr=
-zUfiSms_SmsiUtilitoaFill((tmp&(0x155c+2639-0x1f9c))+((tmp>>(0x53d+5165-0x1966))*
-(0x59c+4450-0x16f4)),res_ptr);zUfiSms_SprintfTime(date->day,sizeof(date->day),
-zte_wms_time.day);*res_ptr++=((char)(0x1ae6+1351-0x2001));tmp=zte_wms_time.hour;
-res_ptr=zUfiSms_SmsiUtilitoaFill((tmp&(0xcd7+4186-0x1d22))+((tmp>>
-(0x8c7+1264-0xdb3))*(0x298+9337-0x2707)),res_ptr);zUfiSms_SprintfTime(date->hour
-,sizeof(date->hour),zte_wms_time.hour);*res_ptr++=((char)(0x536+4136-0x1524));
+((char)(0x2004+1767-0x26bc));tmp=zte_wms_time.day;res_ptr=
+zUfiSms_SmsiUtilitoaFill((tmp&(0x18a6+281-0x19b0))+((tmp>>(0x1b3b+1491-0x210a))*
+(0x220+8258-0x2258)),res_ptr);zUfiSms_SprintfTime(date->day,sizeof(date->day),
+zte_wms_time.day);*res_ptr++=((char)(0xd33+1903-0x1476));tmp=zte_wms_time.hour;
+res_ptr=zUfiSms_SmsiUtilitoaFill((tmp&(0xc3+9725-0x26b1))+((tmp>>
+(0x6a+4913-0x1397))*(0x294+5947-0x19c5)),res_ptr);zUfiSms_SprintfTime(date->hour
+,sizeof(date->hour),zte_wms_time.hour);*res_ptr++=((char)(0x1a42+638-0x1c86));
 tmp=zte_wms_time.minute;res_ptr=zUfiSms_SmsiUtilitoaFill((tmp&
-(0xc71+4984-0x1fda))+((tmp>>(0xf1d+1542-0x151f))*(0x426+3978-0x13a6)),res_ptr);
+(0x5f9+4150-0x1620))+((tmp>>(0x8ab+4508-0x1a43))*(0x104c+1506-0x1624)),res_ptr);
 zUfiSms_SprintfTime(date->min,sizeof(date->min),zte_wms_time.minute);*res_ptr++=
-((char)(0x346+6501-0x1c71));tmp=zte_wms_time.second;res_ptr=
-zUfiSms_SmsiUtilitoaFill((tmp&(0x14a4+3818-0x237f))+((tmp>>(0x7cb+7174-0x23cd))*
-(0x7a6+529-0x9ad)),res_ptr);zUfiSms_SprintfTime(date->sec,sizeof(date->sec),
-zte_wms_time.second);if(zte_wms_time.timezone<(0x1c5b+2299-0x2556)){*res_ptr++=
-((char)(0x1acc+2779-0x257a));tmp=(UINT8)(zte_wms_time.timezone*(-
-(0xf6a+1219-0x142c)));snprintf(date->timezone,sizeof(date->timezone),
-"\x2d\x25\x64",-(0x26d+3387-0xfa7)*zte_wms_time.timezone);}else{*res_ptr++=
-((char)(0x132c+3313-0x1ff2));tmp=(UINT8)zte_wms_time.timezone;snprintf(date->
+((char)(0x140+5999-0x1875));tmp=zte_wms_time.second;res_ptr=
+zUfiSms_SmsiUtilitoaFill((tmp&(0x1b57+553-0x1d71))+((tmp>>(0x1112+1056-0x152e))*
+(0x2261+53-0x228c)),res_ptr);zUfiSms_SprintfTime(date->sec,sizeof(date->sec),
+zte_wms_time.second);if(zte_wms_time.timezone<(0x903+426-0xaad)){*res_ptr++=
+((char)(0xaec+709-0xd84));tmp=(UINT8)(zte_wms_time.timezone*(-(0x31f+254-0x41c))
+);snprintf(date->timezone,sizeof(date->timezone),"\x2d\x25\x64",-
+(0x582+382-0x6ff)*zte_wms_time.timezone);}else{*res_ptr++=
+((char)(0x289+3002-0xe18));tmp=(UINT8)zte_wms_time.timezone;snprintf(date->
 timezone,sizeof(date->timezone),"\x2b\x25\x64",zte_wms_time.timezone);}res_ptr=
-zUfiSms_SmsiUtilitoaFill(tmp,res_ptr);*res_ptr++=((char)(0xc54+2350-0x1560));
+zUfiSms_SmsiUtilitoaFill(tmp,res_ptr);*res_ptr++=((char)(0x217a+985-0x2531));
 return res_ptr;}T_zUfiSms_CmdStatus zUfiSms_HandleReport(unsigned char*ptPduData
 ){T_zUfiSms_RawTsData tRawTsData;T_zUfiSms_ClientTsData tClientTsData;int 
-iReportStatus=(0x5f3+2643-0x1046);unsigned char acDeliverNumber[
-ZTE_WMS_ADDRESS_LEN_MAX+(0x3af+2866-0xee0)];unsigned char tTpScts[
-ZTE_WMS_TP_SCTS_LEN_MAX+(0x1c1c+2659-0x267e)];T_zUfiSms_Date tSmsDate;char 
-acRecFlag[(0x21b5+82-0x2202)]={(0xda+237-0x1c7)};int iRpCount=
-(0x6a6+7620-0x246a);char tmp[(0x316+6675-0x1d1f)];int tmp_i=(0x738+6122-0x1f22);
-unsigned int pos=(0x1530+4538-0x26ea);if(NULL==ptPduData){return WMS_CMD_FAILED;
-}memset(acDeliverNumber,(0x138+4636-0x1354),sizeof(acDeliverNumber));memset(&
-tSmsDate,(0xe0f+201-0xed8),sizeof(T_zUfiSms_Date));memset(tTpScts,
-(0x5c6+263-0x6cd),sizeof(tTpScts));memset(&tRawTsData,(0x14bf+1665-0x1b40),
-sizeof(T_zUfiSms_RawTsData));memset(&tClientTsData,(0x18b3+1734-0x1f79),sizeof(
+iReportStatus=(0x50c+77-0x559);unsigned char acDeliverNumber[
+ZTE_WMS_ADDRESS_LEN_MAX+(0x73+9817-0x26cb)];unsigned char tTpScts[
+ZTE_WMS_TP_SCTS_LEN_MAX+(0xd98+2311-0x169e)];T_zUfiSms_Date tSmsDate;char 
+acRecFlag[(0x107+7419-0x1dfd)]={(0xd04+6071-0x24bb)};int iRpCount=
+(0xed9+3392-0x1c19);char tmp[(0xba3+2678-0x160f)];int tmp_i=(0x17d3+2329-0x20ec)
+;unsigned int pos=(0xc12+5226-0x207c);if(NULL==ptPduData){return WMS_CMD_FAILED;
+}memset(acDeliverNumber,(0x108d+707-0x1350),sizeof(acDeliverNumber));memset(&
+tSmsDate,(0x155+5026-0x14f7),sizeof(T_zUfiSms_Date));memset(tTpScts,
+(0x4f7+5775-0x1b86),sizeof(tTpScts));memset(&tRawTsData,(0x788+6597-0x214d),
+sizeof(T_zUfiSms_RawTsData));memset(&tClientTsData,(0xa5b+3610-0x1875),sizeof(
 T_zUfiSms_ClientTsData));snprintf(tmp,sizeof(tmp),"\x25\x58",ptPduData[
-(0x916+2229-0x11cb)]);tmp_i=atoi(tmp);if(tmp_i<(0x142+3587-0xf45)||tmp_i>INT_MAX
--(0x192f+2953-0x24b7)){at_print(LOG_ERR,
+(0xbb5+4364-0x1cc1)]);tmp_i=atoi(tmp);if(tmp_i<(0x179d+1187-0x1c40)||tmp_i>
+INT_MAX-(0x1098+264-0x119f)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x70\x74\x50\x64\x75\x44\x61\x74\x61\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);return WMS_CMD_FAILED;}pos=tmp_i+(0x1c42+2047-0x2440);if(pos>=
+,tmp_i);return WMS_CMD_FAILED;}pos=tmp_i+(0x5b+7579-0x1df5);if(pos>=
 ZSMS_PDU_SIZE){return WMS_CMD_FAILED;}memcpy((void*)tRawTsData.data,(void*)(
 ptPduData+pos),sizeof(tRawTsData.data));tRawTsData.tpdu_type=zUfiSms_GetTpduType
 (ptPduData+pos);tRawTsData.format=WMS_FORMAT_GW_PP;(void)wms_ts_decode(&
@@ -934,60 +935,59 @@
 "\x64\x6f\x65\x73\x20\x6e\x6f\x74\x20\x67\x77\x2f\x77\x63\x64\x6d\x61\x20\x73\x6d\x73\x20\x72\x65\x70\x6f\x72\x74\x20\x73\x74\x61\x74\x75\x73\x2e"
 );return WMS_CMD_FAILED;}switch(tClientTsData.u.gw_pp.u.status_report.tp_status)
 {case WMS_TP_STATUS_RECEIVED_OK:case WMS_TP_STATUS_UNABLE_TO_CONFIRM_DELIVERY:
-case WMS_TP_STATUS_REPLACED:{iReportStatus=(0x694+5038-0x1a41);break;}case 
+case WMS_TP_STATUS_REPLACED:{iReportStatus=(0x1ccf+605-0x1f2b);break;}case 
 WMS_TP_STATUS_TRYING_CONGESTION:case WMS_TP_STATUS_TRYING_SME_BUSY:case 
 WMS_TP_STATUS_TRYING_NO_RESPONSE_FROM_SME:case 
 WMS_TP_STATUS_TRYING_SERVICE_REJECTED:case 
 WMS_TP_STATUS_TRYING_QOS_NOT_AVAILABLE:case WMS_TP_STATUS_TRYING_SME_ERROR:{
-iReportStatus=(0x9b6+4665-0x1bec);break;}default:{iReportStatus=
-(0x2da+1415-0x85f);break;}}zUfiSms_FormatDeliverNumber(tClientTsData.u.gw_pp.u.
+iReportStatus=(0x170d+3692-0x2576);break;}default:{iReportStatus=
+(0x16d+629-0x3e0);break;}}zUfiSms_FormatDeliverNumber(tClientTsData.u.gw_pp.u.
 status_report.address,acDeliverNumber);(void)zUfiSms_UtilTimeStamp(tClientTsData
 .u.gw_pp.u.status_report.timestamp,tTpScts,&tSmsDate);if(ZUFI_FAIL==
 zUfiSms_InsertReportStatusToDb(acDeliverNumber,&tSmsDate,iReportStatus)){
 at_print(LOG_ERR,
 "\x75\x70\x64\x61\x74\x65\x20\x73\x6d\x73\x20\x72\x65\x70\x6f\x72\x74\x20\x73\x74\x61\x74\x75\x73\x20\x66\x61\x69\x6c\x65\x64\x2e"
-);return WMS_CMD_FAILED;}memset(acRecFlag,(0x4d3+5925-0x1bf8),sizeof(acRecFlag))
+);return WMS_CMD_FAILED;}memset(acRecFlag,(0x9d9+5524-0x1f6d),sizeof(acRecFlag))
 ;sc_cfg_get(ZTE_WMS_NVCONFIG_SMS_REPORT,acRecFlag,sizeof(acRecFlag));iRpCount=
-atoi(acRecFlag);if(iRpCount<(0x3fa+63-0x439)||iRpCount>INT_MAX-
-(0x1b0a+1165-0x1f96)){at_print(LOG_ERR,
+atoi(acRecFlag);if(iRpCount<(0x1bb0+902-0x1f36)||iRpCount>INT_MAX-
+(0x890+2807-0x1386)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x69\x52\x70\x43\x6f\x75\x6e\x74\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,iRpCount);return WMS_CMD_FAILED;}memset(acRecFlag,(0x1cab+2591-0x26ca),sizeof(
+,iRpCount);return WMS_CMD_FAILED;}memset(acRecFlag,(0x15d1+3602-0x23e3),sizeof(
 acRecFlag));snprintf(acRecFlag,sizeof(acRecFlag),"\x25\x64",iRpCount+
-(0x3e1+7786-0x224a));sc_cfg_set(ZTE_WMS_NVCONFIG_SMS_REPORT,acRecFlag);return 
+(0x251b+259-0x261d));sc_cfg_set(ZTE_WMS_NVCONFIG_SMS_REPORT,acRecFlag);return 
 WMS_CMD_SUCCESS;}void zUfiSms_DelModemSms(int in_index){
-#if (0x1fcc+62-0x200a) 
-char StrValue[(0xe08+1541-0x1403)]={(0x1a5+2813-0xca2)};printf(
+#if (0x111f+1148-0x159b) 
+char StrValue[(0x875+5864-0x1f53)]={(0x1899+2191-0x2128)};printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x4d\x6f\x64\x65\x6d\x53\x6d\x73\x20\x66\x75\x6e\x20\x75\x73\x65\x64\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21\x21" "\n"
 );snat_print(LOG_DEBUGStrValue,sizeof(StrValue),"\x25\x64",in_index);
 zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,
 MSG_CMD_AT_DEL_SIM_SMS,strlen(StrValue),StrValue);
 #endif

-int atRes=(0x4f5+1155-0x978);atRes=zSms_SendCmgdReq(in_index);if(atRes==
+int atRes=(0x3f+1502-0x61d);atRes=zSms_SendCmgdReq(in_index);if(atRes==
 ZSMS_RESULT_OK){zSms_RecvCmgdOk();}else{zSms_RecvCmgdErr();}zSms_RecvCmgdFinish(
 );}VOID zUfiSms_getModifyInfo(T_zUfiSms_ModifyFlag*ptModifyBuff){int i=
-(0x7df+4661-0x1a14);memset(&g_zUfiSms_modifyMsg,(0x3e3+4355-0x14e6),sizeof(
-T_zUfiSms_ModifySms));for(i=(0x636+6454-0x1f6c);i<ptModifyBuff->total_id;i++){
+(0x15cd+3694-0x243b);memset(&g_zUfiSms_modifyMsg,(0x53b+6477-0x1e88),sizeof(
+T_zUfiSms_ModifySms));for(i=(0x1df9+1491-0x23cc);i<ptModifyBuff->total_id;i++){
 g_zUfiSms_modifyMsg.sim_id[g_zUfiSms_modifyMsg.sim_count]=ptModifyBuff->id[i];
 g_zUfiSms_modifyMsg.sim_count++;g_zUfiSms_modifyMsg.sim_index_count++;}}int 
-zUfiSms_GetUnreadSmsIndexInSim(){char str_index[(0x1039+1243-0x1494)]={
-(0x131d+3529-0x20e6)};int index=(0x10cd+1436-0x1669);int is_cc=
-(0x80+4351-0x117f);int iSmsId=(0xde1+1277-0x12de);T_zUfiSms_ModifyTag 
-tModifyInfo={(0x8a8+2378-0x11f2)};char StrValue[(0x120+6123-0x1901)]={
-(0x30a+2854-0xe30)};memset(&tModifyInfo,(0x109f+2500-0x1a63),sizeof(
-T_zUfiSms_ModifyTag));iSmsId=g_zUfiSms_modifyMsg.sim_id[g_zUfiSms_modifyMsg.
-sim_index];if(-(0x13eb+4122-0x2404)==(is_cc=zUfiSms_IsConcatSms(iSmsId))){
-at_print(LOG_ERR,
+zUfiSms_GetUnreadSmsIndexInSim(){char str_index[(0x1333+3801-0x218c)]={
+(0xd68+1607-0x13af)};int index=(0x8b+5208-0x14e3);int is_cc=(0x6f8+4015-0x16a7);
+int iSmsId=(0x1664+3516-0x2420);T_zUfiSms_ModifyTag tModifyInfo={
+(0xaad+5122-0x1eaf)};char StrValue[(0x1417+2572-0x1e19)]={(0x87d+349-0x9da)};
+memset(&tModifyInfo,(0x16a5+3775-0x2564),sizeof(T_zUfiSms_ModifyTag));iSmsId=
+g_zUfiSms_modifyMsg.sim_id[g_zUfiSms_modifyMsg.sim_index];if(-
+(0x511+7896-0x23e8)==(is_cc=zUfiSms_IsConcatSms(iSmsId))){at_print(LOG_ERR,
 "\x63\x68\x65\x63\x6b\x20\x63\x6f\x6e\x63\x61\x74\x20\x66\x61\x69\x6c\x65\x64\x2e"
 );return ZUFI_FAIL;}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x47\x65\x74\x55\x6e\x72\x65\x61\x64\x53\x6d\x73\x49\x6e\x64\x65\x78\x49\x6e\x53\x69\x6d\x20\x69\x73\x5f\x63\x63\x3a\x25\x64"
-,is_cc);if((0x1b6+2887-0xcfc)==is_cc){if(ZUFI_FAIL==zUfiSms_GetSmsIndex(iSmsId,&
-tModifyInfo,is_cc)){return ZUFI_FAIL;}g_zUfiSms_modifyMsg.sim_index++;
+,is_cc);if((0xbf7+4391-0x1d1d)==is_cc){if(ZUFI_FAIL==zUfiSms_GetSmsIndex(iSmsId,
+&tModifyInfo,is_cc)){return ZUFI_FAIL;}g_zUfiSms_modifyMsg.sim_index++;
 g_zUfiSms_modifyMsg.sim_index_count--;while(tModifyInfo.num_of_indices>
-(0x466+3655-0x12ad)){index=tModifyInfo.indices[tModifyInfo.id_index];
+(0xab2+1848-0x11ea)){index=tModifyInfo.indices[tModifyInfo.id_index];
 g_modifyIndex.index[g_modifyIndex.total]=index;g_modifyIndex.total++;tModifyInfo
 .id_index++;tModifyInfo.num_of_indices--;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x47\x65\x74\x55\x6e\x72\x65\x61\x64\x53\x6d\x73\x49\x6e\x64\x65\x78\x49\x6e\x53\x69\x6d\x20\x5b\x31\x20\x3d\x3d\x20\x69\x73\x5f\x63\x63\x5d\x20\x69\x6e\x64\x65\x78\x20\x3d\x20\x25\x64\x2c\x20\x74\x6f\x74\x61\x6c\x3d\x25\x64" "\n"
-,index,g_modifyIndex.total);}}else{memset(str_index,(0x6dd+7953-0x25ee),sizeof(
+,index,g_modifyIndex.total);}}else{memset(str_index,(0x448+3458-0x11ca),sizeof(
 str_index));if(ZUFI_FAIL==zUfiSms_GetStorePosById("\x69\x6e\x64",str_index,
 sizeof(str_index),iSmsId)){at_print(LOG_ERR,
 "\x67\x65\x74\x20\x69\x6e\x64\x65\x78\x20\x66\x72\x6f\x6d\x20\x64\x62\x20\x66\x61\x69\x6c\x64\x2e"
@@ -996,14 +996,14 @@
 g_zUfiSms_modifyMsg.sim_index_count--;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x47\x65\x74\x55\x6e\x72\x65\x61\x64\x53\x6d\x73\x49\x6e\x64\x65\x78\x49\x6e\x53\x69\x6d\x20\x5b\x31\x20\x21\x3d\x20\x69\x73\x5f\x63\x63\x5d\x69\x6e\x64\x65\x78\x20\x3d\x20\x25\x64\x2c\x20\x74\x6f\x74\x61\x6c\x3d\x25\x64" "\n"
 ,index,g_modifyIndex.total);}return ZUFI_SUCC;}void zUfiSms_ModifyModemSms(
-T_zUfiSms_ModifyFlag*ptModifyBuff){int atRes=(0x411+6927-0x1f20);char StrValue[
-(0x1fbc+532-0x21c6)]={(0x4ad+1591-0xae4)};printf(
+T_zUfiSms_ModifyFlag*ptModifyBuff){int atRes=(0x124+5095-0x150b);char StrValue[
+(0x1f2f+481-0x2106)]={(0x1585+3030-0x215b)};printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x4d\x6f\x64\x69\x66\x79\x4d\x6f\x64\x65\x6d\x53\x6d\x73\x20\x70\x74\x4d\x6f\x64\x69\x66\x79\x42\x75\x66\x66\x2d\x3e\x74\x79\x70\x65\x20\x3d\x20\x25\x64\x21" "\n"
 ,ptModifyBuff->type);{zUfiSms_getModifyInfo(ptModifyBuff);memset(&g_modifyIndex,
-(0x67c+6234-0x1ed6),sizeof(T_zUfiSms_ModifyIndexInfo));printf(
+(0x13d8+2679-0x1e4f),sizeof(T_zUfiSms_ModifyIndexInfo));printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x4d\x6f\x64\x69\x66\x79\x4d\x6f\x64\x65\x6d\x53\x6d\x73\x20\x70\x74\x4d\x6f\x64\x69\x66\x79\x42\x75\x66\x66\x2d\x3e\x74\x6f\x74\x61\x6c\x5f\x69\x64\x20\x3d\x20\x25\x64\x21" "\n"
 ,ptModifyBuff->total_id);while(g_zUfiSms_modifyMsg.sim_index_count>
-(0x2073+1204-0x2527)){if(ZUFI_FAIL==zUfiSms_GetUnreadSmsIndexInSim()){at_print(
+(0x1f9a+1251-0x247d)){if(ZUFI_FAIL==zUfiSms_GetUnreadSmsIndexInSim()){at_print(
 LOG_ERR,
 "\x64\x65\x6c\x65\x74\x65\x20\x61\x6c\x6c\x3a\x25\x64\x20\x73\x6d\x73\x20\x66\x61\x69\x6c\x65\x64" "\n"
 ,WMS_STORAGE_TYPE_UIM_V01);return;}}while(g_modifyIndex.cur_index<g_modifyIndex.
@@ -1022,21 +1022,21 @@
 zUfiSms_DecodeSmsData(T_zUfiSms_DbStoreData*pDb_Data,int msg_index,
 zUfiSms_StoreType iStorePos,T_SmsStatus bSms_Status,wms_message_format_enum_v01 
 format,long iPdu_Len,unsigned char*pPdu_Received){T_zUfiSms_RawTsData raw_ts;
-T_zUfiSms_ClientTsData ts_data_ptr;char tmp[(0x105c+640-0x12d2)];int tmp_i=
-(0xd02+1115-0x115d);unsigned int pos=(0x544+7358-0x2202);int result=ZUFI_SUCC;if
+T_zUfiSms_ClientTsData ts_data_ptr;char tmp[(0x11a0+1673-0x181f)];int tmp_i=
+(0x63d+4381-0x175a);unsigned int pos=(0x1a9c+509-0x1c99);int result=ZUFI_SUCC;if
 (NULL==pDb_Data){return ZUFI_FAIL;}pDb_Data->mem_store=(unsigned long)iStorePos;
 pDb_Data->index=(unsigned short)msg_index;if(RECEIVED_UNREAD==bSms_Status){
 pDb_Data->tag=WMS_TAG_TYPE_MT_NOT_READ_V01;}else if(RECEIVED_READ==bSms_Status){
 pDb_Data->tag=WMS_TAG_TYPE_MT_READ_V01;}else if(STORED_UNSEND==bSms_Status){
 pDb_Data->tag=WMS_TAG_TYPE_MO_NOT_SENT_V01;}else{pDb_Data->tag=
 WMS_TAG_TYPE_MO_SENT_V01;}pDb_Data->mode=(unsigned short)format;memset(&raw_ts,
-(0x1a32+2937-0x25ab),sizeof(T_zUfiSms_RawTsData));memset(&ts_data_ptr,
-(0x158f+3547-0x236a),sizeof(wms_client_ts_data_s_type));memset(tmp,
-(0x1aca+1108-0x1f1e),sizeof(tmp));snprintf(tmp,sizeof(tmp),"\x25\x64",
-pPdu_Received[(0xb4a+1097-0xf93)]);tmp_i=atoi(tmp);if(tmp_i<(0x13e6+3735-0x227d)
-||tmp_i>INT_MAX-(0x1198+936-0x153f)){at_print(LOG_ERR,
+(0x1dd+7310-0x1e6b),sizeof(T_zUfiSms_RawTsData));memset(&ts_data_ptr,
+(0x109b+5610-0x2685),sizeof(wms_client_ts_data_s_type));memset(tmp,
+(0x777+7563-0x2502),sizeof(tmp));snprintf(tmp,sizeof(tmp),"\x25\x64",
+pPdu_Received[(0x1494+3578-0x228e)]);tmp_i=atoi(tmp);if(tmp_i<
+(0xb82+3661-0x19cf)||tmp_i>INT_MAX-(0x6ff+516-0x902)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x70\x50\x64\x75\x5f\x52\x65\x63\x65\x69\x76\x65\x64\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);return ZUFI_FAIL;}pos=tmp_i+(0xbf8+4114-0x1c09);if(pos>=iPdu_Len){return
+,tmp_i);return ZUFI_FAIL;}pos=tmp_i+(0x12c6+413-0x1462);if(pos>=iPdu_Len){return
  ZUFI_FAIL;}raw_ts.len=iPdu_Len-pos;memcpy((void*)raw_ts.data,(void*)(
 pPdu_Received+pos),WMS_MAX_LEN);raw_ts.tpdu_type=zUfiSms_GetTpduType(
 pPdu_Received+pos);raw_ts.format=(WMS_MESSAGE_FORMAT_CDMA_V01==format)?
@@ -1046,61 +1046,62 @@
 pDb_Data);break;}case WMS_MESSAGE_FORMAT_GW_BC_V01:case 
 WMS_MESSAGE_FORMAT_MWI_V01:{result=ZUFI_FAIL;break;}default:{result=ZUFI_FAIL;
 break;}}return result;}T_zUfiSms_CmdStatus IsSmsLoadSuccess(void){char IsInit[
-(0xcda+285-0xdd3)]={(0x272+2613-0xca7)};sc_cfg_get(NV_SMS_LOAD_RESULT,IsInit,
-sizeof(IsInit));if((0xa+8559-0x2179)==strcmp("\x6f\x6b",IsInit)){printf(
+(0xb2c+521-0xd11)]={(0xaff+6813-0x259c)};sc_cfg_get(NV_SMS_LOAD_RESULT,IsInit,
+sizeof(IsInit));if((0x464+2200-0xcfc)==strcmp("\x6f\x6b",IsInit)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x6d\x73\x20\x4c\x6f\x61\x64\x20\x73\x75\x63\x63\x65\x73\x73\x21" "\n"
 );return WMS_CMD_SUCCESS;}else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x6d\x73\x20\x4c\x6f\x61\x64\x20\x77\x72\x6f\x6e\x67\x20\x21" "\n"
 );return WMS_CMD_FAILED;}}
-#if (0x1bd8+777-0x1ee1)

+#if (0x10a2+4536-0x225a)

 int zUfiSms_FormatSms(CHAR*pSmsRawContent,int contentSize,T_zUfiSms_SmsItem*
-ptSmsPara,int iCmdId){char*P1=strchr(pSmsRawContent,((char)(0x9b9+2479-0x133c)))
-;if(NULL==P1){return ZUFI_FAIL;}char*P2=strchr((char*)(P1+(0x248+3273-0xf10)),
-((char)(0x1921+876-0x1c61)));if(NULL==P2){return ZUFI_FAIL;}char*P3=strchr((char
-*)(P2+(0x382+660-0x615)),((char)(0x1b01+2984-0x267d)));atBase_PreProcRes(
-pSmsRawContent,contentSize);if((0x18b7+1033-0x1cbf)==iCmdId){if(P3==P2+
-(0xa9d+391-0xc23)){sscanf(pSmsRawContent,"\x25\x64\x20\x25\x64\x20\x25\x64\x20",
-&ptSmsPara->index,&ptSmsPara->stat,&ptSmsPara->length);}else{sscanf(
-pSmsRawContent,"\x25\x64\x20\x25\x64\x20\x25\x33\x32\x73\x20\x25\x64\x20",&
-ptSmsPara->index,&ptSmsPara->stat,ptSmsPara->alpha,&ptSmsPara->length);}}else if
-((0x96b+1703-0x1010)==iCmdId){if(P2==P1+(0x569+7902-0x2446)){sscanf(
+ptSmsPara,int iCmdId){char*P1=strchr(pSmsRawContent,((char)(0x1651+3702-0x249b))
+);if(NULL==P1){return ZUFI_FAIL;}char*P2=strchr((char*)(P1+(0xee5+4275-0x1f97)),
+((char)(0xb12+2605-0x1513)));if(NULL==P2){return ZUFI_FAIL;}char*P3=strchr((char
+*)(P2+(0x1371+2937-0x1ee9)),((char)(0xd2b+3355-0x1a1a)));atBase_PreProcRes(
+pSmsRawContent,contentSize);if((0xb66+6647-0x255c)==iCmdId){if(P3==P2+
+(0xe31+2872-0x1968)){sscanf(pSmsRawContent,
+"\x25\x64\x20\x25\x64\x20\x25\x64\x20",&ptSmsPara->index,&ptSmsPara->stat,&
+ptSmsPara->length);}else{sscanf(pSmsRawContent,
+"\x25\x64\x20\x25\x64\x20\x25\x33\x32\x73\x20\x25\x64\x20",&ptSmsPara->index,&
+ptSmsPara->stat,ptSmsPara->alpha,&ptSmsPara->length);}}else if(
+(0xc66+2528-0x1644)==iCmdId){if(P2==P1+(0x205d+1044-0x2470)){sscanf(
 pSmsRawContent,"\x25\x64\x20\x25\x64\x20",&ptSmsPara->stat,&ptSmsPara->length);}
 else{sscanf(pSmsRawContent,"\x25\x64\x20\x25\x33\x32\x73\x20\x25\x64\x20",&
 ptSmsPara->stat,ptSmsPara->alpha,&ptSmsPara->length);}}atBase_RestoreString(
 ptSmsPara->alpha);atBase_RestoreString(ptSmsPara->pdu);return ZUFI_SUCC;}
 #endif

 void zUfiSms_CmglRespProc(T_zSms_SmsInd*pSmsItem){T_zUfiSms_CmdStatus result=
-WMS_CMD_PROCESSING;T_zUfiSms_DbStoreData db_data={(0x22d2+707-0x2595)};
+WMS_CMD_PROCESSING;T_zUfiSms_DbStoreData db_data={(0x13a0+4853-0x2695)};
 zUfiSms_StoreType mem_store=WMS_STORAGE_TYPE_UIM_V01;unsigned char pdu_tmp[
-ZSMS_PDU_SIZE]={(0x1128+3671-0x1f7f)};int total_count=(0x160c+3270-0x22d2);int 
-sim_capability=(0xee3+5269-0x2378);printf(
+ZSMS_PDU_SIZE]={(0x14bf+1281-0x19c0)};int total_count=(0x15db+2647-0x2032);int 
+sim_capability=(0x6c3+5680-0x1cf3);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x45\x6e\x74\x65\x72\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x6c\x52\x65\x73\x70\x50\x72\x6f\x63\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x21" "\n"
 ,pSmsItem->index,pSmsItem->stat,pSmsItem->length);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x70\x64\x75\x20\x64\x61\x74\x61\x5f\x6c\x65\x6e\x3a\x25\x64\x2c\x20\x73\x74\x72\x3a\x25\x73\x21" "\n"
-,strlen(pSmsItem->pdu),pSmsItem->pdu);memset(&db_data,(0x1cd8+884-0x204c),sizeof
-(db_data));memset(pdu_tmp,(0xc43+6712-0x267b),sizeof(pdu_tmp));(void)
+,strlen(pSmsItem->pdu),pSmsItem->pdu);memset(&db_data,(0xca+4438-0x1220),sizeof(
+db_data));memset(pdu_tmp,(0x158d+2864-0x20bd),sizeof(pdu_tmp));(void)
 String2Bytes(pSmsItem->pdu,pdu_tmp,(int)strlen(pSmsItem->pdu));
-#if (0x166+2443-0xaf0)
-zUfiSms_GetReportStatus(pSmsItem->pdu,&pSmsItem->stat);if((0xaa0+1373-0xff8)==
+#if (0x1cb2+648-0x1f39)
+zUfiSms_GetReportStatus(pSmsItem->pdu,&pSmsItem->stat);if((0x831+7159-0x2423)==
 pSmsItem->stat){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x45\x6e\x74\x65\x72\x20\x70\x53\x6d\x73\x49\x74\x65\x6d\x2d\x3e\x73\x74\x61\x74\x20\x3d\x3d\x20\x35" "\n"
 );(void)zUfiSms_HandleReport(pdu_tmp);zUfiSms_DelModemSms(pSmsItem->index);
 return;}
 #endif

-#if (0xdd4+2531-0x17b6)
+#if (0xc57+3470-0x19e4)
 printf("\x2a\x2a\x2a\x2a\x75\x6e\x64\x65\x63\x6f\x64\x65\x3a\x25\x73" "\n",
 pdu_tmp);
 #endif

 (void)zUfiSms_DecodeSmsData(&db_data,pSmsItem->index,mem_store,(T_SmsStatus)
 pSmsItem->stat,WMS_MESSAGE_FORMAT_GW_PP_V01,pSmsItem->length,pdu_tmp);
-#if (0x2bf+3942-0x1224)
+#if (0xa14+3111-0x163a)
 printf("\x2a\x2a\x2a\x2a\x64\x65\x63\x6f\x64\x65\x65\x64\x3a\x25\x73" "\n",
 db_data.sms_content);
 #endif

-(void)zUfiSms_WriteSmsToDb(&db_data,mem_store,-(0x23e6+370-0x2557));{}
-#if (0x102+113-0x172)
+(void)zUfiSms_WriteSmsToDb(&db_data,mem_store,-(0xb2a+5638-0x212f));{}
+#if (0xd7+8334-0x2164)
 if(SMS_LOCATION_SIM==g_zUfiSms_CurLocation){CHAR simCapability[
-(0x9dd+4161-0x19ec)]={(0xec9+5644-0x24d5)};sc_cfg_get(
+(0x1e68+310-0x1f6c)]={(0xc4c+6260-0x24c0)};sc_cfg_get(
 ZTE_WMS_NVCONFIG_SIM_CAPABILITY,simCapability,sizeof(simCapability));
 sim_capability=atoi(simCapability);(void)zUfiSms_GetTotalCount(
 ZTE_WMS_DB_SIM_TABLE,&total_count);if(total_count==sim_capability){
@@ -1110,18 +1111,18 @@
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x68\x65\x63\x6b\x73\x74\x6f\x72\x65\x44\x69\x72\x20\x66\x61\x69\x6c\x65\x64\x2e" "\n"
 );return;}
 #ifdef WEBS_SECURITY

-if(access(ZTE_WMS_DB_PATH,F_OK)!=(0x1815+383-0x1994)){if((access(
-ZTE_WMS_TMP1_PATH,F_OK)==(0x10cd+4520-0x2275))&&(access(ZTE_WMS_SEC_PATH,F_OK)!=
-(0x4e8+1591-0xb1f))){if(rename(ZTE_WMS_TMP1_PATH,ZTE_WMS_SEC_PATH)!=
-(0xf17+2644-0x196b)){printf(
+if(access(ZTE_WMS_DB_PATH,F_OK)!=(0x7f1+5847-0x1ec8)){if((access(
+ZTE_WMS_TMP1_PATH,F_OK)==(0x1525+2366-0x1e63))&&(access(ZTE_WMS_SEC_PATH,F_OK)!=
+(0x1741+2125-0x1f8e))){if(rename(ZTE_WMS_TMP1_PATH,ZTE_WMS_SEC_PATH)!=
+(0x863+2489-0x121c)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x57\x4d\x53\x5f\x54\x4d\x50\x31\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c\x65\x64\x2e" "\n"
-);}}if((access(ZTE_WMS_TMP0_PATH,F_OK)==(0x11ad+3344-0x1ebd))&&(access(
-ZTE_WMS_SEC_PATH,F_OK)!=(0x6c3+3386-0x13fd))){if(rename(ZTE_WMS_TMP0_PATH,
-ZTE_WMS_SEC_PATH)!=(0x147+139-0x1d2)){printf(
+);}}if((access(ZTE_WMS_TMP0_PATH,F_OK)==(0x1488+3053-0x2075))&&(access(
+ZTE_WMS_SEC_PATH,F_OK)!=(0xd4+8960-0x23d4))){if(rename(ZTE_WMS_TMP0_PATH,
+ZTE_WMS_SEC_PATH)!=(0x5bd+4287-0x167c)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x57\x4d\x53\x5f\x54\x4d\x50\x30\x5f\x50\x41\x54\x48\x20\x66\x61\x69\x6c\x65\x64\x2e" "\n"
-);}}if(access(ZTE_WMS_SEC_PATH,F_OK)==(0x776+988-0xb52)){char rnum_buf[
-(0x1c16+1657-0x2277)]={(0x1084+229-0x1169)};char cmd[(0x67c+6723-0x203f)]={
-(0xca2+709-0xf67)};sc_cfg_get("\x72\x6e\x75\x6d\x5f\x61\x74",rnum_buf,sizeof(
+);}}if(access(ZTE_WMS_SEC_PATH,F_OK)==(0xc37+171-0xce2)){char rnum_buf[
+(0x1262+3525-0x200f)]={(0x93c+2227-0x11ef)};char cmd[(0x8d8+2845-0x1375)]={
+(0x869+4224-0x18e9)};sc_cfg_get("\x72\x6e\x75\x6d\x5f\x61\x74",rnum_buf,sizeof(
 rnum_buf));snprintf(cmd,sizeof(cmd),
 "\x2f\x62\x69\x6e\x2f\x6f\x70\x65\x6e\x73\x73\x6c\x20\x65\x6e\x63\x20\x2d\x64\x20\x2d\x61\x65\x73\x32\x35\x36\x20\x2d\x73\x61\x6c\x74\x20\x2d\x69\x6e\x20\x25\x73\x20\x2d\x6f\x75\x74\x20\x25\x73\x20\x2d\x70\x61\x73\x73\x20\x70\x61\x73\x73\x3a\x25\x73"
 ,ZTE_WMS_SEC_PATH,ZTE_WMS_DB_PATH,rnum_buf);zxic_system(cmd);}}
@@ -1133,48 +1134,48 @@
 zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);zUfiSms_SendSmsStatusInfo(
 MSG_SMS_DEFAULT);g_zUfiSms_MsgRefer=zUfiSms_GetSmsMaxReferInDb();
 g_zUfiSms_ConcatSmsReference=zUfiSms_GetConcatMaxReferInDb();}void 
-zUfiSms_CfgSmsNvInit(void){char tmp[(0x127b+1396-0x17e5)]={(0x272+6845-0x1d2f)};
+zUfiSms_CfgSmsNvInit(void){char tmp[(0x336+4323-0x140f)]={(0x13f+8070-0x20c5)};
 sc_cfg_set(NV_SMS_STORE,"");sc_cfg_set(NV_SMS_LOAD_RESULT,"");sc_cfg_set(
 ZTE_WMS_NVCONFIG_RECEVIED,"");sc_cfg_set(NV_SMS_CENTER_NUM,"");snprintf(tmp,
 sizeof(tmp),"\x25\x64",ZTE_WMS_DB_MSG_COUNT_MAX);sc_cfg_set(
 ZTE_WMS_NVCONFIG_NV_CAPABILITY,tmp);}VOID zUfiSms_InitCmdStatus(
 T_zUfiSms_StatusInfo*pStatusInfo,T_zUfiSms_CmdType iCmdId){memset((void*)
-pStatusInfo,(0x903+6540-0x228f),sizeof(T_zUfiSms_StatusInfo));pStatusInfo->cmd=
+pStatusInfo,(0x107+5615-0x16f6),sizeof(T_zUfiSms_StatusInfo));pStatusInfo->cmd=
 iCmdId;pStatusInfo->cmd_status=WMS_CMD_PROCESSING;pStatusInfo->err_code=
-ZTE_SMS_CMS_NONE;pStatusInfo->send_failed_count=(0x815+5742-0x1e83);pStatusInfo
-->delete_failed_count=(0x16af+3980-0x263b);(void)zUfiSms_SetCmdStatus(
-pStatusInfo);}void zUfiSms_CfgInit(void){char tmp[(0x732+399-0x8b7)]={
-(0x16fc+1541-0x1d01)};sc_cfg_set(NV_SMS_STATE,"");sc_cfg_set(
+ZTE_SMS_CMS_NONE;pStatusInfo->send_failed_count=(0xc99+1861-0x13de);pStatusInfo
+->delete_failed_count=(0x9a8+2975-0x1547);(void)zUfiSms_SetCmdStatus(pStatusInfo
+);}void zUfiSms_CfgInit(void){char tmp[(0x145f+1380-0x19b9)]={
+(0x1947+3251-0x25fa)};sc_cfg_set(NV_SMS_STATE,"");sc_cfg_set(
 ZTE_WMS_NVCONFIG_RECEVIED,"");sc_cfg_set(NV_SMS_LOAD_RESULT,"");sc_cfg_set(
 NV_SMS_RECV_RESULT,"");snprintf(tmp,sizeof(tmp),"\x25\x64",
 ZTE_WMS_DB_MSG_COUNT_MAX);sc_cfg_set(ZTE_WMS_NVCONFIG_NV_CAPABILITY,tmp);
 sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CAPABILITY,"");sc_cfg_set(
 ZTE_WMS_NVCONFIG_SMS_REPORT,"");sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");sc_cfg_set(
 NV_SMS_CENTER_NUM,"");}int zUfiSms_IsUnreadSms(T_zUfiSms_MemoryType mem_store){
-int total_count=(0x166f+2026-0x1e59);char buf[(0x1c24+2223-0x24bf)]={
-(0x3ea+4268-0x1496)};if(ZUFI_FAIL==zUfiSms_GetTagCountInDb(mem_store,
+int total_count=(0x1a17+1549-0x2024);char buf[(0x86a+1506-0xe38)]={
+(0xa92+2618-0x14cc)};if(ZUFI_FAIL==zUfiSms_GetTagCountInDb(mem_store,
 WMS_TAG_TYPE_MT_NOT_READ_V01,&total_count)){return FALSE;}sprintf(buf,"\x25\x64"
 ,total_count);sc_cfg_set(
 "\x73\x6d\x73\x5f\x75\x6e\x72\x65\x61\x64\x5f\x63\x6f\x75\x6e\x74",buf);if(
-(0x1c8+4423-0x130f)==total_count){return FALSE;}else{return TRUE;}}VOID 
+(0x1637+2640-0x2087)==total_count){return FALSE;}else{return TRUE;}}VOID 
 zUfiSms_SendSmsStatusInfo(wms_message_status_info sms_op){
-T_zUfi_SmsStatusInfoInd ind={(0xb2c+528-0xd3c)};CHAR temp[(0x29b+328-0x3b1)]={
-(0x178+8891-0x2433)};if(sms_op==MSG_SMS_NEW){ind.sms_new_ind=(0x23af+207-0x247d)
-;}if(sms_op==MSG_SMS_READING){ind.sms_is_reading=(0x1af3+989-0x1ecf);}if(
-zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV)){ind.sms_unread_ind=(0x1f3d+554-0x2166);}
-else{ind.sms_unread_ind=(0x16cf+901-0x1a54);}sc_cfg_get(
-"\x73\x6d\x73\x5f\x75\x6e\x72\x65\x61\x64\x5f\x63\x6f\x75\x6e\x74",temp,sizeof(
-temp));ind.sms_unread_count=atoi(temp);if((g_zUfiSms_MemFullFlag[
+T_zUfi_SmsStatusInfoInd ind={(0xbbd+4431-0x1d0c)};CHAR temp[(0x17f4+1542-0x1dc8)
+]={(0x1471+631-0x16e8)};if(sms_op==MSG_SMS_NEW){ind.sms_new_ind=
+(0x18d8+3069-0x24d4);}if(sms_op==MSG_SMS_READING){ind.sms_is_reading=
+(0x2003+687-0x22b1);}if(zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV)){ind.
+sms_unread_ind=(0x19d5+504-0x1bcc);}else{ind.sms_unread_ind=(0x215+968-0x5dd);}
+sc_cfg_get("\x73\x6d\x73\x5f\x75\x6e\x72\x65\x61\x64\x5f\x63\x6f\x75\x6e\x74",
+temp,sizeof(temp));ind.sms_unread_count=atoi(temp);if((g_zUfiSms_MemFullFlag[
 WMS_STORAGE_TYPE_NV_V01]==TRUE)||(g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_UIM_V01
-]==TRUE)){ind.sms_memory_full_ind=(0x42a+6998-0x1f7f);}else{ind.
-sms_memory_full_ind=(0x6d0+7101-0x228d);}printf(
+]==TRUE)){ind.sms_memory_full_ind=(0x997+2331-0x12b1);}else{ind.
+sms_memory_full_ind=(0x548+4405-0x167d);}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x53\x6d\x73\x53\x74\x61\x74\x75\x73\x49\x6e\x66\x6f\x20\x75\x6e\x72\x65\x61\x64\x20\x3d\x20\x25\x64\x2c\x20\x66\x75\x6c\x6c\x3d\x25\x64\x2c\x20\x6e\x65\x77\x3d\x25\x64\x2c\x20\x72\x65\x61\x64\x69\x6e\x67\x3d\x25\x64" "\n"
 ,ind.sms_unread_ind,ind.sms_memory_full_ind,ind.sms_new_ind,ind.sms_is_reading);
 ipc_send_message(MODULE_ID_SMS,MODULE_ID_MMI,MSG_CMD_SMS_STATUS_INFO_IND,sizeof(
-T_zUfi_SmsStatusInfoInd),&ind,(0x1c83+2277-0x2568));if(ind.sms_memory_full_ind==
-(0x1900+588-0x1b4b)){sc_cfg_set(NV_SMS_INIT_STATUS,
+T_zUfi_SmsStatusInfoInd),&ind,(0x1aa0+2757-0x2565));if(ind.sms_memory_full_ind==
+(0x12e4+3034-0x1ebd)){sc_cfg_set(NV_SMS_INIT_STATUS,
 "\x73\x6d\x73\x5f\x6d\x65\x6d\x6f\x72\x79\x5f\x66\x75\x6c\x6c");}else if(ind.
-sms_unread_ind==(0x1b1d+341-0x1c71)){sc_cfg_set(NV_SMS_INIT_STATUS,
+sms_unread_ind==(0xffd+5434-0x2536)){sc_cfg_set(NV_SMS_INIT_STATUS,
 "\x73\x6d\x73\x5f\x75\x6e\x72\x65\x61\x64");}else{sc_cfg_set(NV_SMS_INIT_STATUS,
 "\x73\x6d\x73\x5f\x6e\x6f\x72\x6d\x61\x6c");}return;}VOID BakNotificationSms(
 char*pushSms,int pushSmsLen){FILE*fp=NULL;int len;fp=fopen(
@@ -1183,7 +1184,7 @@
 "\x5b\x53\x4d\x53\x5d\x20\x42\x61\x6b\x4e\x6f\x74\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x53\x6d\x73\x20\x66\x6f\x70\x65\x6e\x20\x65\x72\x72\x6f\x72" "\n"
 );at_print(LOG_ERR,
 "\x66\x6f\x70\x65\x6e\x28\x20\x2f\x75\x73\x72\x2f\x64\x6d\x2f\x66\x6f\x74\x61\x5f\x70\x75\x73\x68\x5f\x6d\x73\x67\x2e\x64\x61\x74\x61\x20\x2c\x20\x27\x77\x2b\x27\x29\x20\x65\x72\x72\x6f\x72\x21"
-);return;}len=fwrite(pushSms,(0x3c0+8148-0x2393),pushSmsLen,fp);if(len==
+);return;}len=fwrite(pushSms,(0x201f+1515-0x2609),pushSmsLen,fp);if(len==
 pushSmsLen){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x42\x61\x6b\x4e\x6f\x74\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x53\x6d\x73\x20\x77\x72\x69\x74\x65\x20\x74\x6f\x20\x4e\x6f\x74\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x62\x61\x6b\x20\x66\x69\x6c\x65\x20\x4f\x4b\x2c\x20\x6c\x65\x6e\x3d\x25\x64\x20" "\n"
 ,len);printf(
diff --git a/ap/app/zte_comm/sms/src/sms_main.c b/ap/app/zte_comm/sms/src/sms_main.c
index 41feec4..aa42409 100755
--- a/ap/app/zte_comm/sms/src/sms_main.c
+++ b/ap/app/zte_comm/sms/src/sms_main.c
@@ -15,43 +15,43 @@
 g_zUfiSms_FinalCmgsBuf;extern int g_zUfiSms_CurConcatSegNo;extern 
 T_zUfiSms_DbStoreData g_zUfiSms_DbStoreData[ZTE_WMS_CONCAT_SMS_COUNT_MAX];extern
  int g_zUfiSms_SendFailedCount;extern int g_zUfiSms_ConcatTotalNum;extern UINT8 
-g_zUfiSms_IsConcatSendSuc;int iSmsIndex=(0x3b5+1781-0xaaa);int g_zSms_MsqId=-
-(0xc0c+6703-0x263a);int g_zSms_LocalMsqId=-(0xe2+1161-0x56a);sem_t g_sms_sem_id;
-T_zSms_optRsp g_smsOptRsp={(0x13ad+2843-0x1ec8)};static const T_zSmsHandleTable 
+g_zUfiSms_IsConcatSendSuc;int iSmsIndex=(0x168b+867-0x19ee);int g_zSms_MsqId=-
+(0x7c9+1495-0xd9f);int g_zSms_LocalMsqId=-(0xb6a+17-0xb7a);sem_t g_sms_sem_id;
+T_zSms_optRsp g_smsOptRsp={(0x1977+566-0x1bad)};static const T_zSmsHandleTable 
 SmsHandleWebTab[]={{MSG_CMD_SEND_SMS,atWeb_SendSms,TRUE},{
 MSG_CMD_DEL_SMS_BY_INDEX,atWeb_DelSmsByIndex,TRUE},{MSG_CMD_SMS_MODIFY_TAG,
 atWeb_ReadSms,TRUE},{MSG_CMD_DRAFTS_SAVE,atWeb_SaveSms,FALSE},{
 MSG_CMD_SMS_LOCATION_SET,atWeb_SetSms,TRUE},{MSG_CMD_SMS_OUTDATE_CHECK,
-atWeb_OutdateSmsCheck,TRUE},{(0x1f7+1866-0x941),NULL,FALSE}};VOID atWeb_SendSms(
+atWeb_OutdateSmsCheck,TRUE},{(0x19f+3215-0xe2e),NULL,FALSE}};VOID atWeb_SendSms(
 UINT8*pDatabuf){T_zGoaheadMsgBuf*ptMessage=NULL;T_zUfiSms_StatusInfo tStatus={
-(0x16a4+620-0x1910)};assert(pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)
+(0xf3c+2341-0x1861)};assert(pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)
 pDatabuf;zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_MSG_SEND);(void)
 zUfiSms_SendRawSms((T_zUfiSms_SendReq*)ptMessage->msg_data);}VOID 
 atWeb_DelSmsByIndex(UINT8*pDatabuf){T_zUfiSms_DelReq tDelReq={
-(0xe37+4045-0x1e04)};T_zUfiSms_CmdStatus result=WMS_CMD_PROCESSING;
-T_zUfiSms_StatusInfo tStatus={(0x60c+3297-0x12ed)};assert(pDatabuf!=NULL);printf
+(0x1f69+1067-0x2394)};T_zUfiSms_CmdStatus result=WMS_CMD_PROCESSING;
+T_zUfiSms_StatusInfo tStatus={(0x18f8+147-0x198b)};assert(pDatabuf!=NULL);printf
 ("[SMS] atWeb_DelSmsByIndex recv msg\n");memcpy(&tDelReq,pDatabuf,sizeof(
 T_zUfiSms_DelReq));zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_MSG_DELETE);result
 =zUfiSms_DeleteSms(&tDelReq);tStatus.cmd_status=result;(void)
 zUfiSms_SetCmdStatus(&tStatus);zUfiMmi_SendSmsStatus();}VOID atWeb_DelSmsByType(
 UINT8*pDatabuf){
-#if (0x1281+2098-0x1ab3)

+#if (0x7ea+444-0x9a6)

 WEB_DEL_SMS_BY_TYPE*req=NULL;req=(WEB_DEL_SMS_BY_TYPE*)pDatabuf;assert(req!=NULL
 );if(req->eLocation!=ZSMS_LOCATION_SIM){ZTE_LOG(LOG_ERR,
 "\x7a\x53\x6d\x73\x5f\x50\x72\x65\x70\x44\x65\x6c\x42\x79\x54\x79\x70\x65\x20\x70\x61\x72\x61\x20\x4e\x55\x4c\x4c\x2e" "\n"
 );return;}zSms_ChangeMainState(ZSMS_STATE_DELING);ZTE_LOG(LOG_DEBUG,
 "\x7a\x53\x6d\x73\x5f\x50\x72\x65\x70\x44\x65\x6c\x42\x79\x54\x79\x70\x65\x20\x70\x73\x74\x52\x65\x71\x2d\x3e\x65\x42\x6f\x78\x4e\x61\x6d\x65\x3d\x25\x64" "\n"
-,req->eBoxName);SMS_DeleteRecordFromXML(SMS_LOCATION_SIM,(0x21b+1691-0x8b6),req
+,req->eBoxName);SMS_DeleteRecordFromXML(SMS_LOCATION_SIM,(0x7ff+2849-0x1320),req
 ->eBoxName);if(req->eBoxName==SMS_INBOX){sms_LoadSmsFromSim();}
 #endif

 }VOID atWeb_ReadSms(UINT8*pDatabuf){T_zGoaheadMsgBuf*ptMessage=NULL;
 T_zUfiSms_CmdStatus result=WMS_CMD_PROCESSING;T_zUfiSms_StatusInfo tStatus={
-(0x1c42+1545-0x224b)};assert(pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)
+(0xe7c+4177-0x1ecd)};assert(pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)
 pDatabuf;zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_MSG_MODIFY_TAG);result=
 zUfiSms_ModifySmsTag((T_zUfiSms_ModifyFlag*)ptMessage->msg_data);tStatus.
 cmd_status=result;(void)zUfiSms_SetCmdStatus(&tStatus);}VOID atWeb_SaveSms(UINT8
 *pDatabuf){T_zGoaheadMsgBuf*ptMessage=NULL;T_zUfiSms_CmdStatus result=
-WMS_CMD_PROCESSING;T_zUfiSms_StatusInfo tStatus={(0x3c2+5790-0x1a60)};assert(
+WMS_CMD_PROCESSING;T_zUfiSms_StatusInfo tStatus={(0x1519+2291-0x1e0c)};assert(
 pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)pDatabuf;zUfiSms_InitCmdStatus(&
 tStatus,WMS_SMS_CMD_MSG_WRITE);result=zUfiSms_WriteRawSms((T_zUfiSms_SaveReq*)
 ptMessage->msg_data);if(g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_NV]){tStatus.
@@ -61,250 +61,251 @@
 zUfiSms_ChangeMainState(SMS_STATE_SAVING);sc_cfg_set(NV_SMS_SAVE_RESULT,
 "\x6f\x6b");}VOID atWeb_SetSms(UINT8*pDatabuf){T_zGoaheadMsgBuf*ptMessage=NULL;
 T_zUfiSms_CmdStatus result=WMS_CMD_PROCESSING;T_zUfiSms_StatusInfo tStatus={
-(0x940+609-0xba1)};printf(
+(0x218a+175-0x2239)};printf(
 "\x49\x4e\x54\x4f\x20\x61\x74\x57\x65\x62\x5f\x53\x65\x74\x53\x6d\x73\x2e" "\n")
 ;assert(pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)pDatabuf;
 zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_CFG_SET_PARAMETERS);result=
 zUfiSms_SetSmsPara((T_zUfiSms_ParaInfo*)ptMessage->msg_data);tStatus.cmd_status=
 result;(void)zUfiSms_SetCmdStatus(&tStatus);}VOID atWeb_OutdateSmsCheck(UINT8*
-pDatabuf){T_zUfiSms_DelReq tSmsDel={(0x2207+514-0x2409)};
+pDatabuf){T_zUfiSms_DelReq tSmsDel={(0x76f+7318-0x2405)};
 zUfiSms_CheckDbOutdateSms(ZTE_WMS_DB_NV_TABLE,&tSmsDel);printf(
 "\x2d\x2d\x2d\x2d\x6f\x75\x74\x20\x63\x6f\x75\x6e\x20\x6e\x76\x74\x3a\x20\x25\x64\x2d\x2d\x2d\x2d" "\n"
-,tSmsDel.all_or_count);if(tSmsDel.all_or_count>(0xba4+5270-0x203a)){
-atWeb_DelSmsByIndex(&tSmsDel);}memset(&tSmsDel,(0x1353+71-0x139a),sizeof(
+,tSmsDel.all_or_count);if(tSmsDel.all_or_count>(0xf49+980-0x131d)){
+atWeb_DelSmsByIndex(&tSmsDel);}memset(&tSmsDel,(0x27f+4029-0x123c),sizeof(
 T_zUfiSms_DelReq));zUfiSms_CheckDbOutdateSms(ZTE_WMS_DB_SIM_TABLE,&tSmsDel);
 printf(
 "\x2d\x2d\x2d\x2d\x6f\x75\x74\x20\x63\x6f\x75\x6e\x74\x20\x73\x69\x6d\x3a\x20\x25\x64\x2d\x2d\x2d\x2d" "\n"
-,tSmsDel.all_or_count);if(tSmsDel.all_or_count>(0x1460+1686-0x1af6)){
+,tSmsDel.all_or_count);if(tSmsDel.all_or_count>(0x42+10-0x4c)){
 atWeb_DelSmsByIndex(&tSmsDel);}}VOID zSms_HandleWebMsg(MSG_BUF*ptMsgBuf){UINT32 
-i=(0x5c8+5823-0x1c87);assert(ptMsgBuf!=NULL);printf(
+i=(0x1191+595-0x13e4);assert(ptMsgBuf!=NULL);printf(
 "\x73\x6d\x73\x20\x72\x65\x63\x76\x20\x6d\x73\x67\x20\x66\x72\x6f\x6d\x20\x77\x65\x62\x73\x65\x72\x76\x65\x72\x3a\x25\x64" "\n"
-,ptMsgBuf->usMsgCmd);while((0x539+7343-0x21e8)!=SmsHandleWebTab[i].msg_id){if(
+,ptMsgBuf->usMsgCmd);while((0x2115+1113-0x256e)!=SmsHandleWebTab[i].msg_id){if(
 ptMsgBuf->usMsgCmd==SmsHandleWebTab[i].msg_id){if(SmsHandleWebTab[i].need_block
 &&ptMsgBuf->src_id!=MODULE_ID_SMS){ipc_send_message(MODULE_ID_SMS,
 MODULE_ID_SMS_LOCAL,ptMsgBuf->usMsgCmd,ptMsgBuf->usDataLen,(unsigned char*)
-ptMsgBuf->aucDataBuf,(0x1a5+823-0x4dc));}else if(NULL!=SmsHandleWebTab[i].
+ptMsgBuf->aucDataBuf,(0x8c3+3885-0x17f0));}else if(NULL!=SmsHandleWebTab[i].
 func_ptr){SmsHandleWebTab[i].func_ptr(ptMsgBuf->aucDataBuf);}break;}i++;}}SINT32
  zSms_SendMsg(USHORT Msg_cmd,USHORT us_DataLen,UCHAR*pData){printf(
 "\x73\x6d\x73\x20\x73\x65\x6e\x64\x20\x6d\x73\x67\x20\x63\x6d\x64\x3a\x25\x64" "\n"
 ,Msg_cmd);ipc_send_message(MODULE_ID_SMS,MODULE_ID_AT_CTL,Msg_cmd,us_DataLen,(
-unsigned char*)pData,(0x1410+4188-0x246c));return(0xc7+5865-0x17b0);}SINT32 
-zSms_SendCmgsReq(VOID){T_zSms_SendSmsReq sendSmsInfo={(0x18fd+1846-0x2033)};
-memset(&sendSmsInfo,(0xa70+5286-0x1f16),sizeof(T_zSms_SendSmsReq));sendSmsInfo.
+unsigned char*)pData,(0x402+7157-0x1ff7));return(0x16f+4098-0x1171);}SINT32 
+zSms_SendCmgsReq(VOID){T_zSms_SendSmsReq sendSmsInfo={(0x12aa+1874-0x19fc)};
+memset(&sendSmsInfo,(0xbc9+5597-0x21a6),sizeof(T_zSms_SendSmsReq));sendSmsInfo.
 length=g_zUfiSms_FinalCmgsBuf.length;if(strlen(g_zUfiSms_FinalCmgsBuf.pdu)<
-ZSMS_PDU_SIZE-(0x12d3+3671-0x2129)){memcpy(sendSmsInfo.pdu,
-g_zUfiSms_FinalCmgsBuf.pdu,strlen(g_zUfiSms_FinalCmgsBuf.pdu));}else{printf(
+ZSMS_PDU_SIZE-(0x5a+2897-0xbaa)){memcpy(sendSmsInfo.pdu,g_zUfiSms_FinalCmgsBuf.
+pdu,strlen(g_zUfiSms_FinalCmgsBuf.pdu));}else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6d\x67\x73\x52\x65\x71\x20\x70\x64\x75\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x25\x73" "\n"
 ,g_zUfiSms_FinalCmgsBuf.pdu);memcpy(sendSmsInfo.pdu,g_zUfiSms_FinalCmgsBuf.pdu,
-ZSMS_PDU_SIZE-(0x1650+2327-0x1f65));}*(sendSmsInfo.pdu+strlen(
+ZSMS_PDU_SIZE-(0x15ac+861-0x1907));}*(sendSmsInfo.pdu+strlen(
 g_zUfiSms_FinalCmgsBuf.pdu))=ZSMS_CTRL_Z_CHAR;
-#if (0x5cc+6306-0x1e6d)
+#if (0xe5+9743-0x26f3)
 printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6d\x67\x73\x52\x65\x71\x20\x73\x65\x6e\x64\x20\x64\x61\x74\x61" "\n"
 );printf("\n" "\x5b\x53\x4d\x53\x5d\x25\x73" "\n",sendSmsInfo.pdu);
 #endif

 zSms_SendMsg(MSG_CMD_SENDSMS_REQ,sizeof(T_zSms_SendSmsReq),&sendSmsInfo);
-sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0xf67+3109-0x1b8b)){return 
+sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x12d8+5137-0x26e8)){return 
 ZSMS_RESULT_OK;}else{return ZSMS_RESULT_ERROR;}}VOID zSms_RecvCmgsOk(VOID){
 printf(
 "\x73\x6d\x73\x20\x73\x65\x6e\x64\x65\x64\x20\x73\x75\x63\x63\x65\x73\x73\x2e\x20" "\n"
 );g_zUfiSms_CurConcatSegNo++;if(g_zUfiSms_CurConcatSegNo>
 ZTE_WMS_CONCAT_SMS_COUNT_MAX){return;}g_zUfiSms_DbStoreData[
-g_zUfiSms_CurConcatSegNo-(0x2106+1278-0x2603)].tag=WMS_TAG_TYPE_MO_SENT_V01;
+g_zUfiSms_CurConcatSegNo-(0x20e3+463-0x22b1)].tag=WMS_TAG_TYPE_MO_SENT_V01;
 zUfiSms_CmgsRespProc();}VOID zSms_RecvCmgsErr(VOID){printf(
 "\x73\x6d\x73\x20\x73\x65\x6e\x64\x65\x64\x20\x66\x61\x69\x6c\x2e\x20" "\n");
 g_zUfiSms_CurConcatSegNo++;if(g_zUfiSms_CurConcatSegNo>
 ZTE_WMS_CONCAT_SMS_COUNT_MAX){return;}g_zUfiSms_SendFailedCount++;printf(
 "\x73\x65\x6e\x64\x20\x73\x6d\x73\x20\x66\x61\x69\x6c\x65\x64\x2c\x73\x6f\x20\x77\x72\x69\x74\x65\x20\x73\x6d\x73\x20\x74\x6f\x20\x64\x72\x61\x66\x74\x62\x6f\x78\x2e" "\n"
-);g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-(0x160a+2738-0x20bb)].tag=
-WMS_TAG_TYPE_MO_NOT_SENT_V01;if(g_zUfiSms_ConcatTotalNum>(0x1f24+1551-0x2532)){
+);g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-(0x573+2010-0xd4c)].tag=
+WMS_TAG_TYPE_MO_NOT_SENT_V01;if(g_zUfiSms_ConcatTotalNum>(0xf9f+3718-0x1e24)){
 g_zUfiSms_IsConcatSendSuc=FALSE;}zUfiSms_CmgsRespProc();}SINT32 zSms_SendCmgdReq
-(UINT8 index){T_zSms_DelSmsReq delSmsReq={(0x1cd1+600-0x1f29)};delSmsReq.index=
+(UINT8 index){T_zSms_DelSmsReq delSmsReq={(0x275+335-0x3c4)};delSmsReq.index=
 index;zSms_SendMsg(MSG_CMD_DELSMS_REQ,sizeof(T_zSms_DelSmsReq),&delSmsReq);
-sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x32d+2528-0xd0c)){return 
+sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x1376+384-0x14f5)){return 
 ZSMS_RESULT_OK;}else{return ZSMS_RESULT_ERROR;}}VOID zSms_RecvCmgdOk(VOID){CHAR 
-strUsed[(0xf1d+792-0x122b)]={(0xfff+5525-0x2594)};int used=(0xb57+1781-0x124c);
-int tmp_i=(0xeb1+4584-0x2099);sc_cfg_set(NV_SMS_DEL_RESULT,"\x6f\x6b");printf(
+strUsed[(0xd7+3541-0xea2)]={(0xb2d+4087-0x1b24)};int used=(0x14cc+3351-0x21e3);
+int tmp_i=(0x252+9009-0x2583);sc_cfg_set(NV_SMS_DEL_RESULT,"\x6f\x6b");printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x65\x74\x20\x73\x69\x6d\x5f\x64\x65\x6c\x5f\x72\x65\x73\x75\x6c\x74\x20\x74\x6f\x20\x4f\x4b\x2e\x20" "\n"
 );sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));tmp_i=atoi(
-strUsed);if(tmp_i<(0x367+8326-0x23ed)||tmp_i>INT_MAX-(0x1479+2417-0x1de9)){
+strUsed);if(tmp_i<(0x368+7051-0x1ef3)||tmp_i>INT_MAX-(0x14fd+1677-0x1b89)){
 at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x57\x4d\x53\x5f\x4e\x56\x43\x4f\x4e\x46\x49\x47\x5f\x53\x49\x4d\x5f\x43\x41\x52\x44\x5f\x55\x53\x45\x44\x20\x74\x6d\x70\x5f\x69\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,tmp_i);tmp_i=(0x591+2416-0xf01);}used=tmp_i-(0x1c19+1437-0x21b5);if(used<
-(0x1214+5313-0x26d5)){used=(0x6f4+5758-0x1d72);}memset(&strUsed,
-(0x1416+2066-0x1c28),(0x48b+8362-0x252b));snprintf(strUsed,sizeof(strUsed),
+,tmp_i);tmp_i=(0x14a+7807-0x1fc9);}used=tmp_i-(0x1f66+1791-0x2664);if(used<
+(0x11ea+3649-0x202b)){used=(0x1d52+513-0x1f53);}memset(&strUsed,
+(0x862+7814-0x26e8),(0x513+3054-0x10f7));snprintf(strUsed,sizeof(strUsed),
 "\x25\x64",used);sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed);}VOID 
 zSms_RecvCmgdErr(VOID){sc_cfg_set(NV_SMS_DEL_RESULT,"\x66\x61\x69\x6c");printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x65\x74\x20\x73\x69\x6d\x5f\x64\x65\x6c\x5f\x72\x65\x73\x75\x6c\x74\x20\x74\x6f\x20\x66\x61\x69\x6c\x2e\x20" "\n"
-);}VOID zSms_RecvCmgdFinish(VOID){char StrValue[(0x6c3+2576-0x10c9)]={
-(0xb81+5570-0x2143)};CHAR strTotal[(0x587+3544-0x1355)]={(0x7bd+5969-0x1f0e)};
-CHAR strUsed[(0x137d+4472-0x24eb)]={(0xa30+6794-0x24ba)};int total=
-(0x148d+1997-0x1c5a);int used=(0xfdc+2661-0x1a41);int remain=(0x720+6782-0x219e)
-;sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));used=atoi(
-strUsed);if(used<(0x37c+8838-0x2602)||used>INT_MAX-(0xe05+6283-0x268f)){at_print
-(LOG_ERR,
+);}VOID zSms_RecvCmgdFinish(VOID){char StrValue[(0xcab+2288-0x1591)]={
+(0x490+8110-0x243e)};CHAR strTotal[(0x12dc+3963-0x224d)]={(0x1e5c+2001-0x262d)};
+CHAR strUsed[(0x130c+1118-0x1760)]={(0x49f+1647-0xb0e)};int total=
+(0xae0+358-0xc46);int used=(0x13ef+376-0x1567);int remain=(0xd9d+5619-0x2390);
+sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));used=atoi(
+strUsed);if(used<(0x13ad+1156-0x1831)||used>INT_MAX-(0x1915+2622-0x2352)){
+at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x57\x4d\x53\x5f\x4e\x56\x43\x4f\x4e\x46\x49\x47\x5f\x53\x49\x4d\x5f\x43\x41\x52\x44\x5f\x55\x53\x45\x44\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,used);used=(0x2d8+2597-0xcfd);}sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,
-strTotal,sizeof(strTotal));total=atoi(strTotal);if(total<(0xe3a+5031-0x21e1)||
-total>INT_MAX-(0xc2b+1225-0x10f3)){at_print(LOG_ERR,
+,used);used=(0x1b9+3520-0xf79);}sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,
+strTotal,sizeof(strTotal));total=atoi(strTotal);if(total<(0x810+5232-0x1c80)||
+total>INT_MAX-(0x139d+1410-0x191e)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x57\x4d\x53\x5f\x4e\x56\x43\x4f\x4e\x46\x49\x47\x5f\x53\x49\x4d\x5f\x43\x41\x52\x44\x5f\x54\x4f\x54\x41\x4c\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,total);total=(0x24cd+513-0x26ce);}remain=total-used;if(remain<
-(0x3a4+4521-0x154d)){remain=(0x713+3177-0x137c);}memset(&StrValue,
-(0xf20+6019-0x26a3),(0x6a5+4600-0x1893));snprintf(StrValue,sizeof(StrValue),
+,total);total=(0x2f3+7681-0x20f4);}remain=total-used;if(remain<
+(0x65+7129-0x1c3e)){remain=(0xfd5+733-0x12b2);}memset(&StrValue,
+(0x1d4f+951-0x2106),(0x20b+6985-0x1d4a));snprintf(StrValue,sizeof(StrValue),
 "\x25\x64",remain);sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_REMAIN,StrValue);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x69\x6d\x53\x6d\x73\x20\x75\x73\x65\x64\x3d\x25\x64\x2c\x72\x65\x6d\x61\x69\x6e\x3d\x25\x64\x2c\x74\x6f\x74\x61\x6c\x3d\x25\x64" "\n"
 ,used,remain,total);zUfiSms_ChangeMainState(SMS_STATE_DELED);sc_cfg_set(
 NV_SMS_DB_CHANGE,"\x31");}int zSms_SendZmenaReq(SINT32 avail){T_zSms_StroageReq 
-storageReq={(0x443+8197-0x2448)};storageReq.type=avail;zSms_SendMsg(
+storageReq={(0x835+6957-0x2362)};storageReq.type=avail;zSms_SendMsg(
 MSG_CMD_STORAGE_CAP_REQ,sizeof(T_zSms_StroageReq),&storageReq);sem_wait(&
-g_sms_sem_id);if(g_smsOptRsp.result==(0x206+9064-0x256d)){return ZSMS_RESULT_OK;
+g_sms_sem_id);if(g_smsOptRsp.result==(0x7d9+5757-0x1e55)){return ZSMS_RESULT_OK;
 }else{return ZSMS_RESULT_ERROR;}}int zSms_SendCmgrReq(UINT8 index){
-T_zSms_ModifyTagReq modTagReq={(0xbb+6558-0x1a59)};modTagReq.index=index;
+T_zSms_ModifyTagReq modTagReq={(0xfd6+413-0x1173)};modTagReq.index=index;
 zSms_SendMsg(MSG_CMD_MODIFY_TAG_REQ,sizeof(T_zSms_ModifyTagReq),&modTagReq);
-sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x1c2a+1776-0x2319)){return 
+sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x17b0+1572-0x1dd3)){return 
 ZSMS_RESULT_OK;}else{return ZSMS_RESULT_ERROR;}}int zSms_SetCscaReq(PSTR sca){
 T_zSms_SetScaReq setscareq;strncpy(setscareq.sca,sca,sizeof(setscareq.sca)-
-(0x12f9+664-0x1590));zSms_SendMsg(MSG_CMD_SCA_SET_REQ,sizeof(T_zSms_SetScaReq),&
-setscareq);sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x393+4300-0x145e)){
+(0x1080+5266-0x2511));zSms_SendMsg(MSG_CMD_SCA_SET_REQ,sizeof(T_zSms_SetScaReq),
+&setscareq);sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x206+8380-0x22c1)){
 return ZSMS_RESULT_OK;}else{return ZSMS_RESULT_ERROR;}}int zSms_SendCnmiReq(PSTR
- pAtCmdPara){T_zSms_NotifySetReq notifySetReq={(0x200+4763-0x149b)};if(
-(0xbf8+2271-0x14d7)==strcmp(pAtCmdPara,"\x73\x69\x6d")){notifySetReq.mt=
-(0x1ac3+581-0x1d07);}else{notifySetReq.mt=(0x160+6206-0x199c);}zSms_SendMsg(
+ pAtCmdPara){T_zSms_NotifySetReq notifySetReq={(0x749+6955-0x2274)};if(
+(0x75c+6291-0x1fef)==strcmp(pAtCmdPara,"\x73\x69\x6d")){notifySetReq.mt=
+(0x1c4f+1012-0x2042);}else{notifySetReq.mt=(0x539+3129-0x1170);}zSms_SendMsg(
 MSG_CMD_NOTIFY_SET_REQ,sizeof(T_zSms_NotifySetReq),&notifySetReq);sem_wait(&
-g_sms_sem_id);if(g_smsOptRsp.result==(0x16d+4818-0x143e)){return ZSMS_RESULT_OK;
-}else{return ZSMS_RESULT_ERROR;}}VOID zSms_RecvCmtInd(UINT8*pDatabuf){CHAR 
-needSMS[(0x1a78+2932-0x25ba)]={(0xdad+5862-0x2493)};sc_cfg_get(
-NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x2a3+7484-0x1fdf)==strcmp(
+g_sms_sem_id);if(g_smsOptRsp.result==(0x1e67+1225-0x232f)){return ZSMS_RESULT_OK
+;}else{return ZSMS_RESULT_ERROR;}}VOID zSms_RecvCmtInd(UINT8*pDatabuf){CHAR 
+needSMS[(0xf23+5420-0x241d)]={(0x139+5217-0x159a)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x98d+3902-0x18cb)==strcmp(
 needSMS,"\x6e\x6f")){printf(
 "\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
-);return;}T_zSms_SmsInd tCmtRsp={(0x9f+5617-0x1690)};memcpy(&tCmtRsp,(
+);return;}T_zSms_SmsInd tCmtRsp={(0x219+2680-0xc91)};memcpy(&tCmtRsp,(
 T_zSms_SmsInd*)pDatabuf,sizeof(T_zSms_SmsInd));zUfiSms_CmtRespProc(&tCmtRsp);
 zUfiMmi_SendSmsStatus();sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}VOID 
-zSms_RecvCmtiInd(UINT8*pDatabuf){char sms_Main_state[(0x922+5114-0x1cfe)]={
-(0xaa7+6220-0x22f3)};T_zSms_SmsIndexInd*smsIdxInd=(T_zSms_SmsIndexInd*)pDatabuf;
-CHAR needSMS[(0x1a72+2176-0x22c0)]={(0x1a5f+309-0x1b94)};sc_cfg_get(
-NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x1917+2968-0x24af)==strcmp(
+zSms_RecvCmtiInd(UINT8*pDatabuf){char sms_Main_state[(0x12f0+1365-0x1827)]={
+(0xc02+3647-0x1a41)};T_zSms_SmsIndexInd*smsIdxInd=(T_zSms_SmsIndexInd*)pDatabuf;
+CHAR needSMS[(0xf40+5668-0x2532)]={(0x20ed+730-0x23c7)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x1bb+2612-0xbef)==strcmp(
 needSMS,"\x6e\x6f")){printf(
 "\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
 );return;}sc_cfg_get(NV_SMS_STATE,sms_Main_state,sizeof(sms_Main_state));if(
 strcmp(sms_Main_state,"\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67")==
-(0x1ccd+998-0x20b3)){printf(
+(0xf46+2453-0x18db)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x69\x52\x73\x70\x3a\x20\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67" "\n"
-);return;}if((0x4b+3139-0xc8e)==strncmp("\x53\x4d",smsIdxInd->storetype,
-(0x13fb+1281-0x18fa))){zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);
+);return;}if((0x4d3+7695-0x22e2)==strncmp("\x53\x4d",smsIdxInd->storetype,
+(0x8b1+4088-0x18a7))){zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);
 zUfiSms_ChangeMainState(SMS_STATE_RECVING);zSms_SendZmgrReq(smsIdxInd->index);}
 else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x69\x52\x73\x70\x20\x3a\x73\x74\x6f\x72\x65\x20\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x6e\x6f\x74\x20\x53\x4d\x2e" "\n"
 );}sc_cfg_set(NV_SMS_RECV_RESULT,"");}VOID zSms_RecvCdsInd(UINT8*pDatabuf){CHAR 
-needSMS[(0xbab+6411-0x2484)]={(0x1cd+4746-0x1457)};sc_cfg_get(
-NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x3f6+3041-0xfd7)==strcmp(
+needSMS[(0xa05+4223-0x1a52)]={(0xd04+4760-0x1f9c)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x65a+5236-0x1ace)==strcmp(
 needSMS,"\x6e\x6f")){printf(
 "\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
-);return;}T_zSms_SmsInd tCmtRsp={(0x16+9491-0x2529)};memcpy(&tCmtRsp,(
+);return;}T_zSms_SmsInd tCmtRsp={(0x1b0+7036-0x1d2c)};memcpy(&tCmtRsp,(
 T_zSms_SmsInd*)pDatabuf,sizeof(T_zSms_SmsInd));zUfiSms_CdsRespProc(&tCmtRsp);
 zUfiMmi_SendSmsStatus();sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}VOID 
-zSms_RecvCdsiInd(UINT8*pDatabuf){char sms_Main_state[(0x1337+3046-0x1eff)]={
-(0x1862+531-0x1a75)};T_zSms_SmsIndexInd*smsIdxInd=(T_zSms_SmsIndexInd*)pDatabuf;
-CHAR needSMS[(0xdd4+4822-0x2078)]={(0xd4b+3874-0x1c6d)};sc_cfg_get(
-NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x190+7971-0x20b3)==strcmp(
+zSms_RecvCdsiInd(UINT8*pDatabuf){char sms_Main_state[(0x5f+8624-0x21f1)]={
+(0x1cd8+1377-0x2239)};T_zSms_SmsIndexInd*smsIdxInd=(T_zSms_SmsIndexInd*)pDatabuf
+;CHAR needSMS[(0x132b+3399-0x2040)]={(0x1b27+1653-0x219c)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x961+911-0xcf0)==strcmp(
 needSMS,"\x6e\x6f")){printf(
 "\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
 );return;}sc_cfg_get(NV_SMS_STATE,sms_Main_state,sizeof(sms_Main_state));if(
 strcmp(sms_Main_state,"\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67")==
-(0x2bd+4477-0x143a)){printf(
+(0x1ad7+1010-0x1ec9)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x69\x52\x73\x70\x3a\x20\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67" "\n"
-);return;}if((0x6f3+3765-0x15a8)==strncmp("\x53\x4d",smsIdxInd->storetype,
-(0xa21+1491-0xff2))){zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);
+);return;}if((0x123+2574-0xb31)==strncmp("\x53\x4d",smsIdxInd->storetype,
+(0x59b+5855-0x1c78))){zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);
 zUfiSms_ChangeMainState(SMS_STATE_RECVING);zSms_SendZmgrReq(smsIdxInd->index);}
 else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x69\x52\x73\x70\x20\x3a\x73\x74\x6f\x72\x65\x20\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x6e\x6f\x74\x20\x53\x4d\x2e" "\n"
 );}sc_cfg_set(NV_SMS_RECV_RESULT,"");}int zSms_SendCnmaReq(int ack_mode){
-T_zSms_SmsAckReq ackReq={(0x9bc+4277-0x1a71)};CHAR ackPduStr[(0xe85+3787-0x1d1e)
-]={(0x2087+1424-0x2617)};ackReq.ackmode=ack_mode;if(ack_mode==
-(0xd55+5600-0x2333)){zUfiSms_EncodePdu_DeliverReport(ackPduStr,
-(0x188a+3886-0x26e5));memcpy(ackReq.pdu,ackPduStr,strlen(ackPduStr));
-#if (0x2205+202-0x22cf)

-if(strlen(ackPduStr)<ZSMS_PDU_SIZE-(0x405+8717-0x2611)){memcpy(ackReq.pdu,
+T_zSms_SmsAckReq ackReq={(0x105f+4645-0x2284)};CHAR ackPduStr[
+(0x770+4926-0x1a7c)]={(0x9ba+3951-0x1929)};ackReq.ackmode=ack_mode;if(ack_mode==
+(0x31a+2442-0xca2)){zUfiSms_EncodePdu_DeliverReport(ackPduStr,
+(0x543+3389-0x11ad));memcpy(ackReq.pdu,ackPduStr,strlen(ackPduStr));
+#if (0x7c4+1554-0xdd6)

+if(strlen(ackPduStr)<ZSMS_PDU_SIZE-(0x463+7376-0x2132)){memcpy(ackReq.pdu,
 ackPduStr,strlen(ackPduStr));}else{at_print(LOG_DEBUG
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x20\x70\x64\x75\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x25\x73" "\n"
-,ackPduStr);memcpy(ackReq.pdu,ackPduStr,ZSMS_PDU_SIZE-(0x1913+1203-0x1dc4));}
+,ackPduStr);memcpy(ackReq.pdu,ackPduStr,ZSMS_PDU_SIZE-(0x7cf+5732-0x1e31));}
 #endif     

 *(ackReq.pdu+strlen(ackPduStr))=ZSMS_CTRL_Z_CHAR;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x2e\x20\x70\x64\x75\x3d\x20\x25\x73" "\n"
-,ackReq.pdu);ackReq.length=strlen(ackPduStr)/(0x7ab+5344-0x1c89);}zSms_SendMsg(
+,ackReq.pdu);ackReq.length=strlen(ackPduStr)/(0xac3+7064-0x2659);}zSms_SendMsg(
 MSG_CMD_SMSACK_REQ,sizeof(T_zSms_SmsAckReq),&ackReq);sem_wait(&g_sms_sem_id);if(
-g_smsOptRsp.result==(0xd6a+97-0xdca)){return ZSMS_RESULT_OK;}else{return 
+g_smsOptRsp.result==(0xd08+4067-0x1cea)){return ZSMS_RESULT_OK;}else{return 
 ZSMS_RESULT_ERROR;}}int zSms_SendZmgrReq(int index){T_zSms_ReadSmsReq readSmsReq
-={(0x245f+461-0x262c)};iSmsIndex=index;printf(
+={(0x1f69+1816-0x2681)};iSmsIndex=index;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x5a\x6d\x67\x72\x52\x65\x71\x20\x47\x65\x74\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2e" "\n"
 ,iSmsIndex);readSmsReq.index=index;zSms_SendMsg(MSG_CMD_READSMS_REQ,sizeof(
-T_zSms_ReadSmsReq),&readSmsReq);return(0x5a7+5486-0x1b15);}VOID zSms_RecvZmgrRsp
-(UINT8*pDatabuf){T_zSms_SmsInd tCmgrRsp={(0x4ed+4896-0x180d)};memcpy(&tCmgrRsp,(
-T_zSms_SmsInd*)pDatabuf,sizeof(T_zSms_SmsInd));tCmgrRsp.index=iSmsIndex;
-zUfiSms_ZmgrRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();}VOID zSms_RecvZmgrOk(
-UINT8*pDatabuf){T_zSms_optRsp smsOptRsp={(0x22dc+23-0x22f3)};memcpy(&smsOptRsp,(
-T_zSms_optRsp*)pDatabuf,sizeof(T_zSms_optRsp));if(smsOptRsp.result==
-(0x495+1009-0x885)){sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}else{printf(
+T_zSms_ReadSmsReq),&readSmsReq);return(0x1477+2758-0x1f3d);}VOID 
+zSms_RecvZmgrRsp(UINT8*pDatabuf){T_zSms_SmsInd tCmgrRsp={(0x47b+1818-0xb95)};
+memcpy(&tCmgrRsp,(T_zSms_SmsInd*)pDatabuf,sizeof(T_zSms_SmsInd));tCmgrRsp.index=
+iSmsIndex;zUfiSms_ZmgrRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();}VOID 
+zSms_RecvZmgrOk(UINT8*pDatabuf){T_zSms_optRsp smsOptRsp={(0x1d+1203-0x4d0)};
+memcpy(&smsOptRsp,(T_zSms_optRsp*)pDatabuf,sizeof(T_zSms_optRsp));if(smsOptRsp.
+result==(0xc35+4070-0x1c1a)){sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}else{
+printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x5a\x6d\x67\x72\x45\x72\x72\x20\x20\x53\x4d\x53\x20\x7a\x6d\x67\x72\x20\x69\x73\x20\x66\x61\x69\x6c" "\n"
 );sc_cfg_set(NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(
 SMS_STATE_RECVED);}}VOID zSms_RecvZpbicInd(UINT8*pDatabuf){T_zAt_ZpbicRes*ptPara
 =ZUFI_NULL;if(pDatabuf==NULL){return;}ptPara=(T_zAt_ZpbicRes*)(pDatabuf);if((
-(0x40b+5886-0x1b08)==ptPara->result)&&((0xa44+334-0xb92)==ptPara->opertype)){
-CHAR needSms[(0x1028+4477-0x2173)]={(0xb19+773-0xe1e)};sc_cfg_get(
-NV_NEED_SUPPORT_SMS,needSms,sizeof(needSms));if((0x23a0+348-0x24fc)!=strcmp(
+(0x5a8+8476-0x26c3)==ptPara->result)&&((0x1cd2+59-0x1d0d)==ptPara->opertype)){
+CHAR needSms[(0x12ab+179-0x132c)]={(0x18ed+1143-0x1d64)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSms,sizeof(needSms));if((0x207b+630-0x22f1)!=strcmp(
 needSms,"\x6e\x6f")){zSvr_Zpbic_Sms_Init();}}}VOID zSms_RecvCpmsInd(UINT8*
 pDatabuf){T_zSms_CpmsInd*cpmsInd=(T_zSms_CpmsInd*)pDatabuf;CHAR strBuf[
-(0x316+5220-0x1770)]={(0xe98+1049-0x12b1)};int remainSpace=(0xff0+3939-0x1f53);
+(0x629+8326-0x26a5)]={(0x1a10+2329-0x2329)};int remainSpace=(0x6e2+874-0xa4c);
 snprintf(strBuf,sizeof(strBuf),"\x25\x64",cpmsInd->total);sc_cfg_set(
 ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,strBuf);sc_cfg_set(
-ZTE_WMS_NVCONFIG_SIM_CAPABILITY,strBuf);memset(&strBuf,(0x583+871-0x8ea),
-(0x1a0+5535-0x1735));snprintf(strBuf,sizeof(strBuf),"\x25\x64",cpmsInd->used);
+ZTE_WMS_NVCONFIG_SIM_CAPABILITY,strBuf);memset(&strBuf,(0xad7+5443-0x201a),
+(0x19da+2799-0x24bf));snprintf(strBuf,sizeof(strBuf),"\x25\x64",cpmsInd->used);
 sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strBuf);remainSpace=cpmsInd->total-
-cpmsInd->used;memset(&strBuf,(0x10b1+3979-0x203c),(0x718+268-0x81a));snprintf(
-strBuf,sizeof(strBuf),"\x25\x64",remainSpace);sc_cfg_set(
+cpmsInd->used;memset(&strBuf,(0x108a+5337-0x2563),(0x1527+2765-0x1fea));snprintf
+(strBuf,sizeof(strBuf),"\x25\x64",remainSpace);sc_cfg_set(
 ZTE_WMS_NVCONFIG_SIM_CARD_REMAIN,strBuf);sc_cfg_set(NV_SMS_STORE,"\x6f\x6b");}
-#define AT_CMD_MAX (0xc70+2789-0x1715)

-#define ZAT_TAB_REPLACE                     ((unsigned char )((0x8d7+1033-0xbe4)\
+#define AT_CMD_MAX (0x66c+1764-0xd10)

+#define ZAT_TAB_REPLACE                     ((unsigned char )((0x4b3+2926-0xf25)\
 ))    

 #define ZAT_NULL_FILL                       ((unsigned char )(\
-(0xe5d+4088-0x1d58)))    

+(0x15ea+3110-0x2113)))    

 #define ZAT_SPACE_REPLACE                   ((unsigned char )(\
-(0x11a8+5336-0x2582)))    

+(0xc9d+1337-0x10d8)))    

 #define ZAT_LF_REPLACE                      ((unsigned char )(\
-(0xb60+6086-0x222b)))    

+(0x21f+4888-0x143c)))    

 #define ZAT_CR_REPLACE                      ((unsigned char )(\
-(0x1ea+7357-0x1dad)))    

+(0x805+5144-0x1b23)))    

 static void atBase_PreProcRes(char*pParaLine,int paraSize){signed long flg=
-(0x1081+5593-0x265a);unsigned long i=(0x146b+916-0x17ff);unsigned long length=
-(0x19ff+501-0x1bf4);char*pSource=pParaLine;char*pDest=NULL;char*pStrDestMalloc=(
+(0x1095+4587-0x2280);unsigned long i=(0xb5a+4875-0x1e65);unsigned long length=
+(0xbc2+6769-0x2633);char*pSource=pParaLine;char*pDest=NULL;char*pStrDestMalloc=(
 char*)malloc(AT_CMD_MAX);if(NULL==pStrDestMalloc){return;}memset(pStrDestMalloc,
-(0xdaa+345-0xf03),AT_CMD_MAX);assert(pParaLine!=NULL);pDest=pStrDestMalloc;
-length=strlen(pParaLine);if((length==(0x124d+4262-0x22f3))||(length>=AT_CMD_MAX)
-){free(pStrDestMalloc);return;}for(i=(0x422+3088-0x1032);(i<length)&&(pDest-
-pStrDestMalloc<AT_CMD_MAX);i++){if(((char)(0x199c+1558-0x1f90))==*pSource){flg=(
-(0x24c+8138-0x2216)==flg)?(0x13b5+3995-0x234f):(0xcf3+5879-0x23ea);if(
-((char)(0xf25+2943-0x1a82))==*(pSource+(0x7dc+7468-0x2507))){*pDest++=(char)
-ZAT_NULL_FILL;}}else if((((char)(0x793+2853-0x128c))==*pSource)&&(
-(0x90d+380-0xa89)==flg)){*pDest++=((char)(0x1015+4238-0x2083));if(
-((char)(0xd15+88-0xd41))==*(pSource+(0x242+5438-0x177f))){*pDest++=
-((char)(0xd9a+2582-0x1777));}else if('\0'==*(pSource+(0x19cf+1746-0x20a0))){*
-pDest++=(char)ZAT_NULL_FILL;}}else{if((((char)(0x1138+1436-0x16b4))==*pSource)&&
-((0xf49+1111-0x139f)==flg)){*pDest++=(char)ZAT_SPACE_REPLACE;}else if(('\t'==*
-pSource)&&((0x201+7221-0x1e35)==flg)){*pDest++=(char)ZAT_TAB_REPLACE;}else if((
-'\n'==*pSource)&&((0x410+6925-0x1f1c)==flg)){*pDest++=(char)ZAT_LF_REPLACE;}else
- if(('\r'==*pSource)&&((0x1e02+1484-0x23cd)==flg)){*pDest++=(char)ZAT_CR_REPLACE
-;}else{*pDest++=*pSource;}}pSource++;}memset(pParaLine,(0x20f8+144-0x2188),
-paraSize);strncpy(pParaLine,pStrDestMalloc,paraSize-(0x12d6+3937-0x2236));free(
+(0x1e66+1106-0x22b8),AT_CMD_MAX);assert(pParaLine!=NULL);pDest=pStrDestMalloc;
+length=strlen(pParaLine);if((length==(0x8d3+5744-0x1f43))||(length>=AT_CMD_MAX))
+{free(pStrDestMalloc);return;}for(i=(0x481+353-0x5e2);(i<length)&&(pDest-
+pStrDestMalloc<AT_CMD_MAX);i++){if(((char)(0x87f+4758-0x1af3))==*pSource){flg=(
+(0x13a8+1188-0x184c)==flg)?(0x551+461-0x71d):(0xa8d+5462-0x1fe3);if(
+((char)(0x7a7+3380-0x14b9))==*(pSource+(0xab8+5550-0x2065))){*pDest++=(char)
+ZAT_NULL_FILL;}}else if((((char)(0x1336+4115-0x231d))==*pSource)&&(
+(0x1522+1156-0x19a6)==flg)){*pDest++=((char)(0x42f+4699-0x166a));if(
+((char)(0xcad+357-0xde6))==*(pSource+(0x61b+8217-0x2633))){*pDest++=
+((char)(0xb5c+144-0xbb3));}else if('\0'==*(pSource+(0xd56+5306-0x220f))){*pDest
+++=(char)ZAT_NULL_FILL;}}else{if((((char)(0x2128+589-0x2355))==*pSource)&&(
+(0xa97+1894-0x11fc)==flg)){*pDest++=(char)ZAT_SPACE_REPLACE;}else if(('\t'==*
+pSource)&&((0x11d1+3574-0x1fc6)==flg)){*pDest++=(char)ZAT_TAB_REPLACE;}else if((
+'\n'==*pSource)&&((0x1461+232-0x1548)==flg)){*pDest++=(char)ZAT_LF_REPLACE;}else
+ if(('\r'==*pSource)&&((0x227+8451-0x2329)==flg)){*pDest++=(char)ZAT_CR_REPLACE;
+}else{*pDest++=*pSource;}}pSource++;}memset(pParaLine,(0x6f0+8068-0x2674),
+paraSize);strncpy(pParaLine,pStrDestMalloc,paraSize-(0x13e5+562-0x1616));free(
 pStrDestMalloc);}VOID zSms_RecvCscaInd(UINT8*pDatabuf){T_zSms_CscaInd cscaInd={
-(0x3b5+3818-0x129f)};
-#if (0x1797+2899-0x22e9)
+(0x248+5962-0x1992)};
+#if (0x1dd2+2233-0x268a)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x7a\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x73\x63\x61\x49\x6e\x64\x20\x64\x61\x74\x61\x62\x75\x66\x3a\x25\x73" "\n"
 ,pDatabuf);
 #endif

 atBase_PreProcRes(pDatabuf,strlen(pDatabuf));sscanf(pDatabuf,
 "\x25\x32\x31\x73\x20\x25\x32\x31\x73",cscaInd.sca,cscaInd.tosca);
-#if (0xebd+1953-0x165d)
+#if (0xbeb+3950-0x1b58)
 printf(
 "\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x7a\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x73\x63\x61\x49\x6e\x64\x20\x73\x63\x61\x3a\x25\x73\x2c\x20\x74\x6f\x73\x63\x61\x25\x73" "\n"
 ,cscaInd.sca,cscaInd.tosca);
@@ -312,22 +313,22 @@
 sc_cfg_set(NV_SMS_CENTER_NUM,cscaInd.sca);zUfiSms_SetScaPara(cscaInd.sca);}VOID 
 zSms_RecvZmglInd(UINT8*pDatabuf){zUfiSms_CmglRespProc((T_zSms_SmsInd*)pDatabuf);
 }int zSms_SendSmsInitReq(VOID){zSms_SendMsg(MSG_CMD_SMSINIT_REQ,
-(0x1205+1380-0x1769),NULL);return(0x1087+2027-0x1872);}VOID zSms_initAtOk(VOID){
-T_zUfiSms_StatusInfo tStatus={(0x0+609-0x261)};sc_cfg_set(NV_SMS_STORE,
+(0x452+3435-0x11bd),NULL);return(0x930+4083-0x1923);}VOID zSms_initAtOk(VOID){
+T_zUfiSms_StatusInfo tStatus={(0x2ac+7135-0x1e8b)};sc_cfg_set(NV_SMS_STORE,
 "\x6f\x6b");sc_cfg_set(NV_SMS_LOAD_RESULT,"\x6f\x6b");tStatus.cmd_status=
 WMS_CMD_SUCCESS;tStatus.cmd=WMS_SMS_CMD_INIT;(void)zUfiSms_SetCmdStatus(&tStatus
 );zUfiSms_ChangeMainState(SMS_STATE_LOADED);}VOID zSms_initAtErr(VOID){
-T_zUfiSms_StatusInfo tStatus={(0x2ca+3881-0x11f3)};sc_cfg_set(NV_SMS_LOAD_RESULT
-,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_LOADED);tStatus.
-cmd_status=WMS_CMD_FAILED;tStatus.cmd=WMS_SMS_CMD_INIT;(void)
+T_zUfiSms_StatusInfo tStatus={(0x173d+3841-0x263e)};sc_cfg_set(
+NV_SMS_LOAD_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_LOADED)
+;tStatus.cmd_status=WMS_CMD_FAILED;tStatus.cmd=WMS_SMS_CMD_INIT;(void)
 zUfiSms_SetCmdStatus(&tStatus);}VOID zSms_RecvSmsInitRst(UINT8*pDatabuf){memcpy(
 &g_smsOptRsp,pDatabuf,sizeof(T_zSms_optRsp));if(g_smsOptRsp.result==
-(0x2a7+8936-0x258e)){zSms_initAtOk();}else{zSms_initAtErr();}}UINT8 
+(0x271+1898-0x9da)){zSms_initAtOk();}else{zSms_initAtErr();}}UINT8 
 zSms_SmsMsgCreat(VOID){g_zSms_MsqId=msgget(MODULE_ID_SMS,IPC_CREAT|
-(0x5b1+6280-0x1cb9));if(g_zSms_MsqId==-(0x5da+5883-0x1cd4)){return ZUFI_FAIL;}
-g_zSms_LocalMsqId=msgget(MODULE_ID_SMS_LOCAL,IPC_CREAT|(0x640+6232-0x1d18));if(
-g_zSms_LocalMsqId==-(0x8f+1354-0x5d8)){return ZUFI_FAIL;}sem_init(&g_sms_sem_id,
-(0x1e9+751-0x4d8),(0x192+8324-0x2216));return ZUFI_SUCC;}void 
+(0x136f+5247-0x266e));if(g_zSms_MsqId==-(0x20bd+625-0x232d)){return ZUFI_FAIL;}
+g_zSms_LocalMsqId=msgget(MODULE_ID_SMS_LOCAL,IPC_CREAT|(0x1913+2560-0x2193));if(
+g_zSms_LocalMsqId==-(0xbdb+5834-0x22a4)){return ZUFI_FAIL;}sem_init(&
+g_sms_sem_id,(0x555+2896-0x10a5),(0x1045+4284-0x2101));return ZUFI_SUCC;}void 
 zSms_HandleAtctlLocalMsg(MSG_BUF*ptMsgBuf){assert(ptMsgBuf!=NULL);printf(
 "\x73\x6d\x73\x20\x6c\x6f\x63\x61\x6c\x20\x72\x65\x63\x76\x20\x6d\x73\x67\x20\x63\x6d\x64\x3a\x25\x64" "\n"
 ,ptMsgBuf->usMsgCmd);switch(ptMsgBuf->usMsgCmd){case MSG_CMD_ZPBIC_IND:
@@ -351,29 +352,30 @@
 case MSG_CMD_NEWSMS_IND:case MSG_CMD_ZPBIC_IND:case MSG_CMD_ZMGL_IND:case 
 MSG_CMD_NEWSMS_STATUS_IND:ipc_send_message(MODULE_ID_SMS,MODULE_ID_SMS_LOCAL,
 ptMsgBuf->usMsgCmd,ptMsgBuf->usDataLen,(unsigned char*)ptMsgBuf->aucDataBuf,
-(0xbe8+6883-0x26cb));break;default:break;}}VOID zSms_HandleResetToFactory(){CHAR
- clearSms[(0xea7+3501-0x1c22)]={(0xe48+3745-0x1ce9)};sc_cfg_get(
+(0x143f+479-0x161e));break;default:break;}}VOID zSms_HandleResetToFactory(){CHAR
+ clearSms[(0x16ff+1517-0x1cba)]={(0x1559+1773-0x1c46)};sc_cfg_get(
 NV_CLEAR_SMS_WHEN_RESTORE,clearSms,sizeof(clearSms));printf(
 "\x61\x74\x57\x65\x62\x5f\x52\x65\x73\x74\x6f\x72\x65\x46\x61\x63\x74\x6f\x72\x79\x53\x65\x74\x74\x69\x6e\x67\x20\x65\x6e\x74\x65\x72\x65\x64\x21\x20" "\n"
 );printf(
 "\x63\x6c\x65\x61\x72\x5f\x73\x6d\x73\x5f\x77\x68\x65\x6e\x5f\x72\x65\x73\x74\x6f\x72\x65\x3d\x25\x73\x20" "\n"
-,clearSms);if(strcmp(clearSms,"\x79\x65\x73")==(0x169d+1021-0x1a9a)){printf(
+,clearSms);if(strcmp(clearSms,"\x79\x65\x73")==(0x1336+3936-0x2296)){printf(
 "\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x72\x6f\x70\x41\x6c\x6c\x54\x61\x62\x6c\x65\x20\x65\x6e\x74\x65\x72\x65\x64\x21\x20" "\n"
 );zUfiSms_DropAllTable();}else{printf(
 "\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x72\x6f\x70\x41\x6c\x6c\x54\x61\x62\x6c\x65\x45\x78\x63\x65\x70\x74\x53\x6d\x73\x20\x65\x6e\x74\x65\x72\x65\x64\x21\x20" "\n"
 );zUfiSms_DropAllTableExceptSms();}ipc_send_message(MODULE_ID_SMS,
-MODULE_ID_MAIN_CTRL,MSG_CMD_RESET_RSP,(0x7b3+1522-0xda5),NULL,(0x264+2161-0xad5)
-);}void zSms_HandleMainCtrlMsg(MSG_BUF*ptMsgBuf){assert(ptMsgBuf!=NULL);printf(
+MODULE_ID_MAIN_CTRL,MSG_CMD_RESET_RSP,(0x51c+8376-0x25d4),NULL,
+(0x778+5854-0x1e56));}void zSms_HandleMainCtrlMsg(MSG_BUF*ptMsgBuf){assert(
+ptMsgBuf!=NULL);printf(
 "\x73\x6d\x73\x20\x72\x65\x63\x76\x20\x6d\x61\x69\x6e\x20\x63\x74\x72\x6c\x20\x6d\x73\x67\x20\x63\x6d\x64\x3a\x25\x64" "\n"
 ,ptMsgBuf->usMsgCmd);switch(ptMsgBuf->usMsgCmd){case MSG_CMD_RESET_NOTIFY:
 zSms_HandleResetToFactory(ptMsgBuf->aucDataBuf);break;default:break;}}void 
-sms_msg_thread_proc(void*arg){int iRet=(0x4f0+6402-0x1df2);MSG_BUF stMsg={
-(0x1145+4619-0x2350)};int msgSize=sizeof(MSG_BUF)-sizeof(long);int queueId=*((
-int*)arg);prctl(PR_SET_NAME,"\x73\x6d\x73\x5f\x6c\x6f\x63\x61\x6c",
-(0x63f+7722-0x2469),(0x4d6+2188-0xd62),(0x846+2174-0x10c4));while(
-(0x11a9+2963-0x1d3b)){iRet=(0x1933+208-0x1a03);memset(&stMsg,
-(0x163d+1551-0x1c4c),sizeof(MSG_BUF));iRet=msgrcv(queueId,&stMsg,msgSize,
-(0x2604+242-0x26f6),(0x8d7+7500-0x2623));if(iRet>=(0x8d8+296-0xa00)){switch(
+sms_msg_thread_proc(void*arg){int iRet=(0x1842+331-0x198d);MSG_BUF stMsg={
+(0x306+862-0x664)};int msgSize=sizeof(MSG_BUF)-sizeof(long);int queueId=*((int*)
+arg);prctl(PR_SET_NAME,"\x73\x6d\x73\x5f\x6c\x6f\x63\x61\x6c",
+(0x1332+3118-0x1f60),(0x830+3129-0x1469),(0x1b04+2672-0x2574));while(
+(0x11a1+2225-0x1a51)){iRet=(0x1035+5512-0x25bd);memset(&stMsg,
+(0x2128+1447-0x26cf),sizeof(MSG_BUF));iRet=msgrcv(queueId,&stMsg,msgSize,
+(0x9f4+1960-0x119c),(0x56b+267-0x676));if(iRet>=(0x3dd+5215-0x183c)){switch(
 stMsg.src_id){case MODULE_ID_WEB_CGI:{zSms_HandleWebMsg(&stMsg);break;}case 
 MODULE_ID_AT_CTL:{zSms_HandleAtctlMsg(&stMsg);break;}case MODULE_ID_SMS:{
 zSms_HandleWebMsg(&stMsg);zSms_HandleAtctlLocalMsg(&stMsg);break;}case 
@@ -381,14 +383,14 @@
 else{at_print(AT_DEBUG,
 "\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x2c\x20\x65\x72\x72\x6d\x73\x67\x20\x3d\x20\x25\x73" "\n"
 ,errno,strerror(errno));}}}int sms_main(int argc,char*argv[]){pthread_t 
-recv_thread_tid=(0x7f8+4268-0x18a4);MSG_BUF msgBuf={(0x1678+3496-0x2420)};CHAR 
-needSMS[(0x1d5+8930-0x2485)]={(0x11a+3104-0xd3a)};prctl(PR_SET_NAME,
-"\x73\x6d\x73\x5f\x6d\x61\x69\x6e",(0x17c5+1538-0x1dc7),(0x1d7+1961-0x980),
-(0xd5f+1528-0x1357));loglevel_init();sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,
-sizeof(needSMS));if((0xa32+4676-0x1c76)!=strcmp(needSMS,"\x6e\x6f")){
+recv_thread_tid=(0x6a1+2235-0xf5c);MSG_BUF msgBuf={(0x16db+310-0x1811)};CHAR 
+needSMS[(0x170+7991-0x2075)]={(0x11fc+3939-0x215f)};prctl(PR_SET_NAME,
+"\x73\x6d\x73\x5f\x6d\x61\x69\x6e",(0x13a0+3694-0x220e),(0x608+4745-0x1891),
+(0x14ad+1682-0x1b3f));loglevel_init();sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,
+sizeof(needSMS));if((0x590+8110-0x253e)!=strcmp(needSMS,"\x6e\x6f")){
 zUfiSms_InitDb();zUfiSms_CfgSmsNvInit();zUfiMmi_SendSmsStatus();zSms_SmsMsgCreat
-();}else{return-(0x56d+4938-0x18b6);}printf(
+();}else{return-(0x1c27+1149-0x20a3);}printf(
 "\x73\x6d\x73\x20\x61\x70\x70\x20\x69\x6e\x69\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64\x2c\x20\x77\x69\x6c\x6c\x20\x74\x6f\x20\x72\x65\x63\x65\x69\x76\x65\x20\x6d\x73\x67\x2c\x20\x6d\x73\x67\x69\x64\x3a\x25\x64" "\n"
 ,g_zSms_MsqId);if(pthread_create(&recv_thread_tid,NULL,sms_msg_thread_proc,(void
-*)(&g_zSms_LocalMsqId))==-(0xc09+426-0xdb2)){assert((0x4f2+2779-0xfcd));}
-sms_msg_thread_proc(&g_zSms_MsqId);return(0xc1d+1809-0x132e);}
+*)(&g_zSms_LocalMsqId))==-(0x1e5+3623-0x100b)){assert((0xbe0+619-0xe4b));}
+sms_msg_thread_proc(&g_zSms_MsqId);return(0x2ec+3876-0x1210);}
diff --git a/ap/app/zte_comm/sms/src/sms_proc.c b/ap/app/zte_comm/sms/src/sms_proc.c
index 93b20d0..7349b60 100755
--- a/ap/app/zte_comm/sms/src/sms_proc.c
+++ b/ap/app/zte_comm/sms/src/sms_proc.c
@@ -5,117 +5,117 @@
 T_zUfiSms_ConcatInfo g_zUfiSms_ConcatSms;T_zUfiSms_GroupInfo g_zUfiSms_GroupSms;
 T_zUfiSms_DbStoreData g_zUfiSms_DbStoreData[ZTE_WMS_CONCAT_SMS_COUNT_MAX];UINT8 
 g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_MAX]={FALSE,FALSE};T_zUfiSms_DelSms 
-g_zUfiSms_DelMsg;T_zUfiSms_DelIndexInfo g_deleteIndex={(0x22c9+1069-0x26f6)};
-T_zUfiSms_ModifySms g_zUfiSms_modifyMsg={(0xfe7+1958-0x178d)};
-T_zUfiSms_ModifyIndexInfo g_modifyIndex={(0x154c+3471-0x22db)};int 
-g_zUfiSms_UnitLen=(0x85a+3958-0x17d0);int g_zUfiSms_ConcatTotalNum=
-(0x1603+2153-0x1e6c);int g_zUfiSms_CurConcatSegNo=(0x1b19+1141-0x1f8e);UINT8 
-g_zUfiSms_IsConcatSendSuc=TRUE;int g_zUfiSms_SendFailedCount=(0x23e1+106-0x244b)
-;int g_zUfiSms_MsgRefer=(0x4d+5456-0x159d);int g_zUfiSms_SendFailedRetry=
-(0x313+210-0x3e5);char g_Zmena_value[(0x1c5+90-0x21d)]={(0xad7+4316-0x1bb3)};int
- g_displaymode=(0x1346+1795-0x1a49);extern SMS_LOCATION g_zUfiSms_CurLocation;
-extern T_zUfiSms_CmdStatus zUfiSms_HandleReport(unsigned char*ptPduData);extern 
-void zUfiSms_GetReportStatus(char*pdu_tmp,int*stat);extern VOID 
-zUfiSms_ResendAtCmdZmena(int cid);extern int zUfiSms_DecodeSmsData(
+g_zUfiSms_DelMsg;T_zUfiSms_DelIndexInfo g_deleteIndex={(0x2ab+4011-0x1256)};
+T_zUfiSms_ModifySms g_zUfiSms_modifyMsg={(0x3d6+4593-0x15c7)};
+T_zUfiSms_ModifyIndexInfo g_modifyIndex={(0x571+4377-0x168a)};int 
+g_zUfiSms_UnitLen=(0xcef+1922-0x1471);int g_zUfiSms_ConcatTotalNum=
+(0x9a+5346-0x157c);int g_zUfiSms_CurConcatSegNo=(0xacc+84-0xb20);UINT8 
+g_zUfiSms_IsConcatSendSuc=TRUE;int g_zUfiSms_SendFailedCount=(0xb45+109-0xbb2);
+int g_zUfiSms_MsgRefer=(0x1b53+2233-0x240c);int g_zUfiSms_SendFailedRetry=
+(0x15f1+1111-0x1a48);char g_Zmena_value[(0x1ee6+1341-0x2421)]={
+(0x51d+4872-0x1825)};int g_displaymode=(0xfd7+817-0x1308);extern SMS_LOCATION 
+g_zUfiSms_CurLocation;extern T_zUfiSms_CmdStatus zUfiSms_HandleReport(unsigned 
+char*ptPduData);extern void zUfiSms_GetReportStatus(char*pdu_tmp,int*stat);
+extern VOID zUfiSms_ResendAtCmdZmena(int cid);extern int zUfiSms_DecodeSmsData(
 T_zUfiSms_DbStoreData*pDb_Data,int msg_index,zUfiSms_StoreType iStorePos,
 T_SmsStatus bSms_Status,wms_message_format_enum_v01 format,long iPdu_Len,
 unsigned char*pPdu_Received);typedef struct{long mtype;char mtext[
-(0x1500+2150-0x1d5a)];}FOTA_MSG_BUF;
-#define WEBUI_NOTIFY_PUSH_MSG_  (0x770+1039-0xb7c)

+(0x610+5334-0x1ada)];}FOTA_MSG_BUF;
+#define WEBUI_NOTIFY_PUSH_MSG_  (0xf2f+2939-0x1aa7)

 typedef struct{unsigned int isread_record;unsigned int inbox_full;}
 T_zUfiMmi_SmsRecord;void zUfiMmi_SendSmsStatus(void){int iSmsNum=
-(0xcf3+3149-0x1940);T_zUfiMmi_SmsRecord tRecord={(0x670+2937-0x11e9)};CHAR 
-smsNum[(0x14e3+2947-0x2034)]={(0x64d+4046-0x161b)};sc_cfg_get(NV_SMS_IN_NUM,
-smsNum,sizeof(smsNum));iSmsNum=atoi(smsNum);tRecord.isread_record=
-zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_MAX);if(iSmsNum>=ZSMS_NUM_MAX_CPE){tRecord.
-inbox_full=(0xcbf+1422-0x124c);}else{tRecord.inbox_full=(0x902+1983-0x10c1);}}
-VOID zUfiSms_Init(VOID){zUfiSms_CfgInit();zUfiSms_ChangeMainState(
-SMS_STATE_INITING);}VOID zSvr_Zpbic_Sms_Init(VOID){int atRes=(0x1cfb+339-0x1e4e)
-;T_zUfiSms_StatusInfo tStatus={(0x19ca+1232-0x1e9a)};CHAR outDate[
-(0x1373+3995-0x22dc)]={(0xccd+4769-0x1f6e)};zUfiSms_Init();zUfiSms_InitCmdStatus
-(&tStatus,WMS_SMS_CMD_INIT);zSms_SendSmsInitReq();at_print(LOG_DEBUG,
+(0x4ca+2195-0xd5d);T_zUfiMmi_SmsRecord tRecord={(0x2c3+6030-0x1a51)};CHAR smsNum
+[(0x1c08+1253-0x20bb)]={(0x82+8551-0x21e9)};sc_cfg_get(NV_SMS_IN_NUM,smsNum,
+sizeof(smsNum));iSmsNum=atoi(smsNum);tRecord.isread_record=zUfiSms_IsUnreadSms(
+ZTE_WMS_MEMORY_MAX);if(iSmsNum>=ZSMS_NUM_MAX_CPE){tRecord.inbox_full=
+(0x1461+4103-0x2467);}else{tRecord.inbox_full=(0x19c+452-0x360);}}VOID 
+zUfiSms_Init(VOID){zUfiSms_CfgInit();zUfiSms_ChangeMainState(SMS_STATE_INITING);
+}VOID zSvr_Zpbic_Sms_Init(VOID){int atRes=(0x1b46+2400-0x24a6);
+T_zUfiSms_StatusInfo tStatus={(0xab3+170-0xb5d)};CHAR outDate[(0x1f6+874-0x52e)]
+={(0x16ab+2233-0x1f64)};zUfiSms_Init();zUfiSms_InitCmdStatus(&tStatus,
+WMS_SMS_CMD_INIT);zSms_SendSmsInitReq();at_print(LOG_DEBUG,
 "corem zSvr_Zpbic_Sms_Init has send init req\n");zSms_SendZmenaReq(
-(0xb49+84-0xb9d));at_print(LOG_DEBUG,
+(0x84c+4296-0x1914));at_print(LOG_DEBUG,
 "\x63\x6f\x72\x65\x6d\x20\x7a\x53\x76\x72\x5f\x5a\x70\x62\x69\x63\x5f\x53\x6d\x73\x5f\x49\x6e\x69\x74\x20\x68\x61\x73\x20\x73\x65\x6e\x64\x20\x7a\x6d\x65\x6e\x61\x20\x72\x65\x71" "\n"
 );sc_cfg_get(NV_OUTDATE_DELETE,outDate,sizeof(outDate));at_print(LOG_DEBUG,
 "\x63\x6f\x72\x65\x6d\x20\x7a\x53\x76\x72\x5f\x5a\x70\x62\x69\x63\x5f\x53\x6d\x73\x5f\x49\x6e\x69\x74\x20\x6f\x75\x74\x64\x61\x74\x65\x20\x63\x68\x65\x63\x6b\x20\x25\x73" "\n"
-,outDate);if((0x4f+7300-0x1cd3)==strcmp(outDate,"\x31")){atWeb_OutdateSmsCheck(
-ZUFI_NULL);}}VOID zUfiSms_DeleteAllSimSms(VOID){zUfiSms_DeleteAllSimSmsInDb();}
-#if (0x967+2602-0x1391)

-VOID zUfiSms_ResendAtCmdZmena(int cid){CHAR netType[(0x215+5482-0x174d)]={
-(0x18a0+2667-0x230b)};sc_cfg_get(NV_NETWORK_TYPE,netType,sizeof(netType));if(!
-g_Zmena_rsp&&((0x79+5045-0x142e)!=strcmp(
-"\x4e\x6f\x20\x53\x65\x72\x76\x69\x63\x65",netType)&&(0x1aa0+365-0x1c0d)!=strcmp
+,outDate);if((0x1a16+1786-0x2110)==strcmp(outDate,"\x31")){atWeb_OutdateSmsCheck
+(ZUFI_NULL);}}VOID zUfiSms_DeleteAllSimSms(VOID){zUfiSms_DeleteAllSimSmsInDb();}
+#if (0x823+3915-0x176e)

+VOID zUfiSms_ResendAtCmdZmena(int cid){CHAR netType[(0x2d7+3768-0x115d)]={
+(0x149+5377-0x164a)};sc_cfg_get(NV_NETWORK_TYPE,netType,sizeof(netType));if(!
+g_Zmena_rsp&&((0xe2b+5243-0x22a6)!=strcmp(
+"\x4e\x6f\x20\x53\x65\x72\x76\x69\x63\x65",netType)&&(0x209f+226-0x2181)!=strcmp
 ("\x4c\x69\x6d\x69\x74\x65\x64\x20\x53\x65\x72\x76\x69\x63\x65",netType))){
 atUnsoli_Report_Zmena(NULL,cid);}}
 #endif

 void zUfiSms_Ack_new_msg(BOOL needAck){
-#if (0x115b+2066-0x196d)

-CHAR ackPduStr[(0x6aa+212-0x5ee)]={(0x1518+3582-0x2316)};SMS_PARAM reportParam={
-(0x5ac+7938-0x24ae)};int total_length=(0x120d+2428-0x1b89);UINT8 TP_FCS=
-(0x8ba+782-0xbc8);CHAR strValue[(0x692+7191-0x22a7)]={(0x6a2+6873-0x217b)};if(
-needAck){TP_FCS=(0xbaf+3555-0x1992);sprintf(strValue,"\x25\x64",
-(0xc33+1536-0x1232));}else{TP_FCS=(0x12a3+4477-0x234d);sprintf(strValue,
-"\x25\x64",(0xdf1+957-0x11ac));}sprintf(reportParam.SCA,"\x25\x73",cfg_get(
+#if (0x17ea+2028-0x1fd6)

+CHAR ackPduStr[(0xf66+212-0xeaa)]={(0x2a5+5482-0x180f)};SMS_PARAM reportParam={
+(0x14dc+1657-0x1b55)};int total_length=(0x726+6819-0x21c9);UINT8 TP_FCS=
+(0x1255+3334-0x1f5b);CHAR strValue[(0x1235+4257-0x22d4)]={(0x3b5+9045-0x270a)};
+if(needAck){TP_FCS=(0x19e3+3018-0x25ad);sprintf(strValue,"\x25\x64",
+(0x100d+5654-0x2622));}else{TP_FCS=(0x966+1944-0x102b);sprintf(strValue,
+"\x25\x64",(0x10b7+135-0x113c));}sprintf(reportParam.SCA,"\x25\x73",cfg_get(
 "\x73\x6d\x73\x5f\x63\x65\x6e\x74\x65\x72\x5f\x6e\x75\x6d"));total_length=
 zUfiSms_EncodePdu_DeliverReport(&reportParam,ackPduStr,TP_FCS);memset(&
-g_zUfiSms_ackPdu,(0x141d+877-0x178a),sizeof(g_zUfiSms_ackPdu));g_zUfiSms_ackPdu.
+g_zUfiSms_ackPdu,(0xd41+2577-0x1752),sizeof(g_zUfiSms_ackPdu));g_zUfiSms_ackPdu.
 length=String2Bytes(ackPduStr,g_zUfiSms_ackPdu.pdu,strlen(ackPduStr));memset(
-g_zUfiSms_ackPdu.pdu,(0xf15+2387-0x1868),sizeof(g_zUfiSms_ackPdu.pdu));memcpy(&
+g_zUfiSms_ackPdu.pdu,(0x1252+4450-0x23b4),sizeof(g_zUfiSms_ackPdu.pdu));memcpy(&
 g_zUfiSms_ackPdu.pdu,&ackPduStr,sizeof(ackPduStr));atBase_SendMsgToSelf(
 ZAT_CNMA_CMD,strValue,sizeof(strValue));
 #endif

-#if (0xc0a+801-0xf2b)
-CHAR strValue[(0xf05+970-0x12cd)]={(0x154+7746-0x1f96)};if(needAck){snprintf(
-strValue,sizeof(strValue),"\x25\x64",(0x30f+8696-0x2506));}else{snprintf(
-strValue,sizeof(strValue),"\x25\x64",(0x21cb+594-0x241b));}zSvr_InnerSendMsg(
+#if (0x23d+7160-0x1e35)
+CHAR strValue[(0xda7+3122-0x19d7)]={(0x1649+830-0x1987)};if(needAck){snprintf(
+strValue,sizeof(strValue),"\x25\x64",(0x2285+6-0x228a));}else{snprintf(strValue,
+sizeof(strValue),"\x25\x64",(0x69d+7035-0x2216));}zSvr_InnerSendMsg(
 ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,MSG_CMD_AT_CNMA,strlen(strValue
 ),strValue);
 #endif

-if(needAck){zSms_SendCnmaReq((0xa77+4190-0x1ad4));}else{zSms_SendCnmaReq(
-(0x1020+3436-0x1d8a));}}T_zUfiSms_CmdStatus zUfiSms_SendRawSms(T_zUfiSms_SendReq
-*ptSendMsg){if(NULL==ptSendMsg||(0xc25+89-0xc7e)==ptSendMsg->receiver_count){
+if(needAck){zSms_SendCnmaReq((0x701+426-0x8aa));}else{zSms_SendCnmaReq(
+(0x747+7151-0x2334));}}T_zUfiSms_CmdStatus zUfiSms_SendRawSms(T_zUfiSms_SendReq*
+ptSendMsg){if(NULL==ptSendMsg||(0x216c+1300-0x2680)==ptSendMsg->receiver_count){
 return WMS_CMD_FAILED;}at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x52\x61\x77\x53\x6d\x73\x20\x72\x65\x63\x65\x69\x76\x65\x72\x5f\x63\x6f\x75\x6e\x74\x3a\x25\x64\x2f\x64\x65\x73\x74\x5f\x6e\x75\x6d\x3a\x25\x73\x2f\x6d\x73\x67\x5f\x6c\x65\x6e\x3a\x25\x64\x2f\x69\x64\x3a\x25\x64\x2e" "\n"
-,ptSendMsg->receiver_count,ptSendMsg->dest_num[(0xdb8+3530-0x1b82)],ptSendMsg->
+,ptSendMsg->receiver_count,ptSendMsg->dest_num[(0x1c2+3194-0xe3c)],ptSendMsg->
 msg_len,ptSendMsg->id);
-#if (0xd4a+6384-0x2639)
+#if (0x225+6572-0x1bd0)
 at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x52\x61\x77\x53\x6d\x73\x20\x64\x63\x73\x3a\x25\x64" "\n"
 ,ptSendMsg->dcs);
 #endif

-sc_cfg_set(NV_SMS_SEND_RESULT,"");g_zUfiSms_SendFailedCount=(0x274+63-0x2b3);if(
-ptSendMsg->isDelete==TRUE||-(0xf7+8676-0x22da)!=ptSendMsg->id){(void)
+sc_cfg_set(NV_SMS_SEND_RESULT,"");g_zUfiSms_SendFailedCount=(0x3ad+7188-0x1fc1);
+if(ptSendMsg->isDelete==TRUE||-(0x1f50+1820-0x266b)!=ptSendMsg->id){(void)
 zUfiSms_DeleteDraftSms(ptSendMsg->id);}zUfiSms_SetGlobalDcsLang(ptSendMsg->dcs);
-memset(&g_zUfiSms_GroupSms,(0x24ad+364-0x2619),sizeof(g_zUfiSms_GroupSms));if(
+memset(&g_zUfiSms_GroupSms,(0x142d+4346-0x2527),sizeof(g_zUfiSms_GroupSms));if(
 ZUFI_FAIL==zUfiSms_FillGroupSms(ptSendMsg,&g_zUfiSms_GroupSms)){return 
-WMS_CMD_FAILED;}memset(&g_zUfiSms_ConcatSms,(0xef+5895-0x17f6),sizeof(
+WMS_CMD_FAILED;}memset(&g_zUfiSms_ConcatSms,(0x860+5448-0x1da8),sizeof(
 g_zUfiSms_ConcatSms));g_zUfiSms_UnitLen=zUfiSms_FillConcatSms(ptSendMsg,&
 g_zUfiSms_ConcatSms);g_zUfiSms_IsConcatSendSuc=TRUE;g_zUfiSms_CurConcatSegNo=
-(0x14f+8456-0x2257);memset(g_zUfiSms_DbStoreData,(0x1471+1834-0x1b9b),sizeof(
-g_zUfiSms_DbStoreData));if(ptSendMsg->mem_store==(0x1189+4477-0x22fc)){
-g_displaymode=(0x11d2+1179-0x166c);at_print(LOG_DEBUG,
+(0x190c+1778-0x1ffe);memset(g_zUfiSms_DbStoreData,(0xccb+3611-0x1ae6),sizeof(
+g_zUfiSms_DbStoreData));if(ptSendMsg->mem_store==(0x1b02+445-0x1cb5)){
+g_displaymode=(0xc81+4279-0x1d37);at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x53\x6d\x73\x3a\x20\x6d\x73\x67\x5f\x64\x69\x73\x70\x6c\x61\x79\x6d\x6f\x64\x65\x20\x3d\x20\x31" "\n"
-);}else{g_displaymode=(0x1089+177-0x113a);at_print(LOG_DEBUG,
+);}else{g_displaymode=(0xc31+2760-0x16f9);at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x53\x6d\x73\x3a\x20\x6d\x73\x67\x5f\x64\x69\x73\x70\x6c\x61\x79\x6d\x6f\x64\x65\x20\x3d\x20\x30" "\n"
 );}return zUfiSms_SendSms();}T_zUfiSms_CmdStatus zUfiSms_WriteRawSms(
 T_zUfiSms_SaveReq*pSaveBuff){T_zUfiSms_ConcatInfo tConcatSms;T_zUfiSms_GroupInfo
- tGroupSms;int iSmsLen=(0x1a50+1222-0x1f16);T_zUfiSms_CmdStatus result=
+ tGroupSms;int iSmsLen=(0x483+1-0x484);T_zUfiSms_CmdStatus result=
 WMS_CMD_SUCCESS;if(NULL==pSaveBuff){return WMS_CMD_FAILED;}if(
 g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_NV]){at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x52\x61\x77\x53\x6d\x73\x20\x6e\x76\x20\x6d\x65\x6d\x6f\x72\x79\x20\x69\x73\x20\x66\x75\x6c\x6c\x2c\x72\x65\x74\x75\x72\x6e" "\n"
 );return WMS_CMD_FAILED;}if(pSaveBuff->isDelete==TRUE){(void)
 zUfiSms_DeleteDraftSms(pSaveBuff->id);}zUfiSms_SetGlobalDcsLang(pSaveBuff->dcs);
-memset(&tConcatSms,(0xb8f+6391-0x2486),sizeof(T_zUfiSms_ConcatInfo));memset(&
-tGroupSms,(0x526+4898-0x1848),sizeof(T_zUfiSms_GroupInfo));(void)
+memset(&tConcatSms,(0x177b+3868-0x2697),sizeof(T_zUfiSms_ConcatInfo));memset(&
+tGroupSms,(0x2213+998-0x25f9),sizeof(T_zUfiSms_GroupInfo));(void)
 zUfiSms_FillGroupSms(pSaveBuff,&tGroupSms);iSmsLen=zUfiSms_FillConcatSms(
 pSaveBuff,&tConcatSms);at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x52\x61\x77\x53\x6d\x73\x20\x74\x6f\x74\x61\x6c\x5f\x72\x65\x63\x65\x69\x76\x65\x72\x3d\x25\x64\x2c\x69\x53\x6d\x73\x4c\x65\x6e\x3d\x25\x64" "\n"
 ,tGroupSms.total_receiver,iSmsLen);for(tGroupSms.current_receiver=
-(0xc43+722-0xf15);tGroupSms.current_receiver<tGroupSms.total_receiver;tGroupSms.
-current_receiver++){tConcatSms.current_sending=(0x2348+374-0x24be);result=
-zUfiSms_SaveSmsToDb(pSaveBuff,&tConcatSms,&tGroupSms,iSmsLen);at_print(LOG_DEBUG
-,
+(0x1463+3743-0x2302);tGroupSms.current_receiver<tGroupSms.total_receiver;
+tGroupSms.current_receiver++){tConcatSms.current_sending=(0x278+316-0x3b4);
+result=zUfiSms_SaveSmsToDb(pSaveBuff,&tConcatSms,&tGroupSms,iSmsLen);at_print(
+LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x52\x61\x77\x53\x6d\x73\x20\x63\x75\x72\x72\x65\x6e\x74\x5f\x72\x65\x63\x65\x69\x76\x65\x72\x3d\x25\x64\x2c\x72\x65\x73\x75\x6c\x74\x3d\x25\x64" "\n"
 ,tGroupSms.current_receiver,result);}sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");
 zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);if(g_zUfiSms_MemFullFlag[
@@ -127,16 +127,16 @@
 memoryFullbeforeDelete=FALSE;BOOL unreadBeforeDelete=FALSE;if(NULL==ptDelBuff){
 return WMS_CMD_FAILED;}at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x21\x21\x21\x21\x21\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x6d\x73\x21\x21\x63\x6f\x75\x6e\x74\x3a\x25\x64\x2f\x69\x64\x5b\x25\x64\x5d\x2e" "\n"
-,ptDelBuff->all_or_count,ptDelBuff->id[(0xf26+5099-0x2311)]);(void)
+,ptDelBuff->all_or_count,ptDelBuff->id[(0x334+4081-0x1325)]);(void)
 zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);zUfiSms_ChangeMainState(
-SMS_STATE_DELING);memset(&g_zUfiSms_DelMsg,(0x106d+2286-0x195b),sizeof(
+SMS_STATE_DELING);memset(&g_zUfiSms_DelMsg,(0xd24+2882-0x1866),sizeof(
 T_zUfiSms_DelSms));if(ZUFI_FAIL==zUfiSms_SetDeleteInfo(ptDelBuff)){at_print(
 LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x21\x21\x21\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x74\x44\x65\x6c\x65\x74\x65\x49\x6e\x66\x6f\x20\x66\x61\x69\x6c\x2e" "\n"
 );zUfiSms_ChangeMainState(SMS_STATE_DELED);return WMS_CMD_FAILED;}at_print(
 LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x21\x21\x21\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x74\x44\x65\x6c\x65\x74\x65\x49\x6e\x66\x6f\x20\x52\x65\x61\x64\x20\x74\x6f\x20\x44\x65\x6c\x65\x74\x65\x3a\x6e\x76\x5f\x63\x6f\x75\x6e\x74\x3a\x25\x64\x2f\x73\x69\x6d\x5f\x63\x6f\x75\x6e\x74\x3a\x25\x64\x2e" "\n"
-,g_zUfiSms_DelMsg.nv_count,g_zUfiSms_DelMsg.sim_count);if((0x2501+148-0x2595)<
+,g_zUfiSms_DelMsg.nv_count,g_zUfiSms_DelMsg.sim_count);if((0x15f2+2172-0x1e6e)<
 g_zUfiSms_DelMsg.nv_count){if(g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]){
 memoryFullbeforeDelete=TRUE;}unreadBeforeDelete=zUfiSms_IsUnreadSms(
 ZTE_WMS_MEMORY_NV);result=(T_zUfiSms_CmdStatus)zUfiSms_DeleteNvSms();(void)
@@ -147,114 +147,115 @@
 memoryFullbeforeDelete&&!g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]){
 at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x4e\x76\x53\x6d\x73\x3a\x20\x73\x65\x6e\x64\x20\x41\x54\x2b\x5a\x4d\x45\x4e\x41\x3d\x30" "\n"
-);zSms_SendZmenaReq((0x1d6c+846-0x20ba));}if(memoryFullbeforeDelete&&!
+);zSms_SendZmenaReq((0xf3d+107-0xfa8));}if(memoryFullbeforeDelete&&!
 g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]||unreadBeforeDelete&&!
 zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV)){zUfiSms_SendSmsStatusInfo(
-MSG_SMS_DEFAULT);}}if((0x741+7643-0x251c)<g_zUfiSms_DelMsg.sim_count){result=
+MSG_SMS_DEFAULT);}}if((0x1bf9+122-0x1c73)<g_zUfiSms_DelMsg.sim_count){result=
 zUfiSms_DeleteSimSms();(void)zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_SIM);}
 at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x6d\x73\x20\x72\x65\x73\x75\x6c\x74\x3d\x25\x64" "\n"
 ,result);return result;}T_zUfiSms_CmdStatus zUfiSms_ModifySmsTag(
-T_zUfiSms_ModifyFlag*ptModifyBuff){unsigned long i=(0x227+1904-0x997);
-T_zUfiSms_CmdStatus result=WMS_CMD_SUCCESS;char acStorePos[(0xf1+7901-0x1f9c)]={
-(0x2ba+7954-0x21cc)};if(NULL==ptModifyBuff){at_print(LOG_ERR,
+T_zUfiSms_ModifyFlag*ptModifyBuff){unsigned long i=(0xd11+5268-0x21a5);
+T_zUfiSms_CmdStatus result=WMS_CMD_SUCCESS;char acStorePos[(0x519+4872-0x17ef)]=
+{(0x992+7483-0x26cd)};if(NULL==ptModifyBuff){at_print(LOG_ERR,
 "\x69\x6e\x70\x75\x74\x73\x20\x69\x73\x20\x6e\x75\x6c\x6c\x2e");return 
-WMS_CMD_FAILED;}for(i=(0x1a0+7359-0x1e5f);i<ptModifyBuff->total_id;i++){if(
-ptModifyBuff->id[i]<(0x8b9+5286-0x1d5e)||ZUFI_FAIL==zUfiSms_UpdateSmsTagInDb(
+WMS_CMD_FAILED;}for(i=(0x574+3548-0x1350);i<ptModifyBuff->total_id;i++){if(
+ptModifyBuff->id[i]<(0xa8a+5126-0x1e8f)||ZUFI_FAIL==zUfiSms_UpdateSmsTagInDb(
 ptModifyBuff->id[i],ptModifyBuff->tags)){result=WMS_CMD_FAILED;}else{result=
 WMS_CMD_SUCCESS;}}if(ZUFI_FAIL==zUfiSms_GetStorePosById(
 "\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65",acStorePos,sizeof(acStorePos),
-ptModifyBuff->id[(0xe25+4595-0x2018)])){return ZUFI_FAIL;}if(
-(0x1d4b+1902-0x24b9)==strcmp(acStorePos,ZTE_WMS_DB_NV_TABLE)){
-zUfiSms_SendSmsStatusInfo(MSG_SMS_READING);}if((0x1c96+1687-0x232d)==strcmp(
-acStorePos,ZTE_WMS_DB_SIM_TABLE)&&ptModifyBuff->total_id>(0xa06+7274-0x2670)){
+ptModifyBuff->id[(0x667+720-0x937)])){return ZUFI_FAIL;}if((0x2613+128-0x2693)==
+strcmp(acStorePos,ZTE_WMS_DB_NV_TABLE)){zUfiSms_SendSmsStatusInfo(
+MSG_SMS_READING);}if((0x15e2+4175-0x2631)==strcmp(acStorePos,
+ZTE_WMS_DB_SIM_TABLE)&&ptModifyBuff->total_id>(0x86f+766-0xb6d)){
 zUfiSms_ModifyModemSms(ptModifyBuff);}return result;}T_zUfiSms_CmdStatus 
-zUfiSms_SetSmsPara(T_zUfiSms_ParaInfo*ptParaBuff){int atRes=(0x915+6175-0x2134);
-CHAR sca[ZTE_WMS_ADDRESS_DIGIT_MAX_V01+(0x559+6154-0x1d62)]={
-(0x13c3+4841-0x26ac)};CHAR store[(0x6e9+1223-0xb9c)]={(0x73b+1780-0xe2f)};CHAR 
-defaultStore[(0xf18+208-0xfb6)]={(0x1300+4058-0x22da)};if(ptParaBuff==ZUFI_NULL)
-{return WMS_CMD_FAILED;}if(strlen(ptParaBuff->sca)!=(0x651+5353-0x1b3a)){strncpy
-(sca,ptParaBuff->sca,sizeof(sca)-(0x18bc+134-0x1941));at_print(LOG_DEBUG,
+zUfiSms_SetSmsPara(T_zUfiSms_ParaInfo*ptParaBuff){int atRes=(0x6c1+2109-0xefe);
+CHAR sca[ZTE_WMS_ADDRESS_DIGIT_MAX_V01+(0x29d+7995-0x21d7)]={(0x5d2+8183-0x25c9)
+};CHAR store[(0xff5+5729-0x2642)]={(0x2a8+8033-0x2209)};CHAR defaultStore[
+(0x4c+9861-0x269f)]={(0x1ec2+159-0x1f61)};if(ptParaBuff==ZUFI_NULL){return 
+WMS_CMD_FAILED;}if(strlen(ptParaBuff->sca)!=(0x978+859-0xcd3)){strncpy(sca,
+ptParaBuff->sca,sizeof(sca)-(0x70d+3219-0x139f));at_print(LOG_DEBUG,
 "\x73\x65\x6e\x64\x20\x5a\x41\x54\x5f\x43\x53\x43\x41\x5f\x53\x45\x54\x5f\x43\x4d\x44\x20\x6d\x65\x73\x73\x61\x67\x65\x20\x63\x73\x63\x61\x20\x69\x73\x20\x25\x73\x2e" "\n"
 ,sca);atRes=zSms_SetCscaReq(ptParaBuff->sca);if(atRes!=ZSMS_RESULT_OK){return 
 WMS_CMD_FAILED;}}sc_cfg_get(NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));
-if((*(ptParaBuff->default_store)!='\0')&&((0x3c9+5594-0x19a3)!=strcmp(
+if((*(ptParaBuff->default_store)!='\0')&&((0x4f6+1915-0xc71)!=strcmp(
 defaultStore,ptParaBuff->default_store))){{strncpy(store,ptParaBuff->
-default_store,sizeof(store)-(0x820+5695-0x1e5e));}atRes=zSms_SendCnmiReq(store);
-if(atRes!=ZSMS_RESULT_OK){return WMS_CMD_FAILED;}}if(-(0x12a1+2099-0x1ad3)==
+default_store,sizeof(store)-(0x300+2547-0xcf2));}atRes=zSms_SendCnmiReq(store);
+if(atRes!=ZSMS_RESULT_OK){return WMS_CMD_FAILED;}}if(-(0xf08+6126-0x26f5)==
 zUfiSms_SetDbParameters(ptParaBuff)){at_print(LOG_ERR,
 "\x73\x65\x74\x20\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73\x20\x74\x6f\x20\x74\x61\x62\x6c\x65\x20\x66\x61\x69\x6c\x65\x64\x2e"
 );return WMS_CMD_FAILED;}return WMS_CMD_SUCCESS;}void zUfiSms_CmgrNvSet(void){
-char sms_rec_flag[(0xb82+2180-0x1401)]={(0x112c+265-0x1235)};char remind_flag[
-(0x137+5812-0x17e6)];int sms_count=(0x8f9+5468-0x1e55);int remind_count=
-(0x1953+1095-0x1d9a);memset(sms_rec_flag,(0x19c8+3151-0x2617),sizeof(
-sms_rec_flag));sc_cfg_get(ZTE_WMS_NVCONFIG_RECEVIED,sms_rec_flag,sizeof(
-sms_rec_flag));sms_count=atoi(sms_rec_flag);if(sms_count<(0xc0c+2776-0x16e4)||
-sms_count>INT_MAX-(0x10d8+1665-0x1758)){at_print(LOG_ERR,
+char sms_rec_flag[(0x1deb+904-0x216e)]={(0x216+4657-0x1447)};char remind_flag[
+(0x18eb+1238-0x1dbc)];int sms_count=(0x884+574-0xac2);int remind_count=
+(0x643+5740-0x1caf);memset(sms_rec_flag,(0xa44+4092-0x1a40),sizeof(sms_rec_flag)
+);sc_cfg_get(ZTE_WMS_NVCONFIG_RECEVIED,sms_rec_flag,sizeof(sms_rec_flag));
+sms_count=atoi(sms_rec_flag);if(sms_count<(0xe4+3251-0xd97)||sms_count>INT_MAX-
+(0x1382+4208-0x23f1)){at_print(LOG_ERR,
 "\x5b\x53\x4d\x53\x5d\x73\x6d\x73\x5f\x63\x6f\x75\x6e\x74\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,sms_count);return;}memset(sms_rec_flag,(0x55f+5030-0x1905),sizeof(sms_rec_flag)
-);snprintf(sms_rec_flag,sizeof(sms_rec_flag),"\x25\x64",sms_count+
-(0x19d7+774-0x1cdc));sc_cfg_set(ZTE_WMS_NVCONFIG_RECEVIED,sms_rec_flag);
+,sms_count);return;}memset(sms_rec_flag,(0x1796+2471-0x213d),sizeof(sms_rec_flag
+));snprintf(sms_rec_flag,sizeof(sms_rec_flag),"\x25\x64",sms_count+
+(0x119f+353-0x12ff));sc_cfg_set(ZTE_WMS_NVCONFIG_RECEVIED,sms_rec_flag);
 sc_cfg_set(ZTE_WMS_NVCONFIG_RECEVIED_LED,sms_rec_flag);memset(remind_flag,
-(0x305+1029-0x70a),sizeof(remind_flag));snprintf(remind_flag,sizeof(remind_flag)
-,"\x25\x64",remind_count+(0xd86+3511-0x1b3c));sc_cfg_set(
+(0x202+2082-0xa24),sizeof(remind_flag));snprintf(remind_flag,sizeof(remind_flag)
+,"\x25\x64",remind_count+(0x85+1263-0x573));sc_cfg_set(
 ZTE_WMS_NVCONFIG_RECEVIED_REMIND,remind_flag);sc_cfg_set(NV_SMS_RECV_RESULT,
 "\x6f\x6b");sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");}void zUfiSms_CdsRespProc(
 T_zSms_SmsInd*ptRespData){unsigned char acFormatPdu[ZSMS_PDU_SIZE]={
-(0x8a2+404-0xa36)};T_zUfiSms_DbStoreData tDbStoreData={(0x192+3146-0xddc)};int 
-isPushSms=(0x230+2387-0xb83);if(strcmp(ptRespData->pdu,"")==(0xcc3+607-0xf22)){
-CHAR srState[(0x7e2+1193-0xc59)]={(0x1b4d+372-0x1cc1)};sc_cfg_get(NV_SR_STATE,
-srState,sizeof(srState));if((0x1d41+1268-0x2235)!=strcmp(srState,
-"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
+(0x2126+801-0x2447)};T_zUfiSms_DbStoreData tDbStoreData={(0x37c+1960-0xb24)};int
+ isPushSms=(0xdc3+1503-0x13a2);if(strcmp(ptRespData->pdu,"")==
+(0x13ab+1391-0x191a)){CHAR srState[(0x8b8+6522-0x2200)]={(0x1e24+1348-0x2368)};
+sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));if((0x1567+1478-0x1b2d)!=strcmp(
+srState,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
 NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_RECVED)
 ;}else{sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");}
 return;}zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);(void)
 String2Bytes(ptRespData->pdu,acFormatPdu,(int)strlen(ptRespData->pdu));if(
-(0x1fcd+1444-0x256c)==ptRespData->stat){(void)zUfiSms_HandleReport(acFormatPdu);
+(0x819+1897-0xf7d)==ptRespData->stat){(void)zUfiSms_HandleReport(acFormatPdu);
 sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");
 zUfiSms_Ack_new_msg(TRUE);return;}return;}int zUfiSms_CheckIfWholeSms(
 T_zUfiSms_DbStoreData*data,SMS_MSG_INFO*pmsg){if(data->concat_sms!=
-(0x1838+2991-0x23e6)){return(0x337+4539-0x14f2);}zUfiSms_GetCurrentRecvTotalSeq(
-data,pmsg);at_print(LOG_DEBUG,
+(0x701+1216-0xbc0)){return(0xba7+217-0xc80);}zUfiSms_GetCurrentRecvTotalSeq(data
+,pmsg);at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x68\x65\x63\x6b\x49\x66\x57\x68\x6f\x6c\x65\x53\x6d\x73\x20\x69\x64\x20\x3d\x20\x25\x73\x2c\x20\x74\x6f\x74\x61\x6c\x53\x65\x71\x20\x3d\x20\x25\x64\x2c\x72\x65\x66\x20\x3d\x25\x64\x2c\x74\x6f\x74\x61\x6c\x20\x3d\x25\x64\x2c\x20\x73\x65\x71\x3d\x25\x64" "\n"
-,pmsg->id,atoi(pmsg->total_seq),data->concat_info[(0x154+1292-0x660)],data->
-concat_info[(0x838+8-0x83f)],data->concat_info[(0x235c+730-0x2634)]);if(data->
-concat_info[(0x899+3018-0x1462)]==atoi(pmsg->total_seq)){return
-(0x14f7+2774-0x1fcd);}return-(0xeea+5422-0x2417);}void 
+,pmsg->id,atoi(pmsg->total_seq),data->concat_info[(0xa65+2187-0x12f0)],data->
+concat_info[(0xa70+5011-0x1e02)],data->concat_info[(0x497+5094-0x187b)]);if(data
+->concat_info[(0x1dd5+192-0x1e94)]==atoi(pmsg->total_seq)){return
+(0x10ab+1261-0x1598);}return-(0x1817+2471-0x21bd);}void 
 zUfiSms_TrafficChangeSmsTag(T_zUfiSms_DbStoreData*data){CHAR smsNumber[
-(0x1c67+549-0x1e5a)]={(0x39c+5932-0x1ac8)};sc_cfg_get(NV_TRAFFIC_SMS_NUMBER,
-smsNumber,sizeof(smsNumber));if((0x55f+1735-0xc26)==strcmp(smsNumber,data->
+(0x1788+887-0x1acd)]={(0x1351+1556-0x1965)};sc_cfg_get(NV_TRAFFIC_SMS_NUMBER,
+smsNumber,sizeof(smsNumber));if((0x138d+4366-0x249b)==strcmp(smsNumber,data->
 number)){data->tag=WMS_TAG_TYPE_MT_READ_V01;data->msg_displaymode=
-(0x596+5388-0x1aa1);}}void zUfiSms_HandleTrafficSms(T_zUfiSms_DbStoreData*data){
-int iSmsId=(0x44c+8553-0x25b5);SMS_MSG_INFO msg={(0x399+6988-0x1ee5)};CHAR 
-smsNumber[(0x1fef+59-0x1ff8)]={(0x3ba+6651-0x1db5)};sc_cfg_get(
+(0x150b+1801-0x1c13);}}void zUfiSms_HandleTrafficSms(T_zUfiSms_DbStoreData*data)
+{int iSmsId=(0x1140+3012-0x1d04);SMS_MSG_INFO msg={(0x93d+6041-0x20d6)};CHAR 
+smsNumber[(0xb7f+4873-0x1e56)]={(0x1060+399-0x11ef)};sc_cfg_get(
 NV_TRAFFIC_SMS_NUMBER,smsNumber,sizeof(smsNumber));at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x74\x44\x62\x53\x74\x6f\x72\x65\x44\x61\x74\x61\x2e\x6e\x75\x6d\x62\x65\x72\x20\x3d\x20\x25\x73\x2c\x20\x74\x72\x61\x66\x66\x69\x63\x5f\x73\x6d\x73\x5f\x6e\x75\x6d\x62\x65\x72\x20\x3d\x20\x25\x73" "\n"
-,data->number,smsNumber);if((0x65+1535-0x664)==strcmp(smsNumber,data->number)){
-if((0x12cb+2427-0x1c46)!=zUfiSms_CheckIfWholeSms(data,&msg)){at_print(LOG_DEBUG,
+,data->number,smsNumber);if((0xc82+3472-0x1a12)==strcmp(smsNumber,data->number))
+{if((0x1f1b+1777-0x260c)!=zUfiSms_CheckIfWholeSms(data,&msg)){at_print(LOG_DEBUG
+,
 "\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x63\x6d\x74\x20\x69\x6e\x64\x2c\x20\x72\x65\x63\x76\x20\x73\x6d\x73\x2c\x20\x62\x75\x74\x20\x6e\x6f\x74\x20\x77\x68\x6f\x6c\x65\x20\x73\x6d\x73\x2c\x20\x77\x61\x69\x74\x20\x74\x6f\x20\x72\x65\x63\x76\x20\x6e\x65\x78\x74\x20\x73\x65\x67" "\n"
 );return;}sc_cfg_set(NV_TRAFFIC_RECV_SMS_ID,msg.id);sc_cfg_set(
 NV_TRAFFIC_SMS_NUMBER,"\x30");at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x48\x61\x6e\x64\x6c\x65\x54\x72\x61\x66\x66\x69\x63\x53\x6d\x73\x20\x20\x20\x74\x72\x61\x66\x66\x69\x63\x5f\x72\x65\x63\x76\x5f\x73\x6d\x73\x5f\x69\x64\x20\x3d\x20\x25\x73" "\n"
 ,msg.id);}}void zUfiSms_CmtRespProc(T_zSms_SmsInd*ptRespData){zUfiSms_StoreType 
 iStorePos=WMS_STORAGE_TYPE_NV_V01;unsigned char acFormatPdu[ZSMS_PDU_SIZE]={
-(0x1117+3229-0x1db4)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
-(0x562+8530-0x26b4);SMS_PARAM one_sms={(0x1d70+2379-0x26bb)};int 
-unread_sms_before_recv_new_sms=(0x9d9+7147-0x25c4);memset(&tDbStoreData,
-(0x107c+2023-0x1863),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
+(0x172+6878-0x1c50)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
+(0x23d+6869-0x1d12);SMS_PARAM one_sms={(0x827+566-0xa5d)};int 
+unread_sms_before_recv_new_sms=(0x10e8+454-0x12ae);memset(&tDbStoreData,
+(0xbfa+5563-0x21b5),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x45\x6e\x74\x65\x72\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2f\x70\x64\x75\x3a\x25\x73\x21" "\n"
 ,ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);if(
-strcmp(ptRespData->pdu,"")==(0xdf5+6267-0x2670)){CHAR srState[
-(0x752+3298-0x1402)]={(0x325+514-0x527)};sc_cfg_get(NV_SR_STATE,srState,sizeof(
-srState));if((0x23a3+248-0x249b)!=strcmp(srState,
+strcmp(ptRespData->pdu,"")==(0x13df+496-0x15cf)){CHAR srState[
+(0x14f8+482-0x16a8)]={(0x7d5+4020-0x1789)};sc_cfg_get(NV_SR_STATE,srState,sizeof
+(srState));if((0x6a5+6363-0x1f80)!=strcmp(srState,
 "\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
 NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_RECVED)
 ;}else{sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");}
 return;}isPushSms=DecodePushPdu(ptRespData->pdu,&one_sms);at_print(LOG_DEBUG,
 "\x5b\x73\x6d\x73\x5d\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x20\x69\x73\x50\x75\x73\x68\x53\x6d\x73\x20\x3d\x20\x25\x64" "\n"
 ,isPushSms);if(SMS_NOTIFICATION==isPushSms){BakNotificationSms(one_sms.TP_UD,
-strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0x51c+704-0x7dc));}if(SMS_NO_PUSH
-!=isPushSms){at_print(LOG_DEBUG,
+strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0x1237+3386-0x1f71));}if(
+SMS_NO_PUSH!=isPushSms){at_print(LOG_DEBUG,
 "\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x69\x6e\x64\x65\x78\x20\x3d\x20\x25\x64" "\n"
 ,one_sms.index);at_print(LOG_DEBUG,
 "\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x52\x65\x66\x65\x72\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
@@ -265,32 +266,32 @@
 ,one_sms.TP_CurrentPieceNum);zUfiSms_ChangeMainState(SMS_STATE_RECVED);
 zUfiSms_Ack_new_msg(TRUE);return;}zUfiSms_GetReportStatus(ptRespData->pdu,&
 ptRespData->stat);(void)String2Bytes(ptRespData->pdu,acFormatPdu,(int)strlen(
-ptRespData->pdu));if((0x1c0+6999-0x1d12)==ptRespData->stat){(void)
+ptRespData->pdu));if((0x594+203-0x65a)==ptRespData->stat){(void)
 zUfiSms_HandleReport(acFormatPdu);sc_cfg_set(NV_SR_STATE,
 "\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");zUfiSms_Ack_new_msg(TRUE);return
 ;}(void)zUfiSms_DecodeSmsData(&tDbStoreData,ptRespData->index,iStorePos,(
 T_SmsStatus)ptRespData->stat,WMS_MESSAGE_FORMAT_GW_PP_V01,ptRespData->length,
 acFormatPdu);if(tDbStoreData.sms_class==WMS_MESSAGE_CLASS_2){iStorePos=
 WMS_STORAGE_TYPE_UIM_V01;}if(zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV)){
-unread_sms_before_recv_new_sms=(0x1d48+712-0x200f);}else{
-unread_sms_before_recv_new_sms=(0x75f+3201-0x13e0);}zUfiSms_TrafficChangeSmsTag(
-&tDbStoreData);if(ZTE_WMS_NV_MEMORY_FULL==zUfiSms_WriteSmsToDb(&tDbStoreData,
-iStorePos,-(0x6e1+3933-0x163d))){zUfiSms_Ack_new_msg(FALSE);zSms_SendZmenaReq(
-(0x116a+592-0x13b9));return;}if(tDbStoreData.sms_class!=WMS_MESSAGE_CLASS_2){
+unread_sms_before_recv_new_sms=(0x7c+2262-0x951);}else{
+unread_sms_before_recv_new_sms=(0x790+1859-0xed3);}zUfiSms_TrafficChangeSmsTag(&
+tDbStoreData);if(ZTE_WMS_NV_MEMORY_FULL==zUfiSms_WriteSmsToDb(&tDbStoreData,
+iStorePos,-(0x1374+2935-0x1eea))){zUfiSms_Ack_new_msg(FALSE);zSms_SendZmenaReq(
+(0x41f+3760-0x12ce));return;}if(tDbStoreData.sms_class!=WMS_MESSAGE_CLASS_2){
 zUfiSms_Ack_new_msg(TRUE);}zUfiSms_CmgrNvSet();zUfiSms_CheckMemoryFull(
 ZTE_WMS_MEMORY_NV);zUfiSms_ChangeMainState(SMS_STATE_RECVED);
 zUfiSms_SendSmsStatusInfo(MSG_SMS_NEW);zUfiSms_HandleTrafficSms(&tDbStoreData);
 return;}void zUfiSms_ZmgrRespProc(T_zSms_SmsInd*ptRespData){zUfiSms_StoreType 
 iStorePos=WMS_STORAGE_TYPE_NV_V01;unsigned char acFormatPdu[ZSMS_PDU_SIZE]={
-(0x1201+3411-0x1f54)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
-(0xbf3+1386-0x115d);SMS_PARAM one_sms={(0x8d0+7645-0x26ad)};CHAR defaultStore[
-(0x745+3394-0x1455)]={(0x258+1773-0x945)};memset(&tDbStoreData,
-(0x106b+4120-0x2083),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
+(0x3dd+4131-0x1400)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
+(0x5b2+3593-0x13bb);SMS_PARAM one_sms={(0xa8d+4890-0x1da7)};CHAR defaultStore[
+(0xbc2+6905-0x2689)]={(0x20b1+1480-0x2679)};memset(&tDbStoreData,
+(0x1250+2639-0x1c9f),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x45\x6e\x74\x65\x72\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2f\x70\x64\x75\x3a\x25\x73\x21" "\n"
 ,ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);if(
-strcmp(ptRespData->pdu,"")==(0x106d+476-0x1249)){CHAR srState[
-(0x1bd1+1397-0x2114)]={(0x10b7+948-0x146b)};sc_cfg_get(NV_SR_STATE,srState,
-sizeof(srState));if((0x1503+3217-0x2194)!=strcmp(srState,
+strcmp(ptRespData->pdu,"")==(0xa59+3374-0x1787)){CHAR srState[
+(0x1027+5108-0x23e9)]={(0x54f+7011-0x20b2)};sc_cfg_get(NV_SR_STATE,srState,
+sizeof(srState));if((0x21ac+730-0x2486)!=strcmp(srState,
 "\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
 NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_RECVED)
 ;}else{sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");}
@@ -299,7 +300,7 @@
 ,isPushSms);at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x20\x69\x73\x50\x75\x73\x68\x53\x6d\x73\x20\x3d\x25\x64\x20" "\n"
 ,isPushSms);if(SMS_NOTIFICATION==isPushSms){BakNotificationSms(one_sms.TP_UD,
-strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0x9f+4565-0x1274));}if(
+strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0x15bf+3215-0x224e));}if(
 SMS_NO_PUSH!=isPushSms){at_print(LOG_DEBUG,
 "\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x69\x6e\x64\x65\x78\x20\x3d\x20\x25\x64" "\n"
 ,one_sms.index);at_print(LOG_DEBUG,
@@ -310,30 +311,30 @@
 "\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x43\x75\x72\x72\x65\x6e\x74\x50\x69\x65\x63\x65\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
 ,one_sms.TP_CurrentPieceNum);zUfiSms_ChangeMainState(SMS_STATE_RECVED);return;}
 zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);(void)String2Bytes(
-ptRespData->pdu,acFormatPdu,(int)strlen(ptRespData->pdu));if((0xef1+721-0x11bd)
-==ptRespData->stat){(void)zUfiSms_HandleReport(acFormatPdu);sc_cfg_set(
-NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");return;}sc_cfg_get(
-NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));if((0xf5+7360-0x1db5)==
+ptRespData->pdu,acFormatPdu,(int)strlen(ptRespData->pdu));if((0x6+1329-0x532)==
+ptRespData->stat){(void)zUfiSms_HandleReport(acFormatPdu);sc_cfg_set(NV_SR_STATE
+,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");return;}sc_cfg_get(
+NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));if((0x1f9a+1798-0x26a0)==
 strcmp(defaultStore,"\x73\x69\x6d")){iStorePos=WMS_STORAGE_TYPE_UIM_V01;}(void)
 zUfiSms_DecodeSmsData(&tDbStoreData,ptRespData->index,iStorePos,(T_SmsStatus)
 ptRespData->stat,WMS_MESSAGE_FORMAT_GW_PP_V01,ptRespData->length,acFormatPdu);if
 (tDbStoreData.sms_class==WMS_MESSAGE_CLASS_2){iStorePos=WMS_STORAGE_TYPE_UIM_V01
 ;}zUfiSms_TrafficChangeSmsTag(&tDbStoreData);if(ZTE_WMS_NV_MEMORY_FULL==
-zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-(0x1eb9+1538-0x24ba))){return;}if(
+zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-(0x986+6640-0x2375))){return;}if(
 tDbStoreData.sms_class!=WMS_MESSAGE_CLASS_2){}zUfiSms_CmgrNvSet();
 zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);zUfiSms_ChangeMainState(
 SMS_STATE_RECVED);zUfiSms_HandleTrafficSms(&tDbStoreData);return;}void 
 zUfiSms_CmgrRespProc(T_zSms_SmsInd*ptRespData){zUfiSms_StoreType iStorePos=
 WMS_STORAGE_TYPE_NV_V01;unsigned char acFormatPdu[ZSMS_PDU_SIZE]={
-(0xa74+5485-0x1fe1)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
-(0xb92+2418-0x1504);SMS_PARAM one_sms={(0x457+3303-0x113e)};int 
-unread_sms_before_recv_new_sms=(0x5db+5403-0x1af6);memset(&tDbStoreData,
-(0xa35+6498-0x2397),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
+(0x36d+2646-0xdc3)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
+(0x8e7+1902-0x1055);SMS_PARAM one_sms={(0x511+7306-0x219b)};int 
+unread_sms_before_recv_new_sms=(0x7c3+6743-0x221a);memset(&tDbStoreData,
+(0x14f7+2251-0x1dc2),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x45\x6e\x74\x65\x72\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2f\x70\x64\x75\x3a\x25\x73\x21" "\n"
 ,ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);
 zUfiSms_SendSmsStatusInfo(MSG_SMS_READING);if(strcmp(ptRespData->pdu,"")==
-(0x1823+1073-0x1c54)){CHAR srState[(0x1465+3735-0x22ca)]={(0xae7+4295-0x1bae)};
-sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));if((0x16bb+1765-0x1da0)!=strcmp(
+(0x18ed+1486-0x1ebb)){CHAR srState[(0x107+1766-0x7bb)]={(0x6c+1270-0x562)};
+sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));if((0x1a2a+2959-0x25b9)!=strcmp(
 srState,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
 NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_RECVED)
 ;}else{sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");}
@@ -342,8 +343,8 @@
 ,isPushSms);at_print(LOG_DEBUG,
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x20\x69\x73\x50\x75\x73\x68\x53\x6d\x73\x20\x3d\x25\x64\x20" "\n"
 ,isPushSms);if(SMS_NOTIFICATION==isPushSms){BakNotificationSms(one_sms.TP_UD,
-strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0x2a0+4602-0x149a));}if(
-SMS_NO_PUSH!=isPushSms){at_print(LOG_DEBUG,
+strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0x443+413-0x5e0));}if(SMS_NO_PUSH
+!=isPushSms){at_print(LOG_DEBUG,
 "\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x69\x6e\x64\x65\x78\x20\x3d\x20\x25\x64" "\n"
 ,one_sms.index);at_print(LOG_DEBUG,
 "\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x52\x65\x66\x65\x72\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
@@ -353,81 +354,81 @@
 "\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x43\x75\x72\x72\x65\x6e\x74\x50\x69\x65\x63\x65\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
 ,one_sms.TP_CurrentPieceNum);zUfiSms_ChangeMainState(SMS_STATE_RECVED);return;}
 zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);(void)String2Bytes(
-ptRespData->pdu,acFormatPdu,(int)strlen(ptRespData->pdu));if((0xfb3+5315-0x2471)
+ptRespData->pdu,acFormatPdu,(int)strlen(ptRespData->pdu));if((0x264+4593-0x1450)
 ==ptRespData->stat){(void)zUfiSms_HandleReport(acFormatPdu);sc_cfg_set(
 NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");return;}(void)
 zUfiSms_DecodeSmsData(&tDbStoreData,ptRespData->index,iStorePos,(T_SmsStatus)
 ptRespData->stat,WMS_MESSAGE_FORMAT_GW_PP_V01,ptRespData->length,acFormatPdu);if
 (tDbStoreData.sms_class==WMS_MESSAGE_CLASS_2){iStorePos=WMS_STORAGE_TYPE_UIM_V01
 ;}if(zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV)){unread_sms_before_recv_new_sms=
-(0x5cf+2841-0x10e7);}else{unread_sms_before_recv_new_sms=(0x42a+3822-0x1318);}if
-(ZTE_WMS_NV_MEMORY_FULL==zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-
-(0xb53+5165-0x1f7f))){return;}if(tDbStoreData.sms_class!=WMS_MESSAGE_CLASS_2){}
+(0x339+1183-0x7d7);}else{unread_sms_before_recv_new_sms=(0x1509+228-0x15ed);}if(
+ZTE_WMS_NV_MEMORY_FULL==zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-
+(0x1+4446-0x115e))){return;}if(tDbStoreData.sms_class!=WMS_MESSAGE_CLASS_2){}
 zUfiSms_CmgrNvSet();zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);
 zUfiSms_ChangeMainState(SMS_STATE_RECVED);return;}void zUfiSms_CmgsRespProc(VOID
-){T_zUfiSms_StatusInfo tStatusInfo={(0x1830+1275-0x1d2b)};g_zUfiSms_DbStoreData
+){T_zUfiSms_StatusInfo tStatusInfo={(0x10bd+3813-0x1fa2)};g_zUfiSms_DbStoreData
 ->msg_displaymode=g_displaymode;if(g_zUfiSms_DbStoreData->msg_displaymode!=
-(0x1bda+666-0x1e73)){if((0x829+7616-0x25e9)==zUfiSms_WriteSmsToDb(&
-g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-(0x1b6b+1635-0x21cd)],
-WMS_STORAGE_TYPE_NV_V01,-(0x14b1+3166-0x210e))){g_zUfiSms_MsgRefer++;(void)
+(0x12e5+2433-0x1c65)){if((0xcb+8406-0x21a1)==zUfiSms_WriteSmsToDb(&
+g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-(0x1458+3509-0x220c)],
+WMS_STORAGE_TYPE_NV_V01,-(0x8f7+4189-0x1953))){g_zUfiSms_MsgRefer++;(void)
 zUfiSms_SetMaxReference(g_zUfiSms_MsgRefer);}}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x67\x73\x52\x73\x70\x20\x73\x65\x67\x4e\x6f\x3a\x25\x64\x2f\x54\x6f\x74\x61\x6c\x4e\x75\x6d\x3a\x25\x64\x2f\x46\x61\x69\x6c\x4e\x75\x6d\x3a\x25\x64\x2e" "\n"
 ,g_zUfiSms_CurConcatSegNo,g_zUfiSms_ConcatTotalNum,g_zUfiSms_SendFailedCount);if
 (g_zUfiSms_CurConcatSegNo==g_zUfiSms_ConcatTotalNum){g_zUfiSms_CurConcatSegNo=
-(0x881+5518-0x1e0f);memset((void*)&tStatusInfo,(0x44+6571-0x19ef),sizeof(
+(0x8cd+4408-0x1a05);memset((void*)&tStatusInfo,(0x653+2405-0xfb8),sizeof(
 T_zUfiSms_StatusInfo));tStatusInfo.err_code=ZTE_SMS_CMS_NONE;tStatusInfo.
 send_failed_count=g_zUfiSms_SendFailedCount;tStatusInfo.delete_failed_count=
-(0x9c0+3150-0x160e);if(g_zUfiSms_SendFailedCount==(0x483+2293-0xd78)){
+(0x203+1471-0x7c2);if(g_zUfiSms_SendFailedCount==(0x338+6524-0x1cb4)){
 tStatusInfo.cmd_status=WMS_CMD_SUCCESS;sc_cfg_set(NV_SMS_SEND_RESULT,"\x6f\x6b")
 ;}else{tStatusInfo.cmd_status=WMS_CMD_FAILED;sc_cfg_set(NV_SMS_SEND_RESULT,
 "\x66\x61\x69\x6c");}tStatusInfo.cmd=WMS_SMS_CMD_MSG_SEND;(void)
 zUfiSms_SetCmdStatus(&tStatusInfo);sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");
 zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);if(g_zUfiSms_MemFullFlag[
 WMS_STORAGE_TYPE_NV_V01]){zUfiSms_SendSmsStatusInfo(MSG_SMS_DEFAULT);}}else{}}
-int zte_fota_notifyPushMsg(int cmd){FOTA_MSG_BUF msg={(0x125+2133-0x97a)};int 
-errs=(0x558+6507-0x1ec3);key_t req_id=ftok(
+int zte_fota_notifyPushMsg(int cmd){FOTA_MSG_BUF msg={(0x1aa1+2025-0x228a)};int 
+errs=(0x28c+3229-0xf29);key_t req_id=ftok(
 "\x2f\x6d\x65\x64\x69\x61\x2f\x7a\x74\x65\x2f\x7a\x74\x65\x5f\x73\x6f\x63\x6b\x65\x74\x2f\x66\x6f\x74\x61\x5f\x64\x6d\x61\x70\x70\x5f\x6d\x73\x67"
-,(0x11+9689-0x25e9));int msgid=msgget(req_id,(0x7d9+6589-0x2196));if(msgid!=-
-(0x801+2752-0x12c0)){msg.mtype=(0xfd3+4864-0x22d2);msg.mtext[
-(0x1597+1855-0x1cd6)]=WEBUI_NOTIFY_PUSH_MSG_;errs=msgsnd(msgid,&msg,sizeof(msg)-
-sizeof(long),(0x146c+5-0x1471));}return(errs<(0x1303+2814-0x1e01)?
-(0xe26+2680-0x189e):(0xaa4+119-0xb1a));}
-#if (0x197a+1287-0x1e81)  
+,(0x285+1285-0x789));int msgid=msgget(req_id,(0x133b+4905-0x2664));if(msgid!=-
+(0xfe6+5350-0x24cb)){msg.mtype=(0x64+7066-0x1bfd);msg.mtext[(0x260+7205-0x1e85)]
+=WEBUI_NOTIFY_PUSH_MSG_;errs=msgsnd(msgid,&msg,sizeof(msg)-sizeof(long),
+(0xc3+7913-0x1fac));}return(errs<(0xa08+3615-0x1827)?(0x513+1556-0xb27):
+(0x648+1077-0xa7c));}
+#if (0x10c+4430-0x125a)  
 int atSms_SendCmglReq(PSTR pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){return 
 zSvr_SendAtSyn(ZAT_CMGL_CMD,"\x41\x54\x2b\x43\x4d\x47\x4c\x3d\x30" "\r\n",cid,
 pAtRst,atRstSize);}VOID atSms_RecvCmglRsp(T_zAt_AtRes*pResLine){return;}
 #endif 

-#if (0x651+7036-0x21cd) 
+#if (0x6f+2283-0x95a) 
 int atSms_SendZmglReq(PSTR pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){int res
-=(0x209+5376-0x1709);pthread_mutex_lock(&smsdb_mutex);res=zSvr_SendAtSyn(
+=(0x1f43+1740-0x260f);pthread_mutex_lock(&smsdb_mutex);res=zSvr_SendAtSyn(
 ZAT_ZMGL_CMD,"\x41\x54\x2b\x5a\x4d\x47\x4c\x3d\x34" "\r\n",cid,pAtRst,atRstSize)
 ;pthread_mutex_unlock(&smsdb_mutex);return res;}VOID atSms_initAtOk(VOID){
-T_zUfiSms_StatusInfo tStatus={(0xd04+4989-0x2081)};sc_cfg_set(NV_SMS_LOAD_RESULT
-,"\x6f\x6b");tStatus.cmd_status=WMS_CMD_SUCCESS;tStatus.cmd=WMS_SMS_CMD_INIT;(
+T_zUfiSms_StatusInfo tStatus={(0x38c+513-0x58d)};sc_cfg_set(NV_SMS_LOAD_RESULT,
+"\x6f\x6b");tStatus.cmd_status=WMS_CMD_SUCCESS;tStatus.cmd=WMS_SMS_CMD_INIT;(
 void)zUfiSms_SetCmdStatus(&tStatus);zUfiSms_ChangeMainState(SMS_STATE_LOADED);}
 int atSms_initAtErr(UINT8*pErrCode){T_zUfiSms_StatusInfo tStatus={
-(0x1c69+198-0x1d2f)};sc_cfg_set(NV_SMS_LOAD_RESULT,"\x66\x61\x69\x6c");
+(0x7b8+7881-0x2681)};sc_cfg_set(NV_SMS_LOAD_RESULT,"\x66\x61\x69\x6c");
 zUfiSms_ChangeMainState(SMS_STATE_LOADED);tStatus.cmd_status=WMS_CMD_FAILED;
 tStatus.cmd=WMS_SMS_CMD_INIT;(void)zUfiSms_SetCmdStatus(&tStatus);return FALSE;}
 VOID atSms_RecvZmglRsp(T_zAt_AtRes*pResLine){static T_zUfiSms_SmsItem tSmsPara={
-(0xfd9+5482-0x2543)};printf(
+(0xabb+553-0xce4)};printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x5a\x6d\x67\x6c\x52\x73\x70\x20\x45\x6e\x74\x65\x72\x20\x70\x64\x75\x46\x6c\x61\x67\x3a\x25\x64\x2f\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2e" "\n"
 ,pResLine->pduFlag,pResLine->result);if(pResLine->pduFlag==ZAT_ATRES_PDU_FLAG){
 zUfiSms_CmglRespProc(pResLine,&tSmsPara);}else{memset(&tSmsPara,
-(0x1265+652-0x14f1),sizeof(T_zUfiSms_SmsItem));(void)zUfiSms_FormatSms(pResLine
-->resParas,sizeof(pResLine->resParas),&tSmsPara,(0x9b7+4896-0x1cd6));printf(
+(0xc1f+1353-0x1168),sizeof(T_zUfiSms_SmsItem));(void)zUfiSms_FormatSms(pResLine
+->resParas,sizeof(pResLine->resParas),&tSmsPara,(0x16ab+2319-0x1fb9));printf(
 "\x5b\x53\x4d\x53\x5d\x20\x5a\x6d\x67\x6c\x20\x52\x65\x73\x70\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
 ,tSmsPara.index,tSmsPara.stat,tSmsPara.length);}}int atSms_SendCmgrReq(PSTR 
-pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0xceb+3604-0x1aeb)
-]={(0xe06+4094-0x1e04)};iSmsIndex=atoi(pAtCmdPara);printf(
+pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0x5bb+3297-0x1288)
+]={(0xc70+6759-0x26d7)};iSmsIndex=atoi(pAtCmdPara);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6d\x67\x72\x52\x65\x71\x20\x47\x65\x74\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2e" "\n"
 ,iSmsIndex);snprintf(pAtcmdStr,sizeof(pAtcmdStr),
 "\x41\x54\x2b\x43\x4d\x47\x52\x3d\x25\x73" "\r\n",pAtCmdPara);return 
 zSvr_SendAtSyn(ZAT_CMGR_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
 atSms_RecvCmgrRsp(T_zAt_AtRes*pResLine){
-#if (0xb9c+3125-0x17d1)

-static T_zUfiSms_SmsItem tSmsPara={(0x1927+1993-0x20f0)};T_zUfiSms_CmgrSetRsp 
-tCmgrRsp={(0x110c+3901-0x2049)};printf(
+#if (0x5fc+348-0x758)

+static T_zUfiSms_SmsItem tSmsPara={(0x1c07+2628-0x264b)};T_zUfiSms_CmgrSetRsp 
+tCmgrRsp={(0x1f5+8789-0x244a)};printf(
 "\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x67\x72\x52\x73\x70\x20\x45\x6e\x74\x65\x72\x20\x70\x64\x75\x46\x6c\x61\x67\x3a\x25\x64\x2f\x50\x61\x72\x61\x73\x3a\x25\x73\x2f\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2e" "\n"
 ,pResLine->pduFlag,pResLine->resParas,pResLine->result);if(pResLine->pduFlag==
 ZAT_ATRES_PDU_FLAG){if(ZAT_RESULT_AUTOREPORT!=pResLine->result){printf(
@@ -436,15 +437,15 @@
 .stat=tSmsPara.stat;sscanf(pResLine->resParas,"\x25\x35\x30\x30\x73",tCmgrRsp.
 pdu);zUfiSms_CmgrRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();sc_cfg_set(
 "\x73\x6d\x73\x5f\x72\x65\x63\x76\x5f\x72\x65\x73\x75\x6c\x74","\x6f\x6b");}else
-{memset(&tSmsPara,(0x1037+4290-0x20f9),sizeof(T_zUfiSms_SmsItem));(void)
-zUfiSms_FormatSms(pResLine->resParas,&tSmsPara,(0x8b9+1508-0xe9b));tSmsPara.
+{memset(&tSmsPara,(0x8ca+245-0x9bf),sizeof(T_zUfiSms_SmsItem));(void)
+zUfiSms_FormatSms(pResLine->resParas,&tSmsPara,(0x3fa+6538-0x1d82));tSmsPara.
 index=iSmsIndex;printf(
 "\x3d\x3d\x3d\x3d\x3d\x3d\x43\x6d\x67\x72\x20\x52\x65\x73\x70\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
 ,tSmsPara.index,tSmsPara.stat,tSmsPara.length);}
 #endif

 }int atSms_SendZmgrReq(PSTR pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){CHAR 
-pAtcmdStr[(0x13e6+3307-0x20bd)]={(0x147b+2757-0x1f40)};iSmsIndex=atoi(pAtCmdPara
-);printf(
+pAtcmdStr[(0xf3+4636-0x12fb)]={(0x1a0d+2292-0x2301)};iSmsIndex=atoi(pAtCmdPara);
+printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x5a\x6d\x67\x72\x52\x65\x71\x20\x47\x65\x74\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2e" "\n"
 ,iSmsIndex);snprintf(pAtcmdStr,sizeof(pAtcmdStr),
 "\x41\x54\x2b\x5a\x4d\x47\x52\x3d\x25\x73" "\r\n",pAtCmdPara);return 
@@ -456,8 +457,8 @@
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x5a\x6d\x67\x72\x45\x72\x72\x20\x20\x53\x4d\x53\x20\x7a\x6d\x67\x72\x20\x69\x73\x20\x66\x61\x69\x6c" "\n"
 );{sc_cfg_set(NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(
 SMS_STATE_RECVED);}}VOID atSms_RecvZmgrRsp(T_zAt_AtRes*pResLine){static 
-T_zUfiSms_SmsItem tSmsPara={(0x23ca+573-0x2607)};T_zUfiSms_CmgrSetRsp tCmgrRsp={
-(0xe9+6539-0x1a74)};printf(
+T_zUfiSms_SmsItem tSmsPara={(0x592+3998-0x1530)};T_zUfiSms_CmgrSetRsp tCmgrRsp={
+(0x93b+4695-0x1b92)};printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x5a\x6d\x67\x72\x52\x73\x70\x20\x45\x6e\x74\x65\x72\x20\x70\x64\x75\x46\x6c\x61\x67\x3a\x25\x64\x2f\x50\x61\x72\x61\x73\x3a\x25\x73\x2f\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2e" "\n"
 ,pResLine->pduFlag,pResLine->resParas,pResLine->result);if(pResLine->pduFlag==
 ZAT_ATRES_PDU_FLAG){if(ZAT_RESULT_AUTOREPORT!=pResLine->result){printf(
@@ -465,56 +466,57 @@
 );return;}tCmgrRsp.index=tSmsPara.index;tCmgrRsp.length=tSmsPara.length;tCmgrRsp
 .stat=tSmsPara.stat;sscanf(pResLine->resParas,"\x25\x35\x30\x30\x73",tCmgrRsp.
 pdu);zUfiSms_ZmgrRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();sc_cfg_set(
-NV_SMS_RECV_RESULT,"\x6f\x6b");}else{memset(&tSmsPara,(0x1425+20-0x1439),sizeof(
-T_zUfiSms_SmsItem));(void)zUfiSms_FormatSms(pResLine->resParas,sizeof(pResLine->
-resParas),&tSmsPara,(0x484+3629-0x12af));tSmsPara.index=iSmsIndex;printf(
+NV_SMS_RECV_RESULT,"\x6f\x6b");}else{memset(&tSmsPara,(0x1402+4738-0x2684),
+sizeof(T_zUfiSms_SmsItem));(void)zUfiSms_FormatSms(pResLine->resParas,sizeof(
+pResLine->resParas),&tSmsPara,(0x11cd+4602-0x23c5));tSmsPara.index=iSmsIndex;
+printf(
 "\x5b\x53\x4d\x53\x5d\x20\x5a\x6d\x67\x72\x20\x52\x65\x73\x70\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
 ,tSmsPara.index,tSmsPara.stat,tSmsPara.length);}}int atSms_SendCmgdReq(PSTR 
-pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0x6f0+4251-0x1777)
-]={(0xd83+531-0xf96)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
+pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0x189+1865-0x8be)]
+={(0x5d+5618-0x164f)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
 "\x41\x54\x2b\x43\x4d\x47\x44\x3d\x25\x73" "\r\n",pAtCmdPara);return 
 zSvr_SendAtSyn(ZAT_CMGD_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
-atSms_RecvCmgdOk(VOID){CHAR strUsed[(0x221+2484-0xbcb)]={(0xd22+1113-0x117b)};
-int used=(0x32b+2970-0xec5);sc_cfg_set(NV_SMS_DEL_RESULT,"\x6f\x6b");printf(
+atSms_RecvCmgdOk(VOID){CHAR strUsed[(0x18c3+3320-0x25b1)]={(0x429+903-0x7b0)};
+int used=(0x71+8796-0x22cd);sc_cfg_set(NV_SMS_DEL_RESULT,"\x6f\x6b");printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x65\x74\x20\x73\x69\x6d\x5f\x64\x65\x6c\x5f\x72\x65\x73\x75\x6c\x74\x20\x74\x6f\x20\x4f\x4b\x2e\x20" "\n"
 );sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));used=atoi(
-strUsed)-(0x243f+242-0x2530);if(used<(0x96+7584-0x1e36)){used=
-(0x1cc1+458-0x1e8b);}memset(&strUsed,(0x233+7621-0x1ff8),(0x10d3+3012-0x1c8d));
+strUsed)-(0x51c+2813-0x1018);if(used<(0xa99+3522-0x185b)){used=
+(0x5a0+6954-0x20ca);}memset(&strUsed,(0x14c1+2166-0x1d37),(0x207b+301-0x219e));
 snprintf(strUsed,sizeof(strUsed),"\x25\x64",used);sc_cfg_set(
 ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed);}VOID atSms_RecvCmgdErr(VOID){sc_cfg_set
 (NV_SMS_DEL_RESULT,"\x66\x61\x69\x6c");printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x65\x74\x20\x73\x69\x6d\x5f\x64\x65\x6c\x5f\x72\x65\x73\x75\x6c\x74\x20\x74\x6f\x20\x66\x61\x69\x6c\x2e\x20" "\n"
-);}VOID atSms_RecvCmgdFinish(VOID){char StrValue[(0x6f0+4147-0x1719)]={
-(0x1750+3227-0x23eb)};CHAR strTotal[(0xa90+3997-0x1a23)]={(0xc5+5485-0x1632)};
-CHAR strUsed[(0x13fc+2760-0x1eba)]={(0xa6c+7022-0x25da)};int total=
-(0x19df+3093-0x25f4);int used=(0x2090+1625-0x26e9);int remain=
-(0x1b7+4430-0x1305);sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(
-strUsed));used=atoi(strUsed);sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,strTotal
-,sizeof(strTotal));total=atoi(strTotal);remain=total-used;if(remain<
-(0x11ef+3099-0x1e0a)){remain=(0x302+5559-0x18b9);}memset(&StrValue,
-(0xa92+6503-0x23f9),(0x677+5008-0x19fd));snprintf(StrValue,sizeof(StrValue),
-"\x25\x64",remain);sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_REMAIN,StrValue);printf(
+);}VOID atSms_RecvCmgdFinish(VOID){char StrValue[(0x10a+3275-0xdcb)]={
+(0xc3d+437-0xdf2)};CHAR strTotal[(0x1208+3058-0x1df0)]={(0x8c0+4596-0x1ab4)};
+CHAR strUsed[(0xb3+1493-0x67e)]={(0x32+3452-0xdae)};int total=(0x2b+982-0x401);
+int used=(0xbf0+2812-0x16ec);int remain=(0x11c1+823-0x14f8);sc_cfg_get(
+ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));used=atoi(strUsed);
+sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,strTotal,sizeof(strTotal));total=atoi
+(strTotal);remain=total-used;if(remain<(0x417+2573-0xe24)){remain=
+(0x3cf+5681-0x1a00);}memset(&StrValue,(0x178f+23-0x17a6),(0x2131+1158-0x25ad));
+snprintf(StrValue,sizeof(StrValue),"\x25\x64",remain);sc_cfg_set(
+ZTE_WMS_NVCONFIG_SIM_CARD_REMAIN,StrValue);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x69\x6d\x53\x6d\x73\x20\x75\x73\x65\x64\x3d\x25\x64\x2c\x72\x65\x6d\x61\x69\x6e\x3d\x25\x64\x2c\x74\x6f\x74\x61\x6c\x3d\x25\x64" "\n"
 ,used,remain,total);zUfiSms_ChangeMainState(SMS_STATE_DELED);sc_cfg_set(
 NV_SMS_DB_CHANGE,"\x31");}int atSms_SendCmgsReq(PSTR pAtCmdPara,int cid,PSTR 
-pAtRst,int atRstSize){int atRes=(0x94c+3723-0x17d7);CHAR pAtcmdStr[ZSMS_PDU_SIZE
-]={(0x19da+27-0x19f5)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
+pAtRst,int atRstSize){int atRes=(0x1abf+196-0x1b83);CHAR pAtcmdStr[ZSMS_PDU_SIZE
+]={(0xc90+6008-0x2408)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
 "\x41\x54\x2b\x43\x4d\x47\x53\x3d\x25\x64" "\r\n",g_zUfiSms_FinalCmgsBuf.length)
 ;atRes=zSvr_SendAtSyn(ZAT_CMGS_CMD,pAtcmdStr,cid,pAtRst,atRstSize);if(atRes!=
-ZAT_RESULT_SMS){return atRes;}memset(pAtcmdStr,(0x1893+582-0x1ad9),ZSMS_PDU_SIZE
-);if(strlen(g_zUfiSms_FinalCmgsBuf.pdu)<ZSMS_PDU_SIZE-(0xa75+7165-0x2671)){
-memcpy(pAtcmdStr,g_zUfiSms_FinalCmgsBuf.pdu,strlen(g_zUfiSms_FinalCmgsBuf.pdu));
-}else{printf(
+ZAT_RESULT_SMS){return atRes;}memset(pAtcmdStr,(0x13c3+1196-0x186f),
+ZSMS_PDU_SIZE);if(strlen(g_zUfiSms_FinalCmgsBuf.pdu)<ZSMS_PDU_SIZE-
+(0xff3+1005-0x13df)){memcpy(pAtcmdStr,g_zUfiSms_FinalCmgsBuf.pdu,strlen(
+g_zUfiSms_FinalCmgsBuf.pdu));}else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6d\x67\x73\x52\x65\x71\x20\x70\x64\x75\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x25\x73" "\n"
 ,g_zUfiSms_FinalCmgsBuf.pdu);memcpy(pAtcmdStr,g_zUfiSms_FinalCmgsBuf.pdu,
-ZSMS_PDU_SIZE-(0x12d7+1902-0x1a43));}*(pAtcmdStr+strlen(g_zUfiSms_FinalCmgsBuf.
-pdu))=ZSMS_CTRL_Z_CHAR;memset(pAtRst,(0x23e7+357-0x254c),atRstSize);return 
+ZSMS_PDU_SIZE-(0x216c+1401-0x26e3));}*(pAtcmdStr+strlen(g_zUfiSms_FinalCmgsBuf.
+pdu))=ZSMS_CTRL_Z_CHAR;memset(pAtRst,(0xb66+7075-0x2709),atRstSize);return 
 zSvr_SendAtSyn(ZAT_CMGS_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
 atSms_RecvCmgsOk(UINT8*pResLine,int cid){at_print(LOG_DEBUG,
 "\x73\x6d\x73\x20\x73\x65\x6e\x64\x65\x64\x20\x73\x75\x63\x63\x65\x73\x73\x2e\x20" "\n"
 );g_zUfiSms_CurConcatSegNo++;if(g_zUfiSms_CurConcatSegNo>
 ZTE_WMS_CONCAT_SMS_COUNT_MAX){return;}g_zUfiSms_DbStoreData[
-g_zUfiSms_CurConcatSegNo-(0x157b+4314-0x2654)].tag=WMS_TAG_TYPE_MO_SENT_V01;
+g_zUfiSms_CurConcatSegNo-(0x1183+4280-0x223a)].tag=WMS_TAG_TYPE_MO_SENT_V01;
 zUfiSms_CmgsRespProc(cid);}VOID atSms_RecvCmgsErr(UINT8*pResLine,int cid){
 at_print(LOG_DEBUG,
 "\x73\x6d\x73\x20\x73\x65\x6e\x64\x65\x64\x20\x66\x61\x69\x6c\x2e\x20" "\n");
@@ -522,16 +524,16 @@
 ZTE_WMS_CONCAT_SMS_COUNT_MAX){return;}g_zUfiSms_SendFailedCount++;at_print(
 LOG_DEBUG,
 "\x73\x65\x6e\x64\x20\x73\x6d\x73\x20\x66\x61\x69\x6c\x65\x64\x2c\x73\x6f\x20\x77\x72\x69\x74\x65\x20\x73\x6d\x73\x20\x74\x6f\x20\x64\x72\x61\x66\x74\x62\x6f\x78\x2e" "\n"
-);g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-(0x107d+376-0x11f4)].tag=
-WMS_TAG_TYPE_MO_NOT_SENT_V01;if(g_zUfiSms_ConcatTotalNum>(0xb0a+7158-0x26ff)){
+);g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-(0x1b86+2578-0x2597)].tag=
+WMS_TAG_TYPE_MO_NOT_SENT_V01;if(g_zUfiSms_ConcatTotalNum>(0x1114+1879-0x186a)){
 g_zUfiSms_IsConcatSendSuc=FALSE;}zUfiSms_CmgsRespProc(cid);}VOID 
 atSms_RecvCmgsRsp(T_zAt_AtRes*pResLine){return;}VOID atSms_RecvCmtRsp(
-T_zAt_AtRes*pResLine){CHAR needSMS[(0x5d9+188-0x663)]={(0x471+7444-0x2185)};
-sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0xe08+1552-0x1418)==
+T_zAt_AtRes*pResLine){CHAR needSMS[(0x14a4+1921-0x1bf3)]={(0x1da0+707-0x2063)};
+sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0xf00+3146-0x1b4a)==
 strcmp(needSMS,"\x6e\x6f")){printf(
 "\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
-);return;}static T_zUfiSms_SmsItem tSmsPara={(0x2eb+2688-0xd6b)};
-T_zUfiSms_CmtSetRsp tCmtRsp={(0x25d+5148-0x1679)};if(NULL==pResLine){return;}
+);return;}static T_zUfiSms_SmsItem tSmsPara={(0x2a5+9215-0x26a4)};
+T_zUfiSms_CmtSetRsp tCmtRsp={(0x101b+1559-0x1632)};if(NULL==pResLine){return;}
 printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x45\x6e\x74\x65\x72\x20\x70\x64\x75\x46\x6c\x61\x67\x3a\x25\x64\x2f\x50\x61\x72\x61\x73\x3a\x25\x73\x2f\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2e" "\n"
 ,pResLine->pduFlag,pResLine->resParas,pResLine->result);if(pResLine->pduFlag==
@@ -541,40 +543,39 @@
 "\x25\x35\x30\x30\x73",tCmtRsp.pdu);pthread_mutex_lock(&smsdb_mutex);
 zUfiSms_CmtRespProc(&tCmtRsp);zUfiMmi_SendSmsStatus();pthread_mutex_unlock(&
 smsdb_mutex);sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}else{memset(&tSmsPara,
-(0x106d+3354-0x1d87),sizeof(T_zUfiSms_SmsItem));atBase_PreProcRes(pResLine->
+(0x13dc+2346-0x1d06),sizeof(T_zUfiSms_SmsItem));atBase_PreProcRes(pResLine->
 resParas,sizeof(pResLine->resParas));printf(
 "\x5b\x53\x4d\x53\x5d\x20\x63\x6d\x74\x20\x69\x6e\x64\x21\x20\x70\x52\x65\x73\x4c\x69\x6e\x65\x2d\x3e\x72\x65\x73\x50\x61\x72\x61\x73\x3a\x25\x73\x2e" "\n"
 ,pResLine->resParas);sscanf(pResLine->resParas,"\x25\x73\x20\x25\x64",tSmsPara.
 alpha,&tSmsPara.length);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x63\x6d\x74\x20\x69\x6e\x64\x21\x20\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
 ,tSmsPara.length);}}VOID atSms_RecvCmtiRsp(T_zAt_AtRes*pResLine){CHAR needSMS[
-(0x848+6615-0x21ed)]={(0x473+5889-0x1b74)};sc_cfg_get(NV_NEED_SUPPORT_SMS,
-needSMS,sizeof(needSMS));if((0x2013+974-0x23e1)==strcmp(needSMS,"\x6e\x6f")){
-printf(
+(0xc90+4905-0x1f87)]={(0xf4b+429-0x10f8)};sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS
+,sizeof(needSMS));if((0x1924+229-0x1a09)==strcmp(needSMS,"\x6e\x6f")){printf(
 "\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
-);return;}char sms_Main_state[(0x1101+1006-0x14d1)]={(0x95b+850-0xcad)};char*
+);return;}char sms_Main_state[(0x1106+485-0x12cd)]={(0x300+6025-0x1a89)};char*
 memory=NULL;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x69\x52\x73\x70\x20\x65\x6e\x74\x65\x72\x20\x25\x73\x2e" "\n"
 ,pResLine->resParas);if(NULL==pResLine){return;}if(ZAT_CMTI_CMD!=pResLine->
 atCmdId){return;}sc_cfg_get(NV_SMS_STATE,sms_Main_state,sizeof(sms_Main_state));
 if(strcmp(sms_Main_state,"\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67")==
-(0x454+6895-0x1f43)){printf(
+(0x11a3+629-0x1418)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x69\x52\x73\x70\x3a\x20\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67" "\n"
 );return;}memory=strstr(pResLine->resParas,"\"");if(NULL!=memory){memory++;}if(
-(0x246+2125-0xa93)==strncmp("\x53\x4d",memory,(0x14b0+3589-0x22b3))){
+(0x5bd+650-0x847)==strncmp("\x53\x4d",memory,(0x21b5+758-0x24a9))){
 zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);zUfiSms_ChangeMainState(
-SMS_STATE_RECVING);memory+=(0x14d+9527-0x2680);printf(
+SMS_STATE_RECVING);memory+=(0x933+3578-0x1729);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x65\x6e\x64\x20\x63\x6d\x67\x72\x3a\x20\x25\x73" "\n"
 ,memory);zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,
 MSG_CMD_AT_ZMGR,strlen(memory),memory);}else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x69\x52\x73\x70\x20\x3a\x73\x74\x6f\x72\x65\x20\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x6e\x6f\x74\x20\x53\x4d\x2e" "\n"
 );}sc_cfg_set(NV_SMS_RECV_RESULT,"");}VOID atSms_RecvCdsRsp(T_zAt_AtRes*pResLine
-){CHAR needSMS[(0x1430+2174-0x1c7c)]={(0x79d+3341-0x14aa)};sc_cfg_get(
-NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x36a+1042-0x77c)==strcmp(
+){CHAR needSMS[(0x16ba+529-0x1899)]={(0x5bd+7491-0x2300)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x1521+3487-0x22c0)==strcmp(
 needSMS,"\x6e\x6f")){printf(
 "\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
-);return;}static T_zUfiSms_SmsItem tSmsPara={(0x4e9+7440-0x21f9)};
-T_zUfiSms_CmgrSetRsp tCmgrRsp={(0x24e2+417-0x2683)};if(NULL==pResLine){return;}
+);return;}static T_zUfiSms_SmsItem tSmsPara={(0x58+2232-0x910)};
+T_zUfiSms_CmgrSetRsp tCmgrRsp={(0x1b5d+2263-0x2434)};if(NULL==pResLine){return;}
 if(pResLine->pduFlag==ZAT_ATRES_PDU_FLAG){if(ZAT_RESULT_AUTOREPORT!=pResLine->
 result){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x52\x73\x70\x20\x67\x65\x74\x20\x72\x65\x73\x75\x6c\x74\x20\x45\x72\x72\x6f\x72\x2e" "\n"
@@ -582,78 +583,79 @@
 "\x25\x35\x30\x30\x73",tCmgrRsp.pdu);pthread_mutex_lock(&smsdb_mutex);
 zUfiSms_CdsRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();pthread_mutex_unlock(&
 smsdb_mutex);sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}else{memset(&tSmsPara,
-(0x438+4385-0x1559),sizeof(T_zUfiSms_SmsItem));atBase_PreProcRes(pResLine->
+(0x254b+156-0x25e7),sizeof(T_zUfiSms_SmsItem));atBase_PreProcRes(pResLine->
 resParas,sizeof(pResLine->resParas));printf(
 "\x5b\x53\x4d\x53\x5d\x20\x63\x64\x73\x20\x69\x6e\x64\x21\x20\x70\x52\x65\x73\x4c\x69\x6e\x65\x2d\x3e\x72\x65\x73\x50\x61\x72\x61\x73\x3a\x25\x73\x2e" "\n"
 ,pResLine->resParas);sscanf(pResLine->resParas,"\x25\x73\x20\x25\x64",tSmsPara.
 alpha,&tSmsPara.length);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x52\x73\x70\x20\x63\x64\x73\x20\x69\x6e\x64\x21\x20\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
 ,tSmsPara.length);}}VOID atSms_RecvCdsiRsp(T_zAt_AtRes*pResLine){CHAR needSMS[
-(0x48+2577-0xa27)]={(0x2005+1631-0x2664)};sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS
-,sizeof(needSMS));if((0x19ad+3138-0x25ef)==strcmp(needSMS,"\x6e\x6f")){printf(
+(0x12ad+4701-0x24d8)]={(0xd3c+3659-0x1b87)};sc_cfg_get(NV_NEED_SUPPORT_SMS,
+needSMS,sizeof(needSMS));if((0xe45+1334-0x137b)==strcmp(needSMS,"\x6e\x6f")){
+printf(
 "\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
-);return;}char sms_Main_state[(0x1a2a+1237-0x1ee1)]={(0x1ec+7148-0x1dd8)};char*
+);return;}char sms_Main_state[(0x1e75+1173-0x22ec)]={(0x18db+310-0x1a11)};char*
 memory=NULL;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x69\x52\x73\x70\x20\x65\x6e\x74\x65\x72\x20\x25\x73\x2e" "\n"
 ,pResLine->resParas);if(NULL==pResLine){return;}if(ZAT_CDSI_CMD!=pResLine->
 atCmdId){return;}sc_cfg_get(NV_SMS_STATE,sms_Main_state,sizeof(sms_Main_state));
 if(strcmp(sms_Main_state,"\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67")==
-(0xac0+1212-0xf7c)){printf(
+(0x161c+1734-0x1ce2)){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x69\x52\x73\x70\x3a\x20\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67" "\n"
 );return;}memory=strstr(pResLine->resParas,"\"");if(NULL!=memory){memory++;}
 printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x69\x52\x73\x70\x3a\x20\x6d\x65\x6d\x6f\x72\x79\x20\x3d\x20\x25\x73" "\n"
-,memory);if((0xadb+5827-0x219e)==strncmp("\x53\x4d",memory,(0xcfd+5994-0x2465)))
+,memory);if((0x2ad+5872-0x199d)==strncmp("\x53\x4d",memory,(0x4e4+7972-0x2406)))
 {zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);zUfiSms_ChangeMainState(
-SMS_STATE_RECVING);memory+=(0x645+525-0x84e);printf(
+SMS_STATE_RECVING);memory+=(0xf68+2040-0x175c);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x73\x65\x6e\x64\x20\x63\x6d\x67\x72\x3a\x20\x25\x73" "\n"
 ,memory);zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,
 MSG_CMD_AT_ZMGR,strlen(memory),memory);}else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x69\x52\x73\x70\x20\x3a\x73\x74\x6f\x72\x65\x20\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x6e\x6f\x74\x20\x53\x4d\x2e" "\n"
 );}sc_cfg_set(NV_SMS_RECV_RESULT,"");}int atSms_SendZmenaReq(PSTR pAtCmdPara,int
- cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0x11fc+2681-0x1c61)]={
-(0x1639+4239-0x26c8)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
+ cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0x30+7305-0x1ca5)]={
+(0x12f+4224-0x11af)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
 "\x41\x54\x2b\x5a\x4d\x45\x4e\x41\x3d\x25\x73" "\r\n",pAtCmdPara);return 
 zSvr_SendAtSyn(ZAT_ZMENA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
 atSms_RecvZmenaOk(VOID){g_Zmena_rsp=TRUE;return;}VOID atSms_RecvZmenaErr(VOID){
 g_Zmena_rsp=FALSE;return;}int atSms_SendCnmaReq(PSTR pAtCmdPara,int cid,PSTR 
-pAtRst,int atRstSize){int atRes=(0x215+8065-0x2196);CHAR pAtcmdStr[ZSMS_PDU_SIZE
-]={(0x7cf+7440-0x24df)};CHAR ackPduStr[(0xe12+955-0x119b)]={(0x960+4596-0x1b54)}
-;if(atoi(pAtCmdPara)==(0xfeb+4187-0x2045)){snprintf(pAtcmdStr,sizeof(pAtcmdStr),
-"\x41\x54\x2b\x43\x4e\x4d\x41\x3d\x25\x73" "\r\n",pAtCmdPara);atRes=
+pAtRst,int atRstSize){int atRes=(0x49b+4532-0x164f);CHAR pAtcmdStr[ZSMS_PDU_SIZE
+]={(0xa98+3840-0x1998)};CHAR ackPduStr[(0x233b+238-0x23f7)]={(0x236b+230-0x2451)
+};if(atoi(pAtCmdPara)==(0x1108+2734-0x1bb5)){snprintf(pAtcmdStr,sizeof(pAtcmdStr
+),"\x41\x54\x2b\x43\x4e\x4d\x41\x3d\x25\x73" "\r\n",pAtCmdPara);atRes=
 zSvr_SendAtSyn(ZAT_CNMA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x20\x31\x31\x31\x31\x31\x31\x20\x61\x63\x6b\x20\x6f\x6b\x20\x3d\x20\x25\x73\x2e" "\n"
-,pAtcmdStr);return(0x7f5+768-0xaf5);}else{zUfiSms_EncodePdu_DeliverReport(
-ackPduStr,(0x184d+537-0x1993));snprintf(pAtcmdStr,sizeof(pAtcmdStr),
+,pAtcmdStr);return(0x2481+444-0x263d);}else{zUfiSms_EncodePdu_DeliverReport(
+ackPduStr,(0x15d0+113-0x156e));snprintf(pAtcmdStr,sizeof(pAtcmdStr),
 "\x41\x54\x2b\x43\x4e\x4d\x41\x3d\x25\x73\x2c\x25\x64" "\r\n",pAtCmdPara,strlen(
-ackPduStr)/(0x13f0+3903-0x232d));atRes=zSvr_SendAtSyn(ZAT_CNMA_CMD,pAtcmdStr,cid
-,pAtRst,atRstSize);if(atRes!=ZAT_RESULT_SMS){return atRes;}printf(
+ackPduStr)/(0x612+5474-0x1b72));atRes=zSvr_SendAtSyn(ZAT_CNMA_CMD,pAtcmdStr,cid,
+pAtRst,atRstSize);if(atRes!=ZAT_RESULT_SMS){return atRes;}printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x20\x3d\x20\x25\x73\x2e" "\n"
-,pAtcmdStr);memset(pAtcmdStr,(0xe13+5453-0x2360),ZSMS_PDU_SIZE);if(strlen(
-ackPduStr)<ZSMS_PDU_SIZE-(0x858+6962-0x2389)){memcpy(pAtcmdStr,ackPduStr,strlen(
+,pAtcmdStr);memset(pAtcmdStr,(0x796+5156-0x1bba),ZSMS_PDU_SIZE);if(strlen(
+ackPduStr)<ZSMS_PDU_SIZE-(0x8f0+6502-0x2255)){memcpy(pAtcmdStr,ackPduStr,strlen(
 ackPduStr));}else{printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6d\x67\x73\x52\x65\x71\x20\x70\x64\x75\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x25\x73" "\n"
-,ackPduStr);memcpy(pAtcmdStr,ackPduStr,ZSMS_PDU_SIZE-(0x1374+1567-0x1991));}*(
+,ackPduStr);memcpy(pAtcmdStr,ackPduStr,ZSMS_PDU_SIZE-(0xb3+1811-0x7c4));}*(
 pAtcmdStr+strlen(ackPduStr))=ZSMS_CTRL_Z_CHAR;printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x2e\x20\x70\x64\x75\x3d\x20\x25\x73" "\n"
-,pAtcmdStr);memset(pAtRst,(0x673+1760-0xd53),atRstSize);return zSvr_SendAtSyn(
+,pAtcmdStr);memset(pAtRst,(0x105a+507-0x1255),atRstSize);return zSvr_SendAtSyn(
 ZAT_CNMA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}}VOID atSms_RecvCnmaRsp(
 T_zAt_AtRes*pResLine){return;}VOID atUnsoli_Delete_Sim_Sms(UINT8*pDatabuf,int 
-cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0x1042+3441-0x1db3)};int atRes=
-(0x13ba+2697-0x1e43);if(pDatabuf==NULL){return;}atRes=atSms_SendCmgdReq(pDatabuf
-,cid,errCode,ZSVR_AT_RES_CODE_LEN);if(atRes==ZSMS_RESULT_OK){atSms_RecvCmgdOk();
-}else{atSms_RecvCmgdErr();}atSms_RecvCmgdFinish();}VOID atUnsoli_Report_Cnma(
-UINT8*pDatabuf,int cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0x1454+2635-0x1e9f)
-};if(pDatabuf==NULL){printf(
+cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0x911+735-0xbf0)};int atRes=
+(0x907+3367-0x162e);if(pDatabuf==NULL){return;}atRes=atSms_SendCmgdReq(pDatabuf,
+cid,errCode,ZSVR_AT_RES_CODE_LEN);if(atRes==ZSMS_RESULT_OK){atSms_RecvCmgdOk();}
+else{atSms_RecvCmgdErr();}atSms_RecvCmgdFinish();}VOID atUnsoli_Report_Cnma(
+UINT8*pDatabuf,int cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0x89c+6310-0x2142)}
+;if(pDatabuf==NULL){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x55\x6e\x73\x6f\x6c\x69\x5f\x52\x65\x70\x6f\x72\x74\x5f\x43\x6e\x6d\x61\x20\x6e\x75\x6c\x6c"
 );return;}atSms_SendCnmaReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);}VOID 
 atUnsoli_Report_Zmena(UINT8*pDatabuf,int cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]
-={(0x535+2553-0xf2e)};int atRes=(0x1cb0+1007-0x209f);if(pDatabuf==NULL){printf(
+={(0xc9+9193-0x24b2)};int atRes=(0x1506+1193-0x19af);if(pDatabuf==NULL){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x55\x6e\x73\x6f\x6c\x69\x5f\x52\x65\x70\x6f\x72\x74\x5f\x5a\x6d\x65\x6e\x61\x20\x6e\x75\x6c\x6c"
 );return;}atRes=atSms_SendZmenaReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);if
 (atRes==ZSMS_RESULT_OK){atSms_RecvZmenaOk();}else{atSms_RecvZmenaErr();}}VOID 
 atUnsoli_Report_Zmgr(UINT8*pDatabuf,int cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]=
-{(0x1ab8+347-0x1c13)};if(pDatabuf==NULL){printf(
+{(0x3f1+5843-0x1ac4)};if(pDatabuf==NULL){printf(
 "\x5b\x53\x4d\x53\x5d\x20\x61\x74\x55\x6e\x73\x6f\x6c\x69\x5f\x52\x65\x70\x6f\x72\x74\x5f\x5a\x6d\x67\x72\x20\x6e\x75\x6c\x6c"
 );return;}atSms_SendZmgrReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);}
 #endif

diff --git a/ap/app/zte_comm/zte_hotplug/netdev_plug.c b/ap/app/zte_comm/zte_hotplug/netdev_plug.c
index da7ff8c..cf31f7e 100755
--- a/ap/app/zte_comm/zte_hotplug/netdev_plug.c
+++ b/ap/app/zte_comm/zte_hotplug/netdev_plug.c
@@ -579,6 +579,14 @@
 			event->u.netdev.dev_id = dev_id;
 			return 0;
 		}
+		if (KOBJ_ADD == event->action && strstr(dev_ptr, "v4-wan")) {
+			char cmd[60] = {0};
+			
+			snprintf(cmd, sizeof(cmd), "ip route add default dev %s", dev_ptr);
+			slog(NET_PRINT, SLOG_ERR, "[%s][%d]system=%s\n", __func__, __LINE__, cmd);
+			soft_system(cmd);
+			return 0;
+		}
 	}
 
 	return -1;
diff --git a/ap/app/zte_comm/zte_mainctrl/netdev_proc.c b/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
index 7e853a8..1715310 100755
--- a/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
+++ b/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
@@ -720,6 +720,7 @@
 	char tc_enable[4] = {0};
 	char buffer[128] = {0};
 	char mtu[16] = {0};
+	char xlat_enable[4] = {0};
 	
 	sc_cfg_get("tc_enable", tc_enable, sizeof(tc_enable));
 	snprintf(wan_name,NV_NAME_LEN,	"%s%d", ps_wan, actinfo->c_id);
@@ -919,6 +920,22 @@
 			ndp_down(0);
 			snprintf(buffer, sizeof(buffer), "zte_ndp -a -s br0 -d %s -l %s &", defwan_real, ndp_log);
 			system_cmd_ex(buffer);
+			if(actinfo->act_info.ip46flag == V6_VALID){
+				sc_cfg_get("xlat_enable", xlat_enable, sizeof(xlat_enable));
+				if(atoi(xlat_enable) && (default_route_check() == 0)){
+					char xlat_prefix[IPV6ADDLEN_MAX] = {0};
+					sc_cfg_get("xlat_prefix", xlat_prefix, sizeof(xlat_prefix));
+					if(strlen(xlat_prefix) == 0){
+						snprintf(buffer, sizeof(buffer),"clatd -i %s &", defwan_real);
+					} else {
+						snprintf(buffer, sizeof(buffer),"clatd -i %s -p %s &", defwan_real, xlat_prefix);
+					}
+					system_cmd_ex(buffer);
+					system_cmd_ex("echo 1 > /proc/sys/net/ipv4/ip_forward");
+					snprintf(buffer, sizeof(buffer),"iptables -t nat -A POSTROUTING -o v4-%s -j MASQUERADE", defwan_real);
+					system_cmd_ex(buffer);
+				}
+			}
 #ifdef USE_CAP_SUPPORT
 			char dhcps_in_cap[4] = {0};
 			sc_cfg_get("dhcps_in_cap", dhcps_in_cap, sizeof(dhcps_in_cap));
@@ -1055,6 +1072,10 @@
 			}
 		}
 		zte_unpn_set();
+		if(atoi(xlat_enable) && actinfo->act_info.ip46flag == V6_VALID){
+			snprintf(buffer, sizeof(buffer),"ip route add default dev v4-%s", defwan_real);
+			system_cmd_ex(buffer);
+		}
 		net_sendmsg_2_atctl(actinfo->c_id, actinfo->act_info.ip46flag, MSG_CMD_LINKUP_END);
 	}
 }
@@ -1142,7 +1163,7 @@
 			snprintf(cmd, sizeof(cmd), "iptables -t nat -D POSTROUTING -o %s -j MASQUERADE", wan_name);
 			system_cmd_ex(cmd);
 #else
-			net_write_file("/proc/sys/net/ipv4/ip_forward", "0", 1);
+			//net_write_file("/proc/sys/net/ipv4/ip_forward", "0", 1);
 #endif
 			snprintf(cmd, sizeof(cmd),"route del default dev %s", wan_name);
 			system_cmd_ex(cmd);
@@ -1177,6 +1198,10 @@
 			system_cmd_ex("ip -6 route del default");
 			snprintf(cmd, sizeof(cmd),"ip -6 addr del %s/64 dev br0", br_ip6);
 			system_cmd_ex(cmd);
+			system_cmd_ex("ip route del default");
+			system_cmd_ex("killall clatd");
+			snprintf(cmd, sizeof(cmd),"iptables -t nat -D POSTROUTING -o v4-%s -j MASQUERADE", wan_name);
+			system_cmd_ex(cmd);
 			{
 				char path_tmp[16] = {0};
 				char path[32] = {0};