[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/goahead/interface5.0/Makefile b/ap/app/goahead/interface5.0/Makefile
new file mode 100755
index 0000000..86df06d
--- /dev/null
+++ b/ap/app/goahead/interface5.0/Makefile
@@ -0,0 +1,186 @@
+# /*****************************************************************************
+#* °æÈ¨ËùÓÐ (C)2015, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+#*
+#* ÎļþÃû³Æ: Makefile
+#* Îļþ±êʶ: Makefile
+#* ÄÚÈÝÕªÒª: Makefile of ZTE applications
+#* ʹÓ÷½·¨: void
+#*
+#* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
+#* -----------------------------------------------------------------------------
+#* 2015/02/10 V1.0 Create ÁõÑÇÄÏ ´´½¨
+#*
+# ******************************************************************************/
+
+#*******************************************************************************
+# include ZTE application makefile
+#*******************************************************************************
+include $(zte_app_mak)
+
+.PHONE: webuinet
+.PHONE: webuiwifi
+.PHONE: webuiother
+#*******************************************************************************
+# LIBWEBINTERFACE
+#*******************************************************************************
+LIBWEBINTERFACE = libwebinterface.a
+LIBWEBINTERFACE_SHARED = libwebinterface.so
+
+#*******************************************************************************
+# objects
+#*******************************************************************************
+OBJS = zte_web_regist.o zte_web_util.o zte_web_mgmt.o \
+ zte_web_pbm.o \
+ zte_web_wan.o zte_web_sms.o \
+ zte_web_get_fw_para.o \
+ zte_web_httpshare.o zte_web_ussd.o \
+ zte_web_mc.o zte_web_rest.o zte_web_safe.o zte_web_cell_broadcast.o \
+ zte_web_cjson.o zte_web_sem.o
+
+#OBJS += $(wildcard $(zte_lib_path)/libpthread/*.o)
+export WEBUI=
+
+ifeq ($(WEBUI), orig)
+OBJS +=
+WEBOBJS :=
+else
+CFLAGS += -DMYWEBUI
+WEBOBJS := $(patsubst %.c,%.o,$(wildcard ./net/*.c))
+endif
+
+WIFIOBJS := $(patsubst %.c,%.o,$(wildcard ./wifi/*.c))
+
+OTHEROBJS := $(patsubst %.c,%.o,$(wildcard ./other/*.c))
+#OBJS += $(WIFIOBJS)
+#*******************************************************************************
+# include path
+#*******************************************************************************
+CFLAGS += -DCONFIG_CHINA_UNICOM -DWEBS -DUEMF -DOS="LINUX" -DLINUX $(UMSW) $(DASW) $(SSLSW) $(IFMODSW)
+CFLAGS += -DWEBINSPECT_FIX
+CFLAGS += -Wall -fno-strict-aliasing
+#CFLAGS += -I$(ROOTDIR)/lib/libnvram -I$(ROOTDIR)/$(LINUXDIR)/drivers/char -I$(ROOTDIR)/$(LINUXDIR)/include
+#CFLAGS += -I$(ROOTDIR)/$(LINUXDIR)/drivers/flash
+CFLAGS += -I$(zte_lib_path)/libnvram
+CFLAGS += -I$(zte_lib_path)/libezxml
+CFLAGS += -I$(zte_lib_path)/libmxml
+CFLAGS += -I$(zte_lib_path)/zlib/install/include
+CFLAGS += -I../../goahead/interface5.0/net
+CFLAGS += -I../../goahead/interface5.0/wifi
+CFLAGS += -I../../goahead/interface5.0/other
+CFLAGS += -I../../goahead/interface5.0
+CFLAGS += -I../../include
+CFLAGS += -I../../wlan
+#CFLAGS += -I../../zte_sqlite
+#CFLAGS += -I../../soft_timer
+CFLAGS += -I$(zte_lib_path)/libsqlite
+CFLAGS += -I$(zte_lib_path)/libsoft_timer
+CFLAGS += -I../../at_server
+CFLAGS += -I../../awps/include
+CFLAGS += -I.
+
+#CFLAGS += -I../../sms
+
+ifeq ($(LINUX_TYPE),linux)
+CFLAGS += -I$(USR_DIR)
+endif
+
+#CFLAGS += -I$(USR_DIR)/zte_apps/soft_timer
+#CFLAGS += -I$(USR_DIR)/zte_apps/at_server
+CFLAGS += -I../server
+CFLAGS += -fPIC -shared -lc
+SHAREDFLAG := -fPIC -shared -lc
+#CFLAGS += -I$(LIB_DIR)/lib/sms_pbm
+
+ifeq ($(CONFIG_USE_WEBUI_SECURITY),yes)
+CFLAGS += -DWEBS_SECURITY
+endif
+ifeq ($(CONFIG_USE_WEBUI_SSL),yes)
+CFLAGS += -DWEBS_SSL_SUPPORT -DOPENSSL
+endif
+
+#*******************************************************************************
+# macro definition
+#*******************************************************************************
+ifeq ($(FEATURE_IPV6), YES)
+ CFLAGS += -DFEATURE_IPV4V6_MODE
+endif
+
+ifeq ($(FEATURE_SMS_MODE), CS)
+ CFLAGS += -DCS_SMS
+endif
+
+ifeq ($(CUSTOM_MODEL),MF253)
+ ifeq ($(CUSTOM_OPERATOR),VIVO_BR)
+ CFLAGS += -DCUSTOM_VERSION_MF253_VIVO_BR
+ endif
+endif
+
+ifeq ($(FEATURE_TSP_MODE), YES)
+ CFLAGS += -DFEATURE_TSP_MODEM
+endif
+
+ifeq ($(CUSTOM_MODEL), MF253S2)
+ifeq ($(CUSTOM_OPERATOR), CM_CN)
+CFLAGS += -DCUSTOM_VERSION_MF253S2_CM_CN
+endif
+endif
+
+#*******************************************************************************
+# library
+#*******************************************************************************
+LDLIBS += -lpthread -lgcc_s
+LDLIBS += -lnvram_sc -lsoft_timer_sc -lsqlite -lzte_pbm -lwlan_interface -llog
+
+#*******************************************************************************
+# library path
+#*******************************************************************************
+LDLIBS += -L$(zte_lib_path)/libnvram
+LDLIBS += -L$(zte_lib_path)/libsoft_timer
+LDLIBS += -L$(zte_lib_path)/libsqlite
+LDLIBS += -L$(zte_lib_path)/liblog
+LDLIBS += -L$(zte_lib_path)/libzte_pbm
+LDLIBS += -L$(zte_lib_path)/../libezxml
+LDLIBS += -L$(zte_lib_path)/../libmxml
+LDLIBS += -L$(zte_lib_path)/libwlan_interface
+
+CFLAGS += -I$(zte_lib_path)/libssl/install/include
+LDLIBS += -L$(zte_lib_path)/libssl/install/lib -lcrypto
+#*******************************************************************************
+# targets
+#*******************************************************************************
+all: $(LIBWEBINTERFACE) webuinet webuiwifi webuiother
+zte_web_util.o: webuinet webuiwifi webuiother
+#all:
+# echo $(ROOTDIR) $(LINUXDIR) $(zte_lib_path)
+
+$(LIBWEBINTERFACE): $(OBJS) webuinet webuiwifi webuiother
+ $(AR) -rc $@ $(OBJS) $(WEBOBJS) $(WIFIOBJS) $(OTHEROBJS)
+
+$(LIBWEBINTERFACE_SHARED): $(OBJS) webuinet webuiwifi webuiother
+ $(LD) $(SHAREDFLAG) -o $@ $^ $(LDLIBS) $(WEBOBJS) $(WIFIOBJS) $(OTHEROBJS)
+# $(STRIP) $@
+
+romfs:
+
+ifeq ($(WEBUI), orig)
+webuinet:
+ @echo
+else
+webuinet:
+ cd ./net; echo $$pwd ;$(MAKE) -C ./ all||exit $$?
+endif
+
+webuiwifi:
+ cd ./wifi; echo $$pwd ;$(MAKE) -C ./ all||exit $$?
+
+webuiother:
+ cd ./other; echo $$pwd ;$(MAKE) -C ./ all||exit $$?
+
+root_fs:
+# $(ROMFSINST) -e CONFIG_USER_GOAHEAD /bin/$(LIBWEBINTERFACE)
+
+clean:
+ -rm -f $(LIBWEBINTERFACE) *.elf *.gdb *.o
+ -cd ./net && $(MAKE) -C ./ clean
+ -cd ./wifi && $(MAKE) -C ./ clean
+ -cd ./other && $(MAKE) -C ./ clean
diff --git a/ap/app/goahead/interface5.0/net/Makefile b/ap/app/goahead/interface5.0/net/Makefile
new file mode 100755
index 0000000..a2a6e00
--- /dev/null
+++ b/ap/app/goahead/interface5.0/net/Makefile
@@ -0,0 +1,90 @@
+# /*****************************************************************************
+#* °æÈ¨ËùÓÐ (C)2015, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+#*
+#* ÎļþÃû³Æ: Makefile
+#* Îļþ±êʶ: Makefile
+#* ÄÚÈÝÕªÒª: Makefile of ZTE applications
+#* ʹÓ÷½·¨: void
+#*
+#* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
+#* -----------------------------------------------------------------------------
+#* 2015/03/12 V1.0 Create ²ÜÈü ´´½¨
+#*
+# ******************************************************************************/
+
+#*******************************************************************************
+# include ZTE application makefile
+#*******************************************************************************
+include $(zte_app_mak)
+
+#*******************************************************************************
+# execute
+#*******************************************************************************
+#EXEC = libwebuinet.a
+
+#*******************************************************************************
+# objects
+#*******************************************************************************
+OBJS = zte_web_net_lan.o zte_web_net_other.o zte_web_net_wan.o
+
+SRC = zte_web_net_lan.c zte_web_net_other.c zte_web_net_wan.c
+
+#*******************************************************************************
+# include path
+#*******************************************************************************
+CFLAGS += -DCONFIG_CHINA_UNICOM -DWEBS -DUEMF -DOS="LINUX" -DLINUX \
+ -I. \
+ -I$(zte_lib_path)/libnvram \
+ -I$(zte_lib_path)/libezxml \
+ -I$(zte_lib_path)/libmxml \
+ -I../../../include \
+ -I$(zte_lib_path)/libsqlite \
+ -I$(zte_lib_path)/libsoft_timer \
+ -I../../../at_server \
+ -I../../../awps/include \
+ -I../../server \
+ -I.. \
+ -lsoftap \
+ -L$(zte_lib_path)/libsoftap \
+ -lpthread \
+ -lsoft_timer_sc \
+ -L$(zte_lib_path)/libsoft_timer
+
+ifeq ($(CONFIG_USE_WEBUI_SECURITY),yes)
+CFLAGS += -DWEBS_SECURITY
+endif
+#*******************************************************************************
+# macro definition
+#*******************************************************************************
+ifeq ($(CUSTOM_MODEL), MF29S2)
+CFLAGS += -DCUSTOM_VERSION_MF29S2_ZTE
+endif
+#CPPFLAGS += -D_MBB_OS_UCLINUX
+#*******************************************************************************
+# library
+#*******************************************************************************
+
+LDLIBS +=
+
+#*******************************************************************************
+# library path
+#*******************************************************************************
+LDLIBS +=
+
+#*******************************************************************************
+# targets
+#*******************************************************************************
+
+#$(error ===================================>)
+all: $(OBJS)
+ @echo "--------------------webui build-----------------------"
+#$(RANLIB) $@
+
+%.o: %.c
+ $(CC) $(CFLAGS) $(INCLUDES) -c $< -Wl,--start-group $(LDLIBS) -Wl,--end-group
+
+#$(CC) $(LDFLAGS) $(CFLAGS) $(INCLUDES) -o $@ $< -Wl,--start-group $(LDLIBS) -Wl,--end-group
+
+
+clean:
+ -rm -f *.elf *.gdb *.o *.a
diff --git a/ap/app/goahead/interface5.0/net/zte_web_net_lan.c b/ap/app/goahead/interface5.0/net/zte_web_net_lan.c
new file mode 100644
index 0000000..7b82e59
--- /dev/null
+++ b/ap/app/goahead/interface5.0/net/zte_web_net_lan.c
@@ -0,0 +1,893 @@
+#include <stdlib.h>
+#include "zte_web_interface.h"
+#include "zte_web_net_lan.h"
+#include "zte_web_net_other.h"
+
+#include "message.h"
+#include "netotherapi.h"
+#include "mainctl_msg.h"
+
+#define WEB_DHCP_LEASE_TIME_DEFAULT 86400 /* 24*3600 */
+#define safe_free(x) do { if(x) {free(x); x=NULL;} } while(0)
+
+/*¶¨Òåsystemºê*/
+#define CMD_STR_LEN 256
+/*
+#define do_cmd(format, cmds...) ({ \
+ int __STATAS__; \
+ char __TEMP__[CMD_STR_LEN]; \
+ sprintf(__TEMP__, format, ##cmds); \
+ __STATAS__ = system(__TEMP__); \
+ __STATAS__; \
+})
+*/
+
+void zte_dhcpv6_state_set(webs_t wp)
+{
+ char_t *dhcpv6stateE = NULL;
+ char_t *dhcpv6statelessE = NULL;
+
+ dhcpv6stateE = websGetVar(wp, T("dhcpv6stateEnabled"), T(""));
+ dhcpv6statelessE = websGetVar(wp, T("dhcpv6statelessEnabled"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG, "dhcpv6stateE = %s\n", dhcpv6stateE);
+ slog(MISC_PRINT, SLOG_DEBUG, "dhcpv6statelessE = %s\n", dhcpv6statelessE);
+
+ if (!dhcpv6stateE || !strlen(dhcpv6stateE)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (!dhcpv6statelessE || !strlen(dhcpv6statelessE)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if ((atoi(dhcpv6stateE) == 0) && (atoi(dhcpv6statelessE) == 0)) {
+ zte_web_write("dhcpv6stateEnabled", "0");
+ zte_web_write("dhcpv6statelessEnabled", "0");
+ } else if ((atoi(dhcpv6stateE) == 1) && (atoi(dhcpv6statelessE) == 0)) {
+ zte_web_write("dhcpv6stateEnabled", "1");
+ zte_web_write("dhcpv6statelessEnabled", "0");
+ } else if ((atoi(dhcpv6stateE) == 0) && (atoi(dhcpv6statelessE) == 1)) {
+ zte_web_write("dhcpv6stateEnabled", "0");
+ zte_web_write("dhcpv6statelessEnabled", "1");
+ } else {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+ zte_goform_mgmt_reboot_process(wp);
+}
+
+static void dhcp_setting_process(char *lanIp, char *lanNetmask, char *lanDhcpType,
+ char *dhcpStart, char *dhcpEnd, char *dhcpLease)
+{
+ dhcp_setting_req dhcp_setting = {0};
+
+ strncpy(dhcp_setting.lan_ip, lanIp,sizeof(dhcp_setting.lan_ip)-1);
+ strncpy(dhcp_setting.lan_netmask, lanNetmask,sizeof(dhcp_setting.lan_netmask)-1);
+ if (!strncmp(lanDhcpType, "DISABLE", strlen("DISABLE"))) {
+ dhcp_setting.dhcp_enabled = 0;
+ } else {
+ dhcp_setting.dhcp_enabled = 1;
+ strncpy(dhcp_setting.dhcp_start, dhcpStart,sizeof(dhcp_setting.dhcp_start)-1);
+ strncpy(dhcp_setting.dhcp_end, dhcpEnd,sizeof(dhcp_setting.dhcp_end)-1);
+ strncpy(dhcp_setting.dhcp_dns, lanIp,sizeof(dhcp_setting.dhcp_dns)-1);
+ strncpy(dhcp_setting.dhcp_lease, dhcpLease,sizeof(dhcp_setting.dhcp_lease)-1);
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, \
+ MSG_CMD_NET_DHCP_SETTING_REQ, sizeof(dhcp_setting), &dhcp_setting, 0);
+}
+
+//¿ìËÙDHCP²ÎÊýÉèÖÃ
+void quick_dhcp_set(webs_t wp)
+{
+ // data from form
+ char_t *lanIp = NULL;
+ char_t *lanNetmask = NULL;
+ char_t *lanDhcpType = NULL;
+ char_t *dhcpStart = NULL;
+ char_t *dhcpEnd = NULL;
+ char_t *dhcpDns = NULL;
+ char_t *dhcpLease = NULL;
+ char dhcp_temp[NVIO_DEFAULT_LEN] = {0};
+ int dhcp_lease_time = WEB_DHCP_LEASE_TIME_DEFAULT; /* default 24*3600 */
+
+ int dhcp_lease_hour = 24;
+
+ // get old data
+ int bLanNotChangeFlag = 0;
+ char lanIp_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char lanNetmask_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char dhcpType_read[NV_ITEM_VALUE_YES_NO_LEN] = {0};
+ char dhcpStart_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char dhcpEnd_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char dhcpDns_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char dhcpLeaseHour_read[NVIO_DEFAULT_LEN] = {0};
+
+ // wan info
+ //char wan_ip[NVIO_DEFAULT_LEN] = {0};
+
+ // Get the params from pages
+ lanIp = websGetVar(wp, T("lanIp"), T(""));
+ lanNetmask = websGetVar(wp, T("lanNetmask"), T(""));
+ lanDhcpType = websGetVar(wp, T("lanDhcpType"), T("SERVER"));
+ dhcpStart = websGetVar(wp, T("dhcpStart"), T(""));
+ dhcpEnd = websGetVar(wp, T("dhcpEnd"), T(""));
+ dhcpDns = websGetVar(wp, T("dhcpDns"), T(lanIp));
+ dhcpLease = websGetVar(wp, T("dhcpLease"), T("24"));
+#if 0 // kw 3
+ dhcp_lease_time = atoi(dhcpLease) * 3600;/* hours to seconds */
+#else
+ dhcp_lease_hour = atoi(dhcpLease);
+
+ if(dhcp_lease_hour < 0 || dhcp_lease_hour > INT_MAX-1)
+ {
+ dhcp_lease_hour = 24;
+ }
+
+ dhcp_lease_time = dhcp_lease_hour * 3600;
+
+#endif
+ sprintf(dhcp_temp, "%d", dhcp_lease_time);
+
+ //add by liuyingnan for server safe for xss attack start
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(lanIp)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(dhcpStart)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(dhcpEnd)) {
+ sc_cfg_set("data_safe", "failed");
+ slog(MISC_PRINT, SLOG_ERR, "Get Data is no Safe:lanIp:%s\n", lanIp); /*lint !e26*/
+ //zte_write_result_to_web(wp,FAILURE);
+
+ return;
+ }
+ //add by liuyingnan for server safe for xss attack end
+
+ // read old data
+
+ (void)zte_web_read("lan_ipaddr", lanIp_read);
+ (void)zte_web_read("lan_netmask", lanNetmask_read);
+ (void)zte_web_read("dhcpEnabled", dhcpType_read);
+ (void)zte_web_read("dhcpStart", dhcpStart_read);
+ (void)zte_web_read("dhcpEnd", dhcpEnd_read);
+ (void)zte_web_read("dhcpDns", dhcpDns_read);
+ (void)zte_web_read("dhcpLease_hour", dhcpLeaseHour_read);
+
+ if (
+ (0 == strcmp(lanDhcpType, "SERVER"))
+ && (0 == strcmp(dhcpType_read, "1"))
+ ) {
+ if (!strcmp(lanIp, lanIp_read) &&
+ !strcmp(lanNetmask, lanNetmask_read) &&
+ !strcmp(dhcpStart, dhcpStart_read) &&
+ !strcmp(dhcpEnd, dhcpEnd_read) &&
+ !strcmp(dhcpDns, dhcpDns_read) &&
+ !strcmp(dhcpLease, dhcpLeaseHour_read)
+ ) {
+ bLanNotChangeFlag = 1;
+ }
+ } else if ((0 == strcmp(lanDhcpType, "DISABLE")) && (0 == strcmp(dhcpType_read, "0"))) {
+ if (!strcmp(lanIp, lanIp_read) && !strcmp(lanNetmask, lanNetmask_read)) {
+ bLanNotChangeFlag = 1;
+ }
+ }
+
+ if (1 == bLanNotChangeFlag) {
+ return;
+ }
+
+ /*
+ * check static ip address:
+ * lan and wan ip should not be the same except in bridge mode
+ */
+ if (!strncmp(lanDhcpType, "SERVER", strlen("SERVER"))) { /*lint !e530*/
+ if (0 == isIpValid(dhcpStart)) {
+ return;
+ }
+
+ if (0 == isIpValid(dhcpEnd)) {
+ return;
+ }
+ }
+
+ /* dhcpÅäÖ÷¢Ë͸øÖ÷¿Ø */
+ dhcp_setting_process(lanIp, lanNetmask, lanDhcpType, dhcpStart, dhcpEnd, dhcpLease);
+
+}
+
+//DHCP²ÎÊýÉèÖÃ
+void zte_dhcp_set(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User set dhcp!\n"));
+ // data from form
+ char_t *lanIp = NULL;
+ char_t *lanNetmask = NULL;
+ char_t *lanDhcpType = NULL;
+ char_t *dhcpStart = NULL;
+ char_t *dhcpEnd = NULL;
+ char_t *dhcpDns = NULL;
+ char_t *dhcpLease = NULL;
+ char dhcp_temp[NVIO_DEFAULT_LEN] = {0};
+ int dhcp_lease_time = WEB_DHCP_LEASE_TIME_DEFAULT; /* default 24*3600 */
+
+ int dhcp_lease_hour = 24;
+
+ // get old data
+ int bLanNotChangeFlag = 0;
+ char lanIp_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char lanNetmask_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char dhcpType_read[NV_ITEM_VALUE_YES_NO_LEN] = {0};
+ char dhcpStart_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char dhcpEnd_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char dhcpDns_read[WEB_IP_ADDR_MAX_LEN] = {0};
+ char dhcpLeaseHour_read[NVIO_DEFAULT_LEN] = {0};
+
+ // Get the params from pages
+ lanIp = websGetVar(wp, T("lanIp"), T(""));
+ lanNetmask = websGetVar(wp, T("lanNetmask"), T(""));
+ lanDhcpType = websGetVar(wp, T("lanDhcpType"), T("SERVER"));
+ dhcpStart = websGetVar(wp, T("dhcpStart"), T(""));
+ dhcpEnd = websGetVar(wp, T("dhcpEnd"), T(""));
+ dhcpDns = websGetVar(wp, T("dhcpDns"), T(lanIp));
+ dhcpLease = websGetVar(wp, T("dhcpLease"), T("24"));
+
+#if 0 // kw 3
+ dhcp_lease_time = atoi(dhcpLease) * 3600;/* hours to seconds */
+#else
+ dhcp_lease_hour = atoi(dhcpLease);
+
+ if(dhcp_lease_hour < 0 || dhcp_lease_hour > INT_MAX-1)
+ {
+ dhcp_lease_hour = 24;
+ }
+
+ dhcp_lease_time = dhcp_lease_hour * 3600;
+
+#endif
+
+
+ sprintf(dhcp_temp, "%d", dhcp_lease_time);
+ //add by liuyingnan for server safe for xss attack start
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(lanIp)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(dhcpStart)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(dhcpEnd)) {
+ sc_cfg_set("data_safe", "failed");
+ slog(MISC_PRINT, SLOG_ERR, "Get Data is no Safe:lanIp:%s\n", lanIp); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //add by liuyingnan for server safe for xss attack end
+
+ // read old data
+
+ (void)zte_web_read("lan_ipaddr", lanIp_read);
+ (void)zte_web_read("lan_netmask", lanNetmask_read);
+ (void)zte_web_read("dhcpEnabled", dhcpType_read);
+ (void)zte_web_read("dhcpStart", dhcpStart_read);
+ (void)zte_web_read("dhcpEnd", dhcpEnd_read);
+ (void)zte_web_read("dhcpDns", dhcpDns_read);
+ (void)zte_web_read("dhcpLease_hour", dhcpLeaseHour_read);
+
+ if (
+ (0 == strcmp(lanDhcpType, "SERVER"))
+ && (0 == strcmp(dhcpType_read, "1"))
+ ) {
+ if (!strcmp(lanIp, lanIp_read) &&
+ !strcmp(lanNetmask, lanNetmask_read) &&
+ !strcmp(dhcpStart, dhcpStart_read) &&
+ !strcmp(dhcpEnd, dhcpEnd_read) &&
+ !strcmp(dhcpDns, dhcpDns_read) &&
+ !strcmp(dhcpLease, dhcpLeaseHour_read)
+ ) {
+ bLanNotChangeFlag = 1;
+ }
+ } else if ((0 == strcmp(lanDhcpType, "DISABLE")) && (0 == strcmp(dhcpType_read, "0"))) {
+ if (!strcmp(lanIp, lanIp_read) && !strcmp(lanNetmask, lanNetmask_read)) {
+ bLanNotChangeFlag = 1;
+ }
+ }
+
+ if (1 == bLanNotChangeFlag) {
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+ }
+
+ /*
+ * check static ip address:
+ * lan and wan ip should not be the same except in bridge mode
+ */
+ if (!strncmp(lanDhcpType, "SERVER", strlen("SERVER"))) { /*lint !e530*/
+ if (0 == isIpValid(dhcpStart)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (0 == isIpValid(dhcpEnd)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ }
+
+ /* dhcpÅäÖ÷¢Ë͸øÖ÷¿Ø */
+ dhcp_setting_process(lanIp, lanNetmask, lanDhcpType, dhcpStart, dhcpEnd, dhcpLease);
+
+ zte_write_result_to_web(wp, SUCCESS);
+
+ zte_goform_mgmt_reboot_process(wp);
+}
+
+//ÉèÖÃDHCPµØÖ·³ØÖеľ²Ì¬IPÁбí
+void zte_static_dhcp_set(webs_t wp)
+{
+ char_t *mac_ip_list = NULL;
+ mac_ip_list = websGetVar(wp, T("mac_ip_list"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG, "add======mac_ip_list=%s\n", mac_ip_list);
+ if (!mac_ip_list)
+ return;
+ sc_cfg_set("mac_ip_list", mac_ip_list);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_STATIC_DHCP, 0, NULL, 0);
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_set_bind_static_address(webs_t wp)
+{
+ char *bind_enable = NULL; /* 0: Disabled 1: Enabled */
+ bind_enable = websGetVar(wp, T("mac_ip_status"), T("0"));
+
+ switch (atoi(bind_enable)) {
+ case 0:
+ (void)zte_web_write("static_dhcp_enable", "0"); /* Disable */
+ break;
+ case 1:
+ (void)zte_web_write("static_dhcp_enable", "1"); /* Enable */
+ break;
+ default:
+ (void)zte_web_write("static_dhcp_enable", "0"); /* Disable */
+ break;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_set_bind_static_address SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_BIND_STATIC_ADDRESS, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_set_bind_static_address SEND MESSAGE TO MC END"); /*lint !e26*/
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_bind_static_address_add(webs_t wp)
+{
+ char *ip = NULL;
+ char *mac = NULL;
+ struct static_macip_info static_macip_info;
+
+ ip = websGetVar(wp, T("ip_address"), T(""));
+ mac = websGetVar(wp, T("mac_address"), T(""));
+
+ if (!ip || !strlen(ip)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ if ((!mac) || (strlen(mac) != 17)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ strncpy(static_macip_info.mac, mac,sizeof(static_macip_info.mac)-1);
+ strncpy(static_macip_info.ip, ip,sizeof(static_macip_info.ip)-1);
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_bind_static_address_add SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_BIND_STATIC_ADDRESS_ADD, sizeof(struct static_macip_info), (UCHAR *)&static_macip_info, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_bind_static_address_add SEND MESSAGE TO MC END"); /*lint !e26*/
+ Sleep(1);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_bind_static_address_del(webs_t wp)
+{
+ char *mac = NULL;
+ mac = websGetVar(wp, T("mac_address"), T(""));
+
+ if ((!mac) || (strlen(mac) != 17)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_bind_static_address_del SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_BIND_STATIC_ADDRESS_DEL, strlen(mac), (UCHAR *)mac, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_bind_static_address_del SEND MESSAGE TO MC END"); /*lint !e26*/
+ Sleep(1);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_get_current_static_addr_list(webs_t wp)
+{
+ FILE *static_macip_file = NULL;
+ char line[100] = {0};
+ char mac_address[18] = {0};
+ char ip_address[50] = {0};
+
+ BOOL first = TRUE;
+
+ char path_conf[50] = {0};
+ char path_file[100] = {0};
+ sc_cfg_get("path_conf", path_conf, sizeof(path_conf));
+ sprintf(path_file, "%s/static_macip_file", path_conf);
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ (void)websWrite(wp, T("\"%s\":["), CMD_CURRENT_STATICADDR_LIST);
+ static_macip_file = fopen(path_file, "r");
+ if (static_macip_file == NULL) {
+ fprintf(stderr, "can not open file static_macip_file.");
+ goto out;
+ }
+
+ while (fgets(line, sizeof(line), static_macip_file) != NULL) {
+ if (first == FALSE) {
+ (void)websWrite(wp, T(","));
+ } else {
+ first = FALSE;
+ }
+ strncpy(mac_address, line, sizeof(mac_address)-1);
+ if(strlen(line) - 19 > 0 && strlen(line) - 19 < 50){
+ snprintf(ip_address,strlen(line)-18,"%s",line + 18);
+ }
+ //strncpy(ip_address, line + 18, strlen(line) - 19);
+ if (strncmp(mac_address, "", sizeof(mac_address)) != 0 && strncmp(ip_address, "", sizeof(ip_address)) != 0) {
+ (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\"}"), HOSTANME, "", MAC, mac_address, ADDR, ip_address, DOMAIN, "");
+ }
+
+ memset(line, 0, sizeof(line));
+ memset(mac_address, 0, sizeof(mac_address));
+ memset(ip_address, 0, sizeof(ip_address));
+
+ }
+ fclose(static_macip_file);
+
+out:
+ (void)websWrite(wp, T("]"));
+ zte_rest_cmd_write_foot(wp);
+}
+
+/*ÔÚÒ³ÃæÉÏÏÔʾËùÓнÓÈëDHCP client µÄMACµØÖ·ºÍIPµØÖ·*/
+static int zte_dhcp_client_list(int eid, webs_t wp, int argc, char_t **argv)
+{
+ FILE *fp = NULL;/*lint !e63*/
+ typedef struct _DHCPOFFERINFO {
+ unsigned long expires;
+ unsigned long ip;
+ unsigned char mac[6];
+ unsigned char host_name[20];
+ unsigned char pad[2];
+ } DHCPOFFERINFO;
+ struct in_addr addr;/*lint !e1080 !e565 */
+ DHCPOFFERINFO addrlist;
+ int64_t written_at;/*lint !e522*/
+ int i = 0;
+ memset(&addrlist, 0, sizeof(addrlist));
+ // memset(&dclist,0,sizeof(DHCPCLIENTINFO)*MAX_DHCP_CLIENT_NUM);
+ system("killall -q -USR1 udhcpd");
+ fp = fopen("/var/udhcpd.leases", "r"); /*lint !e63*/
+
+ if (NULL == fp) {
+ slog(MISC_PRINT, SLOG_ERR, "can not open file/var/udhcpd.leases.");
+ return -1;
+ }
+ if (fread(&written_at, 1, sizeof(written_at), fp) != sizeof(written_at)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "read the first part of udhcpd.leases fail!");
+ }
+
+ while (fread(&addrlist, 1, sizeof(addrlist), fp) == sizeof(addrlist)) {
+ addr.s_addr = addrlist.ip; /*lint !e115 !e1013 !e63 */
+ websWrite(wp, T("<tr><td align=\"center\" width=\"10%%\" class=\"head\">%d</td>"), i + 1);
+ websWrite(wp, T("<td align=\"center\" width=\"40%%\" class=\"tail\">%02X:%02X:%02X:%02X:%02X:%02X</td>"),
+ addrlist.mac[0], addrlist.mac[1], addrlist.mac[2], addrlist.mac[3], addrlist.mac[4], addrlist.mac[5]);
+ websWrite(wp, T("<td align=\"center\"width=\"40%%\" class=\"tail\">%s</td>"), inet_ntoa(addr));
+ websWrite(wp, T("</tr>"));
+ i++;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "the number of dhcp client access is %d", i); /*lint !e26*/
+
+// if (NULL != fp) { // kw 3
+ fclose(fp);
+// }
+ return 0;
+}
+#ifdef WEB_ASP
+void init_router_web(void)
+{
+ websAspDefine(T("zte_dhcp_client_list"), zte_dhcp_client_list);
+}
+#endif
+//»ñÈ¡³ýwifi lan¿ÚÐÅÏ¢: Óëwifi·Ö¿ªµÄÔÒò£¬ÁÚ¾ÓÁбíºÍlease¶¼ÎÞ·¨Çø·ÖËÊÇwifi£¬Ö»ÓÐwifiоƬ֪µÀ
+void zte_get_lan_station_list(webs_t wp)
+{
+ struct pc_node *mypc_node;
+ DHCPOFFERADDR_LIST_t * list_head = NULL;
+ DHCPOFFERADDR_LIST_t * list_current = NULL;
+ char hostname[50] = {0};
+ char mac[18] = {0};
+ char mac_temp[18] = {0};
+ int result = 0;
+ int result1 = 0;
+ int i = 0;
+ BOOL first = TRUE;
+ struct list_head dhcp_info_list;
+ INIT_LIST_HEAD(&dhcp_info_list);
+
+ char eth_lan[NV_NAME_LEN] = {0};
+ char usb_lan[NV_NAME_LEN] = {0};
+ sc_cfg_get("ethlan", eth_lan, sizeof(eth_lan));
+ sc_cfg_get("usblan", usb_lan, sizeof(usb_lan));
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"%s\":["), CMD_LAN_STATION_LIST);
+
+ mypc_node = (struct pc_node*)malloc(sizeof(struct pc_node));
+ if (!mypc_node) {
+ slog(MISC_PRINT, SLOG_ERR, "malloc err");
+ (void)websWrite(wp, T("]}"));
+ return;
+ }
+
+ if (get_dev_list(mypc_node) < 0) {
+ (void)websWrite(wp, T("]}"));
+ safe_free(mypc_node);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "num: %d\n", mypc_node->num);
+
+ result1 = zte_get_mac_list_from_lease(&dhcp_info_list);
+
+ //if((-1 == result1) || (-2 == result1) || (-3 == result1) )
+ //{
+ // (void)websWrite(wp, T("]}"));
+ // safe_free(dhcp_info_list);
+ // return;
+ //}
+
+// if (0 == result) { // kw 3 result is 0
+ for (i = 0; i < mypc_node->num; i++) {
+ memset(mac, 0, sizeof(mac));
+ memset(hostname, 0, sizeof(hostname));
+ sprintf(mac, "%02X:%02X:%02X:%02X:%02X:%02X", \
+ mypc_node->info[i].mac_addr[0], mypc_node->info[i].mac_addr[1], \
+ mypc_node->info[i].mac_addr[2], mypc_node->info[i].mac_addr[3], \
+ mypc_node->info[i].mac_addr[4], mypc_node->info[i].mac_addr[5]);
+
+ if ((0 != strncmp(mypc_node->info[i].dev_name, eth_lan, strlen(eth_lan) - 1))\
+ && (0 != strncmp(mypc_node->info[i].dev_name, usb_lan, strlen(usb_lan) - 1)))
+ continue;
+
+ if (first == FALSE) {
+ (void)websWrite(wp, T(","));
+ } else {
+ first = FALSE;
+ }
+
+ list_for_each_entry(list_head, &dhcp_info_list, list) {
+ memset(mac_temp, 0, sizeof(mac_temp));
+ sprintf(mac_temp, "%02X:%02X:%02X:%02X:%02X:%02X", \
+ list_head->dhcp_info.mac[0], list_head->dhcp_info.mac[1], \
+ list_head->dhcp_info.mac[2], list_head->dhcp_info.mac[3], \
+ list_head->dhcp_info.mac[4], list_head->dhcp_info.mac[5]);
+
+ if (0 == strcmp(mac, mac_temp)) {
+ strcpy(hostname, list_head->dhcp_info.host_name);
+ break;
+ }
+ }
+
+ if (strlen(hostname)) {
+ (void)websWrite(wp, T("{\"%s\":\"%s\","), HOSTANME, hostname);
+ } else {
+ (void)websWrite(wp, T("{\"%s\":\"--\","), HOSTANME);
+ }
+ (void)websWrite(wp, T("\"%s\":\"%s\"}"), MAC_ADDR, mac);
+ }
+// }
+
+ free(mypc_node);
+
+ (void)websWrite(wp, T("]}"));
+#if 0
+ while (NULL != list_head) {
+ list_current = list_head;
+ list_head = list_head->next;
+ safe_free(list_current);
+ }
+#endif
+ free_dhcp_list(&dhcp_info_list);
+}
+
+void zte_add_children_device(webs_t wp)
+{
+ char *mac = NULL;
+ char mac_buf[18] = {0};
+ struct mac_hostname_info mac_hostname_info;
+ int result = 0;
+ struct list_head dhcp_info_list;
+ DHCPOFFERADDR_LIST_t * list_head = NULL;
+ DHCPOFFERADDR_LIST_t * list_current = NULL;
+ INIT_LIST_HEAD(&dhcp_info_list);
+ mac = websGetVar(wp, T("mac"), T(""));
+
+ if ((!mac) || (strlen(mac) != 17)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ strncpy(mac_hostname_info.mac, mac,sizeof(mac_hostname_info.mac)-1);
+ memset(mac_hostname_info.hostname, 0, sizeof(mac_hostname_info.hostname));
+
+ //´Óudhcpd.leaseÎļþÖжÁÈ¡ÖÕ¶ËÉ豸ÐÅÏ¢
+ //ÕÒµ½macµØÖ·¶ÔÓ¦µÄhostname
+ result = zte_get_mac_list_from_lease(&dhcp_info_list);
+ if (result < 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ free_dhcp_list(&dhcp_info_list);
+ return;
+ }
+
+ if (0 == result) {
+ list_for_each_entry(list_head, &dhcp_info_list, list) {
+ sprintf(mac_buf, "%02X:%02X:%02X:%02X:%02X:%02X", \
+ list_head->dhcp_info.mac[0], list_head->dhcp_info.mac[1], \
+ list_head->dhcp_info.mac[2], list_head->dhcp_info.mac[3], \
+ list_head->dhcp_info.mac[4], list_head->dhcp_info.mac[5]);
+
+ if (0 == strcmp(mac_hostname_info.mac, mac_buf)) {
+ strcpy(mac_hostname_info.hostname, list_head->dhcp_info.host_name);
+ break;
+ }
+ memset(mac_buf, 0, sizeof(mac_buf));
+ }
+ }
+
+ if (0 == strlen(mac_hostname_info.hostname)) {
+ sprintf(mac_hostname_info.hostname, "%s", "--");
+ }
+#if 0
+ while (NULL != list_head) {
+ list_current = list_head;
+ list_head = list_head->next;
+ safe_free(list_current);
+ }
+#endif
+ free_dhcp_list(&dhcp_info_list);
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_add_children_device SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_ADD_CHILDREN_DEVICE, sizeof(struct mac_hostname_info), (UCHAR *)&mac_hostname_info, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_add_children_device SEND MESSAGE TO MC END"); /*lint !e26*/
+ Sleep(1);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_del_children_device(webs_t wp)
+{
+ char *mac = NULL;
+ mac = websGetVar(wp, T("mac"), T(""));
+
+ if ((!mac) || (strlen(mac) != 17)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_del_children_device SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_DEL_CHILDREN_DEVICE, strlen(mac), (UCHAR *)mac, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_del_children_device SEND MESSAGE TO MC END"); /*lint !e26*/
+ Sleep(1);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_add_white_site(webs_t wp)
+{
+ char *name = NULL;
+ char *site = NULL;
+ struct white_site_info white_site;
+
+ name = websGetVar(wp, T("name"), T(""));
+ site = websGetVar(wp, T("site"), T(""));
+ slog(NET_PRINT, SLOG_DEBUG, "zte_add_white_site:name= %s, site = %s\n", name, site);
+ if (!name) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ if (!site || !strlen(site)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ strncpy(white_site.name, name, sizeof(white_site.name)-1);
+ strncpy(white_site.site, site, sizeof(white_site.site)-1);
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_add_white_site SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_ADD_WHITE_SITE, sizeof(struct white_site_info), (UCHAR *)&white_site, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_add_white_site SEND MESSAGE TO MC END"); /*lint !e26*/
+ Sleep(1);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_remove_white_site(webs_t wp)
+{
+ char *ids = NULL;
+ ids = websGetVar(wp, T("ids"), T(""));
+
+ if (!ids || !strlen(ids)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_remove_white_site SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_REMOVE_WHITE_SITE, strlen(ids), (UCHAR *)ids, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_remove_white_site SEND MESSAGE TO MC END"); /*lint !e26*/
+ Sleep(1);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_get_children_device_list(webs_t wp)
+{
+ slog(NET_PRINT, SLOG_NORMAL, "zte_get_children_device_list start!\n");
+ FILE *chilren_device_file = NULL;
+ char line[200] = {0};
+ char mac[18] = {0};
+ char hostname[150] = {0};
+
+ BOOL first = TRUE;
+
+ char path_conf[50] = {0};
+ char path_file[100] = {0};
+ sc_cfg_get("path_conf", path_conf, sizeof(path_conf));
+ sprintf(path_file, "%s/children_device_file", path_conf);
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ (void)websWrite(wp, T("\"%s\":["), DEVICES);
+ chilren_device_file = fopen(path_file, "r");
+ if (chilren_device_file == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "can not open file children_device_file.");
+ goto out;
+ }
+
+ while (fgets(line, sizeof(line), chilren_device_file) != NULL) {
+ if (first == FALSE) {
+ (void)websWrite(wp, T(","));
+ } else {
+ first = FALSE;
+ }
+
+ strncpy(mac, line, sizeof(mac)-1);
+ if(strlen(line) - 19 > 0 && strlen(line) - 19 < 150)
+ snprintf(hostname,strlen(line) - 18,"%s",line + 18);
+ //strncpy(hostname, line + 18, strlen(line) - 19);
+
+ if (strncmp(mac, "", sizeof(mac)) != 0 && strncmp(hostname, "", sizeof(hostname)) != 0) {
+ (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%s\"}"), HOSTANME, hostname, MAC, mac);
+ }
+
+ memset(line, 0, sizeof(line));
+ memset(mac, 0, sizeof(mac));
+ memset(hostname, 0, sizeof(hostname));
+
+ }
+ fclose(chilren_device_file);
+
+out:
+ (void)websWrite(wp, T("]"));
+ zte_rest_cmd_write_foot(wp);
+}
+
+void zte_get_white_site_list(webs_t wp)
+{
+ slog(NET_PRINT, SLOG_ERR, "zte_get_white_site_list start!\n");
+ FILE *white_site_file = NULL;
+ char line[600] = {0};
+ unsigned int id = 1;
+ char name[150] = {0};
+ char site[400] = {0};
+ unsigned int len = 0;
+
+ BOOL first = TRUE;
+
+ char path_conf[50] = {0};
+ char path_file[100] = {0};
+ sc_cfg_get("path_conf", path_conf, sizeof(path_conf));
+ sprintf(path_file, "%s/white_site_file", path_conf);
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ (void)websWrite(wp, T("\"%s\":["), SITELIST);
+ white_site_file = fopen(path_file, "r");
+ if (white_site_file == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "can not open file white_site_file.");
+ goto out;
+ }
+
+ while (fgets(line, sizeof(line), white_site_file) != NULL) {
+ if (first == FALSE)
+ (void)websWrite(wp, T(","));
+ else
+ first = FALSE;
+
+ int i = 0;
+ for (i = 0; i < sizeof(line); i++) {
+ if (line[i] == ',') {
+ len = i;
+ break;
+ }
+ }
+ if(len < sizeof(site) && len > 0)
+ snprintf(site,len+1,"%s",line);
+ //strncpy(site, line, len);
+ //ÿÐж¼ÓÐÒ»¸ö'\n'
+ int name_len = strlen(line) - (len + 2);
+ if(len < 598 && name_len > 0 && name_len < 150)
+ snprintf(name,name_len+1,"%s",line + len + 1);
+ //strncpy(name, line + len + 1, name_len);
+ if (strcmp(site, "") != 0) {
+ (void)websWrite(wp, T("{\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\"}"), ID, id, NAME, name, SITE, site);
+ }
+
+ id = id + 1;
+ memset(line, 0, sizeof(line));
+ memset(name, 0, sizeof(name));
+ memset(site, 0, sizeof(site));
+ len = 0;
+
+ }
+
+ fclose(white_site_file);
+
+out:
+ (void)websWrite(wp, T("]"));
+ zte_rest_cmd_write_foot(wp);
+}
+
+//»ñÈ¡ÄÚÍøÐÅÏ¢
+void zte_get_lan_dev_info(webs_t wp)
+{
+ char_t *dev_name = NULL;
+ LAN_INFO_t lan_info;
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_get_lan_dev_info enter \n");
+ //ÏȽèÓÿª»úʱ¼ä°Ñ¿ò¼Ü´îºÃ, elseµÄÆ´½ÓÓÐÎÊÌ⣬ÔÝʱ²»Ìṩwebserver¸ø¿Í»§£¬
+ //´Ë¹¦ÄÜÓëstation_list/wifi_station_list¹¦ÄÜÓÐÖØµþ£¬ºóÐøÓÅ»¯³ÉͳһµÄ
+#if 1
+ unsigned long cur_time;
+
+ cur_time = time_sec();
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write_int(wp, "poweron_time", cur_time, 0);
+ zte_rest_cmd_write_foot(wp);
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_get_lan_dev_info cur_time:%lu \n", cur_time);
+#else
+ dev_name = websGetVar(wp, "dev_name", T(""));
+ printf(LOG_INFO, "zte_get_lan_dev_info dev:%s \n", dev_name);
+ if ('\0' == (*dev_name)) {
+ return;
+ }
+
+ if (get_laninfo_byname(dev_name, &lan_info) == -1)
+ return;
+
+ printf(LOG_INFO, "zte_get_lan_dev_info mac:%02x:%02x:%02x:%02x:%02x:%02x \n", lan_info.mac[0], lan_info.mac[1], lan_info.mac[2], lan_info.mac[3], lan_info.mac[4], lan_info.mac[5]);
+ printf(LOG_INFO, "zte_get_lan_dev_info ip:%lu, host:%s, dev:%s, remain:%d, last:%d \n", lan_info.ip, lan_info.host_name, lan_info.dev_name, lan_info.time_remain, lan_info.time_last);
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write_int(wp, "mac", lan_info.mac, 1);
+ zte_rest_cmd_write_int(wp, "ip", lan_info.ip, 1);
+ zte_rest_cmd_write_int(wp, "host_name", lan_info.host_name, 1);
+ zte_rest_cmd_write_int(wp, "dev_name", lan_info.dev_name, 1);
+ zte_rest_cmd_write_int(wp, "time_remain", lan_info.time_remain, 1);
+ zte_rest_cmd_write_int(wp, "time_last", lan_info.time_last, 0);
+ zte_rest_cmd_write_foot(wp);
+#endif
+}
+
+
diff --git a/ap/app/goahead/interface5.0/net/zte_web_net_lan.h b/ap/app/goahead/interface5.0/net/zte_web_net_lan.h
new file mode 100644
index 0000000..95db708
--- /dev/null
+++ b/ap/app/goahead/interface5.0/net/zte_web_net_lan.h
@@ -0,0 +1,29 @@
+#ifndef ZTE_WEB_NET_LAN_H
+#define ZTE_WEB_NET_LAN_H
+#include "webs.h"
+
+extern void zte_dhcpv6_state_set(webs_t wp);
+extern void quick_dhcp_set(webs_t wp);
+extern void zte_dhcp_set(webs_t wp);
+extern void zte_static_dhcp_set(webs_t wp);
+
+extern void zte_set_bind_static_address(webs_t wp);
+extern void zte_bind_static_address_add(webs_t wp);
+extern void zte_bind_static_address_del(webs_t wp);
+extern void zte_get_current_static_addr_list(webs_t wp);
+
+extern void zte_get_lan_station_list(webs_t wp);
+
+extern void zte_add_children_device(webs_t wp);
+extern void zte_del_children_device(webs_t wp);
+
+extern void zte_add_white_site(webs_t wp);
+extern void zte_remove_white_site(webs_t wp);
+
+extern void zte_get_children_device_list(webs_t wp);
+extern void zte_get_white_site_list(webs_t wp);
+
+
+
+#endif
+
diff --git a/ap/app/goahead/interface5.0/net/zte_web_net_other.c b/ap/app/goahead/interface5.0/net/zte_web_net_other.c
new file mode 100755
index 0000000..de459aa
--- /dev/null
+++ b/ap/app/goahead/interface5.0/net/zte_web_net_other.c
@@ -0,0 +1,385 @@
+#include "zte_web_net_other.h"
+#include "../wifi/zte_web_lan_utils.h"
+#include "zte_web_mgmt.h"
+#include "wifi.h"
+
+#include <stdlib.h>
+//#include <linux/wireless.h>
+#include <sys/ioctl.h>
+#include "message.h"
+#include "softap_api.h"
+
+#define NV_MACIP_LIST_MAX_LEN 500
+
+#define safe_free(x) do { if(x) {free(x); x=NULL;} } while(0)
+
+//extern void zte_get_wifi_sta_list(RT_802_11_MAC_TABLE *staList);
+
+//¼ì²âijIPµØÖ·ÊÇ·ñΪÓû§¾²Ì¬ÉèÖõÄÖÕ¶ËIPµØÖ·
+BOOL zte_is_static_dhcp_ip(char *ipAddr)
+{
+ char list[NV_MACIP_LIST_MAX_LEN] = {0};
+
+ sc_cfg_get("mac_ip_list", list, sizeof(list));
+ if (strlen(list) == 0) {
+ return FALSE;
+ }
+
+ if (strstr(list, ipAddr) == NULL) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+//ÓÃÓÚ¼ì²âÊÇ·ñΪUSBµÄMACµØÖ·
+static BOOL zte_is_usb_mac(unsigned char mac[])
+{
+ /*
+ char mac0[3] = {0};
+ char mac1[3] = {0};
+ char mac2[3] = {0};
+
+ sprintf(mac0, "%02X", mac[0]);
+ sprintf(mac1, "%02X", mac[1]);
+ sprintf(mac2, "%02X", mac[2]);
+ */
+
+ BOOL ret = TRUE;
+ int i;
+ size_t read_len = 0;
+
+ FILE *usb_mac_file = NULL;
+ unsigned char usb_mac[7] = {0};
+
+ usb_mac_file = fopen("/var/usbmac", "r");
+ if (usb_mac_file != NULL) {
+ read_len = fread(usb_mac, sizeof(usb_mac[0]), 7, usb_mac_file);
+ if(read_len != 7)
+ {
+ slog(MISC_PRINT, SLOG_DEBUG, "read len :%d \n", read_len);
+ }
+ fclose(usb_mac_file);
+ }
+
+ //printf("zte_is_usb_mac stored usbmac %x %x %x %x %x %x\n",usb_mac[0],usb_mac[1],usb_mac[2],usb_mac[3],usb_mac[4],usb_mac[5]);
+ //printf("zte_is_usb_mac lease mac %x %x %x %x %x %x\n",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
+
+ for (i = 0; i < 6; i++) {
+
+ if (usb_mac[i] != mac[i]) {
+ ret = FALSE;
+ break;
+ }
+ }
+
+ /*
+ if (strcmp(mac0, "00") == 0 && strcmp(mac1, "A0") == 0 && strcmp(mac2, "C6") == 0)
+ {
+ fprintf(stderr, "current mac is from usb");
+ return TRUE;
+ }
+ */
+
+ return ret;
+}
+
+//MTU ÉèÖÃ
+void zte_mtu_set(webs_t wp)
+{
+ char_t *new_mtu = NULL;
+
+ new_mtu = websGetVar(wp, T("mtu"), T(""));
+
+ if ('\0' == (*new_mtu)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_mtu_set new_mtu= %s\n", new_mtu);
+
+ (void)zte_web_write("mtu", new_mtu);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_mtu_set MESSAGE TO MC START");
+ //zte_send_message(MODULE_ID_MAIN_CTRL, MSG_CMD_NET_MTU, 0, 0);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_MTU, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_mtu_set MESSAGE TO MC END");
+
+ //sc_cfg_save();
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+//ÉèÖÃÊÖ¶¯DNS mode
+/*void zte_dns_mode_set(webs_t wp)
+{
+ char_t *pswan_dns_mode = NULL;
+ char_t *pswan_ipv6_dns_mode = NULL;
+
+ pswan_dns_mode = websGetVar(wp, T("pswan_dns_mode"), T(""));
+ pswan_ipv6_dns_mode = websGetVar(wp, T("pswan_ipv6_dns_mode"), T(""));
+
+ if ('\0' == (*pswan_dns_mode) && '\0' == (*pswan_ipv6_dns_mode))
+ {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (('\0' != (*pswan_dns_mode) && strcmp(pswan_dns_mode, "auto") && strcmp(pswan_dns_mode, "manual"))
+ || ('\0' != (*pswan_ipv6_dns_mode) && strcmp(pswan_ipv6_dns_mode, "auto") && strcmp(pswan_ipv6_dns_mode, "manual")))
+ {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if ('\0' != (*pswan_dns_mode))
+ (void)zte_web_write("pswan_dns_mode", pswan_dns_mode);
+
+ if ('\0' != (*pswan_ipv6_dns_mode))
+ (void)zte_web_write("pswan_ipv6_dns_mode", pswan_ipv6_dns_mode);
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+*/
+//ÉèÖÃÊÖ¶¯DNS server --- ÔÝʱֻ֧³Öpswan¿Ú
+/*void zte_dns_server_set(webs_t wp)
+{
+ char_t *pswan_pridns = NULL;
+ char_t *pswan_secdns = NULL;
+ char_t *pswan_ipv6_pridns = NULL;
+ char_t *pswan_ipv6_secdns = NULL;
+
+ pswan_pridns = websGetVar(wp, T("pswan_pridns_manual"), T(""));
+ pswan_secdns = websGetVar(wp, T("pswan_secdns_manual"), T(""));
+ pswan_ipv6_pridns = websGetVar(wp, T("pswan_ipv6_pridns_manual"), T(""));
+ pswan_ipv6_secdns = websGetVar(wp, T("pswan_ipv6_secdns_manual"), T(""));
+
+ printf("zte_dns_server_set: %s - %s - %s - %s \n", pswan_pridns, pswan_secdns, pswan_ipv6_pridns, pswan_ipv6_secdns);
+
+ if ('\0' == (*pswan_pridns) && '\0' == (*pswan_secdns) && '\0' == (*pswan_ipv6_pridns) && '\0' == (*pswan_ipv6_secdns))
+ {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //ÉèÖÃÁ˵ØÖ·£¬µ«ÊÇÊÇ´íÎóµÄ
+ if (('\0' != (*pswan_pridns) && !isIpValid(pswan_pridns))
+ || ('\0' != (*pswan_secdns) && !isIpValid(pswan_secdns))
+ || ('\0' != (*pswan_ipv6_pridns) && !isIpv6Valid(pswan_ipv6_pridns))
+ || ('\0' != (*pswan_ipv6_secdns) && !isIpv6Valid(pswan_ipv6_secdns)))
+ {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if ('\0' != (*pswan_pridns))
+ (void)zte_web_write("pswan_pridns_manual", pswan_pridns);
+ if ('\0' != (*pswan_secdns))
+ (void)zte_web_write("pswan_secdns_manual", pswan_secdns);
+ if ('\0' != (*pswan_ipv6_pridns))
+ (void)zte_web_write("pswan_ipv6_pridns_manual", pswan_ipv6_pridns);
+ if ('\0' != (*pswan_ipv6_secdns))
+ (void)zte_web_write("pswan_ipv6_secdns_manual", pswan_ipv6_secdns);
+
+ //sc_cfg_save();
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+*/
+
+//±à¼²¢±£´æMACºÍ¶ÔÓ¦µÄÖ÷»úÃû
+void zte_edit_hostname(webs_t wp)
+{
+ char_t *mac = NULL;
+ char_t *hostname = NULL;
+ struct mac_hostname_info mac_hostname_info;
+
+ mac = websGetVar(wp, T("mac"), T(""));
+ hostname = websGetVar(wp, T("hostname"), T(""));
+
+ slog(NET_PRINT, SLOG_ERR, "zte_edit_hostname:mac= %s, hostname = %s\n£¬len=%d", mac, hostname, strlen(hostname));
+ if ((strcmp(hostname, "") == 0) || (strlen(mac) != 17)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ strncpy(mac_hostname_info.mac, mac,sizeof(mac_hostname_info.mac)-1);
+ strncpy(mac_hostname_info.hostname, hostname,sizeof(mac_hostname_info.hostname)-1);
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_edit_hostname MESSAGE TO MC START");
+ //zte_send_message(MODULE_ID_MAIN_CTRL, MSG_CMD_NET_GET_HOSTNAME, sizeof(struct mac_hostname_info), (UCHAR *)&mac_hostname_info);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_GET_HOSTNAME, sizeof(struct mac_hostname_info), (UCHAR *)&mac_hostname_info, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_edit_hostname MESSAGE TO MC END");
+ Sleep(2);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+//´ÓÎļþÖжÁÈ¡MACºÍ¶ÔÓ¦µÄÖ÷»úÃû²¢ÏÔʾÔÚwebui
+void zte_get_hostnamelist(webs_t wp)
+{
+ FILE *hostname_mac_file = NULL;
+ char line[200] = {0};
+ char line_mac[18] = {0};
+ char line_hostname[150] = {0};
+
+ BOOL first = TRUE;
+
+ char path_conf[50] = {0};
+ char path_file[100] = {0};
+ sc_cfg_get("path_conf", path_conf, sizeof(path_conf));
+ sprintf(path_file, "%s/hostname_mac_file", path_conf);
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ (void)websWrite(wp, T("\"%s\":["), DEVICES);
+ hostname_mac_file = fopen(path_file, "r");
+ if (hostname_mac_file == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "can not open file hostname_mac_file.");
+ goto out;
+ }
+
+ while (fgets(line, 200, hostname_mac_file) != NULL) {
+ if (first == FALSE) {
+ (void)websWrite(wp, T(","));
+ } else {
+ first = FALSE;
+ }
+ strncpy(line_mac, line, 17);
+ if((strlen(line) - 19) < 150)
+ snprintf(line_hostname,strlen(line) -18,"%s",line + 18);
+ //strncpy(line_hostname, line + 18, strlen(line) - 19);
+ if (strncmp(line_mac, "", sizeof(line_mac)) != 0 && strncmp(line_hostname, "", sizeof(line_hostname)) != 0) {
+ (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%s\"}"), HOSTANME, line_hostname, MAC, line_mac);
+ }
+
+ memset(line, 0, sizeof(line));
+ memset(line_mac, 0, sizeof(line_mac));
+ memset(line_hostname, 0, sizeof(line_hostname));
+
+ }
+ fclose(hostname_mac_file);
+
+out:
+ (void)websWrite(wp, T("]"));
+ zte_rest_cmd_write_foot(wp);
+}
+
+/* * check the existence of semicolon in str */
+int checkSemicolon(char *str)
+{
+ char *c = strchr(str, ';');
+ if (c)
+ return 1;
+ return 0;
+}
+
+void zte_goform_ddns(webs_t wp)
+{
+
+ char *ddns_provider, *ddns, *DDNS_Hash_Value, *ddns_acc, *ddns_pass, *DDNS_Enable, *DDNS_Mode;
+ //char empty_char = '\0';
+
+ DDNS_Enable = websGetVar(wp, T("DDNS_Enable"), T("1"));
+ DDNS_Mode = websGetVar(wp, T("DDNS_Mode"), T("manual"));
+ ddns_provider = websGetVar(wp, T("DDNSProvider"), T("none"));
+ ddns = websGetVar(wp, T("DDNS"), T(""));
+ DDNS_Hash_Value = websGetVar(wp, T("DDNS_Hash_Value"), T(""));
+ ddns_acc = websGetVar(wp, T("DDNSAccount"), T(""));
+ ddns_pass = websGetVar(wp, T("DDNSPassword"), T(""));
+
+ if (strcmp(DDNS_Enable, "0")) { //disable
+ if (!ddns_provider || !ddns || !ddns_acc || !ddns_pass) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ if (!strcmp(T("none"), ddns_provider)) {
+ //ddns = ddns_acc = ddns_pass = DDNS_Hash_Value = T("");//&empty_char;//cov
+ } else {
+ if (!strlen(ddns) || !strlen(ddns_acc) || !strlen(ddns_pass)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ }
+
+ if (checkSemicolon(ddns) || checkSemicolon(ddns_acc) || checkSemicolon(ddns_pass)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ sc_cfg_set("DDNS_Mode", DDNS_Mode);
+ sc_cfg_set("DDNSProvider", ddns_provider);
+ if(!strcmp(T("none"), ddns_provider))// kw OVERWRITE_CONST_CHAR
+ {
+ sc_cfg_set("DDNS", "");
+ sc_cfg_set("DDNS_Hash_Value", "");
+ sc_cfg_set("DDNSAccount", "");
+ sc_cfg_set("DDNSPassword", "");
+ }
+ else
+ {
+ sc_cfg_set("DDNS", ddns);
+ sc_cfg_set("DDNS_Hash_Value", DDNS_Hash_Value);
+ sc_cfg_set("DDNSAccount", ddns_acc);
+ sc_cfg_set("DDNSPassword", ddns_pass);
+ }
+ }
+ sc_cfg_set("DDNS_Enable", DDNS_Enable);
+ //sc_cfg_save();
+
+ system("ddns.sh");
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+//parent control nv set
+void zte_parent_control_set(webs_t wp)
+{
+ char* time_limited = NULL;
+ char old_time_limited[512] = {0};
+ sc_cfg_get("time_limited", old_time_limited, sizeof(old_time_limited));
+ time_limited = websGetVar(wp, T("time_limited"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s]time_limited=%s,old_time_limited=%s\n", __FUNCTION__, time_limited, old_time_limited);
+
+ //parent control time has no open/close button,so if time_limited is null,
+ //means close , if time_limited is not null, means set
+#if 0
+ if (time_limited == NULL || *time_limited == '\0') {
+ printf("zte_parent_control_set: invalid input para\n");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+#endif
+
+ if (strcmp(time_limited, old_time_limited) == 0) {
+ slog(MISC_PRINT, SLOG_NORMAL,"[%s]para not changed\n", __FUNCTION__); /*lint !e26*/
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+ } else {
+ sc_cfg_set("time_limited", time_limited);
+ if (strcmp(time_limited, "") == 0) {
+ slog(MISC_PRINT, SLOG_NORMAL,"[%s]send to parent control set : MSG_CMD_PARENT_CONTROL_CLOSE\n", __FUNCTION__);
+ //zte_send_message(MODULE_ID_PARENT_CONTROL_SET,MSG_CMD_PARENT_CONTROL_CLOSE,0,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_PARENT_CONTROL_SET, MSG_CMD_PARENT_CONTROL_CLOSE, 0, NULL, 0);
+ } else {
+ slog(MISC_PRINT, SLOG_NORMAL,"[%s]send to parent control set : MSG_CMD_PARENT_CONTROL_SET\n", __FUNCTION__);
+ //zte_send_message(MODULE_ID_PARENT_CONTROL_SET,MSG_CMD_PARENT_CONTROL_SET,0,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_PARENT_CONTROL_SET, MSG_CMD_PARENT_CONTROL_SET, 0, NULL, 0);
+ }
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+//¿ª»úʱ¼ä
+void zte_get_poweron_time(webs_t wp)
+{
+ unsigned long cur_time;
+
+ slog(MISC_PRINT, SLOG_NORMAL,"zte_get_poweron_time enter \n");
+
+ cur_time = time_sec();
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write_int(wp, "poweron_time", cur_time, 0);
+ zte_rest_cmd_write_foot(wp);
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_get_poweron_time cur_time:%lu \n", cur_time);
+}
+
diff --git a/ap/app/goahead/interface5.0/net/zte_web_net_other.h b/ap/app/goahead/interface5.0/net/zte_web_net_other.h
new file mode 100644
index 0000000..fce8ddd
--- /dev/null
+++ b/ap/app/goahead/interface5.0/net/zte_web_net_other.h
@@ -0,0 +1,47 @@
+#ifndef ZTE_WEB_NET_OTHER_H
+#define ZTE_WEB_NET_OTHER_H
+//#include "zte_web_lan_utils.h"
+//#include "zte_web_mgmt.h"
+//#include "zte_web_net_xfrm.h"
+#include <stdlib.h>
+#include "webs.h"
+#include "wifi.h"
+
+#ifndef BOOL
+
+#define BOOL unsigned char
+#endif
+
+
+//extern void zte_get_mac_list(webs_t wp);
+//extern void zte_get_mac_list_network(webs_t wp);
+
+/*zhangpeimin 20160427 begin
+typedef struct _DHCPOFFERADDR_LIST
+{
+ DHCPOFFERADDR dhcp_info;
+ struct _DHCPOFFERADDR_LIST *next;
+
+} DHCPOFFERADDR_LIST_t;
+zhangpeimin 20160427 end*/
+static BOOL zte_is_usb_mac(unsigned char mac[]);
+extern void zte_mtu_set(webs_t wp);
+extern void zte_dns_mode_set(webs_t wp);
+//extern void zte_dns_server_set(webs_t wp);
+extern void zte_ping_diagnostics_start(webs_t wp);
+extern void zte_ping_diagnostics_stop(webs_t wp);
+extern void zte_get_poweron_time(webs_t wp);
+extern void zte_get_lan_dev_info(webs_t wp);
+extern void zte_edit_hostname(webs_t wp);
+extern void zte_get_hostnamelist(webs_t wp);
+//int zte_get_mac_list_from_lease(DHCPOFFERADDR_LIST_t **dhcpInfo_list);
+BOOL zte_is_static_dhcp_ip(char *ipAddr);
+
+//һϼ¸¸öº¯ÊýĿǰ²»µ÷Ó㬺¯ÊýÌåΪ¿Õ
+//extern void zte_get_mac_list_ap2_network(webs_t wp,int sta_num_1);
+//extern void zte_reset_mac_list();
+extern void zte_goform_ddns(webs_t wp);
+
+
+
+#endif
diff --git a/ap/app/goahead/interface5.0/net/zte_web_net_wan.c b/ap/app/goahead/interface5.0/net/zte_web_net_wan.c
new file mode 100755
index 0000000..8cea5ac
--- /dev/null
+++ b/ap/app/goahead/interface5.0/net/zte_web_net_wan.c
@@ -0,0 +1,1813 @@
+#include "zte_web_interface.h"
+#include "zte_web_net_wan.h"
+#include "zte_web_get_fw_para.h"
+#include "message.h"
+
+#define IP_VERSION_V4 "ipv4"
+#define IP_VERSION_V6 "ipv6"
+
+//======================Global Constants=============================//
+static char wan_if_name[20] = {0}; /* default is ppp0 */
+
+//==============================Util================================//
+static int isMacValid(char *str)
+{
+ int i, len = strlen(str);
+ if (len != 17)
+ return 0;
+
+ for (i = 0; i < 5; i++) {
+ if ((!isxdigit(str[i * 3])) || (!isxdigit(str[i * 3 + 1])) || (str[i * 3 + 2] != ':'))
+ return 0;
+ }
+ return (isxdigit(str[15]) && isxdigit(str[16])) ? 1 : 0;
+}
+
+int isIpValid(char *str)
+{
+ struct in_addr addr; // for examination/*lint !e1080 !565 */
+ if ((! strcmp(T("any"), str)) || (! strcmp(T("any/0"), str)))
+ return 1;
+#ifdef WEBS_SECURITY
+ int len = strlen(str);
+ len--;
+ while(len > 0)
+ {
+ len--;
+ if(str[len] == '0' && str[len+1] >= '0')
+ {
+ if(len == 0 || (len > 1 && str[len-1] == '.'))
+ return 0;
+ }
+ }
+#endif
+ if (!(inet_aton(str, &addr))) {
+ slog(MISC_PRINT, SLOG_ERR, "isIpValid(): %s is not a valid IP address.\n", str); /*lint !e26*/
+ return 0;
+ }
+ return 1;
+}
+
+int isIpv6Valid(char *str)
+{
+ int ret = 0;
+ struct in6_addr ipv6_addr;
+
+ if ((! strcmp(T("any"), str)) || (! strcmp(T("any/0"), str)))
+ return 1;
+
+ ret = inet_pton(AF_INET6, str, &ipv6_addr);
+ if (ret < 1) {
+ slog(MISC_PRINT, SLOG_ERR,"isIpv6Valid: str inet_pton failed: %d \n", ret);
+ return 0;
+ }
+ return 1;
+}
+
+static int isNumOnly(char *str)
+{
+ int i, len = strlen(str);
+ for (i = 0; i < len; i++) {
+ if ((str[i] >= '0' && str[i] <= '9'))
+ continue;
+ return 0;
+ }
+ return 1;
+}
+
+static int isAllNumAndSlash(char *str)
+{
+ int i, len = strlen(str);
+ for (i = 0; i < len; i++) {
+ if ((str[i] >= '0' && str[i] <= '9') || str[i] == '.' || str[i] == '/')
+ continue;
+ return 0;
+ }
+ return 1;
+}
+
+static int isOnlyOneSlash(char *str)
+{
+ int i, count = 0;
+ int len = strlen(str);
+ for (i = 0; i < len; i++)
+ if (str[i] == '/')
+ count++;
+ return count <= 1 ? 1 : 0;
+}
+
+static int isIpNetmaskValid(char *s)
+{
+ char str[32]={0};
+ char *slash;
+ struct in_addr addr; // for examination/*lint !e1080*/
+
+ if (!s || !strlen(s)) {
+ return 0;
+ }
+
+ strncpy(str, s, sizeof(str)-1);
+
+ if ((!strcmp("any", str)) || (!strcmp("any/0", str)))
+ return 1;
+
+ if (!isAllNumAndSlash(str)) {
+ return 0;
+ }
+
+ if (!isOnlyOneSlash(str)) {
+ return 0;
+ }
+
+ slash = strchr(str, '/');
+ if (slash) {
+ int mask;
+
+ *slash = '\0';
+ slash++;
+ if (!strlen(slash)) {
+ return 0;
+ }
+
+ if (!isNumOnly(slash)) {
+ return 0;
+ }
+
+ mask = atoi(slash);
+ if (mask < 0 || mask > 32) {
+ return 0;
+ }
+ }
+
+ if (!(inet_aton(str, &addr))) {
+ slog(MISC_PRINT, SLOG_ERR, "isIpNetmaskValid(): %s is not a valid IP address.\n", str); /*lint !e26*/
+ return 0;
+ }
+ return 1;
+}
+
+static int getNums(char *value, char delimit)
+{
+
+ char *pos = value;
+
+ int count = 1;
+ if (!pos)
+ return 0;
+ while ((pos = strchr(pos, delimit))) {
+
+ pos = pos + 1;
+
+ count++;
+
+ }
+
+ return count;
+}
+
+static int getRuleNums(char *rules)
+{
+
+ return getNums(rules, ';');
+}
+
+
+
+/*
+ * argument: [IN] index -- the index array of deleted items(begin from 0)
+ * [IN] count -- deleted itmes count.
+ * [IN/OUT] value -- original string/return string
+ * [IN] delimit -- delimitor
+ */
+static int static_deleteNthValueMulti(int index[], int count, char *value, char delimit)
+{
+ char *begin, *end;
+ int i = 0, j = 0;
+ int need_check_flag = 0;
+ char *buf = strdup(value);
+
+ if(buf == NULL)
+ return 0;
+ *(buf+strlen(value)) = 0;
+ begin = buf;
+
+ end = strchr(begin, delimit);
+ while (end) {
+ if (i == index[j]) {
+ memset(begin, 0, end - begin);
+ if (index[j] == 0)
+ need_check_flag = 1;
+ j++;
+ if (j >= count)
+ break;
+ }
+ begin = end;
+
+ end = strchr(begin + 1, delimit);
+ i++;
+ }
+
+ if (!end && index[j] == i)
+ memset(begin, 0, strlen(begin));
+
+ if (need_check_flag) {
+ for (i = 0; i < strlen(value); i++) {
+ if (buf[i] == '\0')
+ continue;
+ if (buf[i] == ';')
+ buf[i] = '\0';
+ break;
+ }
+ }
+
+ for (i = 0, j = 0; i < strlen(value) && j < 1023; i++) {
+ if (buf[i] != '\0') {
+ value[j++] = buf[i];
+ }
+ }
+ value[j] = '\0';
+
+ free(buf);
+ return 0;
+}
+
+/*
+ * substitution of getNthValue which dosen't destroy the original value
+ */
+static int static_getNthValueSafe(int index, char *value, char delimit, char *result, int len)
+{
+ int i = 0, result_len = 0;
+ char *begin, *end;
+
+ if (!value || !result || !len)
+ return -1;
+
+ begin = value;
+ end = strchr(begin, delimit);
+
+ while (i < index && end) {
+ begin = end + 1;
+ end = strchr(begin, delimit);
+ i++;
+ }
+
+ //no delimit
+ if (!end) {
+ if (i == index) {
+ end = begin + strlen(begin);
+ result_len = (len - 1) < (end - begin) ? (len - 1) : (end - begin);
+ } else
+ return -1;
+ } else
+ result_len = (len - 1) < (end - begin) ? (len - 1) : (end - begin);
+
+ memcpy(result, begin, result_len);
+ *(result + result_len) = '\0';
+
+ return 0;
+}
+
+/*************************** firewallÏà¹Ø ***************************/
+
+/*IP¡¢PORTµÈ·À»ðǽµÄwebÒ³Ãæ»ù±¾ÅäÖÃ*/
+void zte_fw_basic_setting(webs_t wp)
+{
+ char *firewall_enable = NULL; /* 0: Disabled 1: Enabled */
+ char *default_policy = NULL; /* 0: Accepted 1: Dropped */
+
+ firewall_enable = websGetVar(wp, T("portFilterEnabled"), T("0"));
+ default_policy = websGetVar(wp, T("defaultFirewallPolicy"), T("0"));
+
+ switch (atoi(firewall_enable)) {
+ case 0:
+ (void)zte_web_write("IPPortFilterEnable", "0"); /* Disable */
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User disable port filtering!\n"));
+ break;
+ case 1:
+ (void)zte_web_write("IPPortFilterEnable", "1"); /* Enable */
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User enable port filtering!\n"));
+ break;
+ default:
+ (void)zte_web_write("IPPortFilterEnable", "0"); /* Accepted */
+ break;
+ }
+
+ switch (atoi(default_policy)) {
+ case 1:
+ (void)zte_web_write("DefaultFirewallPolicy", "1"); /* Dropped */
+ break;
+ case 0:
+ default:
+ (void)zte_web_write("DefaultFirewallPolicy", "0"); /* Accepted */
+ break;
+ }
+
+ //zte_iptables_basic_setting();
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_basic_setting SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FILTER, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_fw_basic_setting SEND MESSAGE TO MC END"); /*lint !e26*/
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*¶Ë¿Úת·¢web»ù±¾ÅäÖÃ*/
+void zte_fw_forward_setting(webs_t wp)
+{
+ char *firewall_enable = NULL; /* 0: Disabled 1: Enabled */
+
+ firewall_enable = websGetVar(wp, T("PortForwardEnable"), T("0"));
+
+ switch (atoi(firewall_enable)) {
+ case 0:
+ (void)zte_web_write("PortForwardEnable", "0"); /* Disable */
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User disable port forward!\n"));
+ break;
+ case 1:
+ (void)zte_web_write("PortForwardEnable", "1"); /* Enable */
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User enable port forward!\n"));
+ break;
+ default:
+ (void)zte_web_write("PortForwardEnable", "0"); /* Accepted */
+ break;
+ }
+
+ //zte_iptables_basic_setting();
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_forward_setting SEND MESSAGE TO MC START"); /*lint !e26*/
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FORWARD, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_fw_forward_setting SEND MESSAGE TO MC END"); /*lint !e26*/
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*·À»ðǽÖÐÍâÍø¿Ú¶¨ÖƹæÔò£¬ÊôÓÚ·À»ðǽ·¶³ë*/
+void zte_fw_sys_security_setting(webs_t wp)
+{
+ char *rmE = NULL; /* 0: Disabled 1: Enabled */
+ char *wpfE = NULL; /* 0: Disabled 1: Enabled */
+
+ rmE = websGetVar(wp, T("RemoteManagement"), T("0"));
+ wpfE = websGetVar(wp, T("WANPingFilter"), T("0"));
+
+ switch (atoi(rmE)) {
+ case 0:
+ (void)zte_web_write("RemoteManagement", "0"); /* Disable */
+ break;
+ case 1:
+ (void)zte_web_write("RemoteManagement", "1"); /* Enable */
+ break;
+ default:
+ (void)zte_web_write("RemoteManagement", "0"); /* Accepted */
+ break;
+ }
+
+ switch (atoi(wpfE)) {
+ case 0:
+ (void)zte_web_write("WANPingFilter", "0"); /* Disable */
+ break;
+ case 1:
+ (void)zte_web_write("WANPingFilter", "1"); /* Enable */
+ break;
+ default:
+ (void)zte_web_write("WANPingFilter", "0"); /* Accepted */
+ break;
+ }
+
+ //zte_iptables_basic_setting();
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FORWARD, 0, NULL, 0);
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*ɾ³ýÒ»Ìõ·À»ðǽ*/
+void zte_fw_ipport_filter_del(webs_t wp)
+{
+ /* value from web page */
+ int i = 0, j = 0;
+ char_t *delete_id = NULL;
+ int id = 0;
+ char_t *start = NULL;
+ char IPPortFilterRules_x[NV_ITEM_STRING_LEN_50] = {0};
+ char IPPortFilterRules[NV_ITEM_STRING_LEN_200] = {0};
+ int flag = 0;
+
+ delete_id = websGetVar(wp, "delete_id", "");
+
+ if (*delete_id == '\0') {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //to delete the rules
+ for (start = delete_id; *delete_id != '\0';) {
+ if (*delete_id == ';') {
+ *delete_id = '\0';
+ id = atoi(start);
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ (void)snprintf(IPPortFilterRules_x, NV_ITEM_STRING_LEN_50, "IPPortFilterRules_%d", id);
+ (void)sc_cfg_set(IPPortFilterRules_x, "");
+
+ delete_id ++;/*lint !e52*/
+ start = delete_id;
+ } else {
+ delete_id ++;/*lint !e52*/
+ }
+ }
+
+ //organize the rule
+ for (i = 0; i <= 9; i++) {
+ flag = 0;
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ memset(IPPortFilterRules, 0, sizeof(IPPortFilterRules));
+
+ (void)snprintf(IPPortFilterRules_x, NV_ITEM_STRING_LEN_50, "IPPortFilterRules_%d", i);
+ sc_cfg_get(IPPortFilterRules_x, IPPortFilterRules, sizeof(IPPortFilterRules));
+ if (0 == strcmp(IPPortFilterRules, "")) {
+ for (j = (i + 1); j <= 9; j++) {
+ //reset
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ memset(IPPortFilterRules, 0, sizeof(IPPortFilterRules));
+
+ (void)snprintf(IPPortFilterRules_x, NV_ITEM_STRING_LEN_50, "IPPortFilterRules_%d", j);
+ sc_cfg_get(IPPortFilterRules_x, IPPortFilterRules, sizeof(IPPortFilterRules));
+ if (0 != strcmp(IPPortFilterRules, "")) {
+ sc_cfg_set(IPPortFilterRules_x, "");
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ (void)snprintf(IPPortFilterRules_x, NV_ITEM_STRING_LEN_50, "IPPortFilterRules_%d", i);
+ sc_cfg_set(IPPortFilterRules_x, IPPortFilterRules);
+ flag = 1;
+ break;
+ }
+ }
+
+ if (0 == flag) {
+ break;
+ }
+ }
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FILTER, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_ipport_filter_del SEND MESSAGE TO MC END");/*lint !e26*/ /*lint !e26*/
+
+ //sc_cfg_save();
+ //zte_response_json_for_test(wp,"zte_fw_ipport_filter_del","send message to mc");
+
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+}
+
+/*ɾ³ýÒ»Ìõ¶Ë¿Úת·¢¹æÔò*/
+void zte_fw_port_forward_del(webs_t wp)
+{
+ int i = 0, j = 0;
+ char_t *delete_id = NULL;
+ int id = 0;
+ char_t *start = NULL;
+ char PortForwardRules_x[NV_ITEM_STRING_LEN_50] = {0};
+ char PortForwardRules[NV_ITEM_STRING_LEN_200] = {0};
+ int flag = 0;
+
+ delete_id = websGetVar(wp, "delete_id", "");
+
+ if (*delete_id == '\0') {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //to delete the rules
+ for (start = delete_id; *delete_id != '\0';) {
+ if (*delete_id == ';') {
+ *delete_id = '\0';
+ id = atoi(start);
+ memset(PortForwardRules_x, 0, sizeof(PortForwardRules_x));
+ (void)snprintf(PortForwardRules_x, NV_ITEM_STRING_LEN_50, "PortForwardRules_%d", id);
+ slog(MISC_PRINT, SLOG_DEBUG, "port_forward delete NV:[%s]", PortForwardRules_x);
+ (void)sc_cfg_set(PortForwardRules_x, "");
+
+ delete_id ++;/*lint !e52*/
+ start = delete_id;
+ } else {
+ delete_id ++;/*lint !e52*/
+ }
+ }
+
+ //organize the rule
+ for (i = 0; i <= 9; i++) {
+ flag = 0;
+ memset(PortForwardRules_x, 0, sizeof(PortForwardRules_x));
+ memset(PortForwardRules, 0, sizeof(PortForwardRules));
+
+ (void)snprintf(PortForwardRules_x, NV_ITEM_STRING_LEN_50, "PortForwardRules_%d", i);
+ sc_cfg_get(PortForwardRules_x, PortForwardRules, sizeof(PortForwardRules));
+
+ if (0 == strcmp(PortForwardRules, "")) {
+ for (j = (i + 1); j <= 9; j++) {
+ //reset
+ memset(PortForwardRules_x, 0, sizeof(PortForwardRules_x));
+ memset(PortForwardRules, 0, sizeof(PortForwardRules));
+
+ (void)snprintf(PortForwardRules_x, NV_ITEM_STRING_LEN_50, "PortForwardRules_%d", j);
+ sc_cfg_get(PortForwardRules_x, PortForwardRules, sizeof(PortForwardRules));
+ if (0 != strcmp(PortForwardRules, "")) {
+ (void)sc_cfg_set(PortForwardRules_x, "");
+
+ memset(PortForwardRules_x, 0, sizeof(PortForwardRules_x));
+ (void)snprintf(PortForwardRules_x, NV_ITEM_STRING_LEN_50, "PortForwardRules_%d", i);
+ (void)sc_cfg_set(PortForwardRules_x, PortForwardRules);
+
+ flag = 1;
+ break;
+ }
+ }
+
+ if (0 == flag) {
+ break;
+ }
+ }
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FORWARD, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_port_forward_del SEND MESSAGE TO MC END"); /*lint !e26*/
+ //zte_response_json_for_test(wp,"zte_fw_port_forward_del","send message to mc");
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+}
+
+/******************************************************
+* Function: zte_fw_port_map_check()
+* Description: check the add port map data
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2014/08/18 V1.0 gebin create
+*******************************************************/
+static int zte_fw_port_map_check(webs_t wp, fw_port_map_type *fw_port_map)
+{
+ // we dont trust user input.....
+ if (!fw_port_map->spr) {//klocwork
+ return -1;
+ }
+ if (!fw_port_map->dpr) {
+ return -1;
+ }
+ /* user choose nothing but press "apply" only */
+ if (0 == strlen(fw_port_map->ip_address)
+ || 0 == strlen(fw_port_map->spr)
+ || 0 == strlen(fw_port_map->dpr)
+ || 0 == strlen(fw_port_map->comment)) {
+ zte_web_write("PortMapEnable", "1");
+ slog(MISC_PRINT, SLOG_DEBUG, "port_map some parameter null");
+ return -1;
+ }
+#ifdef WEBS_SECURITY
+ int i = 0;
+ int len = strlen(fw_port_map->comment);
+ for (i = 0; i < len; i++) {
+ if (strchr("`$&*\\[];:\'\"<>,",fw_port_map->comment[i]) || !isprint(fw_port_map->comment[i])) {
+ return -1;
+ }
+ }
+#endif
+#if 0 // kw 3 fw_port_map->ip_address has already checked
+ if (!strlen(fw_port_map->ip_address)) {
+ return -1;
+ }
+#endif
+ if (!isIpValid(fw_port_map->ip_address)) {
+ return -1;
+ }
+
+ if (!(fw_port_map->spr_int = atoi(fw_port_map->spr))) {
+ return -1;
+ }
+ if (fw_port_map->spr_int > 65000) {
+ return -1;
+ }
+
+ if (!(fw_port_map->dpr_int = atoi(fw_port_map->dpr))) {
+ return -1;
+ }
+ if (fw_port_map->dpr_int > 65000) {
+ return -1;
+ }
+
+ if (!strcmp(fw_port_map->protocol, "TCP"))
+ fw_port_map->proto = PROTO_TCP;
+ else if (!strcmp(fw_port_map->protocol, "UDP"))
+ fw_port_map->proto = PROTO_UDP;
+ else if (!strcmp(fw_port_map->protocol, "TCP&UDP"))
+ fw_port_map->proto = PROTO_TCP_UDP;
+ else {
+ return -1;
+ }
+ if (strlen(fw_port_map->comment) > 32) {
+ return -1;
+ }
+ /* i know you will try to break our box... ;) */
+ if (strchr(fw_port_map->comment, ';') || strchr(fw_port_map->comment, ',')) {
+ return -1;
+ }
+
+ return 1;
+}
+
+/*Ìí¼ÓÒ»Ìõ¶Ë¿ÚÓ³É乿Ôò*/
+void zte_fw_port_map_add(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_ERR, T("UFIx User added port map!\n"));
+ fw_port_map_type fw_port_map;
+ int check_result = 0;
+ int count = 0;
+ int flag = 0;
+ char PortMapRules[NV_FW_RULE_MAX_LEN] = {0};
+ char PortMapRules_x[NV_ITEM_STRING_LEN_50] = {0};
+ char *portmap_enable = NULL; /* 0: Disabled 1: Enabled */
+ char portmap_original[2] = {0}; /* 0: Disabled 1: Enabled */
+
+ slog(MISC_PRINT, SLOG_DEBUG, "enter zte_fw_port_map_add.\n");
+
+ //port_map setting
+ portmap_enable = websGetVar(wp, T("portMapEnabled"), T("0"));
+
+ //read original port_map setting
+ zte_web_read("PortMapEnable", portmap_original);
+ slog(MISC_PRINT, SLOG_DEBUG, "portmap_original: %s, portmap_enable: %s\n", portmap_original, portmap_enable);
+
+ switch (atoi(portmap_enable)) {
+ case 0:
+ (void)zte_web_write("PortMapEnable", "0"); /* Disable */
+ break;
+ case 1:
+ (void)zte_web_write("PortMapEnable", "1"); /* Enable */
+ break;
+ default:
+ (void)zte_web_write("PortMapEnable", "0"); /* Accepted */
+ break;
+ }
+
+ //portmap switch open/close, or keep close
+ if ((0 != strcmp(portmap_original, portmap_enable)) || (0 == strcmp(portmap_enable, "0"))) {
+ /* EC: 616000297057, ÔÒò: ÍøÂç²»Ö§³Ö¶Ë¿ÚÓ³Éä */
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_MAPPING, 0, NULL, 0);
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+ slog(MISC_PRINT, SLOG_NORMAL, "portmap switch open/close, or keep close\n");
+ return;
+ }
+
+ memset(&fw_port_map, 0, sizeof(fw_port_map_type));
+ fw_port_map.ip_address = websGetVar(wp, T("ip_address"), T(""));
+ fw_port_map.spr = websGetVar(wp, T("fromPort"), T(""));
+ fw_port_map.dpr = websGetVar(wp, T("toPort"), T(""));
+ fw_port_map.protocol = websGetVar(wp, T("protocol"), T(""));
+ fw_port_map.comment = websGetVar(wp, T("comment"), T(""));
+
+ /* user re-press port_map open apply button, should return SUCCESS*/
+ /* while user choose nothing but press "apply" only will be checked by js code*/
+ if (0 == strlen(fw_port_map.ip_address)
+ && 0 == strlen(fw_port_map.spr)
+ && 0 == strlen(fw_port_map.dpr)
+ && 0 == strlen(fw_port_map.comment)) {
+ zte_write_result_to_web(wp, SUCCESS);
+ slog(MISC_PRINT, SLOG_DEBUG, "portmap re-press open apply button\n");
+ return;
+ }
+
+ //add rules
+ check_result = zte_fw_port_map_check(wp, &fw_port_map);
+ if (check_result < 0) {
+ slog(MISC_PRINT, SLOG_ERR, "portmap add rule failure\n");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ for (count = 0; count <= 9; count++) {
+ (void)snprintf(PortMapRules_x, NV_ITEM_STRING_LEN_50, "PortMapRules_%d", count);
+ memset(PortMapRules, 0, sizeof(PortMapRules));
+ zte_web_read(PortMapRules_x, PortMapRules);
+ if (0 == strcmp(PortMapRules, "")) {
+ memset(PortMapRules, 0, sizeof(PortMapRules));
+ (void)snprintf(PortMapRules, NV_ITEM_STRING_LEN_200, "%s,%d,%d,%d,%s",
+ fw_port_map.ip_address, fw_port_map.spr_int,
+ fw_port_map.dpr_int, fw_port_map.proto,
+ fw_port_map.comment);
+ (void)zte_web_write(PortMapRules_x, PortMapRules);
+ flag = 1;
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_fw_port_map_add %s: %s\n", PortMapRules_x, PortMapRules);
+ break;
+ }
+ }
+
+ if (0 == flag) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_MAPPING, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_port_map_add MESSAGE TO MC END\n"); /*lint !e26*/
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*ɾ³ýÒ»Ìõ¶Ë¿ÚÓ³É乿Ôò*/
+void zte_fw_port_map_del(webs_t wp)
+{
+ int i = 0, j = 0;
+ char_t *delete_id = NULL;
+ int id = 0;
+ char_t *start = NULL;
+ char PortMapRules_x[NV_ITEM_STRING_LEN_50] = {0};
+ char PortMapRules[NV_ITEM_STRING_LEN_200] = {0};
+ int flag = 0;
+
+ delete_id = websGetVar(wp, "delete_id", "");
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_fw_port_map_del delete_id: %s\n", delete_id);
+ if (*delete_id == '\0') {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //to delete the rules
+ for (start = delete_id; *delete_id != '\0';) {
+ if (*delete_id == ';') {
+ *delete_id = '\0';
+ id = atoi(start);
+ memset(PortMapRules_x, 0, sizeof(PortMapRules_x));
+ (void)snprintf(PortMapRules_x, NV_ITEM_STRING_LEN_50, "PortMapRules_%d", id);
+ slog(MISC_PRINT, SLOG_DEBUG, "port_map delete NV: %s\n", PortMapRules_x);
+ (void)sc_cfg_set(PortMapRules_x, "");
+
+ delete_id++; /*lint !e52*/
+ start = delete_id;
+ } else {
+ delete_id ++;/*lint !e52*/
+ }
+ }
+
+ //organize the rule
+ for (i = 0; i <= 9; i++) {
+ flag = 0;
+ memset(PortMapRules_x, 0, sizeof(PortMapRules_x));
+ memset(PortMapRules, 0, sizeof(PortMapRules));
+
+ (void)snprintf(PortMapRules_x, NV_ITEM_STRING_LEN_50, "PortMapRules_%d", i);
+ sc_cfg_get(PortMapRules_x, PortMapRules, sizeof(PortMapRules));
+
+ if (0 == strcmp(PortMapRules, "")) {
+ for (j = (i + 1); j <= 9; j++) {
+ //reset
+ memset(PortMapRules_x, 0, sizeof(PortMapRules_x));
+ memset(PortMapRules, 0, sizeof(PortMapRules));
+
+ (void)snprintf(PortMapRules_x, NV_ITEM_STRING_LEN_50, "PortMapRules_%d", j);
+ sc_cfg_get(PortMapRules_x, PortMapRules, sizeof(PortMapRules));
+ if (0 != strcmp(PortMapRules, "")) {
+ (void)sc_cfg_set(PortMapRules_x, "");
+
+ memset(PortMapRules_x, 0, sizeof(PortMapRules_x));
+ (void)snprintf(PortMapRules_x, NV_ITEM_STRING_LEN_50, "PortMapRules_%d", i);
+ (void)sc_cfg_set(PortMapRules_x, PortMapRules);
+
+ flag = 1;
+ break;
+ }
+ }
+
+ if (0 == flag) {
+ break;
+ }
+ }
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_MAPPING, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_port_map_del SEND MESSAGE TO MC END\n"); /*lint !e26*/
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+//¹©web»ñÈ¡¹æÔòÐÐÊý
+/*int zte_get_fw_rules_num(webs_t wp, char* ruleName)
+{
+ char rules[NV_FW_RULE_MAX_LEN]={0};
+
+ sc_cfg_get(ruleName, rules, sizeof(rules));
+ if(0 == strlen(rules))
+ {
+ websWrite(wp, T("0"));
+ return 0;
+ }
+
+ websWrite(wp, T("%d"), getRuleNums(rules));
+ return 0;
+}*/
+
+void zte_goform_url_filter_add_process(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User added url filter!\n"));
+ char urlfilters[1023] = {0};
+ char new_urlfilters[1024] = {0};
+ char *rule = websGetVar(wp, T("addURLFilter"), T(""));
+
+ memset(urlfilters, 0, 1023);
+ memset(new_urlfilters, 0, 1024);
+
+ if (!rule)
+ return;
+ if (strchr(rule, ';'))
+ return;
+
+ sc_cfg_get("websURLFilters", urlfilters, sizeof(urlfilters));
+ if (0 == strcmp(urlfilters, "")) {
+ sc_cfg_set("websURLFilters", rule);
+ } else {
+ snprintf(new_urlfilters,sizeof(new_urlfilters),"%s%s%s",urlfilters,";",rule);
+/* strcat(new_urlfilters, urlfilters);
+ strcat(new_urlfilters, ";");
+ if(strlen(new_urlfilters) + strlen(rule) < 1024)
+ strcat(new_urlfilters, rule);*/
+ sc_cfg_set("websURLFilters", new_urlfilters);
+ }
+
+ //zte_iptables_Webs_Filter_Run();
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_URL_FILTER, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_goform_url_filter_add_process MESSAGE TO MC END"); /*lint !e26*/
+
+ //sc_cfg_save();
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+//URL¹ýÂ˹æÔòɾ³ý
+void zte_goform_url_filter_delete_process(webs_t wp)
+{
+ int j = 0, rule_count = 0;
+ char_t name_buf[16] = {0};
+ char_t *value = NULL;
+ char_t *delete_id = NULL;
+ int *deleArray = NULL;
+ char rules[1024] = {0};
+ char_t *start = NULL;
+ int id = 0;
+
+ delete_id = websGetVar(wp, "url_filter_delete_id", NULL);
+
+ if (delete_id == NULL || *delete_id == '\0') {
+ slog(MISC_PRINT, SLOG_DEBUG, "delete_id is NULL."); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE); /*lint !e26*/
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "delete_id is [%s].", delete_id); /*lint !e26*/
+
+ //to delete the rules
+
+ sc_cfg_get("websURLFilters", rules, sizeof(rules));
+ if (0 == strlen(rules)) {
+ slog(MISC_PRINT, SLOG_ERR, "rules is NULL."); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ rule_count = getRuleNums(rules);
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ if (!rule_count) {
+ slog(MISC_PRINT, SLOG_ERR, "rule_count is NULL."); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+#endif
+ deleArray = (int *)malloc(rule_count * sizeof(int));
+ if (NULL == deleArray) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ for (start = delete_id; *delete_id != '\0';) {
+ if (*delete_id == ';') {
+ *delete_id = '\0';
+ id = atoi(start);
+ slog(MISC_PRINT, SLOG_DEBUG, "delete_id single is [%d].", id); /*lint !e26*/
+ deleArray[j++] = id; /*lint !e52*/
+ delete_id ++;
+ start = delete_id;
+ } else {
+ delete_id ++;/*lint !e52*/
+ }
+ }
+#if 0
+ for (i = 0, j = 0; i < rule_count; i++) {
+ snprintf(name_buf, 16, "DR%d", i);
+ value = websGetVar(wp, name_buf, NULL);
+ if (value) {
+ deleArray[j++] = i;
+ }
+ }
+#endif
+ if (!j) {
+ free(deleArray);
+
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ static_deleteNthValueMulti(deleArray, rule_count, rules, ';');
+ free(deleArray);
+ deleArray = NULL;
+
+ sc_cfg_set("websURLFilters", rules);
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_URL_FILTER, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_goform_url_filter_delete_process MESSAGE TO MC END"); /*lint !e26*/
+
+ //sc_cfg_save();
+
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+}
+
+//DMZ¹æÔòÌí¼Ó
+void zte_fw_dmz(webs_t wp)
+{
+ char *dmzE, *ip_address;
+
+ dmzE = websGetVar(wp, T("DMZEnabled"), T(""));
+ ip_address = websGetVar(wp, T("DMZIPAddress"), T(""));
+
+ // someone use malform page.....
+ if (!dmzE || !strlen(dmzE)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (atoi(dmzE) && !isIpValid(ip_address)) { // enable && invalid mac address
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //zte_iptables_DMZ_Run();
+ if (atoi(dmzE) == 0) {
+ zte_web_write("DMZEnable", "0");// disable
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User disable port forward!\n"));
+ } else {
+ zte_web_write("DMZEnable", "1");// enable
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User enable port forward!\n"));
+ if (strlen(ip_address)) {
+ zte_web_write("DMZIPAddress", ip_address);
+ }
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_DMZ, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_dmz SEND MESSAGE TO MC END"); /*lint !e26*/
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+static int zte_fw_ipport_filter_check(webs_t wp, fw_ipport_filter_type *fw_ipport_filter)
+{
+ char *ip_version = NULL;
+ ip_version = websGetVar(wp, T("ip_version"), T(""));
+
+ if (0 == strlen(fw_ipport_filter->mac_address)
+ && 0 == strlen(fw_ipport_filter->sip_1)
+ && 0 == strlen(fw_ipport_filter->dip_1)
+ && 0 == strlen(fw_ipport_filter->sprf)
+ && 0 == strlen(fw_ipport_filter->dprf)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_fw_ipport_filter_add -> No MAC/IP/Port input!"); /*lint !e26*/
+ return -1;
+ }
+
+ if (strlen(fw_ipport_filter->mac_address) > 0
+ && !isMacValid(fw_ipport_filter->mac_address)) {
+ slog(MISC_PRINT, SLOG_ERR, "Mac address is error."); /*lint !e26*/
+ return -1;
+ }
+
+ if (strlen(fw_ipport_filter->sip_1)) {
+ if (0 == strcmp(ip_version, IP_VERSION_V4)) {
+ if (!isIpNetmaskValid(fw_ipport_filter->sip_1)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_fw_ipport_filter_add -> src ip is invalid:[%s]", fw_ipport_filter->sip_1); /*lint !e26*/
+ return -1;
+ }
+ }
+ } else {
+ fw_ipport_filter->sip_1 = T("any/0");
+ slog(MISC_PRINT, SLOG_DEBUG, "liuyingnan check:[%s]", fw_ipport_filter->sip_1); /*lint !e26*/
+ }
+
+ if (strlen(fw_ipport_filter->dip_1)) {
+ if (0 == strcmp(ip_version, IP_VERSION_V4)) {
+ if (!isIpNetmaskValid(fw_ipport_filter->dip_1)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_fw_ipport_filter_add -> dest ip is invalid:[%s]", fw_ipport_filter->dip_1); /*lint !e26*/
+ return -1;
+ }
+ }
+ } else {
+ fw_ipport_filter->dip_1 = T("any/0");
+ slog(MISC_PRINT, SLOG_DEBUG, "liuyingnan check:[%s]", fw_ipport_filter->dip_1); /*lint !e26*/
+ }
+
+ fw_ipport_filter->sip_2 = fw_ipport_filter->dip_2 = "0";
+
+ if (!strcmp(fw_ipport_filter->protocol, T("TCP")))
+ fw_ipport_filter->proto = PROTO_TCP;
+ else if (!strcmp(fw_ipport_filter->protocol, T("UDP")))
+ fw_ipport_filter->proto = PROTO_UDP;
+ else if (!strcmp(fw_ipport_filter->protocol, T("None")))
+ fw_ipport_filter->proto = PROTO_NONE;
+ else if (!strcmp(fw_ipport_filter->protocol, T("ICMP")))
+ fw_ipport_filter->proto = PROTO_ICMP;
+ else if (!strcmp(fw_ipport_filter->protocol, T("TCP&UDP")))
+ fw_ipport_filter->proto = PROTO_TCP_UDP;
+ else {
+ slog(MISC_PRINT, SLOG_ERR, "protocol is invalid:[%s]", fw_ipport_filter->protocol); /*lint !e26*/
+ return -1;
+ }
+
+ /* port(1~65535) is valid only when the protocol is TCP or UDP */
+ if (!strlen(fw_ipport_filter->sprf)
+ || fw_ipport_filter->proto == PROTO_NONE
+ || fw_ipport_filter->proto == PROTO_ICMP) {
+ fw_ipport_filter->sprf_int = 0;
+ } else {
+ fw_ipport_filter->sprf_int = atoi(fw_ipport_filter->sprf);
+ if (fw_ipport_filter->sprf_int == 0 || fw_ipport_filter->sprf_int > 65535) {
+ slog(MISC_PRINT, SLOG_ERR, "sprf is invalid:[%s]", fw_ipport_filter->sprf); /*lint !e26*/
+ return -1;
+ }
+ }
+
+ if (!strlen(fw_ipport_filter->sprt)
+ || fw_ipport_filter->proto == PROTO_NONE
+ || fw_ipport_filter->proto == PROTO_ICMP) {
+ fw_ipport_filter->sprt_int = 0;
+ } else {
+ fw_ipport_filter->sprt_int = atoi(fw_ipport_filter->sprt);
+ if (fw_ipport_filter->sprt_int == 0 || fw_ipport_filter->sprt_int > 65535) {
+ slog(MISC_PRINT, SLOG_ERR, "sprt is invalid:[%s]", fw_ipport_filter->sprt); /*lint !e26*/
+ return -1;
+ }
+ }
+
+ if (!strlen(fw_ipport_filter->dprf)
+ || fw_ipport_filter->proto == PROTO_NONE
+ || fw_ipport_filter->proto == PROTO_ICMP) {
+ fw_ipport_filter->dprf_int = 0;
+ } else {
+ fw_ipport_filter->dprf_int = atoi(fw_ipport_filter->dprf);
+ if (fw_ipport_filter->dprf_int == 0 || fw_ipport_filter->dprf_int > 65535) {
+ slog(MISC_PRINT, SLOG_ERR, "dprf is invalid:[%s]", fw_ipport_filter->dprf); /*lint !e26*/
+ return -1;
+ }
+ }
+
+ if (!strlen(fw_ipport_filter->dprt)
+ || fw_ipport_filter->proto == PROTO_NONE
+ || fw_ipport_filter->proto == PROTO_ICMP) {
+ fw_ipport_filter->dprt_int = 0;
+ } else {
+ fw_ipport_filter->dprt_int = atoi(fw_ipport_filter->dprt);
+ if (fw_ipport_filter->dprt_int == 0 || fw_ipport_filter->dprt_int > 65535) {
+ slog(MISC_PRINT, SLOG_ERR, "dprt is invalid:[%s]", fw_ipport_filter->dprt); /*lint !e26*/
+ return -1;
+ }
+ }
+
+ if (0 == (strcmp(fw_ipport_filter->action_str, T("Accept")))) {
+ fw_ipport_filter->action = ACTION_ACCEPT;
+ } else if (0 == (strcmp(fw_ipport_filter->action_str, T("Drop")))) {
+ fw_ipport_filter->action = ACTION_DROP;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "action is invalid:[%s]", fw_ipport_filter->action_str); /*lint !e26*/
+ return -1;
+ }
+
+ if (strlen(fw_ipport_filter->comment) > 32) {
+ slog(MISC_PRINT, SLOG_ERR, "comment is too long."); /*lint !e26*/
+ return -1;
+ }
+ // i know you will try to break our box... ;)
+ if (strchr(fw_ipport_filter->comment, ';') || strchr(fw_ipport_filter->comment, ',')) {
+ slog(MISC_PRINT, SLOG_ERR, "comment is invalid."); /*lint !e26*/
+ return -1;
+ }
+
+ return 1;
+}
+
+/*IPV4¶Ë¿Ú¹ýÂËÌí¼Ó*/
+static void zte_fw_ipport_filter_add_v4(webs_t wp)
+{
+ fw_ipport_filter_type fw_ipport_filter_v4;
+ char IPPortFilterRules[NV_FW_RULE_MAX_LEN] = {0};
+ char IPPortFilterRules_x[NV_ITEM_STRING_LEN_50] = {0};
+ int check_result = 0;
+ int count = 0;
+ int flag = 0;
+
+ memset(&fw_ipport_filter_v4, 0, sizeof(fw_ipport_filter_type));
+ fw_ipport_filter_v4.sip_1 = websGetVar(wp, T("sip_address"), T("any"));
+ fw_ipport_filter_v4.sip_2 = websGetVar(wp, T("sip_address2"), T("")); // TODO: not support now
+ fw_ipport_filter_v4.sprf = websGetVar(wp, T("sFromPort"), T("0"));
+ fw_ipport_filter_v4.sprt = websGetVar(wp, T("sToPort"), T(""));
+ fw_ipport_filter_v4.dip_1 = websGetVar(wp, T("dip_address"), T("any"));
+ fw_ipport_filter_v4.dip_2 = websGetVar(wp, T("dip_address2"), T("")); // TODO: not support now
+ fw_ipport_filter_v4.dprf = websGetVar(wp, T("dFromPort"), T("0"));
+ fw_ipport_filter_v4.dprt = websGetVar(wp, T("dToPort"), T(""));
+ fw_ipport_filter_v4.mac_address = websGetVar(wp, T("mac_address"), T(""));
+ fw_ipport_filter_v4.protocol = websGetVar(wp, T("protocol"), T("")); // None | TCP | UDP | ICMP | TCP&UDP
+ fw_ipport_filter_v4.action_str = websGetVar(wp, T("action"), T("")); // Drop | Accept
+ fw_ipport_filter_v4.comment = websGetVar(wp, T("comment"), T(""));
+
+ check_result = zte_fw_ipport_filter_check(wp, &fw_ipport_filter_v4);
+ if (check_result < 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ for (count = 0; count <= 9; count ++) {
+ (void)snprintf(IPPortFilterRules_x, NV_ITEM_STRING_LEN_50, "IPPortFilterRules_%d", count);
+ memset(IPPortFilterRules, 0, sizeof(IPPortFilterRules));
+ zte_web_read(IPPortFilterRules_x, IPPortFilterRules);
+ if (0 == strcmp(IPPortFilterRules, "")) {
+ memset(IPPortFilterRules, 0, sizeof(IPPortFilterRules));
+ (void)snprintf(IPPortFilterRules, NV_FW_RULE_MAX_LEN, "%s,%s,%d,%d,%s,%s,%d,%d,%d,%d,%s,%s",
+ fw_ipport_filter_v4.sip_1, fw_ipport_filter_v4.sip_2,
+ fw_ipport_filter_v4.sprf_int, fw_ipport_filter_v4.sprt_int,
+ fw_ipport_filter_v4.dip_1, fw_ipport_filter_v4.dip_2,
+ fw_ipport_filter_v4.dprf_int, fw_ipport_filter_v4.dprt_int,
+ fw_ipport_filter_v4.proto, fw_ipport_filter_v4.action,
+ fw_ipport_filter_v4.comment, fw_ipport_filter_v4.mac_address);
+ (void)zte_web_write(IPPortFilterRules_x, IPPortFilterRules);
+ flag = 1;
+ break;
+ }
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FILTER, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_ipport_filter_add_v4 SEND MESSAGE TO MC END"); /*lint !e26*/
+ //zte_response_json_for_test(wp,"zte_fw_ipport_filter_add","send message to mc");
+ //sc_cfg_save();
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*IPV6¶Ë¿Ú¹ýÂËÌí¼Ó*/
+static void zte_fw_ipport_filter_add_v6(webs_t wp)
+{
+ fw_ipport_filter_type fw_ipport_filter_v6;
+ char IPPortFilterRulesV6[NV_FW_RULE_MAX_LEN] = {0};
+ char IPPortFilterRulesV6_x[NV_ITEM_STRING_LEN_50] = {0};
+ int check_result = 0;
+ int count = 0;
+ int flag = 0;
+
+ memset(&fw_ipport_filter_v6, 0, sizeof(fw_ipport_filter_type));
+ fw_ipport_filter_v6.sip_1 = websGetVar(wp, T("sip_address"), T("any"));
+ fw_ipport_filter_v6.sip_2 = websGetVar(wp, T("sip_address2"), T("")); // TODO: not support now
+ fw_ipport_filter_v6.sprf = websGetVar(wp, T("sFromPort"), T("0"));
+ fw_ipport_filter_v6.sprt = websGetVar(wp, T("sToPort"), T(""));
+ fw_ipport_filter_v6.dip_1 = websGetVar(wp, T("dip_address"), T("any"));
+ fw_ipport_filter_v6.dip_2 = websGetVar(wp, T("dip_address2"), T("")); // TODO: not support now
+ fw_ipport_filter_v6.dprf = websGetVar(wp, T("dFromPort"), T("0"));
+ fw_ipport_filter_v6.dprt = websGetVar(wp, T("dToPort"), T(""));
+ fw_ipport_filter_v6.mac_address = websGetVar(wp, T("mac_address"), T(""));
+ fw_ipport_filter_v6.protocol = websGetVar(wp, T("protocol"), T("")); // None | TCP | UDP | ICMP | TCP&UDP
+ fw_ipport_filter_v6.action_str = websGetVar(wp, T("action"), T("")); // Drop | Accept
+ fw_ipport_filter_v6.comment = websGetVar(wp, T("comment"), T(""));
+
+ check_result = zte_fw_ipport_filter_check(wp, &fw_ipport_filter_v6);
+ if (check_result < 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ for (count = 0; count <= 9; count ++) {
+ (void)snprintf(IPPortFilterRulesV6_x, NV_ITEM_STRING_LEN_50, "IPPortFilterRulesv6_%d", count);
+ memset(IPPortFilterRulesV6, 0, sizeof(IPPortFilterRulesV6));
+ zte_web_read(IPPortFilterRulesV6_x, IPPortFilterRulesV6);
+ if (0 == strcmp(IPPortFilterRulesV6, "")) {
+ memset(IPPortFilterRulesV6, 0, sizeof(IPPortFilterRulesV6));
+ (void)snprintf(IPPortFilterRulesV6, NV_FW_RULE_MAX_LEN, "%s,%s,%d,%d,%s,%s,%d,%d,%d,%d,%s,%s",
+ fw_ipport_filter_v6.sip_1, fw_ipport_filter_v6.sip_2,
+ fw_ipport_filter_v6.sprf_int, fw_ipport_filter_v6.sprt_int,
+ fw_ipport_filter_v6.dip_1, fw_ipport_filter_v6.dip_2,
+ fw_ipport_filter_v6.dprf_int, fw_ipport_filter_v6.dprt_int,
+ fw_ipport_filter_v6.proto, fw_ipport_filter_v6.action,
+ fw_ipport_filter_v6.comment, fw_ipport_filter_v6.mac_address);
+ (void)zte_web_write(IPPortFilterRulesV6_x, IPPortFilterRulesV6);
+ flag = 1;
+ break;
+ }
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FILTER, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_ipport_filter_add_v6 MESSAGE TO MC END"); /*lint !e26*/
+
+ //zte_response_json_for_test(wp,"zte_fw_ipport_filter_add","send message to mc");
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*¶Ë¿Ú¹ýÂËÓÐЧÐÔ¼ì²é*/
+static int zte_fw_port_forward_check(webs_t wp, fw_port_forward_type *fw_port_forward)
+{
+ /* user choose nothing but press "apply" only */
+ if (0 == strlen(fw_port_forward->ip_address)
+ && 0 == strlen(fw_port_forward->prf)
+ && 0 == strlen(fw_port_forward->prt)
+ && 0 == strlen(fw_port_forward->comment)) {
+ zte_web_write("PortForwardEnable", "1");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FORWARD, 0, NULL, 0);
+ return -1;
+ }
+
+ if (!strlen(fw_port_forward->ip_address)) {
+ return -1;
+ }
+ if (!isIpValid(fw_port_forward->ip_address)) {
+ return -1;
+ }
+
+ // we dont trust user input.....
+ if (!fw_port_forward->prf || !strlen(fw_port_forward->prf)) {
+ return -1;
+ }
+ if (!(fw_port_forward->prf_int = atoi(fw_port_forward->prf))) {
+ return -1;
+ }
+ if (fw_port_forward->prf_int > 65535) {
+ return -1;
+ }
+
+ if (!fw_port_forward->prt) {
+ return -1;
+ }
+ if (strlen(fw_port_forward->prt)) {
+ if (!(fw_port_forward->prt_int = atoi(fw_port_forward->prt))) {
+ return -1;
+ }
+ if (fw_port_forward->prt_int < fw_port_forward->prf_int) {
+ return -1;
+ }
+ if (fw_port_forward->prt_int > 65535)
+ return -1;
+ } else {
+ fw_port_forward->prt_int = 0;
+ }
+
+ if (! strcmp(fw_port_forward->protocol, "TCP"))
+ fw_port_forward->proto = PROTO_TCP;
+ else if (!strcmp(fw_port_forward->protocol, "UDP"))
+ fw_port_forward->proto = PROTO_UDP;
+ else if (!strcmp(fw_port_forward->protocol, "TCP&UDP"))
+ fw_port_forward->proto = PROTO_TCP_UDP;
+ else {
+ return -1;
+ }
+ if (strlen(fw_port_forward->comment) > 32) {
+ return -1;
+ }
+ /* i know you will try to break our box... ;) */
+ if (strchr(fw_port_forward->comment, ';') || strchr(fw_port_forward->comment, ',')) {
+ return -1;
+ }
+
+ return 1;
+}
+
+/*Ìí¼ÓÒ»Ìõ·À»ðǽ*/
+void zte_fw_ipport_filter_add(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User added port filter!\n"));
+
+ char *ip_version = NULL;
+
+ ip_version = websGetVar(wp, T("ip_version"), T(""));
+
+ if (0 == strcmp(ip_version, IP_VERSION_V4)) {
+ zte_fw_ipport_filter_add_v4(wp);
+ } else if (0 == strcmp(ip_version, IP_VERSION_V6)) {
+ zte_fw_ipport_filter_add_v6(wp);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "unknown ip_version:[%s]", ip_version); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+}
+
+/*Ìí¼ÓÒ»Ìõ¶Ë¿Úת·¢¹æÔò£¬½»ÓÉzte_routerͳһ´¦Àí*/
+void zte_fw_port_forward_add(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User added port forward!\n"));
+ fw_port_forward_type fw_port_forward;
+ int check_result = 0;
+ int count = 0;
+ int flag = 0;
+ char PortForwardRules[NV_FW_RULE_MAX_LEN] = {0};
+ char PortForwardRules_x[NV_ITEM_STRING_LEN_50] = {0};
+ memset(&fw_port_forward, 0, sizeof(fw_port_forward_type));
+ fw_port_forward.ip_address = websGetVar(wp, T("ipAddress"), T(""));
+ fw_port_forward.prf = websGetVar(wp, T("portStart"), T(""));
+ fw_port_forward.prt = websGetVar(wp, T("portEnd"), T(""));
+ fw_port_forward.protocol = websGetVar(wp, T("protocol"), T(""));
+ fw_port_forward.comment = websGetVar(wp, T("comment"), T(""));
+ //slog(MISC_PRINT,SLOG_DEBUG, "fw_port_forward.protocol:[%s]", fw_port_forward.protocol);
+
+ check_result = zte_fw_port_forward_check(wp, &fw_port_forward);
+ if (check_result < 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //zte_web_write("PortForwardEnable", "1");
+ for (count = 0; count <= 9; count ++) {
+ (void)snprintf(PortForwardRules_x, NV_ITEM_STRING_LEN_50, "PortForwardRules_%d", count);
+ memset(PortForwardRules, 0, sizeof(PortForwardRules));
+ zte_web_read(PortForwardRules_x, PortForwardRules);
+ if (0 == strcmp(PortForwardRules, "")) {
+ memset(PortForwardRules, 0, sizeof(PortForwardRules));
+ (void)snprintf(PortForwardRules, NV_ITEM_STRING_LEN_200, "%s,%d,%d,%d,%s",
+ fw_port_forward.ip_address, fw_port_forward.prf_int,
+ fw_port_forward.prt_int, fw_port_forward.proto,
+ fw_port_forward.comment);
+ (void)zte_web_write(PortForwardRules_x, PortForwardRules);
+ flag = 1;
+ break;
+ }
+ }
+
+ if (0 == flag) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FORWARD, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_port_forward_add MESSAGE TO MC END"); /*lint !e26*/
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*ɾ³ýV4µÄ¶Ë¿ÚÁбí*/
+static void zte_fw_ipport_filter_del_v4(webs_t wp)
+{
+ int i = 0, j = 0;
+ char_t *delete_id = NULL;
+ int id = 0;
+ char_t *start = NULL;
+ char IPPortFilterRules_x[NV_ITEM_STRING_LEN_50] = {0};
+ char IPPortFilterRules[NV_FW_RULE_MAX_LEN] = {0};
+ int flag = 0;
+
+ delete_id = websGetVar(wp, "delete_id", "");
+ slog(MISC_PRINT, SLOG_DEBUG, "delete_id is [%s].", delete_id); /*lint !e26*/
+
+ if (*delete_id == '\0') {
+ return; // no delete the v4 rule
+ }
+
+ //to delete the rules
+ for (start = delete_id; *delete_id != '\0';) {
+ if (*delete_id == ';') {
+ *delete_id = '\0';
+ id = atoi(start);
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ (void)snprintf(IPPortFilterRules_x, sizeof(IPPortFilterRules_x) - 1, "IPPortFilterRules_%d", id);
+ (void)zte_web_write(IPPortFilterRules_x, "");
+
+ delete_id ++;/*lint !e52*/
+ start = delete_id;
+ } else {
+ delete_id ++;/*lint !e52*/
+ }
+ }
+
+ //organize the rule
+ for (i = 0; i <= 9; i++) {
+ flag = 0;
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ memset(IPPortFilterRules, 0, sizeof(IPPortFilterRules));
+
+ (void)snprintf(IPPortFilterRules_x, sizeof(IPPortFilterRules_x) - 1, "IPPortFilterRules_%d", i);
+ (void)zte_web_read(IPPortFilterRules_x, IPPortFilterRules);
+
+ if (0 == strcmp(IPPortFilterRules, "")) {
+ for (j = (i + 1); j <= 9; j++) {
+ //reset
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ memset(IPPortFilterRules, 0, sizeof(IPPortFilterRules));
+
+ (void)snprintf(IPPortFilterRules_x, sizeof(IPPortFilterRules_x) - 1, "IPPortFilterRules_%d", j);
+ (void)zte_web_read(IPPortFilterRules_x, IPPortFilterRules);
+ if (0 != strcmp(IPPortFilterRules, "")) {
+ (void)zte_web_write(IPPortFilterRules_x, "");
+
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ (void)snprintf(IPPortFilterRules_x, sizeof(IPPortFilterRules_x) - 1, "IPPortFilterRules_%d", i);
+ (void)zte_web_write(IPPortFilterRules_x, IPPortFilterRules);
+
+ flag = 1;
+ break;
+ }
+ }
+
+ if (0 == flag) {
+ break;
+ }
+ }
+ }
+}
+
+/*ɾ³ýV6µÄ¶Ë¿ÚÁбí*/
+static void zte_fw_ipport_filter_del_v6(webs_t wp)
+{
+ int i = 0, j = 0;
+ char_t *delete_id = NULL;
+ int id = 0;
+ char_t *start = NULL;
+ char IPPortFilterRules_x[NV_ITEM_STRING_LEN_50] = {0};
+ char IPPortFilterRules[NV_FW_RULE_MAX_LEN_V6] = {0};
+ int flag = 0;
+
+ delete_id = websGetVar(wp, "delete_id_v6", "");
+ slog(MISC_PRINT, SLOG_DEBUG, "delete_id is [%s].", delete_id); /*lint !e26*/
+
+ if (*delete_id == '\0') {
+ return; // no delete the v6 rule
+ }
+
+ //to delete the rules
+ for (start = delete_id; *delete_id != '\0';) {
+ if (*delete_id == ';') {
+ *delete_id = '\0';
+ id = atoi(start);
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ (void)snprintf(IPPortFilterRules_x, sizeof(IPPortFilterRules_x) - 1, "IPPortFilterRulesv6_%d", id);
+ (void)zte_web_write(IPPortFilterRules_x, "");
+
+ delete_id ++;/*lint !e52*/
+ start = delete_id;
+ } else {
+ delete_id ++;/*lint !e52*/
+ }
+ }
+
+ //organize the rule
+ for (i = 0; i <= 9; i++) {
+ flag = 0;
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ memset(IPPortFilterRules, 0, sizeof(IPPortFilterRules));
+
+ (void)snprintf(IPPortFilterRules_x, sizeof(IPPortFilterRules_x) - 1, "IPPortFilterRulesv6_%d", i);
+ (void)zte_web_read(IPPortFilterRules_x, IPPortFilterRules);
+
+ if (0 == strcmp(IPPortFilterRules, "")) {
+ for (j = (i + 1); j <= 9; j++) {
+ //reset
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ memset(IPPortFilterRules, 0, sizeof(IPPortFilterRules));
+
+ (void)snprintf(IPPortFilterRules_x, sizeof(IPPortFilterRules_x) - 1, "IPPortFilterRulesv6_%d", j);
+ (void)zte_web_read(IPPortFilterRules_x, IPPortFilterRules);
+ if (0 != strcmp(IPPortFilterRules, "")) {
+ (void)zte_web_write(IPPortFilterRules_x, "");
+
+ memset(IPPortFilterRules_x, 0, sizeof(IPPortFilterRules_x));
+ (void)snprintf(IPPortFilterRules_x, sizeof(IPPortFilterRules_x) - 1, "IPPortFilterRulesv6_%d", i);
+ (void)zte_web_write(IPPortFilterRules_x, IPPortFilterRules);
+
+ flag = 1;
+ break;
+ }
+ }
+
+ if (0 == flag) {
+ break;
+ }
+ }
+ }
+
+}
+
+/*ɾ³ýij¶Ë¿ÚÁбí*/
+void zte_fw_ipport_filter_del_v4_v6(webs_t wp)
+{
+ //delete the v4 rule and v6 rule
+ zte_fw_ipport_filter_del_v4(wp);
+ zte_fw_ipport_filter_del_v6(wp);
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_IPPORT_FILTER, 0, NULL, 0);
+
+ //response
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/**********************************************************************
+¿ª¹ØupnpÒµÎñ
+**********************************************************************/
+void zte_fw_upnp_set(webs_t wp, char_t *path, char_t *query)
+{
+ char *upnp_set = NULL;
+#if 0
+ //wanghan start ÓÉÓÚȱʧ¶¯Ì¬¿âÍ·Îļþdlfcn.h£¬miniupnpdÔÝʱÎÞ·¨±àÒë¹ý£¬ÏÈ´ò×®±£Ö¤webui²»»á¿¨×¡
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+ //wanghan end
+#endif
+ //zte_topsw_state_e_type status = ZTE_NVIO_DONE;
+
+ upnp_set = websGetVar(wp, T("upnp_setting_option"), T("0"));
+
+ if (atoi(upnp_set) == 0) {
+ // disable
+ (void)zte_web_write("upnpEnabled", "0");
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User disable port forward!\n"));
+ } else {
+ // enable
+ (void)zte_web_write("upnpEnabled", "1");
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User enable port forward!\n"));
+ }
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_UPNP, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_fw_upnp_set MESSAGE TO MC END"); /*lint !e26*/
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*************************** wan pppoe ***************************/
+void zte_goform_set_wan_gatewaymode_PPPOE(webs_t wp)
+{
+ char work_state[20] = {0};
+ char *actionLink = NULL;
+ char_t *pppoe_username = NULL;
+ char_t *pppoe_cc = NULL;
+ char_t *eth_dial_mode = NULL;
+
+ pppoe_username = websGetVar(wp, T("pppoe_username"), T(""));
+ pppoe_cc = websGetVar(wp, T("pppoe_cc"), T(""));
+ eth_dial_mode = websGetVar(wp, T("dial_mode"), T(""));
+ actionLink = websGetVar(wp, T("action_link"), T(""));
+ sc_cfg_set(NV_OPMS_WAN_MODE, "PPPOE");
+ sc_cfg_set("ethwan_mode", "pppoe");
+ zte_write_result_to_web(wp, SUCCESS);
+ sc_cfg_get("rj45_state", work_state, sizeof(work_state));
+
+ if (IFSTREQUAL(eth_dial_mode, "auto_dial")) {
+ sc_cfg_set("ethwan_dialmode", "auto");
+ if (0 == strcmp(work_state, "idle")) { //rj45ÒѲåÈë Ôò×Ô¶¯²¦ºÅ ·ñÔòʲô¶¼²»×ö
+ sc_cfg_set("pppoe_username", pppoe_username);
+ sc_cfg_set("pppoe_cc", pppoe_cc);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ } else if (IFSTREQUAL(eth_dial_mode, "on_demand_dial")) {
+ sc_cfg_set("ethwan_dialmode", "ondemand");
+ if (0 == strcmp(work_state, "idle")) { //rj45ÒѲåÈë Ôò×Ô¶¯²¦ºÅ ·ñÔòʲô¶¼²»×ö
+ sc_cfg_set("pppoe_username", pppoe_username);
+ sc_cfg_set("pppoe_cc", pppoe_cc);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ } else if (IFSTREQUAL(eth_dial_mode, "manual_dial")) { //Ö»ÓÐÔÚrj45ÒѾ²åÈëµÄÇé¿öϲÅÄܹ»ÉèÖÃÊÖ¶¯Ä£Ê½
+ sc_cfg_set("ethwan_dialmode", "manual");
+ if (!strcmp(actionLink, "connect")) {
+ sc_cfg_set("pppoe_username", pppoe_username);
+ sc_cfg_set("pppoe_cc", pppoe_cc);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ } else {
+ netdev_disconnect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ }
+ //sc_cfg_save();
+}
+
+void zte_goform_set_wan_gatewaymode_DHCP(webs_t wp)
+{
+ char work_state[20] = {0};
+ char *actionLink = NULL;
+ char_t *eth_dial_mode = NULL;
+
+ actionLink = websGetVar(wp, T("action_link"), T(""));
+ eth_dial_mode = websGetVar(wp, T("dial_mode"), T(""));
+
+ sc_cfg_set(NV_OPMS_WAN_MODE, "DHCP");
+ sc_cfg_set("ethwan_mode", "dhcp");
+
+ zte_write_result_to_web(wp, SUCCESS);
+
+ sc_cfg_set("ethwan_dialmode", "auto");//dhcp Ò³ÃæÉÏûÓÐÊÖ¶¯ ÔÝʱĬÈÏΪ×Ô¶¯²¦ºÅ
+ sc_cfg_get("rj45_state", work_state, sizeof(work_state));
+
+ if (IFSTREQUAL(eth_dial_mode, "auto_dial")) {
+ sc_cfg_set("ethwan_dialmode", "auto");
+ if (0 == strcmp(work_state, "idle"))//rj45ÒѲåÈë Ôò×Ô¶¯²¦ºÅ ·ñÔòʲô¶¼²»×ö
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ } else if (IFSTREQUAL(eth_dial_mode, "on_demand_dial")) {
+ sc_cfg_set("ethwan_dialmode", "ondemand");
+ if (0 == strcmp(work_state, "idle"))//rj45ÒѲåÈë Ôò×Ô¶¯²¦ºÅ ·ñÔòʲô¶¼²»×ö
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ } else if (IFSTREQUAL(eth_dial_mode, "manual_dial")) { //Ö»ÓÐÔÚrj45ÒѾ²åÈëµÄÇé¿öϲÅÄܹ»ÉèÖÃÊÖ¶¯Ä£Ê½
+ sc_cfg_set("ethwan_dialmode", "manual");
+ if (!strcmp(actionLink, "connect")) {
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ } else {
+ netdev_disconnect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ }
+ //sc_cfg_save();
+}
+
+void zte_goform_set_wan_gatewaymode_STATIC(webs_t wp)
+{
+ char work_state[20] = {0};
+ char *actionLink = NULL;
+ char_t *eth_dial_mode = NULL;
+ char_t *static_wan_ipaddr = NULL;
+ char_t *static_wan_netmask = NULL;
+ char_t *static_wan_gateway = NULL;
+ char_t *static_wan_primary_dns = NULL;
+ char_t *static_wan_secondary_dns = NULL;
+
+ static_wan_ipaddr = websGetVar(wp, T("static_wan_ipaddr"), T(""));
+ static_wan_netmask = websGetVar(wp, T("static_wan_netmask"), T("0"));
+ static_wan_gateway = websGetVar(wp, T("static_wan_gateway"), T(""));
+ static_wan_primary_dns = websGetVar(wp, T("static_wan_primary_dns"), T(""));
+ static_wan_secondary_dns = websGetVar(wp, T("static_wan_secondary_dns"), T(""));
+ actionLink = websGetVar(wp, T("action_link"), T(""));
+ eth_dial_mode = websGetVar(wp, T("dial_mode"), T(""));
+
+ sc_cfg_set("ethwan_mode", "static");
+ sc_cfg_set(NV_OPMS_WAN_MODE, "STATIC");
+ zte_write_result_to_web(wp, SUCCESS);
+ sc_cfg_get("rj45_state", work_state, sizeof(work_state));
+
+ if (IFSTREQUAL(eth_dial_mode, "auto_dial")) {
+ sc_cfg_set("ethwan_dialmode", "auto");
+ if (0 == strcmp(work_state, "idle")) { //rj45ÒѲåÈë Ôò×Ô¶¯²¦ºÅ ·ñÔòʲô¶¼²»×ö
+ sc_cfg_set("static_wan_ipaddr", static_wan_ipaddr);
+ sc_cfg_set("static_wan_netmask", static_wan_netmask);
+ sc_cfg_set("static_wan_gateway", static_wan_gateway);
+ sc_cfg_set("static_wan_primary_dns", static_wan_primary_dns);
+ sc_cfg_set("static_wan_secondary_dns", static_wan_secondary_dns);
+ sc_cfg_set("static_ethwan_ip", static_wan_ipaddr);
+ sc_cfg_set("static_ethwan_nw", static_wan_netmask);
+ sc_cfg_set("static_ethwan_gw", static_wan_gateway);
+ sc_cfg_set("static_ethwan_pridns", static_wan_primary_dns);
+ sc_cfg_set("static_ethwan_secdns", static_wan_secondary_dns);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ } else if (IFSTREQUAL(eth_dial_mode, "on_demand_dial")) {
+ sc_cfg_set("ethwan_dialmode", "ondemand");
+ if (0 == strcmp(work_state, "idle")) { //rj45ÒѲåÈë Ôò×Ô¶¯²¦ºÅ ·ñÔòʲô¶¼²»×ö
+ sc_cfg_set("static_wan_ipaddr", static_wan_ipaddr);
+ sc_cfg_set("static_wan_netmask", static_wan_netmask);
+ sc_cfg_set("static_wan_gateway", static_wan_gateway);
+ sc_cfg_set("static_wan_primary_dns", static_wan_primary_dns);
+ sc_cfg_set("static_wan_secondary_dns", static_wan_secondary_dns);
+ sc_cfg_set("static_ethwan_ip", static_wan_ipaddr);
+ sc_cfg_set("static_ethwan_nw", static_wan_netmask);
+ sc_cfg_set("static_ethwan_gw", static_wan_gateway);
+ sc_cfg_set("static_ethwan_pridns", static_wan_primary_dns);
+ sc_cfg_set("static_ethwan_secdns", static_wan_secondary_dns);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ } else if (IFSTREQUAL(eth_dial_mode, "manual_dial")) { //Ö»ÓÐÔÚrj45ÒѾ²åÈëµÄÇé¿öϲÅÄܹ»ÉèÖÃÊÖ¶¯Ä£Ê½
+ sc_cfg_set("ethwan_dialmode", "manual");
+ if (!strcmp(actionLink, "connect")) {
+ sc_cfg_set("static_wan_ipaddr", static_wan_ipaddr);
+ sc_cfg_set("static_wan_netmask", static_wan_netmask);
+ sc_cfg_set("static_wan_gateway", static_wan_gateway);
+ sc_cfg_set("static_wan_primary_dns", static_wan_primary_dns);
+ sc_cfg_set("static_wan_secondary_dns", static_wan_secondary_dns);
+ sc_cfg_set("static_ethwan_ip", static_wan_ipaddr);
+ sc_cfg_set("static_ethwan_nw", static_wan_netmask);
+ sc_cfg_set("static_ethwan_gw", static_wan_gateway);
+ sc_cfg_set("static_ethwan_pridns", static_wan_primary_dns);
+ sc_cfg_set("static_ethwan_secdns", static_wan_secondary_dns);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ } else {
+ netdev_disconnect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ }
+ //sc_cfg_save();
+}
+
+void zte_goform_set_wan_gatewaymode_AUTO(webs_t wp)
+{
+ char work_state[20] = {0};
+ char_t *pppoe_username = NULL;
+ char_t *pppoe_cc = NULL;
+ char_t *actionLink = NULL;
+ char_t *eth_dial_mode = NULL;
+
+ pppoe_username = websGetVar(wp, T("pppoe_username"), T(""));
+ pppoe_cc = websGetVar(wp, T("pppoe_cc"), T(""));
+ actionLink = websGetVar(wp, T("action_link"), T(""));
+ eth_dial_mode = websGetVar(wp, T("dial_mode"), T(""));
+
+ sc_cfg_set("ethwan_mode", "auto");
+ sc_cfg_set("ethwan_dialmode", "auto");
+ sc_cfg_set(NV_OPMS_WAN_MODE, "AUTO");
+
+ zte_write_result_to_web(wp, SUCCESS);
+
+ sc_cfg_get("rj45_state", work_state, sizeof(work_state));
+
+ if (IFSTREQUAL(eth_dial_mode, "auto_dial")) {
+ sc_cfg_set("ethwan_dialmode", "auto");
+ if (0 == strcmp(work_state, "idle")) { //rj45ÒѲåÈë Ôò×Ô¶¯²¦ºÅ ·ñÔòʲô¶¼²»×ö
+ sc_cfg_set("pppoe_username", pppoe_username);
+ sc_cfg_set("pppoe_cc", pppoe_cc);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ } else if (IFSTREQUAL(eth_dial_mode, "on_demand_dial")) {
+ sc_cfg_set("ethwan_dialmode", "ondemand");
+ if (0 == strcmp(work_state, "idle")) { //rj45ÒѲåÈë Ôò×Ô¶¯²¦ºÅ ·ñÔòʲô¶¼²»×ö
+ sc_cfg_set("pppoe_username", pppoe_username);
+ sc_cfg_set("pppoe_cc", pppoe_cc);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ } else if (IFSTREQUAL(eth_dial_mode, "manual_dial")) { //Ö»ÓÐÔÚrj45ÒѾ²åÈëµÄÇé¿öϲÅÄܹ»ÉèÖÃÊÖ¶¯Ä£Ê½
+ sc_cfg_set("ethwan_dialmode", "manual");
+ if (!strcmp(actionLink, "connect")) {
+ sc_cfg_set("pppoe_username", pppoe_username);
+ sc_cfg_set("pppoe_cc", pppoe_cc);
+ netdev_connect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ } else {
+ netdev_disconnect_internet(RJ45_WAN_DEV, MODULE_ID_WEB_CGI);
+ }
+ }
+ //sc_cfg_save();
+}
+
+void zte_goform_set_operation_mode(webs_t wp)
+{
+ char_t *mode = NULL;
+ char oldMode[128] = {0};
+ char buf[NV_ITEM_STRING_LEN_20] = {0};
+
+ sc_cfg_get(NV_BLC_WAN_MODE, oldMode, sizeof(oldMode));
+ mode = websGetVar(wp, T("opMode"), T("PPP"));
+ sc_cfg_set(NV_BLC_WAN_MODE, mode);
+
+ if (!strcmp(mode, oldMode)) {
+ zte_write_result_to_web(wp, FAILURE);
+ } else {
+ zte_write_result_to_web(wp, SUCCESS);
+ slog(MISC_PRINT, SLOG_NORMAL,"zte_goform_set_operation_mode: send MSG_CMD_RESTART_REQUEST\n");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_RESTART_REQUEST, 0, NULL, 0);
+ }
+}
+
+
+//Æô¶¯pingÕï¶Ï
+void zte_ping_diagnostics_start(webs_t wp)
+{
+ char_t *diag_addr = NULL;
+ char_t *repetition_count = NULL;
+ char_t *time_out = NULL;
+ char_t *data_size = NULL;
+ char_t *diag_interface = NULL;
+
+ diag_addr = websGetVar(wp, T("ping_diag_addr"), T(""));
+ repetition_count = websGetVar(wp, T("ping_repetition_count"), T(""));
+ time_out = websGetVar(wp, T("ping_time_out"), T(""));
+ data_size = websGetVar(wp, T("ping_data_size"), T(""));
+ diag_interface = websGetVar(wp, T("ping_diag_interface"), T(""));
+
+ if ('\0' == (*diag_addr) || !isIpValid(diag_addr)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ (void)zte_web_write("ping_diag_addr", diag_addr);
+
+ if ('\0' != (*repetition_count))
+ (void)zte_web_write("ping_repetition_count", repetition_count);
+
+ if ('\0' != (*time_out))
+ (void)zte_web_write("ping_time_out", time_out);
+
+ if ('\0' != (*data_size))
+ (void)zte_web_write("ping_data_size", data_size);
+
+ if ('\0' != (*diag_interface))
+ (void)zte_web_write("ping_diag_interface", diag_interface);
+
+ //sc_cfg_save();
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_PING_DIAGNOSTICS, 0, NULL, 0);
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+//¹Ø±ÕpingÕï¶Ï
+void zte_ping_diagnostics_stop(webs_t wp)
+{
+ system("killall ping");
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+
diff --git a/ap/app/goahead/interface5.0/net/zte_web_net_wan.h b/ap/app/goahead/interface5.0/net/zte_web_net_wan.h
new file mode 100644
index 0000000..bd7abb3
--- /dev/null
+++ b/ap/app/goahead/interface5.0/net/zte_web_net_wan.h
@@ -0,0 +1,205 @@
+#ifndef ZTE_WEB_NET_WAN_H
+#define ZTE_WEB_NET_WAN_H
+
+#include "webs.h"
+
+/********************************Constant************************/
+#define PROTO_UNKNOWN 0
+#define PROTO_TCP 1
+#define PROTO_UDP 2
+#define PROTO_TCP_UDP 3
+#define PROTO_ICMP 4
+#define PROTO_NONE 5
+
+#define RULE_MODE_DISABLE 0
+#define RULE_MODE_DROP 1
+#define RULE_MODE_ACCEPT 2
+
+#define ACTION_DROP 0
+#define ACTION_ACCEPT 1
+
+#define NV_FW_EACH_RULE_LEN 150
+#define NV_FW_RULE_MAX_LEN 300
+
+#define WEB_PORT_MAX 65535
+#define ZTE_FW_IP_ADDR_LEN 16
+#define ZTE_FW_MAC_ADDR_LEN 18
+#define ZTE_FW_PORT_LEN 6
+#define ZTE_FW_FLAG_LEN 2
+#define ZTE_FW_SHORT_COMMENT_LEN 16
+#define ZTE_FW_MAC_FILTER_MAX_LEN 500
+#define ZTE_FW_IP_ADDR_LEN_V6 45
+
+#define WEB_IP_ADDR_MAX_LEN 32
+#define WEB_IP_PORT_MAX_LEN 8
+#define WEB_MAC_ADDR_MAX_LEN 32
+#define WEB_RULE_COMMENT_LEN 32
+
+
+#define FMT_ECHO_IPTABLES_CMD " 1>/dev/null 2>&1"
+#define IPPORT_FILTER_CHAIN "macipport_filter"
+#define VPN_CHAIN "vpn_filter"
+#define PORT_FORWARD_CHAIN "port_forward"
+
+#define WEB_FILTER_CHAIN "web_filter"
+#define DMZ_CHAIN "DMZ"
+
+/* Same as the file "linux/netfilter_ipv4/ipt_webstr.h" */
+#define BLK_JAVA 0x01
+#define BLK_ACTIVE 0x02
+#define BLK_COOKIE 0x04
+#define BLK_PROXY 0x08
+
+typedef struct _fw_ipport_filter_type {
+ char_t *mac_address;
+ char_t *sip_1;
+ char_t *sip_2;
+ char_t *sprf;
+ char_t *sprt;
+ char_t *dip_1;
+ char_t *dip_2;
+ char_t *dprf;
+ char_t *dprt;
+ char_t *protocol;
+ char_t *action_str;
+ char_t *comment;
+ int sprf_int;
+ int sprt_int;
+ int dprf_int;
+ int dprt_int;
+ int proto;
+ int action;
+} fw_ipport_filter_type;
+
+typedef struct _fw_port_map_type {
+ char_t *ip_address;
+ char_t *spr;
+ char_t *dpr;
+ char_t *protocol;
+ char_t *comment;
+ int spr_int;
+ int dpr_int;
+ int proto;
+
+} fw_port_map_type;
+
+typedef struct _fw_port_forward_type {
+ char_t *pfe;
+ char_t *ip_address;
+ char_t *prf;
+ char_t *prt;
+ char_t *protocol;
+ char_t *comment;
+ int prf_int;
+ int prt_int;
+ int proto;
+
+} fw_port_forward_type;
+
+extern void zte_goform_url_filter_add_process(webs_t wp);
+extern void zte_goform_url_filter_delete_process(webs_t wp);
+
+extern void init_router_web(void);
+//static int zte_dhcp_client_list(int eid, webs_t wp, int argc, char_t **argv);
+
+//static void zte_fw_ipport_filter_del_v4(webs_t wp);
+//static void zte_fw_ipport_filter_del_v6(webs_t wp);
+
+extern void zte_fw_basic_setting(webs_t wp);
+extern void zte_fw_forward_setting(webs_t wp);
+extern void zte_fw_sys_security_setting(webs_t wp);
+extern void zte_fw_ipport_filter_add(webs_t wp);
+extern void zte_fw_ipport_filter_del(webs_t wp);
+extern void zte_fw_port_forward_del(webs_t wp);
+//static int zte_fw_port_map_check(webs_t wp, fw_port_map_type *fw_port_map);
+extern void zte_fw_port_map_add(webs_t wp);
+extern void zte_fw_port_map_del(webs_t wp);
+
+
+//extern int zte_get_fw_rules_num(webs_t wp, char* ruleName);
+extern void zte_fw_dmz(webs_t wp);
+extern void zte_make_filter_rules_v6(char *buf, int len, char *mac_address,
+ char *sip_1, char *sip_2, int sprf_int, int sprt_int,
+ char *dip_1, char *dip_2, int dprf_int, int dprt_int, int proto, int action);
+extern void zte_parse_mac_ip_port_filter_rules_v6(char* rules, char* mac_address);
+extern void zte_run_mac_ip_port_filter_rules_v6(void);
+extern void zte_run_all_filter_rules_v6(void);
+//static int changeNthValue(int index, char *value, char delimit, char *result, char *web_list);
+//static int deleteNthValue(int index, char *value, char delimit);
+//static int deleteNthValue(int index, char *value, char delimit);
+extern void zte_static_route_list_ini_run(void);
+extern void zte_static_route_list_add(char *name, char *private, char *active, char *des_ip, char *subnet_mask, char *gateway, char *metric);
+extern void zte_static_route_list_run_one(char *list, char delimit);
+extern void zte_static_route_list_del_one(char *list, char delimit);
+extern void zte_static_route_list_del(int index, char delimit);
+extern int zte_static_route_list_edit_one(int index, char *value, char delimit, char *result, char *web_list);
+extern void zte_static_route_list_edit(char *index, char *web_name, char *web_private, char *web_active, char *web_des_ip, char *web_subnet_mask, char *web_gateway, char *web_metric);
+extern void zte_fw_port_forward_add(webs_t wp);
+//static void zte_fw_ipport_filter_del_v6(webs_t wp);
+extern void zte_fw_ipport_filter_del_v4_v6(webs_t wp);
+//static void zte_goform_maciplist_add_process(char_t *web_mac_ip_list);
+
+extern void zte_fw_upnp_set(webs_t wp, char_t *path, char_t *query);
+extern void zte_qos_list_run(void);
+extern void zte_goform_qoslist_add_process(char_t *web_ip, char_t *max_download, char_t *max_upload, char_t *web_comment);
+extern void zte_goform_qoslist_del_process(char_t *index);/*lint !e129*/
+extern void zte_goform_qoslist_edit_process(char_t *web_ip, char_t *maxdownload, char_t *maxupload, char_t *web_comment, char_t *index); /*lint !e129*/
+
+//==============================ASP Functions================================//
+
+//static int showPortForwardRulesASP(int eid, webs_t wp, int argc, char_t **argv);/* PortForwardRules */
+//static int showIPPortFilterRulesASP(int eid, webs_t wp, int argc, char_t **argv); /* IPPortFilterRules */
+//static int getDMZEnableASP(int eid, webs_t wp, int argc, char_t **argv);
+//static int showDMZIPAddressASP(int eid, webs_t wp, int argc, char_t **argv);
+
+
+/* added by liuweipeng for ipv6 firwall 20120315 end */
+//==========================Functions to add rules===========================//
+//static void zte_fw_ipport_filter_add_v4(webs_t wp);
+//static void zte_fw_ipport_filter_add_v6(webs_t wp);
+//static int zte_fw_ipport_filter_check(webs_t wp, fw_ipport_filter_type *fw_ipport_filter);
+//static int zte_fw_port_forward_check(webs_t wp, fw_port_forward_type *fw_port_forward);
+//==========================Functions to clear iptables rules===========================//
+//static void zte_iptables_filter_flush(void);
+//static void zte_iptables_nat_flush(void);
+
+//======================Functions to make rules=============================//
+/* Mac/Ip/Port Filtering Web page */
+//static void zte_iptables_basic_setting(void);
+//static void zte_iptables_filter_run(void);
+//static void zte_iptables_make_filter_rule(char *buf, int len, char *mac_address,
+// char *sip_1, char *sip_2, int sprf_int, int sprt_int,
+// char *dip_1, char *dip_2, int dprf_int, int dprt_int, int proto, int action);
+/* Port Forwarding Web page */
+//static void zte_iptables_port_forward_run(void);
+//static void zte_iptables_make_port_forward_rule(char *buf, int len, char *wan_name,
+// char *ip_address, int proto, int prf_int, int prt_int);
+/* System Security Web page */
+/* Run all rules */
+
+//======================Util=============================//
+//static int static_deleteNthValueMulti(int index[], int count, char *value, char delimit);
+//static int static_getNthValueSafe(int index, char *value, char delimit, char *result, int len);/*lint !e402*/
+//static int getNums(char *value, char delimit);
+//static int getRuleNums(char *rules);
+//static int isMacValid(char *str);
+//static int isIpNetmaskValid(char *s);
+extern int isIpValid(char *str);
+//static int isNumOnly(char *str);
+//static int isAllNumAndSlash(char *str);
+//static int isOnlyOneSlash(char *str);
+/*lint +e402*/
+
+
+/*************************** wan pppoe ***************************/
+extern void zte_goform_set_wan_gatewaymode_PPPOE(webs_t wp);
+extern void zte_goform_set_wan_gatewaymode_STATIC(webs_t wp);
+extern void zte_goform_set_wan_gatewaymode_DHCP(webs_t wp);
+extern void zte_goform_set_wan_gatewaymode_AUTO(webs_t wp);
+extern void zte_goform_set_operation_mode(webs_t wp);
+
+
+#endif
+
+
+
diff --git a/ap/app/goahead/interface5.0/other/Makefile b/ap/app/goahead/interface5.0/other/Makefile
new file mode 100644
index 0000000..ba81605
--- /dev/null
+++ b/ap/app/goahead/interface5.0/other/Makefile
@@ -0,0 +1,63 @@
+# /*****************************************************************************
+#* °æÈ¨ËùÓÐ (C)2015, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+#*
+#* ÎļþÃû³Æ: Makefile
+#* Îļþ±êʶ: Makefile
+#* ÄÚÈÝÕªÒª: Makefile of ZTE applications
+#* ʹÓ÷½·¨: void
+#*
+#* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
+#* -----------------------------------------------------------------------------
+#* 2015/02/10 V1.0 Create ÁõÑÇÄÏ ´´½¨
+#*
+# ******************************************************************************/
+
+#*******************************************************************************
+# include ZTE application makefile
+#*******************************************************************************
+include $(zte_app_mak)
+
+.PHONE: webuinet
+.PHONE: webuiwifi
+#*******************************************************************************
+# LIBWEBINTERFACE
+#*******************************************************************************
+LIBWEBINTERFACE = libwebinterface.a
+LIBWEBINTERFACE_SHARED = libwebinterface.so
+
+#*******************************************************************************
+# objects
+#*******************************************************************************
+OBJS = zte_web_traffic.o zte_web_traffic_util.o
+
+SRC = zte_web_traffic.c zte_web_traffic_util.c
+#*******************************************************************************
+# include path
+#*******************************************************************************
+CFLAGS += -DCONFIG_CHINA_UNICOM -DWEBS -DUEMF -DOS="LINUX" -DLINUX \
+ -I. \
+ -I$(zte_lib_path)/libnvram \
+ -I$(zte_lib_path)/libezxml \
+ -I$(zte_lib_path)/libmxml \
+ -I../../../include \
+ -I../../../wlan \
+ -I$(zte_lib_path)/libsqlite \
+ -I$(zte_lib_path)/libsoft_timer \
+ -I../../../at_server \
+ -I../../server \
+ -I.. \
+ -I../net \
+ -I../other
+
+
+# targets
+#*******************************************************************************
+all: $(OBJS)
+ @echo "--------------------wifi build-----------------------"
+#$(RANLIB) $@
+%.o: %.c
+ $(CC) $(CFLAGS) $(INCLUDES) -c $< -Wl,--start-group $(LDLIBS) -Wl,--end-group
+
+clean:
+ -rm -f *.elf *.gdb *.o *.a
+
diff --git a/ap/app/goahead/interface5.0/other/zte_web_traffic.c b/ap/app/goahead/interface5.0/other/zte_web_traffic.c
new file mode 100755
index 0000000..e476ad1
--- /dev/null
+++ b/ap/app/goahead/interface5.0/other/zte_web_traffic.c
@@ -0,0 +1,1726 @@
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include <sys/msg.h>
+#include <sys/ipc.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <sys/select.h>
+#include "../../include/message.h"
+#include <netdb.h>
+#include "../zte_web_interface.h"
+#include "../zte_web_sms.h"
+#include "../zte_web_cjson.h"
+#include "cfg_api.h"
+#include <ctype.h>
+#include <float.h>
+
+
+/**************************************************************************
+* ºê¶¨ÒåÇø
+**************************************************************************/
+
+#define TRAFFIC_PLATFORM "mifi"
+#define CX_360_SERVER_IP_NV "traffic_server_ip"
+#define CX_360_DEFAULT_SERVER_IP "223.202.20.216"
+#define CX_360_PORT 80
+#define CX_360_SERVER_URL "cx.shouji.360.cn"
+#define TRAFFIC_SMS_QUERY_URL "http://cx.shouji.360.cn/smscode/index.php"
+#define TRAFFIC_SMS_PARSE_URL "http://cx.shouji.360.cn/parsesms_v2/index.php"
+
+#define TRAFFIC_MAX_REQUEST 3
+#define GET_TRAFFIC_SUCCESS 100
+
+//for WEBUI read
+#define NV_TRAFFIC_USED_OFFSET_DATA "traffic_alined_delta"
+#define NV_TRAFFIC_PROCESS_STATE "is_traffic_alining"
+
+#define NV_TRAFFIC_RECV_SMS_ID "traffic_recv_sms_id"
+#define NV_TRAFFIC_SMS_SEND_TIME "traffic_sms_send_time"
+#define NV_TRAFFIC_SMS_NUMBER "traffic_sms_number"
+#define NV_TRAFFIC_OVER_TIME "traffic_over_time"
+#define NV_TRAFFIC_END_TIME "traffic_end_time"
+#define NV_TRAFFIC_STATE "traffic_process_state"
+#define NV_TRAFFIC_RESULT "traffic_process_result"
+#define NV_TRAFFIC_GLOBAL_TOTAL "traffic_global_total"
+#define NV_TRAFFIC_GLOBAL_USED "traffic_global_used"
+#define NV_TRAFFIC_LOCAL_TOTAL "traffic_local_total"
+#define NV_TRAFFIC_LOCAL_USED "traffic_local_used"
+#define NV_TRAFFIC_PROVINCEINNER_TOTAL "traffic_provinceinner_total"
+#define NV_TRAFFIC_PROVINCEINNER_USED "traffic_provinceinner_used"
+#define NV_TRAFFIC_PROVINCEOUTTER_TOTAL "traffic_provinceoutter_total"
+#define NV_TRAFFIC_PROVINCEOUTTER_USED "traffic_provinceoutter_used"
+#define TIME_ONE_DAY_INTERVAL (60*60*24) /* 1 DAY */
+#define TRAFFIC_SMS_MEM_STORE_IN_DB 10
+
+#define TRAFFIC_FIRST_REQUEST_SEND_LEN 500
+#define TRAFFIC_SECOND_REQUEST_SEND_LEN 4000
+#define TRAFFIC_ENCODE_HTTP_HEAD_LEN 3500
+#define TRAFFIC_ENCODE_SMS_UTF8_LEN 3000
+
+/**************************************************************************
+* Êý¾Ý½á¹¹¶¨ÒåÇø
+**************************************************************************/
+
+/*Á÷Á¿Ð£×¼µÄ״̬»ú¿ØÖÆ*/
+typedef enum _traffic_process_state_type_t {
+ TRAFFIC_STATE_IDLE,
+ TRAFFIC_STATE_FIRST_REQUEST,
+ TRAFFIC_STATE_SEND_SMS,
+ TRAFFIC_STATE_WAIT_RECV_SMS,
+ TRAFFIC_STATE_SECOND_REQUEST,
+ TRAFFIC_STATE_OVER
+} traffic_process_state_type_t;
+
+
+typedef struct _TRAFFIC_FIRST_PARSE {
+ char traffic_number[20];
+ char traffic_code[20];
+} TRAFFIC_FIRST_PARSE;
+
+typedef struct _TRAFFIC_SECOND_PARSE {
+ char code[10];
+ char msg[50];
+ char local_total[30];
+ char local_used[30];
+ char local_balance[30];
+ char global_total[30];
+ char global_used[30];
+ char global_balance[30];
+ char provinceinner_total[30];
+ char provinceinner_used[30];
+ char provinceinner_balance[30];
+ char provinceoutter_total[30];
+ char provinceoutter_used[30];
+ char provinceoutter_balance[30];
+} TRAFFIC_SECOND_PARSE;
+
+typedef struct _TRAFFIC_REQUEST_PARAM {
+ char operator[60];
+ char brand[60];
+ char province[50];
+ char city[50];
+ char platform[30];
+ char imsi[50];
+ char version[50];
+} TRAFFIC_REQUEST_PARAM;
+
+
+typedef enum _traffic_result_type_t {
+ TRAFFIC_RESULT_FAIL = -1,
+ TRAFFIC_RESULT_OK,
+ TRAFFIC_RESULT_CONTINUE,
+ TRAFFIC_NOT_SELECT_SIM_PROVINCE,
+ TRAFFIC_NOT_ENABLE_SWITCH,
+ TRAFFIC_NOT_CONNECT_NET,
+ TRAFFIC_NOT_ENOUGH_SMS_MEMORY,
+} traffic_result_type_t;
+
+/**************************************************************************
+* È«¾Ö±äÁ¿¶¨ÒåÇø
+**************************************************************************/
+
+int g_traffic_sock_fd = -1;
+int g_traffic_select_offset_time = 0;
+int g_traffic_select_retry_count = 0;
+int g_traffic_302reponse_retry_count = 0;
+
+TRAFFIC_FIRST_PARSE traffic_first_parse;
+char * g_traffic_sms_body;
+long g_traffic_last_time = 0;
+int g_traffic_process_state = TRAFFIC_STATE_OVER;
+
+pthread_mutex_t g_web_getaddrinfo_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t g_web_getnameinfo_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/**************************************************************************
+* º¯ÊýÉùÃ÷Çø
+**************************************************************************/
+
+extern void zte_traffic_handle();
+extern void zte_traffic_cfg_init();
+extern void zte_traffic_calculate_offset(unsigned long long used);
+
+/**************************************************************************
+* Ö÷ҪʵÏÖº¯Êý
+**************************************************************************/
+void zte_traffic_set_end_time(long now_time)
+{
+ //±¾º¯ÊýרΪWEBUIÏÔʾʱ¼äÖµ
+ struct tm ptm = {0};
+ char buf[NV_ITEM_STRING_LEN_50] = {0};
+
+ //ptm = localtime(&now_time);
+ localtime_r(&now_time, &ptm);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic]zte_traffic_set_end_time:Y->%d;M->%d;D->%d\n", ptm.tm_year, ptm.tm_mon, ptm.tm_mday);
+
+ //if(ptm != NULL)
+ {
+ snprintf(buf,50, "%d-%02d-%02d_%02d:%02d:%02d", ptm.tm_year + 1900, ptm.tm_mon + 1, ptm.tm_mday, ptm.tm_hour, ptm.tm_min, ptm.tm_sec);
+ sc_cfg_set(NV_TRAFFIC_END_TIME, buf);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_set_end_time = %s\n", buf);
+}
+
+void zte_traffic_set_process_result(int result)
+{
+ long now_time = 0;
+ char now_time_str[NV_ITEM_STRING_LEN_20] = {0};
+
+ if (result == TRAFFIC_RESULT_FAIL) {
+ sc_cfg_set(NV_TRAFFIC_RESULT, "failure");
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_set_process_result = fail \r\n");
+ } else {
+ sc_cfg_set(NV_TRAFFIC_RESULT, "success");
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_set_process_result = success \r\n");
+ }
+
+ time(&now_time);//ÒÔÃëΪµ¥Î»
+ sprintf(now_time_str, "%ld", now_time);
+ sc_cfg_set(NV_TRAFFIC_OVER_TIME, now_time_str);
+ sc_cfg_set(NV_TRAFFIC_PROCESS_STATE, "no");
+ zte_traffic_set_end_time(now_time);
+}
+
+void zte_traffic_set_process_state(int state)
+{
+ char _state[NV_ITEM_STRING_LEN_50] = {0};
+
+ g_traffic_process_state = state;
+
+ if (state == TRAFFIC_STATE_FIRST_REQUEST) {
+ strncpy(_state, "TRAFFIC_STATE_FIRST_REQUEST", sizeof(_state) - 1);
+ } else if (state == TRAFFIC_STATE_SEND_SMS) {
+ strncpy(_state, "TRAFFIC_STATE_SEND_SMS", sizeof(_state) - 1);
+ } else if (state == TRAFFIC_STATE_WAIT_RECV_SMS) {
+ strncpy(_state, "TRAFFIC_STATE_WAIT_RECV_SMS", sizeof(_state) - 1);
+ } else if (state == TRAFFIC_STATE_SECOND_REQUEST) {
+ strncpy(_state, "TRAFFIC_STATE_SECOND_REQUEST", sizeof(_state) - 1);
+ } else if (state == TRAFFIC_STATE_OVER) {
+ strncpy(_state, "TRAFFIC_STATE_OVER", sizeof(_state) - 1);
+ } else if (state == TRAFFIC_STATE_IDLE) {
+ strncpy(_state, "TRAFFIC_STATE_IDLE", sizeof(_state) - 1);
+ } else {
+ strncpy(_state, "TRAFFIC_STATE_ERROR", sizeof(_state) - 1);
+ }
+
+ if (strlen(_state) > 0) {
+ sc_cfg_set(NV_TRAFFIC_STATE, _state);
+ }
+}
+
+int zte_traffic_get_process_state()
+{
+ return g_traffic_process_state;
+}
+
+
+void zte_traffic_close_socket()
+{
+ if (g_traffic_sock_fd != -1) {
+ close(g_traffic_sock_fd);
+ g_traffic_sock_fd = -1;
+ }
+}
+
+unsigned long zte_traffic_get_server_ip()
+{
+ struct addrinfo hints = { 0 };
+ struct addrinfo *result = NULL;
+ struct addrinfo *result_pointer = NULL;
+
+ int ret = 0;
+ unsigned long ul_ip = (unsigned long)inet_addr(CX_360_DEFAULT_SERVER_IP);
+
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_CANONNAME;
+ hints.ai_protocol = 0;
+
+ pthread_mutex_lock(&g_web_getaddrinfo_mutex);
+ ret = getaddrinfo(CX_360_SERVER_URL, NULL, &hints, &result);
+ pthread_mutex_unlock(&g_web_getaddrinfo_mutex);
+
+ if (ret != 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic_calibration] error in getaddrinfo: %s, use default ip: %s \n", gai_strerror(ret), CX_360_DEFAULT_SERVER_IP);
+ return ul_ip;
+ }
+
+ for (result_pointer = result; result_pointer != NULL; result_pointer = result_pointer->ai_next) {
+ char hostname[1025] = {0};
+
+ if (result_pointer->ai_family == AF_INET6) {
+ continue;
+ }
+
+ pthread_mutex_lock(&g_web_getnameinfo_mutex);
+ ret = getnameinfo(result_pointer->ai_addr, result_pointer->ai_addrlen, hostname, sizeof hostname, NULL, 0, NI_NUMERICHOST);
+ pthread_mutex_unlock(&g_web_getnameinfo_mutex);
+
+ if (ret != 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic_calibration] error in getnameinfo: %s.\n", gai_strerror(ret));
+ continue;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic_calibration] Server ip = %s.\n", hostname);
+ ul_ip = (unsigned long)inet_addr(hostname);
+ break;
+ }
+
+ freeaddrinfo(result);
+ return ul_ip;
+}
+
+
+char *zte_traffic_get_brand(char *operator)
+{
+ if (0 == strcmp(operator, "China Mobile") || 0 == strcmp(operator, "CHINA MOBILE")) {
+ return "\%e7\%a5\%9e\%e5\%b7\%9e\%e8\%a1\%8c";
+ } else if (0 == strcmp(operator, "CHINA UNICOM")) {
+ return "\%e8\%81\%94\%e9\%80\%9a3G";
+ } else {
+ return "\%e7\%94\%b5\%e4\%bf\%a1";
+ }
+}
+
+char *zte_traffic_get_operator(char *operator)
+{
+ if (0 == strcmp(operator, "China Mobile") || 0 == strcmp(operator, "CHINA MOBILE")) {
+ return "\%e4\%b8\%ad\%e5\%9b\%bd\%e7\%a7\%bb\%e5\%8a\%a8";
+ } else if (0 == strcmp(operator, "CHINA UNICOM")) {
+ return "\%e4\%b8\%ad\%e5\%9b\%bd\%e8\%81\%94\%e9\%80\%9a";
+ } else {
+ return "\%e4\%b8\%ad\%e5\%9b\%bd\%e7\%94\%b5\%e4\%bf\%a1";
+ }
+}
+
+int zte_traffic_isdigit(char *srcStr, int len)
+{
+ int i = 0;
+ int flag = 0;
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_isdigit....srcStr =%s \n", srcStr);
+ for (i = 0; i < len; i++) {
+ if (srcStr[i] >= '0' && srcStr[i] <= '9') {
+ continue;
+ } else {
+ flag = -1;
+ break;
+ }
+ }
+
+ if (flag == 0) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_isdigit....content_length is digit \n");
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_isdigit....content_length is not digit, error!!!\n");
+ }
+ return flag;
+}
+
+int zte_traffic_parse_response_content(char *srcStr, char *content, int max_len)
+{
+ char *p1 = NULL;
+ char *p2 = NULL;
+ int len = 0;
+ char content_length[NV_ITEM_STRING_LEN_10] = {0};
+
+ p1 = strstr(srcStr, "Content-Length");
+ if (p1 != NULL) {
+ len = strlen("Content-Length: ");
+ p1 = p1 + len;
+
+ p2 = strchr(p1, '\r');
+ len = p2 - p1;
+ if (len >= NV_ITEM_STRING_LEN_10) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ memcpy(content_length, p1, len);
+ content_length[9]=0;
+ if (-1 == zte_traffic_isdigit(content_length, strlen(content_length))) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_parse_content....content_length = %s \n", content_length);
+ p1 = strchr(srcStr, '{');
+ if (p1 == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_parse_content....not correct ,no { ,fail, return \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+ int tmplen = atoi(content_length);
+ if (tmplen >= max_len) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_parse_content....content_length > max_len size\n");
+ memcpy(content, p1, max_len - 1);
+ } else {
+ memcpy(content, p1, tmplen);
+ }
+ } else {
+ p1 = strchr(srcStr, '{');
+ if (p1 == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_parse_content....not Content-Length and no { ,fail, return \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ p2 = strrchr(srcStr, '}');
+ if (p2 == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_parse_content....not Content-Length and no } ,fail, return \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ len = p2 - p1 + 1;
+ if (len >= max_len) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_parse_content....len > max_len size\n");
+ memcpy(content, p1, max_len - 1);
+ } else {
+ memcpy(content, p1, len);
+ }
+ }
+
+ return TRAFFIC_RESULT_OK;
+}
+
+
+int zte_traffic_parse_response_state(char *srcStr)
+{
+ char *p1 = NULL;
+ char *p2 = NULL;
+ char state[NV_ITEM_STRING_LEN_10] = {0};
+ int len = 0;
+ int i = 0;
+
+ while (srcStr[i] == ' ') {
+ i++;
+ }
+
+ if (i > 0) {
+ srcStr = srcStr + i;
+ }
+
+ i = 0;
+ p1 = strchr(srcStr, ' ');
+ if (p1 == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ while (p1[i] == ' ') {
+ i++;
+ }
+
+ p1 = p1 + i;
+ p2 = strchr(p1, ' ');
+ if (p2 == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ len = p2 - p1;
+
+ if ((len > 0) && (len <= sizeof(state) - 1)) {
+ memcpy(state, p1, len);
+ } else {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_parse_response_state....state = %s \n", state);
+ return atoi(state);
+}
+
+void zte_traffic_get_request_param(TRAFFIC_REQUEST_PARAM *request, int type)
+{
+ char buf[NV_ITEM_STRING_LEN_150] = {0};
+ char network[NV_ITEM_STRING_LEN_50] = {0};
+ char province[NV_ITEM_STRING_LEN_50] = {0};
+
+ sc_cfg_get("network_provider", network, sizeof(network));
+ sc_cfg_get(NV_DATA_TRAFFIC_SIM_PROVINCE, province, sizeof(province));
+ strncpy(request->operator, zte_traffic_get_operator(network), sizeof(request->operator) - 1);
+ strncpy(request->brand, zte_traffic_get_brand(network), sizeof(request->brand) - 1);
+
+ URLEncode(province, strlen(province), buf, sizeof(buf));
+ strncpy(request->province, buf, sizeof(request->province) - 1);
+ strncpy(request->city, buf, sizeof(request->city) - 1);
+ strncpy(request->platform, "\%6d\%69\%66\%69", sizeof(request->platform) - 1);
+
+ if (type == 1) {
+ sc_cfg_get("sim_imsi", (request->imsi), sizeof(request->imsi));
+ sc_cfg_get("cr_version", (request->version), sizeof(request->version));
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_get_request_param, imsi = %s, version=%s \n", request->imsi, request->version);
+
+ }
+}
+
+int zte_traffic_first_encode_request_url(char *url, int url_len)
+{
+ TRAFFIC_REQUEST_PARAM request = {0};
+ char buf[NV_ITEM_STRING_LEN_50] = {0};
+
+ sc_cfg_get("network_provider", buf, sizeof(buf));
+ if (strlen(&buf) == 0 || url == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ zte_traffic_get_request_param(&request, 0);
+
+ strncat(url, TRAFFIC_SMS_QUERY_URL, url_len -1);
+ strncat(url, "?", url_len - strlen(url) - 1);
+ strncat(url, "operator=", url_len - strlen(url) - 1);
+ strncat(url, request.operator, url_len - strlen(url) - 1);
+ strncat(url, "&", url_len - strlen(url) - 1);
+ strncat(url, "brand=", url_len - strlen(url) - 1);
+ strncat(url, request.brand, url_len - strlen(url) - 1);
+ strncat(url, "&", url_len - strlen(url) - 1);
+ strncat(url, "province=", url_len - strlen(url) - 1);
+ strncat(url, request.province, url_len - strlen(url) - 1);
+ strncat(url, "&", url_len - strlen(url) - 1);
+ strncat(url, "city=", url_len - strlen(url) - 1);
+ strncat(url, request.city, url_len - strlen(url) - 1);
+ strncat(url, "&", url_len - strlen(url) - 1);
+ strncat(url, "platform=", url_len - strlen(url) - 1);
+ strncat(url, request.platform, url_len - strlen(url) - 1);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] first url = %s!\n", url);
+ return TRAFFIC_RESULT_OK;
+}
+
+
+int zte_traffic_first_encode_http_head(char *head, int head_len)
+{
+ char url[NV_ITEM_STRING_LEN_200 * 2] = {0};
+ char ip[NV_ITEM_STRING_LEN_50] = {0};
+
+ if (head == NULL || head_len == 0) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ if (TRAFFIC_RESULT_FAIL == zte_traffic_first_encode_request_url(&url, NV_ITEM_STRING_LEN_200 * 2)) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ sc_cfg_get(CX_360_SERVER_IP_NV, ip, sizeof(ip));
+ strncat(head, "GET ", head_len-1);
+ strncat(head, url, head_len-strlen(head)-1);
+ strncat(head, " HTTP/1.1\r\n", head_len-strlen(head)-1);
+ //strcat(head, "Accept-Language: zh-cn\r\n");
+ //strcat(head, "Accept: application/json, text/html, text/*, */*\r\n");
+ //strcat(head, "Accept-Encoding: x-gzip,gzip, deflate\r\n");
+ //strcat(head, "Accept-charset: utf-8; q=0.5,*;q=0.5\r\n");
+ strncat(head, "Host: ", head_len-strlen(head)-1);
+ strncat(head, &ip, head_len-strlen(head)-1);
+ strncat(head, "\r\n", head_len-strlen(head)-1);
+ strncat(head, "Accept: */*\r\n", head_len-strlen(head)-1);
+ strncat(head, "Connection: Keep-Alive\r\n", head_len-strlen(head)-1);
+ //strcat(head, "Cache-Control: no-cache\r\n");
+ strncat(head, "\r\n", head_len-strlen(head)-1);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] first. http_head: %s \n", head);
+ return TRAFFIC_RESULT_OK;
+}
+
+
+
+
+/*******
+*{"charge_code":"YE","charge_number":"10086","traffic_code":"1091",
+ "traffic_number":"10086","fenzhong_code":"1091","fenzhong_number":"10086",
+"duanxin_code":"1091","duanxin_number":"10086","sp_code":"0000","sp_number":"10086"}
+*/
+int zte_traffic_first_parse_json(char *srcStr)
+{
+ cJSON *root = NULL;
+ cJSON *object = NULL;
+ memset(&traffic_first_parse, 0, sizeof(TRAFFIC_FIRST_PARSE));
+ root = cJSON_Parse(srcStr);
+ if (root == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] first.. zte_traffic_first_parse_json, root == NULL fail \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ object = cJSON_GetObjectItem(root, "traffic_code");
+ if (object == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] first.. zte_traffic_first_parse_json, traffic_code == NULL fail \n");
+ cJSON_Delete(root);
+ return TRAFFIC_RESULT_FAIL;
+ }
+ strncpy(traffic_first_parse.traffic_code, object->valuestring, sizeof(traffic_first_parse.traffic_code) - 1);
+
+ object = cJSON_GetObjectItem(root, "traffic_number");
+ if (object == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] first.. zte_traffic_first_parse_json, traffic_number == NULL fail \n");
+ cJSON_Delete(root);
+ return TRAFFIC_RESULT_FAIL;
+ }
+ strncpy(traffic_first_parse.traffic_number, object->valuestring, sizeof(traffic_first_parse.traffic_number) - 1);
+ cJSON_Delete(root);
+ traffic_first_parse.traffic_code[19]=0;
+ traffic_first_parse.traffic_number[19]=0;
+ if (strlen(traffic_first_parse.traffic_code) == 0 || strlen(traffic_first_parse.traffic_number) == 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_web_traffic_parse_json_first...invalid data fail \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_parse_json_first....traffic_code = %s \n", traffic_first_parse.traffic_code);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_parse_json_first....traffic_number = %s \n", traffic_first_parse.traffic_number);
+ return TRAFFIC_RESULT_OK;
+}
+
+
+int zte_traffic_first_parse_response(char *srcStr)
+{
+ char *p1 = NULL;
+ char *p2 = NULL;
+
+ int len = 0;
+ char data[500] = {0};
+ int state = 0;
+
+ if (srcStr == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ state = zte_traffic_parse_response_state(srcStr);
+ if (state != 200) {
+ if (state == 302) {
+ if (g_traffic_302reponse_retry_count < TRAFFIC_MAX_REQUEST) {
+ g_traffic_302reponse_retry_count ++;
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_first_parse_response..state = 302, retry_count = %d, continue\n", g_traffic_302reponse_retry_count);
+ return TRAFFIC_RESULT_CONTINUE;
+ }
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_first_parse_response..state = %d, fail\n", state);
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ state = zte_traffic_parse_response_content(srcStr, &data, sizeof(data));
+ if (state == TRAFFIC_RESULT_FAIL) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_first_parse_response..parse_content fail\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_first_parse_response....data = %s \n", data);
+ return zte_traffic_first_parse_json(&data);
+}
+
+
+int zte_traffic_socket_creat()
+{
+ g_traffic_sock_fd = socket(AF_INET, SOCK_STREAM, 0);
+ if (g_traffic_sock_fd < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] sendSocket Creation Fail!\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ return TRAFFIC_RESULT_OK;
+}
+
+int zte_traffic_socket_connect()
+{
+ struct sockaddr_in toAddr;
+ char IPdotdec[20];
+ toAddr.sin_addr.s_addr = zte_traffic_get_server_ip();
+ toAddr.sin_family = AF_INET;
+ toAddr.sin_port = htons(CX_360_PORT);
+ bzero(&(toAddr.sin_zero), 8);
+
+ //slog(MISC_PRINT, SLOG_DEBUG,"[traffic] Send IP: %s \n", inet_ntoa(toAddr.sin_addr));
+ //sc_cfg_set(CX_360_SERVER_IP_NV, inet_ntoa(toAddr.sin_addr));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] Send IP: %s \n", inet_ntop(AF_INET, &toAddr.sin_addr, IPdotdec, 16));
+ sc_cfg_set(CX_360_SERVER_IP_NV, IPdotdec);
+
+ if (connect(g_traffic_sock_fd, (struct sockaddr *)&toAddr, sizeof(struct sockaddr)) == -1) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] sendSocket connect Fail!\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ return TRAFFIC_RESULT_OK;
+}
+
+int zte_traffic_socket_send()
+{
+ int retValue = TRAFFIC_RESULT_FAIL;
+ int state = 0;
+ char *buf = NULL;
+ int size = 0;
+
+ state = zte_traffic_get_process_state();
+ if (state == TRAFFIC_STATE_FIRST_REQUEST) {
+ size = TRAFFIC_FIRST_REQUEST_SEND_LEN;
+ } else if (state == TRAFFIC_STATE_SECOND_REQUEST) {
+ size = TRAFFIC_SECOND_REQUEST_SEND_LEN;
+ } else {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ buf = malloc(size);
+ if (buf == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ memset(buf, 0, size);
+
+ if (state == TRAFFIC_STATE_FIRST_REQUEST) {
+ retValue = zte_traffic_first_encode_http_head(buf, TRAFFIC_FIRST_REQUEST_SEND_LEN);
+// } else if (state == TRAFFIC_STATE_SECOND_REQUEST) { // kw 3
+ }else{ // for other value return TRAFFIC_RESULT_FAIL
+ retValue = zte_traffic_second_encode_http_head(buf, TRAFFIC_SECOND_REQUEST_SEND_LEN);
+ }
+
+ if (retValue != TRAFFIC_RESULT_OK) {
+// if (buf != NULL) { // kw 3
+ free(buf);
+ buf = NULL;
+// }
+ return retValue;
+ }
+
+ retValue = send(g_traffic_sock_fd, buf, strlen(buf), 0);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] need send len = %d, send success len = %d chars \n", strlen(buf), retValue);
+// if (buf != NULL) { // kw 3
+ free(buf);
+ buf = NULL;
+// }
+ return TRAFFIC_RESULT_OK;
+}
+
+
+int zte_traffic_socket_select()
+{
+ fd_set readfds;
+ struct timeval tv;
+ int retValue = 0;
+
+ FD_ZERO(&readfds);
+ FD_SET(g_traffic_sock_fd, &readfds);
+ tv.tv_sec = 10 + g_traffic_select_offset_time;
+ tv.tv_usec = 0;
+ do {
+ retValue = select(g_traffic_sock_fd + 1, &readfds, NULL, NULL, &tv);
+ } while (retValue < 0 && errno == EINTR);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] first select retValue = %d\n", retValue);
+
+ if (retValue < 0 || (g_traffic_select_retry_count >= TRAFFIC_MAX_REQUEST)) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] ...select data fail...break \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ if (retValue == 0) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] ...select no data , so again to send, tryCount = %d\n", g_traffic_select_retry_count);
+ g_traffic_select_retry_count ++;
+ g_traffic_select_offset_time += 5;
+ return TRAFFIC_RESULT_CONTINUE;
+ }
+
+ g_traffic_select_offset_time = 0;
+ g_traffic_select_retry_count = 0;
+
+ return TRAFFIC_RESULT_OK;
+}
+
+int zte_traffic_socket_recv()
+{
+ int retValue;
+ int state = 0;
+ char buf[1024] = {0};
+
+ retValue = recv(g_traffic_sock_fd, buf, sizeof(buf), 0);
+ if (retValue <= 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] ...recv data fail... \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] ...recv msg , buf = %s \n", buf);
+ buf[1024 - 1] = '\0';
+ state = zte_traffic_get_process_state();
+ if (state == TRAFFIC_STATE_FIRST_REQUEST) {
+ retValue = zte_traffic_first_parse_response(buf);
+ } else if (state == TRAFFIC_STATE_SECOND_REQUEST) {
+ retValue = zte_traffic_second_parse_response(buf);
+ }
+
+ return retValue;
+}
+
+
+int zte_traffic_send_http_request()
+{
+ int retValue = 0;
+
+ retValue = zte_traffic_socket_creat();
+ if (retValue != TRAFFIC_RESULT_OK) {
+ return retValue;
+ }
+
+ retValue = zte_traffic_socket_connect();
+ if (retValue != TRAFFIC_RESULT_OK) {
+ return retValue;
+ }
+
+ retValue = zte_traffic_socket_send();
+ if (retValue != TRAFFIC_RESULT_OK) {
+ return retValue;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] ...Received msg ... \n");
+
+ retValue = zte_traffic_socket_select();
+ if (retValue != TRAFFIC_RESULT_OK) {
+ return retValue;
+ }
+
+ retValue = zte_traffic_socket_recv();
+ if (retValue != TRAFFIC_RESULT_OK) {
+ return retValue;
+ }
+
+ return TRAFFIC_RESULT_OK;
+}
+
+void zte_traffic_calculate_offset(unsigned long long used)
+{
+ unsigned long long month_used = 0;
+ long long offset = 0;
+ char buf[NV_ITEM_STRING_LEN_150] = {0};
+ char month_total[NV_ITEM_STRING_LEN_20] = {0};
+
+ sc_cfg_get("flux_month_total", month_total, sizeof(month_total));
+ month_used = atoll(month_total);
+ if(month_used > ULLONG_MAX-1){
+ month_used = 0;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_calculate_offset used = %lld\n", used);
+ offset = used - month_used;
+ sprintf(buf, "%lld", offset);
+ sc_cfg_set(NV_TRAFFIC_USED_OFFSET_DATA, buf);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_calculate_offset offset = %s\n", buf);
+ //zte_send_message(MODULE_ID_MMI,CB_MSG_MMI_TRAFFIC_INFO_RESET,0, NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MMI, MSG_CMD_TRAFFIC_INFO_RESET, 0, NULL, 0);
+}
+
+int zte_traffic_check_data(TRAFFIC_SECOND_PARSE *parse)
+{
+ if (strlen(parse->global_total) > 0 || strlen(parse->local_total) > 0
+ || strlen(parse->provinceinner_total) > 0 || strlen(parse->provinceoutter_total) > 0) {
+ return TRAFFIC_RESULT_OK;
+ }
+
+ return TRAFFIC_RESULT_FAIL;
+}
+
+int zte_traffic_save_data(TRAFFIC_SECOND_PARSE *parse)
+{
+ char data[NV_ITEM_STRING_LEN_20] = {0};
+ float tmp_used = 0;
+ float all_used = 0;
+ int tmp_total = 0;
+ long total = 0;
+ unsigned long long used = 0;
+ int flag = 0;
+
+ flag = zte_traffic_check_data(parse);
+ if (flag == TRAFFIC_RESULT_FAIL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ if (strlen(parse->global_total) > 0) {
+ sscanf(parse->global_total, "%d", &tmp_total);
+ if(tmp_total < 0 || tmp_total > INT_MAX-1) // kw 3
+ {
+ tmp_total = 0;
+ }
+
+ sscanf(parse->global_used, "%f", &tmp_used);
+ if(tmp_used < 0 || tmp_used > FLT_MAX) // kw 3
+ {
+ tmp_used = 0;
+ }
+
+ total = total + tmp_total;
+ all_used = all_used + tmp_used;
+ }
+
+ if (strlen(parse->local_total) > 0) {
+ sscanf(parse->local_total, "%d", &tmp_total);
+ if(tmp_total < 0 || tmp_total > INT_MAX-1) // kw 3
+ {
+ tmp_total = 0;
+ }
+
+
+ sscanf(parse->local_used, "%f", &tmp_used);
+ if(tmp_used < 0 || tmp_used > FLT_MAX) // kw 3
+ {
+ tmp_used = 0;
+ }
+
+
+ total = total + tmp_total;
+ all_used = all_used + tmp_used;
+ }
+
+ if (strlen(parse->provinceinner_total) > 0) {
+ sscanf(parse->provinceinner_total, "%d", &tmp_total);
+ if(tmp_total < 0 || tmp_total > INT_MAX-1) // kw 3
+ {
+ tmp_total = 0;
+ }
+
+ sscanf(parse->provinceinner_used, "%f", &tmp_used);
+ if(tmp_used < 0 || tmp_used > FLT_MAX) // kw 3
+ {
+ tmp_used = 0;
+ }
+
+
+ total = total + tmp_total;
+ all_used = all_used + tmp_used;
+ }
+
+ if (strlen(parse->provinceoutter_total) > 0) {
+ sscanf(parse->provinceoutter_total, "%d", &tmp_total);
+ if(tmp_total < 0 || tmp_total > INT_MAX-1) // kw 3
+ {
+ tmp_total = 0;
+ }
+
+ sscanf(parse->provinceoutter_used, "%f", &tmp_used);
+ if(tmp_used < 0 || tmp_used > FLT_MAX-1) // kw 3
+ {
+ tmp_used = 0;
+ }
+
+ total = total + tmp_total;
+ all_used = all_used + tmp_used;
+ }
+
+ sprintf(data, "%d", total);
+ sc_cfg_set(NV_DATA_TRAFFIC_MONTH_TOTAL, data);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_save_data total = %s\n", data);
+
+ memset(data, 0, sizeof(data));
+ sprintf(data, "%f", all_used);
+ sc_cfg_set(NV_DATA_TRAFFIC_MONTH_USED, data);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_save_data used = %s\n", data);
+
+ used = all_used * 1024 * 1024;
+ zte_traffic_calculate_offset(used);
+ return TRAFFIC_RESULT_OK;
+}
+
+/**
+{"code":"100",
+"msg":"ok",
+"data":{"local":
+ {"total":"5120","used":"5120","balance":"0"},
+ "global":
+ {"total":"11264","used":"6476.32","balance":"4787.68"}
+}
+}
+*/
+int zte_traffic_second_parse_json(char *srcStr)
+{
+ cJSON *root = NULL;
+ cJSON *data = NULL;
+ cJSON *object = NULL;
+ cJSON *object1 = NULL;
+ TRAFFIC_SECOND_PARSE traffic_second_parse;
+
+ memset(&traffic_second_parse, 0, sizeof(TRAFFIC_SECOND_PARSE));
+ root = cJSON_Parse(srcStr);
+ if (root == NULL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second.. zte_traffic_second_parse_json, root == NULL fail \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ object = cJSON_GetObjectItem(root, "code");
+ if (object == NULL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second.. zte_traffic_second_parse_json, code == NULL fail \n");
+ cJSON_Delete(root);
+ return TRAFFIC_RESULT_FAIL;
+ }
+ strncpy(traffic_second_parse.code, object->valuestring, sizeof(traffic_second_parse.code) - 1);
+ traffic_second_parse.code[9]='\0';
+ object = cJSON_GetObjectItem(root, "msg");
+ if (object == NULL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second.. zte_traffic_second_parse_json, msg == NULL fail\n");
+ cJSON_Delete(root);
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ strncpy(traffic_second_parse.msg, object->valuestring, sizeof(traffic_second_parse.msg) - 1);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second.. code = %s \n", traffic_second_parse.code);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...msg = %s \n", traffic_second_parse.msg);
+
+ if (atoi(traffic_second_parse.code) != GET_TRAFFIC_SUCCESS) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second.. zte_traffic_second_parse_json, msg = %s ,not success\n", traffic_second_parse.msg);
+ cJSON_Delete(root);
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ //for data
+ data = cJSON_GetObjectItem(root, "data");
+ if (data == NULL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second.. zte_traffic_second_parse_json, data == NULL fail \n");
+ cJSON_Delete(root);
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ object = cJSON_GetObjectItem(data, "local");
+ if (object != NULL) {
+ object1 = cJSON_GetObjectItem(object, "total");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.local_total, object1->valuestring, sizeof(traffic_second_parse.local_total) - 1);
+ sc_cfg_set(NV_TRAFFIC_LOCAL_TOTAL, object1->valuestring);
+ }
+
+ object1 = cJSON_GetObjectItem(object, "used");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.local_used, object1->valuestring, sizeof(traffic_second_parse.local_used) - 1);
+ sc_cfg_set(NV_TRAFFIC_LOCAL_USED, object1->valuestring);
+ }
+
+ object1 = cJSON_GetObjectItem(object, "balance");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.local_balance, object1->valuestring, sizeof(traffic_second_parse.local_balance) - 1);
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...local_total = %s \n", traffic_second_parse.local_total);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...local_used = %s \n", traffic_second_parse.local_used);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...local_balance = %s \n", traffic_second_parse.local_balance);
+ }
+
+ object = cJSON_GetObjectItem(data, "global");
+ if (object != NULL) {
+ object1 = cJSON_GetObjectItem(object, "total");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.global_total, object1->valuestring, sizeof(traffic_second_parse.global_total) - 1);
+ sc_cfg_set(NV_TRAFFIC_GLOBAL_TOTAL, object1->valuestring);
+ }
+
+ object1 = cJSON_GetObjectItem(object, "used");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.global_used, object1->valuestring, sizeof(traffic_second_parse.global_used) - 1);
+ sc_cfg_set(NV_TRAFFIC_GLOBAL_USED, object1->valuestring);
+ }
+
+ object1 = cJSON_GetObjectItem(object, "balance");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.global_balance, object1->valuestring, sizeof(traffic_second_parse.global_balance) - 1);
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...global_total = %s \n", traffic_second_parse.global_total);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...global_used = %s \n", traffic_second_parse.global_used);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...global_balance = %s \n", traffic_second_parse.global_balance);
+ }
+
+ object = cJSON_GetObjectItem(data, "provinceinner");
+ if (object != NULL) {
+ object1 = cJSON_GetObjectItem(object, "total");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.provinceinner_total, object1->valuestring, sizeof(traffic_second_parse.provinceinner_total) - 1);
+ sc_cfg_set(NV_TRAFFIC_PROVINCEINNER_TOTAL, object1->valuestring);
+ }
+
+ object1 = cJSON_GetObjectItem(object, "used");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.provinceinner_used, object1->valuestring, sizeof(traffic_second_parse.provinceinner_used) - 1);
+ sc_cfg_set(NV_TRAFFIC_PROVINCEINNER_USED, object1->valuestring);
+ }
+
+ object1 = cJSON_GetObjectItem(object, "balance");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.provinceinner_balance, object1->valuestring, sizeof(traffic_second_parse.provinceinner_balance) - 1);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...provinceinner_total = %s \n", traffic_second_parse.provinceinner_total);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...provinceinner_used = %s \n", traffic_second_parse.provinceinner_used);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...provinceinner_balance = %s \n", traffic_second_parse.provinceinner_balance);
+ }
+
+ object = cJSON_GetObjectItem(data, "provinceoutter");
+ if (object != NULL) {
+ object1 = cJSON_GetObjectItem(object, "total");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.provinceoutter_total, object1->valuestring, sizeof(traffic_second_parse.provinceoutter_total) - 1);
+ sc_cfg_set(NV_TRAFFIC_PROVINCEOUTTER_TOTAL, object1->valuestring);
+ }
+
+ object1 = cJSON_GetObjectItem(object, "used");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.provinceoutter_used, object1->valuestring, sizeof(traffic_second_parse.provinceoutter_used) - 1);
+ sc_cfg_set(NV_TRAFFIC_PROVINCEOUTTER_USED, object1->valuestring);
+ }
+
+ object1 = cJSON_GetObjectItem(object, "balance");
+ if (object1 != NULL) {
+ strncpy(traffic_second_parse.provinceoutter_balance, object1->valuestring, sizeof(traffic_second_parse.provinceoutter_balance) - 1);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...provinceoutter_total = %s \n", traffic_second_parse.provinceoutter_total);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...provinceoutter_used = %s \n", traffic_second_parse.provinceoutter_used);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second...provinceoutter_balance = %s \n", traffic_second_parse.provinceoutter_balance);
+ }
+
+ cJSON_Delete(root);
+ return zte_traffic_save_data(&traffic_second_parse);
+}
+
+
+int zte_traffic_second_parse_response(char *srcStr)
+{
+ char *p1 = NULL;
+ char *p2 = NULL;
+ int len = 0;
+ char data[500] = {0};
+ int state = 0;
+
+ if (srcStr == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ state = zte_traffic_parse_response_state(srcStr);
+ if (state != 200) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_second_parse_response..state != 200 fail\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ state = zte_traffic_parse_response_content(srcStr, &data, sizeof(data));
+ if (state == TRAFFIC_RESULT_FAIL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_second_parse_response..parse_content fail\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_second_parse_response....data = %s \n", data);
+
+ return zte_traffic_second_parse_json(&data);
+}
+
+
+int zte_traffic_second_get_request_data(char *data, int data_len)
+{
+ char *sms_body = NULL;
+ int size = TRAFFIC_ENCODE_SMS_UTF8_LEN;
+ TRAFFIC_REQUEST_PARAM request = {0};
+
+ if (data == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ sms_body = malloc(size);
+ if (sms_body == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ memset(sms_body, 0, size);
+
+ if (g_traffic_sms_body != NULL) {
+ zte_traffic_convert_unicode_to_utf8(g_traffic_sms_body, strlen(g_traffic_sms_body), sms_body, size);
+ free(g_traffic_sms_body);
+ g_traffic_sms_body = NULL;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_second_get_request_data=============================== \n");
+
+ zte_traffic_get_request_param(&request, 1);
+
+ strncat(data, "operator=", data_len-1);
+ strncat(data, request.operator, data_len-strlen(data)-1);
+ strncat(data, "&", data_len-strlen(data)-1);
+ strncat(data, "brand=", data_len-strlen(data)-1);
+ strncat(data, request.brand, data_len-strlen(data)-1);
+ strncat(data, "&", data_len-strlen(data)-1);
+ strncat(data, "province=", data_len-strlen(data)-1);
+ strncat(data, request.province, data_len-strlen(data)-1);
+ strncat(data, "&", data_len-strlen(data)-1);
+ strncat(data, "city=", data_len-strlen(data)-1);
+ strncat(data, request.city, data_len-strlen(data)-1);
+ strncat(data, "&", data_len-strlen(data)-1);
+ strncat(data, "platform=", data_len-strlen(data)-1);
+ strncat(data, request.platform, data_len-strlen(data)-1);
+ strncat(data, "&", data_len-strlen(data)-1);
+ strncat(data, "imsi=", data_len-strlen(data)-1);
+ strncat(data, request.imsi, data_len-strlen(data)-1);
+ strncat(data, "&", data_len-strlen(data)-1);
+ strncat(data, "version=", data_len-strlen(data)-1);
+ strncat(data, request.version, data_len-strlen(data)-1);
+ strncat(data, "&", data_len-strlen(data)-1);
+ strncat(data, "smsbody=", data_len-strlen(data)-1);
+ strncat(data, sms_body, data_len-strlen(data)-1);
+
+// if (sms_body != NULL) { // kw 3
+ free(sms_body);
+ sms_body = NULL;
+// }
+ return TRAFFIC_RESULT_OK;
+}
+
+
+int zte_traffic_second_encode_http_head(char *head, int head_len)
+{
+ char *data = NULL;
+ int size = TRAFFIC_ENCODE_HTTP_HEAD_LEN;
+ int len = 0;
+ char buf[NV_ITEM_STRING_LEN_10] = {0};
+ int ret = -1;
+ char ip[NV_ITEM_STRING_LEN_50] = {0};
+
+ if (head == NULL || head_len == 0) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ data = malloc(size);
+ if (data == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ memset(data, 0, size);
+ ret = zte_traffic_second_get_request_data(data, size);
+ if (ret == TRAFFIC_RESULT_FAIL) {
+// if (data != NULL) { // kw 3
+ free(data);
+ data = NULL;
+// }
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ len = strlen(data);
+ snprintf(buf,10, "%d", len);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second. data len: %s \n", buf);
+ sc_cfg_get(CX_360_SERVER_IP_NV, ip, sizeof(ip));
+ strncat(head, "POST ", head_len-1);
+ strncat(head, TRAFFIC_SMS_PARSE_URL, head_len-strlen(head)-1);
+ strncat(head, " HTTP/1.1\r\n", head_len-strlen(head)-1);
+ strncat(head, "Host: ", head_len-strlen(head)-1);
+ strncat(head, &ip, head_len-strlen(head)-1);
+ strncat(head, "\r\n", head_len-strlen(head)-1);
+ strncat(head, "Accept: */*\r\n", head_len-strlen(head)-1);
+ strncat(head, "Connection: Keep-Alive\r\n", head_len-strlen(head)-1);
+ strncat(head, "Content-Length: ", head_len-strlen(head)-1);
+ strncat(head, buf, head_len-strlen(head)-1);
+ strncat(head, "\r\n", head_len-strlen(head)-1);
+ strncat(head, "Content-Type: application/x-www-form-urlencoded\r\n", head_len-strlen(head)-1);
+ strncat(head, "\r\n", head_len-strlen(head)-1);
+ strncat(head, data, head_len-strlen(head)-1);
+ strncat(head, "\r\n", head_len-strlen(head)-1);
+
+// if (data != NULL) { // kw 3
+ free(data);
+ data = NULL;
+// }
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] second. http_head: %s \n", head);
+ return TRAFFIC_RESULT_OK;
+}
+
+
+void zte_traffic_delete_sms_after_process_over()
+{
+ /*·ÀÖ¹Á÷Á¿Ð£×¼Ê§°ÜºóÁ÷Á¿¶ÌÐÅ´æÁôÔÚÊý¾Ý¿âÖÐÕ¼¿Õ¼ä
+ ´Ë´¦Í³Ò»´¦Àíɾ³ý¶ÌÐÅ*/
+ char str_id[100] = {0};
+ int count = 0;
+ int rec_count = 0;
+ int i = 0;
+ T_zUfiSms_DelReq del_req = {0};
+ unsigned char rec_separate[10][20] = {0};
+ int tmp_id = 0;
+
+ zte_libwms_get_traffic_sms_id(&str_id, &count);
+ if (count == 0) {
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_traffic_delete_sms_after_process_over str_id = %s.\n", str_id);
+ rec_count = zte_traffic_parse_str_by_separator(str_id, (unsigned char *)rec_separate, 20, SEPARATOR_CHARACTER);
+
+ for (i = 0; i < rec_count; i++) {
+ tmp_id = atoi(rec_separate[i]);
+ if(tmp_id < 0 || tmp_id > INT_MAX-1) // kw 3
+ {
+ tmp_id = 0;
+ }
+ del_req.id[i] = tmp_id;
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic]zte_traffic_delete_sms_after_process_over: del_req.id[%d] = %d\n", i, del_req.id[i]);
+ }
+ del_req.all_or_count = count;
+
+ if (ZTE_MC_OK_S == zte_mc_relay_sms_delete_msg((T_zUfiSms_DelReq*)(&del_req))) {
+ slog(MISC_PRINT, SLOG_NORMAL,"[traffic]zte_traffic_delete_sms_after_process_over:send delete sms cmd to mc success.\n");
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic]zte_traffic_delete_sms_after_process_over:send delete sms cmd to mc fail.\n");
+ }
+}
+
+void zte_traffic_delete_sms(long id)
+{
+ T_zUfiSms_DelReq del_req = {0};
+
+ del_req.all_or_count = 1;
+ del_req.id[0] = id;
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic]zte_traffic_delete_sms: id = %d\n", id);
+
+ if (ZTE_MC_OK_S == zte_mc_relay_sms_delete_msg((T_zUfiSms_DelReq*)(&del_req))) {
+ slog(MISC_PRINT, SLOG_NORMAL,"[traffic]zte_traffic_delete_recv_sms:send delete sms cmd to mc success.\n");
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic]zte_traffic_delete_recv_sms:send delete sms cmd to mc fail.\n");
+ }
+}
+
+int zte_traffic_wait_to_recv_sms()
+{
+ char buf[NV_ITEM_STRING_LEN_20] = {0};
+ long id = 0;
+ int result = 0;
+ int body_size = 2 * ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX * ZTE_WMS_CONCAT_SMS_COUNT_MAX + 1 ;
+ long now_time = 0;
+ long offset_time = 0;
+
+ //´Ë´¦½ÓÊÕ¶ÌÐŵȴý120Ãë
+ time(&now_time);
+ offset_time = now_time - g_traffic_last_time;
+ if (offset_time > 120 || offset_time < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_wait_to_recv_sms wait sms,time arrived, not recv whole sms , stop to recv, fail\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ sc_cfg_get(NV_TRAFFIC_RECV_SMS_ID, buf, sizeof(buf));
+ if (0 == strcmp(buf, "0")) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_wait_to_recv_sms wait sms contiue\n");
+ return TRAFFIC_RESULT_CONTINUE;
+ }
+
+ id = atol(buf);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_wait_to_recv_sms id=%ld\n", id);
+
+ if (id == 0) {
+ return TRAFFIC_RESULT_CONTINUE;
+ }
+
+ g_traffic_sms_body = malloc(body_size);
+ if (g_traffic_sms_body == NULL) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ memset(g_traffic_sms_body, 0, sizeof(body_size));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_wait_to_recv_sms id=%d \n", id);
+ result = zte_libwms_get_traffic_sms_body(id, g_traffic_sms_body);
+ if (result != 0) {
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ //zte_traffic_delete_sms(id);
+
+ //´Ë´¦Á¢¼´ÖÿÕÊÇÒòΪ±ÜÃâÔÚÿ´ÎÊÕ¶ÌÐÅʱºò¶¼Òª
+ //½øÐкÅÂëµÄ±È¶Ô
+ sc_cfg_set(NV_TRAFFIC_SMS_NUMBER, "0");
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_wait_to_recv_sms body=%s\n", g_traffic_sms_body);
+ return TRAFFIC_RESULT_OK;
+}
+
+
+int zte_traffic_check_can_send_sms()
+{
+ T_zUfiSms_StatusInfo cmd_status_info = {0};
+ int result = 0;
+
+ cmd_status_info.cmd = WMS_SMS_CMD_MSG_SEND;
+ result = zte_libwms_get_cmd_status(&cmd_status_info);
+ if (result == -1) {
+ return TRAFFIC_RESULT_OK;
+ }
+
+ if (cmd_status_info.cmd_status == WMS_CMD_PROCESSING) {
+ return TRAFFIC_RESULT_CONTINUE;
+ }
+
+ return TRAFFIC_RESULT_OK;
+}
+
+
+int zte_traffic_send_sms()
+{
+ unsigned int i = 0;
+ int message_content_len = 0;
+ unsigned int rec_count = 0;
+
+ int s_flag = 0;
+ int index = 0;
+ struct timeval time_tv;
+ struct tm ptm = {0};
+ int result = 0;
+ char body[NV_ITEM_STRING_LEN_50] = {0};
+ int year = 0;
+ char time_buf[30] = {0};
+ long now_time = 0;
+ long offset_time = 0;
+
+ //´Ë´¦·¢ËͶÌÐÅÔÊÐíµÈ´ý60Ãë
+ time(&now_time);
+ offset_time = now_time - g_traffic_last_time;
+ if (offset_time > 60 || offset_time < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_send_sms wait sms, time arrived, stop to send sms, fail\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ result = zte_traffic_check_can_send_sms();
+ if (result != TRAFFIC_RESULT_OK) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] zte_traffic_check_can_send_sms fail \n");
+ return result;
+ }
+
+ unsigned char rec_separate[ZTE_WMS_SEND_NUM_MAX][ZTE_WMS_ADDRESS_LEN_MAX + 1] = {0};
+ T_zUfiSms_SendReq MSG_SEND_ST;
+
+ memset(&MSG_SEND_ST, 0, sizeof(T_zUfiSms_SendReq));
+
+ message_content_len = zte_traffic_ConvertUcs2(traffic_first_parse.traffic_code, strlen(traffic_first_parse.traffic_code), &body);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, content USC2S body = %s, len = %d\n", body, message_content_len);
+ rec_count = zte_traffic_parse_str_by_separator(traffic_first_parse.traffic_number, (unsigned char *)rec_separate, ZTE_WMS_ADDRESS_LEN_MAX + 1, SEPARATOR_CHARACTER);
+
+ if (0 != gettimeofday(&time_tv, NULL)) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] get time of system fail \n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+ gmtime_r(&time_tv.tv_sec, &ptm);
+ year = ptm.tm_year + 1900 - 2000;
+ if (year > 9) {
+ snprintf(MSG_SEND_ST.date.year,5, "%d", year);
+ } else {
+ snprintf(MSG_SEND_ST.date.year,5, "0%d", year);
+ }
+
+ snprintf(MSG_SEND_ST.date.month,3, "%d", ptm.tm_mon + 1);
+ snprintf(MSG_SEND_ST.date.day,3, "%d", ptm.tm_mday);
+ snprintf(MSG_SEND_ST.date.hour,3, "%d", ptm.tm_hour);
+ snprintf(MSG_SEND_ST.date.min,3, "%d", ptm.tm_min);
+ snprintf(MSG_SEND_ST.date.sec,3, "%d", ptm.tm_sec);
+ sprintf(MSG_SEND_ST.date.timezone, "%d", 8);
+
+ snprintf(time_buf, sizeof(time_buf),"%d", (int)time_tv.tv_sec);
+ sc_cfg_set(NV_TRAFFIC_SMS_SEND_TIME, time_buf);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, time_tv = %s\n", time_buf);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, year = %s\n", MSG_SEND_ST.date.year);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, month = %s\n", MSG_SEND_ST.date.month);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, day = %s\n", MSG_SEND_ST.date.day);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, hour = %s\n", MSG_SEND_ST.date.hour);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, min = %s\n", MSG_SEND_ST.date.min);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, sec = %s\n", MSG_SEND_ST.date.sec);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, content = %s\n", traffic_first_parse.traffic_code);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] send sms, content len = %d\n", strlen(traffic_first_parse.traffic_code));
+
+ zte_libwms_db_write_send_msg_content_data(&body);
+
+ MSG_SEND_ST.msg_len = message_content_len;
+ MSG_SEND_ST.dcs = DCS_GSM7_DEFAULT;
+ MSG_SEND_ST.receiver_count = rec_count;
+ MSG_SEND_ST.id = -1;
+ MSG_SEND_ST.mem_store = TRAFFIC_SMS_MEM_STORE_IN_DB;
+ memcpy(MSG_SEND_ST.dest_num, rec_separate, sizeof(rec_separate));
+
+ sc_cfg_set(NV_TRAFFIC_SMS_NUMBER, MSG_SEND_ST.dest_num[0]);
+ slog(MISC_PRINT, SLOG_NORMAL,"[traffic] send sms, num = %s\n", MSG_SEND_ST.dest_num[0]);
+ zte_sms_handle_DB_status_whenSend(WMS_CMD_PROCESSING);
+ if (0 == zte_mc_relay_sms_send_msg((T_zUfiSms_SendReq*)(&MSG_SEND_ST))) {
+ return TRAFFIC_RESULT_OK;
+ } else {
+ zte_sms_handle_DB_status_whenSend(WMS_CMD_FAILED);
+ return TRAFFIC_RESULT_FAIL;
+ }
+}
+
+void zte_traffic_clear_param_state()
+{
+ sc_cfg_set(NV_TRAFFIC_SMS_NUMBER, "0");
+ sc_cfg_set(NV_TRAFFIC_RECV_SMS_ID, "0");
+ sc_cfg_set(NV_TRAFFIC_SMS_SEND_TIME, "0");
+
+ g_traffic_select_offset_time = 0;
+ g_traffic_select_retry_count = 0;
+ g_traffic_302reponse_retry_count = 0;
+
+ if (g_traffic_sms_body != NULL) {
+ free(g_traffic_sms_body);
+ g_traffic_sms_body = NULL;
+ }
+}
+
+void zte_traffic_init_nv()
+{
+ sc_cfg_set(NV_TRAFFIC_PROCESS_STATE, "yes");
+ sc_cfg_set(NV_TRAFFIC_RESULT, "processing");
+ sc_cfg_set(NV_TRAFFIC_GLOBAL_TOTAL, "");
+ sc_cfg_set(NV_TRAFFIC_GLOBAL_USED, "");
+ sc_cfg_set(NV_TRAFFIC_LOCAL_TOTAL, "");
+ sc_cfg_set(NV_TRAFFIC_LOCAL_USED, "");
+ sc_cfg_set(NV_TRAFFIC_PROVINCEINNER_TOTAL, "");
+ sc_cfg_set(NV_TRAFFIC_PROVINCEINNER_USED, "");
+ sc_cfg_set(NV_TRAFFIC_PROVINCEOUTTER_TOTAL, "");
+ sc_cfg_set(NV_TRAFFIC_PROVINCEOUTTER_USED, "");
+}
+
+void zte_traffic_process()
+{
+ int state = 0;
+ int result = TRAFFIC_RESULT_FAIL;
+
+ zte_traffic_init_nv();
+ zte_traffic_clear_param_state();
+ zte_traffic_set_process_state(TRAFFIC_STATE_FIRST_REQUEST);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] start to traffic=============!!!\n");
+
+ while (1) {
+ state = zte_traffic_get_process_state();
+
+ if (state == TRAFFIC_STATE_FIRST_REQUEST) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_first_request!\n");
+ result = zte_traffic_send_http_request();
+ if (result == TRAFFIC_RESULT_CONTINUE) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_first_request, continue!\n");
+ zte_traffic_close_socket();
+ continue;
+ } else if (result == TRAFFIC_RESULT_FAIL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_first_request,fail ---> traffic_over!\n");
+ break;
+ }
+
+ zte_traffic_set_process_state(TRAFFIC_STATE_SEND_SMS);
+ zte_traffic_close_socket();
+ time(&g_traffic_last_time);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_first_request, success!\n");
+ } else if (state == TRAFFIC_STATE_SEND_SMS) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_send_sms!\n");
+ result = zte_traffic_send_sms();
+ if (result == TRAFFIC_RESULT_FAIL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_send_sms, fail -->traffic_over!\n");
+ break;
+ } else if (result == TRAFFIC_RESULT_CONTINUE) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_send_sms, CONFLICT, sleep and wait 5s, and continue to send!\n");
+ sleep(5);
+ continue;
+ }
+
+ zte_traffic_set_process_state(TRAFFIC_STATE_WAIT_RECV_SMS);
+
+ time(&g_traffic_last_time);
+ sleep(5);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_send_sms, success!\n");
+ } else if (state == TRAFFIC_STATE_WAIT_RECV_SMS) {
+ result = zte_traffic_wait_to_recv_sms();
+ if (result == TRAFFIC_RESULT_CONTINUE) {
+ sleep(10);
+ continue;
+ } else if (result == TRAFFIC_RESULT_FAIL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_wait_to_recv_sms,fail ---> traffic_over!\n");
+ break;
+ }
+
+ zte_traffic_set_process_state(TRAFFIC_STATE_SECOND_REQUEST);
+ } else if (state == TRAFFIC_STATE_SECOND_REQUEST) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_second_request!\n");
+ result = zte_traffic_send_http_request();
+ if (result == TRAFFIC_RESULT_CONTINUE) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_second_request, continue!\n");
+ zte_traffic_close_socket();
+ continue;
+ } else if (result == TRAFFIC_RESULT_FAIL) {
+ slog(MISC_PRINT, SLOG_ERR,"[traffic] traffic_second_request,fail ---> traffic_over!\n");
+ break;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] traffic_second_request, success!\n");
+ break;
+ }
+ }
+
+ zte_traffic_set_process_state(TRAFFIC_STATE_OVER);
+ zte_traffic_set_process_result(result);
+ zte_traffic_clear_param_state();
+ zte_traffic_close_socket();
+ zte_traffic_delete_sms_after_process_over();
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_process, over====================!\n");
+ return;
+}
+
+
+int zte_web_traffic_start()
+{
+ pthread_t traffic_thread_id;
+ pthread_attr_t attr;
+ int result = 0;
+ slog(MISC_PRINT, SLOG_NORMAL,"[traffic] zte_traffic_start--------!\n");
+
+ if (zte_traffic_get_process_state() != TRAFFIC_STATE_OVER) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] already running, can not start now, fail!\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+ zte_traffic_set_process_state(TRAFFIC_STATE_IDLE);
+ result = pthread_create(&traffic_thread_id, &attr, zte_traffic_process, NULL);
+ pthread_attr_destroy(&attr);
+ if (result != 0) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] pthread_create faild!\n");
+ zte_traffic_set_process_state(TRAFFIC_STATE_OVER);
+ return TRAFFIC_RESULT_FAIL;
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] pthread_create SUCCESS!\n");
+ return TRAFFIC_RESULT_OK;
+ }
+}
+
+int zte_web_traffic_check()
+{
+ char ppp_status[NV_ITEM_STRING_LEN_50] = {0};
+ char traffic_switch[NV_ITEM_STRING_LEN_10] = {0};
+ char province[NV_ITEM_STRING_LEN_50] = {0};
+
+ sc_cfg_get(NV_DATA_TRAFFIC_SWITCH, traffic_switch, sizeof(traffic_switch));
+ if (0 != strcmp(traffic_switch, "yes")) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check switch is off , can not start traffic, fail!\n");
+ return TRAFFIC_NOT_ENABLE_SWITCH;
+ }
+
+ if (zte_traffic_get_process_state() != TRAFFIC_STATE_OVER) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] already running, can not start now, fail!\n");
+ return TRAFFIC_RESULT_FAIL;
+ }
+
+ sc_cfg_get(NV_DATA_TRAFFIC_SIM_PROVINCE, province, sizeof(province));
+ if (0 == strlen(&province)) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check province fail!\n");
+ return TRAFFIC_NOT_SELECT_SIM_PROVINCE;
+ }
+
+ sc_cfg_get("ppp_status", ppp_status, sizeof(ppp_status));
+ if (0 != strcmp(ppp_status, "ppp_connected")
+ && 0 != strcmp(ppp_status, "ipv4_ipv6_connected")
+ && 0 != strcmp(ppp_status, "ipv6_connected")) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] ppp disconnected, can not start traffic, fail!\n");
+ return TRAFFIC_NOT_CONNECT_NET;
+ }
+
+ if (zte_get_sms_remain_capacity() < 5) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] TRAFFIC_NOT_ENOUGH_SMS_MEMORY, fail!\n");
+ return TRAFFIC_NOT_ENOUGH_SMS_MEMORY;
+ }
+ sc_cfg_set("traffic_check", "yes");
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check SUCCESS!\n");
+ return TRAFFIC_RESULT_OK;
+}
+
+
+int zte_web_traffic_check_if_exceed_one_day_time()
+{
+ long now_time = 0;
+ long last_traffic_over_time = 0;
+ long interval_time = 0;
+ char last_traffic_over_time_str[NV_ITEM_STRING_LEN_20] = {0};
+ int result = -1;
+
+ time(&now_time);//ÒÔÃëΪµ¥Î»
+ sc_cfg_get(NV_TRAFFIC_OVER_TIME, last_traffic_over_time_str, sizeof(last_traffic_over_time_str));
+
+ last_traffic_over_time = atol(last_traffic_over_time_str);
+ if(last_traffic_over_time < 0 || last_traffic_over_time > LONG_MAX-1){
+ last_traffic_over_time = LONG_MAX;
+ }
+
+ interval_time = now_time - last_traffic_over_time;
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check_if_exceed_one_day_time, last_traffic_over_time = %d!\n", last_traffic_over_time);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check_if_exceed_one_day_time, interval_time = %d!\n", interval_time);
+
+ //ÅжÏÉÏ´ÎУ׼½áÊøµÄʱ¼äÓ뵱ǰʱ¼äµÄ²î¾àÊÇ·ñ´óÓÚ1Ìì
+ if (interval_time >= TIME_ONE_DAY_INTERVAL || interval_time < 0) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check_if_exceed_one_day_time, interval_time >= TIME_ONE_DAY_INTERVAL !\n");
+ result = 0;
+ }
+
+ return result;
+}
+
+
+int zte_web_traffic_check_if_same_day()
+{
+ struct tm now_ptm = {0};
+ struct tm last_traffic_ptm = {0};
+
+ long now_time = 0;
+ long last_traffic_over_time = 0;
+ char last_traffic_over_time_str[NV_ITEM_STRING_LEN_20] = {0};
+
+ time(&now_time);//ÒÔÃëΪµ¥Î»
+ gmtime_r(&now_time, &now_ptm);
+ //now_ptm = gmtime(&now_time);
+ //if(now_ptm == NULL)
+ //{
+ // return -1;
+ //}
+
+ sc_cfg_get(NV_TRAFFIC_OVER_TIME, last_traffic_over_time_str, sizeof(last_traffic_over_time_str));
+
+ if (strlen(last_traffic_over_time_str) == 0) {
+ return 0;
+ }
+
+ last_traffic_over_time = atol(last_traffic_over_time_str);
+ gmtime_r(&last_traffic_over_time, &last_traffic_ptm);
+ //last_traffic_ptm = gmtime(&last_traffic_over_time);
+ //if(last_traffic_ptm == NULL)
+ //{
+ // return -1;
+ //}
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check_if_same_day, last_traffic_ptm, tm_year = %d, tm_month=%d, tm_day=%d\n", last_traffic_ptm.tm_year, last_traffic_ptm.tm_mon, last_traffic_ptm.tm_mday);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check_if_same_day, now_ptm, tm_year = %d, tm_month=%d, tm_day=%d\n", now_ptm.tm_year, now_ptm.tm_mon, now_ptm.tm_mday);
+ if ((now_ptm.tm_year == last_traffic_ptm.tm_year)
+ && (now_ptm.tm_mon == last_traffic_ptm.tm_mon)
+ && (now_ptm.tm_mday == last_traffic_ptm.tm_mday)) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check_if_same_day, the same day, no need traffic when poweron!\n");
+ return -1;;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_web_traffic_check_if_same_day, not the same day,need traffic when poweron!\n");
+ return 0;
+}
+
+
+void zte_traffic_cfg_init()
+{
+ sc_cfg_set("is_traffic_alining", "no");
+}
+
+void zte_traffic_handle()
+{
+ int flag = 0;
+ char buf[NV_ITEM_STRING_LEN_10] = {0};
+
+ memset(&buf, 0, sizeof(buf));
+ sc_cfg_get("poweron_traffic", buf, sizeof(buf));
+ if ((0 == strcmp(buf, "yes"))
+ && (0 == zte_web_traffic_check())) {
+ sc_cfg_set("test_is_poweron_traffic", "yes");
+ sc_cfg_set("poweron_traffic", "no");
+
+ if (0 == zte_web_traffic_check_if_same_day()) {
+ flag = 1;
+ }
+ }
+
+ //for traffic Ñ»·¼ÆÊ±£¬Ê±¼äµ½Ð£×¼Ò»´Î
+ if ((0 == zte_web_traffic_check_if_exceed_one_day_time())
+ && (0 == zte_web_traffic_check())) {
+ sc_cfg_set("test_is_time_arrived_traffic", "yes");
+ flag = 1;
+ }
+
+ if (flag == 1) {
+ zte_web_traffic_start();
+ }
+}
+
diff --git a/ap/app/goahead/interface5.0/other/zte_web_traffic_util.c b/ap/app/goahead/interface5.0/other/zte_web_traffic_util.c
new file mode 100644
index 0000000..696a569
--- /dev/null
+++ b/ap/app/goahead/interface5.0/other/zte_web_traffic_util.c
@@ -0,0 +1,32889 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "os_type_def.h"
+#include "softap_log.h"
+
+
+//extern int URLEncode(const char* str, const int strSize, char* result, const int resultSize);
+//extern unsigned int Ucs2ToUtf8(unsigned short *ucs2, unsigned int ucs2_size, unsigned char *utf8, unsigned int utf8_size);
+
+
+/*-----------------+----------------------+------------------------
+ | ±àÂëת»»Ïà¹Ø |
+-------------------+----------------------+-----------------------*/
+
+unsigned short g_gbk_to_unicode_buf_size = 32095;
+unsigned short g_gbk_first_code = 33088;
+unsigned short g_gbk_last_code = 65183;
+
+//GBK to Unicode MAP table, GBK start from "33088", end with "65183"
+unsigned short g_gbk_to_unicode_buf[] = {
+ 19970,
+ 19972,
+ 19973,
+ 19974,
+ 19983,
+ 19986,
+ 19991,
+ 19999,
+ 20000,
+ 20001,
+ 20003,
+ 20006,
+ 20009,
+ 20014,
+ 20015,
+ 20017,
+ 20019,
+ 20021,
+ 20023,
+ 20028,
+ 20032,
+ 20033,
+ 20034,
+ 20036,
+ 20038,
+ 20042,
+ 20049,
+ 20053,
+ 20055,
+ 20058,
+ 20059,
+ 20066,
+ 20067,
+ 20068,
+ 20069,
+ 20071,
+ 20072,
+ 20074,
+ 20075,
+ 20076,
+ 20077,
+ 20078,
+ 20079,
+ 20082,
+ 20084,
+ 20085,
+ 20086,
+ 20087,
+ 20088,
+ 20089,
+ 20090,
+ 20091,
+ 20092,
+ 20093,
+ 20095,
+ 20096,
+ 20097,
+ 20098,
+ 20099,
+ 20100,
+ 20101,
+ 20103,
+ 20106,
+ 0,
+ 20112,
+ 20118,
+ 20119,
+ 20121,
+ 20124,
+ 20125,
+ 20126,
+ 20131,
+ 20138,
+ 20143,
+ 20144,
+ 20145,
+ 20148,
+ 20150,
+ 20151,
+ 20152,
+ 20153,
+ 20156,
+ 20157,
+ 20158,
+ 20168,
+ 20172,
+ 20175,
+ 20176,
+ 20178,
+ 20186,
+ 20187,
+ 20188,
+ 20192,
+ 20194,
+ 20198,
+ 20199,
+ 20201,
+ 20205,
+ 20206,
+ 20207,
+ 20209,
+ 20212,
+ 20216,
+ 20217,
+ 20218,
+ 20220,
+ 20222,
+ 20224,
+ 20226,
+ 20227,
+ 20228,
+ 20229,
+ 20230,
+ 20231,
+ 20232,
+ 20235,
+ 20236,
+ 20242,
+ 20243,
+ 20244,
+ 20245,
+ 20246,
+ 20252,
+ 20253,
+ 20257,
+ 20259,
+ 20264,
+ 20265,
+ 20268,
+ 20269,
+ 20270,
+ 20273,
+ 20275,
+ 20277,
+ 20279,
+ 20281,
+ 20283,
+ 20286,
+ 20287,
+ 20288,
+ 20289,
+ 20290,
+ 20292,
+ 20293,
+ 20295,
+ 20296,
+ 20297,
+ 20298,
+ 20299,
+ 20300,
+ 20306,
+ 20308,
+ 20310,
+ 20321,
+ 20322,
+ 20326,
+ 20328,
+ 20330,
+ 20331,
+ 20333,
+ 20334,
+ 20337,
+ 20338,
+ 20341,
+ 20343,
+ 20344,
+ 20345,
+ 20346,
+ 20349,
+ 20352,
+ 20353,
+ 20354,
+ 20357,
+ 20358,
+ 20359,
+ 20362,
+ 20364,
+ 20366,
+ 20368,
+ 20370,
+ 20371,
+ 20373,
+ 20374,
+ 20376,
+ 20377,
+ 20378,
+ 20380,
+ 20382,
+ 20383,
+ 20385,
+ 20386,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 20388,
+ 20395,
+ 20397,
+ 20400,
+ 20401,
+ 20402,
+ 20403,
+ 20404,
+ 20406,
+ 20407,
+ 20408,
+ 20409,
+ 20410,
+ 20411,
+ 20412,
+ 20413,
+ 20414,
+ 20416,
+ 20417,
+ 20418,
+ 20422,
+ 20423,
+ 20424,
+ 20425,
+ 20427,
+ 20428,
+ 20429,
+ 20434,
+ 20435,
+ 20436,
+ 20437,
+ 20438,
+ 20441,
+ 20443,
+ 20448,
+ 20450,
+ 20452,
+ 20453,
+ 20455,
+ 20459,
+ 20460,
+ 20464,
+ 20466,
+ 20468,
+ 20469,
+ 20470,
+ 20471,
+ 20473,
+ 20475,
+ 20476,
+ 20477,
+ 20479,
+ 20480,
+ 20481,
+ 20482,
+ 20483,
+ 20484,
+ 20485,
+ 20486,
+ 20487,
+ 20488,
+ 20489,
+ 20490,
+ 0,
+ 20491,
+ 20494,
+ 20496,
+ 20497,
+ 20499,
+ 20501,
+ 20502,
+ 20503,
+ 20507,
+ 20509,
+ 20510,
+ 20512,
+ 20514,
+ 20515,
+ 20516,
+ 20519,
+ 20523,
+ 20527,
+ 20528,
+ 20529,
+ 20530,
+ 20531,
+ 20532,
+ 20533,
+ 20534,
+ 20535,
+ 20536,
+ 20537,
+ 20539,
+ 20541,
+ 20543,
+ 20544,
+ 20545,
+ 20546,
+ 20548,
+ 20549,
+ 20550,
+ 20553,
+ 20554,
+ 20555,
+ 20557,
+ 20560,
+ 20561,
+ 20562,
+ 20563,
+ 20564,
+ 20566,
+ 20567,
+ 20568,
+ 20569,
+ 20571,
+ 20573,
+ 20574,
+ 20575,
+ 20576,
+ 20577,
+ 20578,
+ 20579,
+ 20580,
+ 20582,
+ 20583,
+ 20584,
+ 20585,
+ 20586,
+ 20587,
+ 20589,
+ 20590,
+ 20591,
+ 20592,
+ 20593,
+ 20594,
+ 20595,
+ 20596,
+ 20597,
+ 20600,
+ 20601,
+ 20602,
+ 20604,
+ 20605,
+ 20609,
+ 20610,
+ 20611,
+ 20612,
+ 20614,
+ 20615,
+ 20617,
+ 20618,
+ 20619,
+ 20620,
+ 20622,
+ 20623,
+ 20624,
+ 20625,
+ 20626,
+ 20627,
+ 20628,
+ 20629,
+ 20630,
+ 20631,
+ 20632,
+ 20633,
+ 20634,
+ 20635,
+ 20636,
+ 20637,
+ 20638,
+ 20639,
+ 20640,
+ 20641,
+ 20642,
+ 20644,
+ 20646,
+ 20650,
+ 20651,
+ 20653,
+ 20654,
+ 20655,
+ 20656,
+ 20657,
+ 20659,
+ 20660,
+ 20661,
+ 20662,
+ 20663,
+ 20664,
+ 20665,
+ 20668,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 20669,
+ 20670,
+ 20671,
+ 20672,
+ 20673,
+ 20674,
+ 20675,
+ 20676,
+ 20677,
+ 20678,
+ 20679,
+ 20680,
+ 20681,
+ 20682,
+ 20683,
+ 20684,
+ 20685,
+ 20686,
+ 20688,
+ 20689,
+ 20690,
+ 20691,
+ 20692,
+ 20693,
+ 20695,
+ 20696,
+ 20697,
+ 20699,
+ 20700,
+ 20701,
+ 20702,
+ 20703,
+ 20704,
+ 20705,
+ 20706,
+ 20707,
+ 20708,
+ 20709,
+ 20712,
+ 20713,
+ 20714,
+ 20715,
+ 20719,
+ 20720,
+ 20721,
+ 20722,
+ 20724,
+ 20726,
+ 20727,
+ 20728,
+ 20729,
+ 20730,
+ 20732,
+ 20733,
+ 20734,
+ 20735,
+ 20736,
+ 20737,
+ 20738,
+ 20739,
+ 20740,
+ 20741,
+ 20744,
+ 0,
+ 20745,
+ 20746,
+ 20748,
+ 20749,
+ 20750,
+ 20751,
+ 20752,
+ 20753,
+ 20755,
+ 20756,
+ 20757,
+ 20758,
+ 20759,
+ 20760,
+ 20761,
+ 20762,
+ 20763,
+ 20764,
+ 20765,
+ 20766,
+ 20767,
+ 20768,
+ 20770,
+ 20771,
+ 20772,
+ 20773,
+ 20774,
+ 20775,
+ 20776,
+ 20777,
+ 20778,
+ 20779,
+ 20780,
+ 20781,
+ 20782,
+ 20783,
+ 20784,
+ 20785,
+ 20786,
+ 20787,
+ 20788,
+ 20789,
+ 20790,
+ 20791,
+ 20792,
+ 20793,
+ 20794,
+ 20795,
+ 20796,
+ 20797,
+ 20798,
+ 20802,
+ 20807,
+ 20810,
+ 20812,
+ 20814,
+ 20815,
+ 20816,
+ 20818,
+ 20819,
+ 20823,
+ 20824,
+ 20825,
+ 20827,
+ 20829,
+ 20830,
+ 20831,
+ 20832,
+ 20833,
+ 20835,
+ 20836,
+ 20838,
+ 20839,
+ 20841,
+ 20842,
+ 20847,
+ 20850,
+ 20858,
+ 20862,
+ 20863,
+ 20867,
+ 20868,
+ 20870,
+ 20871,
+ 20874,
+ 20875,
+ 20878,
+ 20879,
+ 20880,
+ 20881,
+ 20883,
+ 20884,
+ 20888,
+ 20890,
+ 20893,
+ 20894,
+ 20895,
+ 20897,
+ 20899,
+ 20902,
+ 20903,
+ 20904,
+ 20905,
+ 20906,
+ 20909,
+ 20910,
+ 20916,
+ 20920,
+ 20921,
+ 20922,
+ 20926,
+ 20927,
+ 20929,
+ 20930,
+ 20931,
+ 20933,
+ 20936,
+ 20938,
+ 20941,
+ 20942,
+ 20944,
+ 20946,
+ 20947,
+ 20948,
+ 20949,
+ 20950,
+ 20951,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 20952,
+ 20953,
+ 20954,
+ 20956,
+ 20958,
+ 20959,
+ 20962,
+ 20963,
+ 20965,
+ 20966,
+ 20967,
+ 20968,
+ 20969,
+ 20970,
+ 20972,
+ 20974,
+ 20977,
+ 20978,
+ 20980,
+ 20983,
+ 20990,
+ 20996,
+ 20997,
+ 21001,
+ 21003,
+ 21004,
+ 21007,
+ 21008,
+ 21011,
+ 21012,
+ 21013,
+ 21020,
+ 21022,
+ 21023,
+ 21025,
+ 21026,
+ 21027,
+ 21029,
+ 21030,
+ 21031,
+ 21034,
+ 21036,
+ 21039,
+ 21041,
+ 21042,
+ 21044,
+ 21045,
+ 21052,
+ 21054,
+ 21060,
+ 21061,
+ 21062,
+ 21063,
+ 21064,
+ 21065,
+ 21067,
+ 21070,
+ 21071,
+ 21074,
+ 21075,
+ 21077,
+ 21079,
+ 21080,
+ 0,
+ 21081,
+ 21082,
+ 21083,
+ 21085,
+ 21087,
+ 21088,
+ 21090,
+ 21091,
+ 21092,
+ 21094,
+ 21096,
+ 21099,
+ 21100,
+ 21101,
+ 21102,
+ 21104,
+ 21105,
+ 21107,
+ 21108,
+ 21109,
+ 21110,
+ 21111,
+ 21112,
+ 21113,
+ 21114,
+ 21115,
+ 21116,
+ 21118,
+ 21120,
+ 21123,
+ 21124,
+ 21125,
+ 21126,
+ 21127,
+ 21129,
+ 21130,
+ 21131,
+ 21132,
+ 21133,
+ 21134,
+ 21135,
+ 21137,
+ 21138,
+ 21140,
+ 21141,
+ 21142,
+ 21143,
+ 21144,
+ 21145,
+ 21146,
+ 21148,
+ 21156,
+ 21157,
+ 21158,
+ 21159,
+ 21166,
+ 21167,
+ 21168,
+ 21172,
+ 21173,
+ 21174,
+ 21175,
+ 21176,
+ 21177,
+ 21178,
+ 21179,
+ 21180,
+ 21181,
+ 21184,
+ 21185,
+ 21186,
+ 21188,
+ 21189,
+ 21190,
+ 21192,
+ 21194,
+ 21196,
+ 21197,
+ 21198,
+ 21199,
+ 21201,
+ 21203,
+ 21204,
+ 21205,
+ 21207,
+ 21209,
+ 21210,
+ 21211,
+ 21212,
+ 21213,
+ 21214,
+ 21216,
+ 21217,
+ 21218,
+ 21219,
+ 21221,
+ 21222,
+ 21223,
+ 21224,
+ 21225,
+ 21226,
+ 21227,
+ 21228,
+ 21229,
+ 21230,
+ 21231,
+ 21233,
+ 21234,
+ 21235,
+ 21236,
+ 21237,
+ 21238,
+ 21239,
+ 21240,
+ 21243,
+ 21244,
+ 21245,
+ 21249,
+ 21250,
+ 21251,
+ 21252,
+ 21255,
+ 21257,
+ 21258,
+ 21259,
+ 21260,
+ 21262,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 21265,
+ 21266,
+ 21267,
+ 21268,
+ 21272,
+ 21275,
+ 21276,
+ 21278,
+ 21279,
+ 21282,
+ 21284,
+ 21285,
+ 21287,
+ 21288,
+ 21289,
+ 21291,
+ 21292,
+ 21293,
+ 21295,
+ 21296,
+ 21297,
+ 21298,
+ 21299,
+ 21300,
+ 21301,
+ 21302,
+ 21303,
+ 21304,
+ 21308,
+ 21309,
+ 21312,
+ 21314,
+ 21316,
+ 21318,
+ 21323,
+ 21324,
+ 21325,
+ 21328,
+ 21332,
+ 21336,
+ 21337,
+ 21339,
+ 21341,
+ 21349,
+ 21352,
+ 21354,
+ 21356,
+ 21357,
+ 21362,
+ 21366,
+ 21369,
+ 21371,
+ 21372,
+ 21373,
+ 21374,
+ 21376,
+ 21377,
+ 21379,
+ 21383,
+ 21384,
+ 21386,
+ 21390,
+ 21391,
+ 0,
+ 21392,
+ 21393,
+ 21394,
+ 21395,
+ 21396,
+ 21398,
+ 21399,
+ 21401,
+ 21403,
+ 21404,
+ 21406,
+ 21408,
+ 21409,
+ 21412,
+ 21415,
+ 21418,
+ 21419,
+ 21420,
+ 21421,
+ 21423,
+ 21424,
+ 21425,
+ 21426,
+ 21427,
+ 21428,
+ 21429,
+ 21431,
+ 21432,
+ 21433,
+ 21434,
+ 21436,
+ 21437,
+ 21438,
+ 21440,
+ 21443,
+ 21444,
+ 21445,
+ 21446,
+ 21447,
+ 21454,
+ 21455,
+ 21456,
+ 21458,
+ 21459,
+ 21461,
+ 21466,
+ 21468,
+ 21469,
+ 21470,
+ 21473,
+ 21474,
+ 21479,
+ 21492,
+ 21498,
+ 21502,
+ 21503,
+ 21504,
+ 21506,
+ 21509,
+ 21511,
+ 21515,
+ 21524,
+ 21528,
+ 21529,
+ 21530,
+ 21532,
+ 21538,
+ 21540,
+ 21541,
+ 21546,
+ 21552,
+ 21555,
+ 21558,
+ 21559,
+ 21562,
+ 21565,
+ 21567,
+ 21569,
+ 21570,
+ 21572,
+ 21573,
+ 21575,
+ 21577,
+ 21580,
+ 21581,
+ 21582,
+ 21583,
+ 21585,
+ 21594,
+ 21597,
+ 21598,
+ 21599,
+ 21600,
+ 21601,
+ 21603,
+ 21605,
+ 21607,
+ 21609,
+ 21610,
+ 21611,
+ 21612,
+ 21613,
+ 21614,
+ 21615,
+ 21616,
+ 21620,
+ 21625,
+ 21626,
+ 21630,
+ 21631,
+ 21633,
+ 21635,
+ 21637,
+ 21639,
+ 21640,
+ 21641,
+ 21642,
+ 21645,
+ 21649,
+ 21651,
+ 21655,
+ 21656,
+ 21660,
+ 21662,
+ 21663,
+ 21664,
+ 21665,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 21666,
+ 21669,
+ 21678,
+ 21680,
+ 21682,
+ 21685,
+ 21686,
+ 21687,
+ 21689,
+ 21690,
+ 21692,
+ 21694,
+ 21699,
+ 21701,
+ 21706,
+ 21707,
+ 21718,
+ 21720,
+ 21723,
+ 21728,
+ 21729,
+ 21730,
+ 21731,
+ 21732,
+ 21739,
+ 21740,
+ 21743,
+ 21744,
+ 21745,
+ 21748,
+ 21749,
+ 21750,
+ 21751,
+ 21752,
+ 21753,
+ 21755,
+ 21758,
+ 21760,
+ 21762,
+ 21763,
+ 21764,
+ 21765,
+ 21768,
+ 21770,
+ 21771,
+ 21772,
+ 21773,
+ 21774,
+ 21778,
+ 21779,
+ 21781,
+ 21782,
+ 21783,
+ 21784,
+ 21785,
+ 21786,
+ 21788,
+ 21789,
+ 21790,
+ 21791,
+ 21793,
+ 21797,
+ 21798,
+ 0,
+ 21800,
+ 21801,
+ 21803,
+ 21805,
+ 21810,
+ 21812,
+ 21813,
+ 21814,
+ 21816,
+ 21817,
+ 21818,
+ 21819,
+ 21821,
+ 21824,
+ 21826,
+ 21829,
+ 21831,
+ 21832,
+ 21835,
+ 21836,
+ 21837,
+ 21838,
+ 21839,
+ 21841,
+ 21842,
+ 21843,
+ 21844,
+ 21847,
+ 21848,
+ 21849,
+ 21850,
+ 21851,
+ 21853,
+ 21854,
+ 21855,
+ 21856,
+ 21858,
+ 21859,
+ 21864,
+ 21865,
+ 21867,
+ 21871,
+ 21872,
+ 21873,
+ 21874,
+ 21875,
+ 21876,
+ 21881,
+ 21882,
+ 21885,
+ 21887,
+ 21893,
+ 21894,
+ 21900,
+ 21901,
+ 21902,
+ 21904,
+ 21906,
+ 21907,
+ 21909,
+ 21910,
+ 21911,
+ 21914,
+ 21915,
+ 21918,
+ 21920,
+ 21921,
+ 21922,
+ 21923,
+ 21924,
+ 21925,
+ 21926,
+ 21928,
+ 21929,
+ 21930,
+ 21931,
+ 21932,
+ 21933,
+ 21934,
+ 21935,
+ 21936,
+ 21938,
+ 21940,
+ 21942,
+ 21944,
+ 21946,
+ 21948,
+ 21951,
+ 21952,
+ 21953,
+ 21954,
+ 21955,
+ 21958,
+ 21959,
+ 21960,
+ 21962,
+ 21963,
+ 21966,
+ 21967,
+ 21968,
+ 21973,
+ 21975,
+ 21976,
+ 21977,
+ 21978,
+ 21979,
+ 21982,
+ 21984,
+ 21986,
+ 21991,
+ 21993,
+ 21997,
+ 21998,
+ 22000,
+ 22001,
+ 22004,
+ 22006,
+ 22008,
+ 22009,
+ 22010,
+ 22011,
+ 22012,
+ 22015,
+ 22018,
+ 22019,
+ 22020,
+ 22021,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 22022,
+ 22023,
+ 22026,
+ 22027,
+ 22029,
+ 22032,
+ 22033,
+ 22034,
+ 22035,
+ 22036,
+ 22037,
+ 22038,
+ 22039,
+ 22041,
+ 22042,
+ 22044,
+ 22045,
+ 22048,
+ 22049,
+ 22050,
+ 22053,
+ 22054,
+ 22056,
+ 22057,
+ 22058,
+ 22059,
+ 22062,
+ 22063,
+ 22064,
+ 22067,
+ 22069,
+ 22071,
+ 22072,
+ 22074,
+ 22076,
+ 22077,
+ 22078,
+ 22080,
+ 22081,
+ 22082,
+ 22083,
+ 22084,
+ 22085,
+ 22086,
+ 22087,
+ 22088,
+ 22089,
+ 22090,
+ 22091,
+ 22095,
+ 22096,
+ 22097,
+ 22098,
+ 22099,
+ 22101,
+ 22102,
+ 22106,
+ 22107,
+ 22109,
+ 22110,
+ 22111,
+ 22112,
+ 22113,
+ 0,
+ 22115,
+ 22117,
+ 22118,
+ 22119,
+ 22125,
+ 22126,
+ 22127,
+ 22128,
+ 22130,
+ 22131,
+ 22132,
+ 22133,
+ 22135,
+ 22136,
+ 22137,
+ 22138,
+ 22141,
+ 22142,
+ 22143,
+ 22144,
+ 22145,
+ 22146,
+ 22147,
+ 22148,
+ 22151,
+ 22152,
+ 22153,
+ 22154,
+ 22155,
+ 22156,
+ 22157,
+ 22160,
+ 22161,
+ 22162,
+ 22164,
+ 22165,
+ 22166,
+ 22167,
+ 22168,
+ 22169,
+ 22170,
+ 22171,
+ 22172,
+ 22173,
+ 22174,
+ 22175,
+ 22176,
+ 22177,
+ 22178,
+ 22180,
+ 22181,
+ 22182,
+ 22183,
+ 22184,
+ 22185,
+ 22186,
+ 22187,
+ 22188,
+ 22189,
+ 22190,
+ 22192,
+ 22193,
+ 22194,
+ 22195,
+ 22196,
+ 22197,
+ 22198,
+ 22200,
+ 22201,
+ 22202,
+ 22203,
+ 22205,
+ 22206,
+ 22207,
+ 22208,
+ 22209,
+ 22210,
+ 22211,
+ 22212,
+ 22213,
+ 22214,
+ 22215,
+ 22216,
+ 22217,
+ 22219,
+ 22220,
+ 22221,
+ 22222,
+ 22223,
+ 22224,
+ 22225,
+ 22226,
+ 22227,
+ 22229,
+ 22230,
+ 22232,
+ 22233,
+ 22236,
+ 22243,
+ 22245,
+ 22246,
+ 22247,
+ 22248,
+ 22249,
+ 22250,
+ 22252,
+ 22254,
+ 22255,
+ 22258,
+ 22259,
+ 22262,
+ 22263,
+ 22264,
+ 22267,
+ 22268,
+ 22272,
+ 22273,
+ 22274,
+ 22277,
+ 22279,
+ 22283,
+ 22284,
+ 22285,
+ 22286,
+ 22287,
+ 22288,
+ 22289,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 22290,
+ 22291,
+ 22292,
+ 22293,
+ 22294,
+ 22295,
+ 22296,
+ 22297,
+ 22298,
+ 22299,
+ 22301,
+ 22302,
+ 22304,
+ 22305,
+ 22306,
+ 22308,
+ 22309,
+ 22310,
+ 22311,
+ 22315,
+ 22321,
+ 22322,
+ 22324,
+ 22325,
+ 22326,
+ 22327,
+ 22328,
+ 22332,
+ 22333,
+ 22335,
+ 22337,
+ 22339,
+ 22340,
+ 22341,
+ 22342,
+ 22344,
+ 22345,
+ 22347,
+ 22354,
+ 22355,
+ 22356,
+ 22357,
+ 22358,
+ 22360,
+ 22361,
+ 22370,
+ 22371,
+ 22373,
+ 22375,
+ 22380,
+ 22382,
+ 22384,
+ 22385,
+ 22386,
+ 22388,
+ 22389,
+ 22392,
+ 22393,
+ 22394,
+ 22397,
+ 22398,
+ 22399,
+ 22400,
+ 0,
+ 22401,
+ 22407,
+ 22408,
+ 22409,
+ 22410,
+ 22413,
+ 22414,
+ 22415,
+ 22416,
+ 22417,
+ 22420,
+ 22421,
+ 22422,
+ 22423,
+ 22424,
+ 22425,
+ 22426,
+ 22428,
+ 22429,
+ 22430,
+ 22431,
+ 22437,
+ 22440,
+ 22442,
+ 22444,
+ 22447,
+ 22448,
+ 22449,
+ 22451,
+ 22453,
+ 22454,
+ 22455,
+ 22457,
+ 22458,
+ 22459,
+ 22460,
+ 22461,
+ 22462,
+ 22463,
+ 22464,
+ 22465,
+ 22468,
+ 22469,
+ 22470,
+ 22471,
+ 22472,
+ 22473,
+ 22474,
+ 22476,
+ 22477,
+ 22480,
+ 22481,
+ 22483,
+ 22486,
+ 22487,
+ 22491,
+ 22492,
+ 22494,
+ 22497,
+ 22498,
+ 22499,
+ 22501,
+ 22502,
+ 22503,
+ 22504,
+ 22505,
+ 22506,
+ 22507,
+ 22508,
+ 22510,
+ 22512,
+ 22513,
+ 22514,
+ 22515,
+ 22517,
+ 22518,
+ 22519,
+ 22523,
+ 22524,
+ 22526,
+ 22527,
+ 22529,
+ 22531,
+ 22532,
+ 22533,
+ 22536,
+ 22537,
+ 22538,
+ 22540,
+ 22542,
+ 22543,
+ 22544,
+ 22546,
+ 22547,
+ 22548,
+ 22550,
+ 22551,
+ 22552,
+ 22554,
+ 22555,
+ 22556,
+ 22557,
+ 22559,
+ 22562,
+ 22563,
+ 22565,
+ 22566,
+ 22567,
+ 22568,
+ 22569,
+ 22571,
+ 22572,
+ 22573,
+ 22574,
+ 22575,
+ 22577,
+ 22578,
+ 22579,
+ 22580,
+ 22582,
+ 22583,
+ 22584,
+ 22585,
+ 22586,
+ 22587,
+ 22588,
+ 22589,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 22590,
+ 22591,
+ 22592,
+ 22593,
+ 22594,
+ 22595,
+ 22597,
+ 22598,
+ 22599,
+ 22600,
+ 22601,
+ 22602,
+ 22603,
+ 22606,
+ 22607,
+ 22608,
+ 22610,
+ 22611,
+ 22613,
+ 22614,
+ 22615,
+ 22617,
+ 22618,
+ 22619,
+ 22620,
+ 22621,
+ 22623,
+ 22624,
+ 22625,
+ 22626,
+ 22627,
+ 22628,
+ 22630,
+ 22631,
+ 22632,
+ 22633,
+ 22634,
+ 22637,
+ 22638,
+ 22639,
+ 22640,
+ 22641,
+ 22642,
+ 22643,
+ 22644,
+ 22645,
+ 22646,
+ 22647,
+ 22648,
+ 22649,
+ 22650,
+ 22651,
+ 22652,
+ 22653,
+ 22655,
+ 22658,
+ 22660,
+ 22662,
+ 22663,
+ 22664,
+ 22666,
+ 22667,
+ 22668,
+ 0,
+ 22669,
+ 22670,
+ 22671,
+ 22672,
+ 22673,
+ 22676,
+ 22677,
+ 22678,
+ 22679,
+ 22680,
+ 22683,
+ 22684,
+ 22685,
+ 22688,
+ 22689,
+ 22690,
+ 22691,
+ 22692,
+ 22693,
+ 22694,
+ 22695,
+ 22698,
+ 22699,
+ 22700,
+ 22701,
+ 22702,
+ 22703,
+ 22704,
+ 22705,
+ 22706,
+ 22707,
+ 22708,
+ 22709,
+ 22710,
+ 22711,
+ 22712,
+ 22713,
+ 22714,
+ 22715,
+ 22717,
+ 22718,
+ 22719,
+ 22720,
+ 22722,
+ 22723,
+ 22724,
+ 22726,
+ 22727,
+ 22728,
+ 22729,
+ 22730,
+ 22731,
+ 22732,
+ 22733,
+ 22734,
+ 22735,
+ 22736,
+ 22738,
+ 22739,
+ 22740,
+ 22742,
+ 22743,
+ 22744,
+ 22745,
+ 22746,
+ 22747,
+ 22748,
+ 22749,
+ 22750,
+ 22751,
+ 22752,
+ 22753,
+ 22754,
+ 22755,
+ 22757,
+ 22758,
+ 22759,
+ 22760,
+ 22761,
+ 22762,
+ 22765,
+ 22767,
+ 22769,
+ 22770,
+ 22772,
+ 22773,
+ 22775,
+ 22776,
+ 22778,
+ 22779,
+ 22780,
+ 22781,
+ 22782,
+ 22783,
+ 22784,
+ 22785,
+ 22787,
+ 22789,
+ 22790,
+ 22792,
+ 22793,
+ 22794,
+ 22795,
+ 22796,
+ 22798,
+ 22800,
+ 22801,
+ 22802,
+ 22803,
+ 22807,
+ 22808,
+ 22811,
+ 22813,
+ 22814,
+ 22816,
+ 22817,
+ 22818,
+ 22819,
+ 22822,
+ 22824,
+ 22828,
+ 22832,
+ 22834,
+ 22835,
+ 22837,
+ 22838,
+ 22843,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 22845,
+ 22846,
+ 22847,
+ 22848,
+ 22851,
+ 22853,
+ 22854,
+ 22858,
+ 22860,
+ 22861,
+ 22864,
+ 22866,
+ 22867,
+ 22873,
+ 22875,
+ 22876,
+ 22877,
+ 22878,
+ 22879,
+ 22881,
+ 22883,
+ 22884,
+ 22886,
+ 22887,
+ 22888,
+ 22889,
+ 22890,
+ 22891,
+ 22892,
+ 22893,
+ 22894,
+ 22895,
+ 22896,
+ 22897,
+ 22898,
+ 22901,
+ 22903,
+ 22906,
+ 22907,
+ 22908,
+ 22910,
+ 22911,
+ 22912,
+ 22917,
+ 22921,
+ 22923,
+ 22924,
+ 22926,
+ 22927,
+ 22928,
+ 22929,
+ 22932,
+ 22933,
+ 22936,
+ 22938,
+ 22939,
+ 22940,
+ 22941,
+ 22943,
+ 22944,
+ 22945,
+ 22946,
+ 22950,
+ 0,
+ 22951,
+ 22956,
+ 22957,
+ 22960,
+ 22961,
+ 22963,
+ 22964,
+ 22965,
+ 22966,
+ 22967,
+ 22968,
+ 22970,
+ 22972,
+ 22973,
+ 22975,
+ 22976,
+ 22977,
+ 22978,
+ 22979,
+ 22980,
+ 22981,
+ 22983,
+ 22984,
+ 22985,
+ 22988,
+ 22989,
+ 22990,
+ 22991,
+ 22997,
+ 22998,
+ 23001,
+ 23003,
+ 23006,
+ 23007,
+ 23008,
+ 23009,
+ 23010,
+ 23012,
+ 23014,
+ 23015,
+ 23017,
+ 23018,
+ 23019,
+ 23021,
+ 23022,
+ 23023,
+ 23024,
+ 23025,
+ 23026,
+ 23027,
+ 23028,
+ 23029,
+ 23030,
+ 23031,
+ 23032,
+ 23034,
+ 23036,
+ 23037,
+ 23038,
+ 23040,
+ 23042,
+ 23050,
+ 23051,
+ 23053,
+ 23054,
+ 23055,
+ 23056,
+ 23058,
+ 23060,
+ 23061,
+ 23062,
+ 23063,
+ 23065,
+ 23066,
+ 23067,
+ 23069,
+ 23070,
+ 23073,
+ 23074,
+ 23076,
+ 23078,
+ 23079,
+ 23080,
+ 23082,
+ 23083,
+ 23084,
+ 23085,
+ 23086,
+ 23087,
+ 23088,
+ 23091,
+ 23093,
+ 23095,
+ 23096,
+ 23097,
+ 23098,
+ 23099,
+ 23101,
+ 23102,
+ 23103,
+ 23105,
+ 23106,
+ 23107,
+ 23108,
+ 23109,
+ 23111,
+ 23112,
+ 23115,
+ 23116,
+ 23117,
+ 23118,
+ 23119,
+ 23120,
+ 23121,
+ 23122,
+ 23123,
+ 23124,
+ 23126,
+ 23127,
+ 23128,
+ 23129,
+ 23131,
+ 23132,
+ 23133,
+ 23134,
+ 23135,
+ 23136,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 23137,
+ 23139,
+ 23140,
+ 23141,
+ 23142,
+ 23144,
+ 23145,
+ 23147,
+ 23148,
+ 23149,
+ 23150,
+ 23151,
+ 23152,
+ 23153,
+ 23154,
+ 23155,
+ 23160,
+ 23161,
+ 23163,
+ 23164,
+ 23165,
+ 23166,
+ 23168,
+ 23169,
+ 23170,
+ 23171,
+ 23172,
+ 23173,
+ 23174,
+ 23175,
+ 23176,
+ 23177,
+ 23178,
+ 23179,
+ 23180,
+ 23181,
+ 23182,
+ 23183,
+ 23184,
+ 23185,
+ 23187,
+ 23188,
+ 23189,
+ 23190,
+ 23191,
+ 23192,
+ 23193,
+ 23196,
+ 23197,
+ 23198,
+ 23199,
+ 23200,
+ 23201,
+ 23202,
+ 23203,
+ 23204,
+ 23205,
+ 23206,
+ 23207,
+ 23208,
+ 23209,
+ 23211,
+ 23212,
+ 0,
+ 23213,
+ 23214,
+ 23215,
+ 23216,
+ 23217,
+ 23220,
+ 23222,
+ 23223,
+ 23225,
+ 23226,
+ 23227,
+ 23228,
+ 23229,
+ 23231,
+ 23232,
+ 23235,
+ 23236,
+ 23237,
+ 23238,
+ 23239,
+ 23240,
+ 23242,
+ 23243,
+ 23245,
+ 23246,
+ 23247,
+ 23248,
+ 23249,
+ 23251,
+ 23253,
+ 23255,
+ 23257,
+ 23258,
+ 23259,
+ 23261,
+ 23262,
+ 23263,
+ 23266,
+ 23268,
+ 23269,
+ 23271,
+ 23272,
+ 23274,
+ 23276,
+ 23277,
+ 23278,
+ 23279,
+ 23280,
+ 23282,
+ 23283,
+ 23284,
+ 23285,
+ 23286,
+ 23287,
+ 23288,
+ 23289,
+ 23290,
+ 23291,
+ 23292,
+ 23293,
+ 23294,
+ 23295,
+ 23296,
+ 23297,
+ 23298,
+ 23299,
+ 23300,
+ 23301,
+ 23302,
+ 23303,
+ 23304,
+ 23306,
+ 23307,
+ 23308,
+ 23309,
+ 23310,
+ 23311,
+ 23312,
+ 23313,
+ 23314,
+ 23315,
+ 23316,
+ 23317,
+ 23320,
+ 23321,
+ 23322,
+ 23323,
+ 23324,
+ 23325,
+ 23326,
+ 23327,
+ 23328,
+ 23329,
+ 23330,
+ 23331,
+ 23332,
+ 23333,
+ 23334,
+ 23335,
+ 23336,
+ 23337,
+ 23338,
+ 23339,
+ 23340,
+ 23341,
+ 23342,
+ 23343,
+ 23344,
+ 23345,
+ 23347,
+ 23349,
+ 23350,
+ 23352,
+ 23353,
+ 23354,
+ 23355,
+ 23356,
+ 23357,
+ 23358,
+ 23359,
+ 23361,
+ 23362,
+ 23363,
+ 23364,
+ 23365,
+ 23366,
+ 23367,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 23368,
+ 23369,
+ 23370,
+ 23371,
+ 23372,
+ 23373,
+ 23374,
+ 23375,
+ 23378,
+ 23382,
+ 23390,
+ 23392,
+ 23393,
+ 23399,
+ 23400,
+ 23403,
+ 23405,
+ 23406,
+ 23407,
+ 23410,
+ 23412,
+ 23414,
+ 23415,
+ 23416,
+ 23417,
+ 23419,
+ 23420,
+ 23422,
+ 23423,
+ 23426,
+ 23430,
+ 23434,
+ 23437,
+ 23438,
+ 23440,
+ 23441,
+ 23442,
+ 23444,
+ 23446,
+ 23455,
+ 23463,
+ 23464,
+ 23465,
+ 23468,
+ 23469,
+ 23470,
+ 23471,
+ 23473,
+ 23474,
+ 23479,
+ 23482,
+ 23483,
+ 23484,
+ 23488,
+ 23489,
+ 23491,
+ 23496,
+ 23497,
+ 23498,
+ 23499,
+ 23501,
+ 23502,
+ 23503,
+ 0,
+ 23505,
+ 23508,
+ 23509,
+ 23510,
+ 23511,
+ 23512,
+ 23513,
+ 23514,
+ 23515,
+ 23516,
+ 23520,
+ 23522,
+ 23523,
+ 23526,
+ 23527,
+ 23529,
+ 23530,
+ 23531,
+ 23532,
+ 23533,
+ 23535,
+ 23537,
+ 23538,
+ 23539,
+ 23540,
+ 23541,
+ 23542,
+ 23543,
+ 23549,
+ 23550,
+ 23552,
+ 23554,
+ 23555,
+ 23557,
+ 23559,
+ 23560,
+ 23563,
+ 23564,
+ 23565,
+ 23566,
+ 23568,
+ 23570,
+ 23571,
+ 23575,
+ 23577,
+ 23579,
+ 23582,
+ 23583,
+ 23584,
+ 23585,
+ 23587,
+ 23590,
+ 23592,
+ 23593,
+ 23594,
+ 23595,
+ 23597,
+ 23598,
+ 23599,
+ 23600,
+ 23602,
+ 23603,
+ 23605,
+ 23606,
+ 23607,
+ 23619,
+ 23620,
+ 23622,
+ 23623,
+ 23628,
+ 23629,
+ 23634,
+ 23635,
+ 23636,
+ 23638,
+ 23639,
+ 23640,
+ 23642,
+ 23643,
+ 23644,
+ 23645,
+ 23647,
+ 23650,
+ 23652,
+ 23655,
+ 23656,
+ 23657,
+ 23658,
+ 23659,
+ 23660,
+ 23661,
+ 23664,
+ 23666,
+ 23667,
+ 23668,
+ 23669,
+ 23670,
+ 23671,
+ 23672,
+ 23675,
+ 23676,
+ 23677,
+ 23678,
+ 23680,
+ 23683,
+ 23684,
+ 23685,
+ 23686,
+ 23687,
+ 23689,
+ 23690,
+ 23691,
+ 23694,
+ 23695,
+ 23698,
+ 23699,
+ 23701,
+ 23709,
+ 23710,
+ 23711,
+ 23712,
+ 23713,
+ 23716,
+ 23717,
+ 23718,
+ 23719,
+ 23720,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 23722,
+ 23726,
+ 23727,
+ 23728,
+ 23730,
+ 23732,
+ 23734,
+ 23737,
+ 23738,
+ 23739,
+ 23740,
+ 23742,
+ 23744,
+ 23746,
+ 23747,
+ 23749,
+ 23750,
+ 23751,
+ 23752,
+ 23753,
+ 23754,
+ 23756,
+ 23757,
+ 23758,
+ 23759,
+ 23760,
+ 23761,
+ 23763,
+ 23764,
+ 23765,
+ 23766,
+ 23767,
+ 23768,
+ 23770,
+ 23771,
+ 23772,
+ 23773,
+ 23774,
+ 23775,
+ 23776,
+ 23778,
+ 23779,
+ 23783,
+ 23785,
+ 23787,
+ 23788,
+ 23790,
+ 23791,
+ 23793,
+ 23794,
+ 23795,
+ 23796,
+ 23797,
+ 23798,
+ 23799,
+ 23800,
+ 23801,
+ 23802,
+ 23804,
+ 23805,
+ 23806,
+ 23807,
+ 23808,
+ 0,
+ 23809,
+ 23812,
+ 23813,
+ 23816,
+ 23817,
+ 23818,
+ 23819,
+ 23820,
+ 23821,
+ 23823,
+ 23824,
+ 23825,
+ 23826,
+ 23827,
+ 23829,
+ 23831,
+ 23832,
+ 23833,
+ 23834,
+ 23836,
+ 23837,
+ 23839,
+ 23840,
+ 23841,
+ 23842,
+ 23843,
+ 23845,
+ 23848,
+ 23850,
+ 23851,
+ 23852,
+ 23855,
+ 23856,
+ 23857,
+ 23858,
+ 23859,
+ 23861,
+ 23862,
+ 23863,
+ 23864,
+ 23865,
+ 23866,
+ 23867,
+ 23868,
+ 23871,
+ 23872,
+ 23873,
+ 23874,
+ 23875,
+ 23876,
+ 23877,
+ 23878,
+ 23880,
+ 23881,
+ 23885,
+ 23886,
+ 23887,
+ 23888,
+ 23889,
+ 23890,
+ 23891,
+ 23892,
+ 23893,
+ 23894,
+ 23895,
+ 23897,
+ 23898,
+ 23900,
+ 23902,
+ 23903,
+ 23904,
+ 23905,
+ 23906,
+ 23907,
+ 23908,
+ 23909,
+ 23910,
+ 23911,
+ 23912,
+ 23914,
+ 23917,
+ 23918,
+ 23920,
+ 23921,
+ 23922,
+ 23923,
+ 23925,
+ 23926,
+ 23927,
+ 23928,
+ 23929,
+ 23930,
+ 23931,
+ 23932,
+ 23933,
+ 23934,
+ 23935,
+ 23936,
+ 23937,
+ 23939,
+ 23940,
+ 23941,
+ 23942,
+ 23943,
+ 23944,
+ 23945,
+ 23946,
+ 23947,
+ 23948,
+ 23949,
+ 23950,
+ 23951,
+ 23952,
+ 23953,
+ 23954,
+ 23955,
+ 23956,
+ 23957,
+ 23958,
+ 23959,
+ 23960,
+ 23962,
+ 23963,
+ 23964,
+ 23966,
+ 23967,
+ 23968,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 23969,
+ 23970,
+ 23971,
+ 23972,
+ 23973,
+ 23974,
+ 23975,
+ 23976,
+ 23977,
+ 23978,
+ 23979,
+ 23980,
+ 23981,
+ 23982,
+ 23983,
+ 23984,
+ 23985,
+ 23986,
+ 23987,
+ 23988,
+ 23989,
+ 23990,
+ 23992,
+ 23993,
+ 23994,
+ 23995,
+ 23996,
+ 23997,
+ 23998,
+ 23999,
+ 24000,
+ 24001,
+ 24002,
+ 24003,
+ 24004,
+ 24006,
+ 24007,
+ 24008,
+ 24009,
+ 24010,
+ 24011,
+ 24012,
+ 24014,
+ 24015,
+ 24016,
+ 24017,
+ 24018,
+ 24019,
+ 24020,
+ 24021,
+ 24022,
+ 24023,
+ 24024,
+ 24025,
+ 24026,
+ 24028,
+ 24031,
+ 24032,
+ 24035,
+ 24036,
+ 24042,
+ 24044,
+ 24045,
+ 0,
+ 24048,
+ 24053,
+ 24054,
+ 24056,
+ 24057,
+ 24058,
+ 24059,
+ 24060,
+ 24063,
+ 24064,
+ 24068,
+ 24071,
+ 24073,
+ 24074,
+ 24075,
+ 24077,
+ 24078,
+ 24082,
+ 24083,
+ 24087,
+ 24094,
+ 24095,
+ 24096,
+ 24097,
+ 24098,
+ 24099,
+ 24100,
+ 24101,
+ 24104,
+ 24105,
+ 24106,
+ 24107,
+ 24108,
+ 24111,
+ 24112,
+ 24114,
+ 24115,
+ 24116,
+ 24117,
+ 24118,
+ 24121,
+ 24122,
+ 24126,
+ 24127,
+ 24128,
+ 24129,
+ 24131,
+ 24134,
+ 24135,
+ 24136,
+ 24137,
+ 24138,
+ 24139,
+ 24141,
+ 24142,
+ 24143,
+ 24144,
+ 24145,
+ 24146,
+ 24147,
+ 24150,
+ 24151,
+ 24152,
+ 24153,
+ 24154,
+ 24156,
+ 24157,
+ 24159,
+ 24160,
+ 24163,
+ 24164,
+ 24165,
+ 24166,
+ 24167,
+ 24168,
+ 24169,
+ 24170,
+ 24171,
+ 24172,
+ 24173,
+ 24174,
+ 24175,
+ 24176,
+ 24177,
+ 24181,
+ 24183,
+ 24185,
+ 24190,
+ 24193,
+ 24194,
+ 24195,
+ 24197,
+ 24200,
+ 24201,
+ 24204,
+ 24205,
+ 24206,
+ 24210,
+ 24216,
+ 24219,
+ 24221,
+ 24225,
+ 24226,
+ 24227,
+ 24228,
+ 24232,
+ 24233,
+ 24234,
+ 24235,
+ 24236,
+ 24238,
+ 24239,
+ 24240,
+ 24241,
+ 24242,
+ 24244,
+ 24250,
+ 24251,
+ 24252,
+ 24253,
+ 24255,
+ 24256,
+ 24257,
+ 24258,
+ 24259,
+ 24260,
+ 24261,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 24262,
+ 24263,
+ 24264,
+ 24267,
+ 24268,
+ 24269,
+ 24270,
+ 24271,
+ 24272,
+ 24276,
+ 24277,
+ 24279,
+ 24280,
+ 24281,
+ 24282,
+ 24284,
+ 24285,
+ 24286,
+ 24287,
+ 24288,
+ 24289,
+ 24290,
+ 24291,
+ 24292,
+ 24293,
+ 24294,
+ 24295,
+ 24297,
+ 24299,
+ 24300,
+ 24301,
+ 24302,
+ 24303,
+ 24304,
+ 24305,
+ 24306,
+ 24307,
+ 24309,
+ 24312,
+ 24313,
+ 24315,
+ 24316,
+ 24317,
+ 24325,
+ 24326,
+ 24327,
+ 24329,
+ 24332,
+ 24333,
+ 24334,
+ 24336,
+ 24338,
+ 24340,
+ 24342,
+ 24345,
+ 24346,
+ 24348,
+ 24349,
+ 24350,
+ 24353,
+ 24354,
+ 24355,
+ 24356,
+ 0,
+ 24360,
+ 24363,
+ 24364,
+ 24366,
+ 24368,
+ 24370,
+ 24371,
+ 24372,
+ 24373,
+ 24374,
+ 24375,
+ 24376,
+ 24379,
+ 24381,
+ 24382,
+ 24383,
+ 24385,
+ 24386,
+ 24387,
+ 24388,
+ 24389,
+ 24390,
+ 24391,
+ 24392,
+ 24393,
+ 24394,
+ 24395,
+ 24396,
+ 24397,
+ 24398,
+ 24399,
+ 24401,
+ 24404,
+ 24409,
+ 24410,
+ 24411,
+ 24412,
+ 24414,
+ 24415,
+ 24416,
+ 24419,
+ 24421,
+ 24423,
+ 24424,
+ 24427,
+ 24430,
+ 24431,
+ 24434,
+ 24436,
+ 24437,
+ 24438,
+ 24440,
+ 24442,
+ 24445,
+ 24446,
+ 24447,
+ 24451,
+ 24454,
+ 24461,
+ 24462,
+ 24463,
+ 24465,
+ 24467,
+ 24468,
+ 24470,
+ 24474,
+ 24475,
+ 24477,
+ 24478,
+ 24479,
+ 24480,
+ 24482,
+ 24483,
+ 24484,
+ 24485,
+ 24486,
+ 24487,
+ 24489,
+ 24491,
+ 24492,
+ 24495,
+ 24496,
+ 24497,
+ 24498,
+ 24499,
+ 24500,
+ 24502,
+ 24504,
+ 24505,
+ 24506,
+ 24507,
+ 24510,
+ 24511,
+ 24512,
+ 24513,
+ 24514,
+ 24519,
+ 24520,
+ 24522,
+ 24523,
+ 24526,
+ 24531,
+ 24532,
+ 24533,
+ 24538,
+ 24539,
+ 24540,
+ 24542,
+ 24543,
+ 24546,
+ 24547,
+ 24549,
+ 24550,
+ 24552,
+ 24553,
+ 24556,
+ 24559,
+ 24560,
+ 24562,
+ 24563,
+ 24564,
+ 24566,
+ 24567,
+ 24569,
+ 24570,
+ 24572,
+ 24583,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 24584,
+ 24585,
+ 24587,
+ 24588,
+ 24592,
+ 24593,
+ 24595,
+ 24599,
+ 24600,
+ 24602,
+ 24606,
+ 24607,
+ 24610,
+ 24611,
+ 24612,
+ 24620,
+ 24621,
+ 24622,
+ 24624,
+ 24625,
+ 24626,
+ 24627,
+ 24628,
+ 24630,
+ 24631,
+ 24632,
+ 24633,
+ 24634,
+ 24637,
+ 24638,
+ 24640,
+ 24644,
+ 24645,
+ 24646,
+ 24647,
+ 24648,
+ 24649,
+ 24650,
+ 24652,
+ 24654,
+ 24655,
+ 24657,
+ 24659,
+ 24660,
+ 24662,
+ 24663,
+ 24664,
+ 24667,
+ 24668,
+ 24670,
+ 24671,
+ 24672,
+ 24673,
+ 24677,
+ 24678,
+ 24686,
+ 24689,
+ 24690,
+ 24692,
+ 24693,
+ 24695,
+ 24702,
+ 24704,
+ 0,
+ 24705,
+ 24706,
+ 24709,
+ 24710,
+ 24711,
+ 24712,
+ 24714,
+ 24715,
+ 24718,
+ 24719,
+ 24720,
+ 24721,
+ 24723,
+ 24725,
+ 24727,
+ 24728,
+ 24729,
+ 24732,
+ 24734,
+ 24737,
+ 24738,
+ 24740,
+ 24741,
+ 24743,
+ 24745,
+ 24746,
+ 24750,
+ 24752,
+ 24755,
+ 24757,
+ 24758,
+ 24759,
+ 24761,
+ 24762,
+ 24765,
+ 24766,
+ 24767,
+ 24768,
+ 24769,
+ 24770,
+ 24771,
+ 24772,
+ 24775,
+ 24776,
+ 24777,
+ 24780,
+ 24781,
+ 24782,
+ 24783,
+ 24784,
+ 24786,
+ 24787,
+ 24788,
+ 24790,
+ 24791,
+ 24793,
+ 24795,
+ 24798,
+ 24801,
+ 24802,
+ 24803,
+ 24804,
+ 24805,
+ 24810,
+ 24817,
+ 24818,
+ 24821,
+ 24823,
+ 24824,
+ 24827,
+ 24828,
+ 24829,
+ 24830,
+ 24831,
+ 24834,
+ 24835,
+ 24836,
+ 24837,
+ 24839,
+ 24842,
+ 24843,
+ 24844,
+ 24848,
+ 24849,
+ 24850,
+ 24851,
+ 24852,
+ 24854,
+ 24855,
+ 24856,
+ 24857,
+ 24859,
+ 24860,
+ 24861,
+ 24862,
+ 24865,
+ 24866,
+ 24869,
+ 24872,
+ 24873,
+ 24874,
+ 24876,
+ 24877,
+ 24878,
+ 24879,
+ 24880,
+ 24881,
+ 24882,
+ 24883,
+ 24884,
+ 24885,
+ 24886,
+ 24887,
+ 24888,
+ 24889,
+ 24890,
+ 24891,
+ 24892,
+ 24893,
+ 24894,
+ 24896,
+ 24897,
+ 24898,
+ 24899,
+ 24900,
+ 24901,
+ 24902,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 24903,
+ 24905,
+ 24907,
+ 24909,
+ 24911,
+ 24912,
+ 24914,
+ 24915,
+ 24916,
+ 24918,
+ 24919,
+ 24920,
+ 24921,
+ 24922,
+ 24923,
+ 24924,
+ 24926,
+ 24927,
+ 24928,
+ 24929,
+ 24931,
+ 24932,
+ 24933,
+ 24934,
+ 24937,
+ 24938,
+ 24939,
+ 24940,
+ 24941,
+ 24942,
+ 24943,
+ 24945,
+ 24946,
+ 24947,
+ 24948,
+ 24950,
+ 24952,
+ 24953,
+ 24954,
+ 24955,
+ 24956,
+ 24957,
+ 24958,
+ 24959,
+ 24960,
+ 24961,
+ 24962,
+ 24963,
+ 24964,
+ 24965,
+ 24966,
+ 24967,
+ 24968,
+ 24969,
+ 24970,
+ 24972,
+ 24973,
+ 24975,
+ 24976,
+ 24977,
+ 24978,
+ 24979,
+ 24981,
+ 0,
+ 24982,
+ 24983,
+ 24984,
+ 24985,
+ 24986,
+ 24987,
+ 24988,
+ 24990,
+ 24991,
+ 24992,
+ 24993,
+ 24994,
+ 24995,
+ 24996,
+ 24997,
+ 24998,
+ 25002,
+ 25003,
+ 25005,
+ 25006,
+ 25007,
+ 25008,
+ 25009,
+ 25010,
+ 25011,
+ 25012,
+ 25013,
+ 25014,
+ 25016,
+ 25017,
+ 25018,
+ 25019,
+ 25020,
+ 25021,
+ 25023,
+ 25024,
+ 25025,
+ 25027,
+ 25028,
+ 25029,
+ 25030,
+ 25031,
+ 25033,
+ 25036,
+ 25037,
+ 25038,
+ 25039,
+ 25040,
+ 25043,
+ 25045,
+ 25046,
+ 25047,
+ 25048,
+ 25049,
+ 25050,
+ 25051,
+ 25052,
+ 25053,
+ 25054,
+ 25055,
+ 25056,
+ 25057,
+ 25058,
+ 25059,
+ 25060,
+ 25061,
+ 25063,
+ 25064,
+ 25065,
+ 25066,
+ 25067,
+ 25068,
+ 25069,
+ 25070,
+ 25071,
+ 25072,
+ 25073,
+ 25074,
+ 25075,
+ 25076,
+ 25078,
+ 25079,
+ 25080,
+ 25081,
+ 25082,
+ 25083,
+ 25084,
+ 25085,
+ 25086,
+ 25088,
+ 25089,
+ 25090,
+ 25091,
+ 25092,
+ 25093,
+ 25095,
+ 25097,
+ 25107,
+ 25108,
+ 25113,
+ 25116,
+ 25117,
+ 25118,
+ 25120,
+ 25123,
+ 25126,
+ 25127,
+ 25128,
+ 25129,
+ 25131,
+ 25133,
+ 25135,
+ 25136,
+ 25137,
+ 25138,
+ 25141,
+ 25142,
+ 25144,
+ 25145,
+ 25146,
+ 25147,
+ 25148,
+ 25154,
+ 25156,
+ 25157,
+ 25158,
+ 25162,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 25167,
+ 25168,
+ 25173,
+ 25174,
+ 25175,
+ 25177,
+ 25178,
+ 25180,
+ 25181,
+ 25182,
+ 25183,
+ 25184,
+ 25185,
+ 25186,
+ 25188,
+ 25189,
+ 25192,
+ 25201,
+ 25202,
+ 25204,
+ 25205,
+ 25207,
+ 25208,
+ 25210,
+ 25211,
+ 25213,
+ 25217,
+ 25218,
+ 25219,
+ 25221,
+ 25222,
+ 25223,
+ 25224,
+ 25227,
+ 25228,
+ 25229,
+ 25230,
+ 25231,
+ 25232,
+ 25236,
+ 25241,
+ 25244,
+ 25245,
+ 25246,
+ 25251,
+ 25254,
+ 25255,
+ 25257,
+ 25258,
+ 25261,
+ 25262,
+ 25263,
+ 25264,
+ 25266,
+ 25267,
+ 25268,
+ 25270,
+ 25271,
+ 25272,
+ 25274,
+ 25278,
+ 25280,
+ 25281,
+ 0,
+ 25283,
+ 25291,
+ 25295,
+ 25297,
+ 25301,
+ 25309,
+ 25310,
+ 25312,
+ 25313,
+ 25316,
+ 25322,
+ 25323,
+ 25328,
+ 25330,
+ 25333,
+ 25336,
+ 25337,
+ 25338,
+ 25339,
+ 25344,
+ 25347,
+ 25348,
+ 25349,
+ 25350,
+ 25354,
+ 25355,
+ 25356,
+ 25357,
+ 25359,
+ 25360,
+ 25362,
+ 25363,
+ 25364,
+ 25365,
+ 25367,
+ 25368,
+ 25369,
+ 25372,
+ 25382,
+ 25383,
+ 25385,
+ 25388,
+ 25389,
+ 25390,
+ 25392,
+ 25393,
+ 25395,
+ 25396,
+ 25397,
+ 25398,
+ 25399,
+ 25400,
+ 25403,
+ 25404,
+ 25406,
+ 25407,
+ 25408,
+ 25409,
+ 25412,
+ 25415,
+ 25416,
+ 25418,
+ 25425,
+ 25426,
+ 25427,
+ 25428,
+ 25430,
+ 25431,
+ 25432,
+ 25433,
+ 25434,
+ 25435,
+ 25436,
+ 25437,
+ 25440,
+ 25444,
+ 25445,
+ 25446,
+ 25448,
+ 25450,
+ 25451,
+ 25452,
+ 25455,
+ 25456,
+ 25458,
+ 25459,
+ 25460,
+ 25461,
+ 25464,
+ 25465,
+ 25468,
+ 25469,
+ 25470,
+ 25471,
+ 25473,
+ 25475,
+ 25476,
+ 25477,
+ 25478,
+ 25483,
+ 25485,
+ 25489,
+ 25491,
+ 25492,
+ 25493,
+ 25495,
+ 25497,
+ 25498,
+ 25499,
+ 25500,
+ 25501,
+ 25502,
+ 25503,
+ 25505,
+ 25508,
+ 25510,
+ 25515,
+ 25519,
+ 25521,
+ 25522,
+ 25525,
+ 25526,
+ 25529,
+ 25531,
+ 25533,
+ 25535,
+ 25536,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 25537,
+ 25538,
+ 25539,
+ 25541,
+ 25543,
+ 25544,
+ 25546,
+ 25547,
+ 25548,
+ 25553,
+ 25555,
+ 25556,
+ 25557,
+ 25559,
+ 25560,
+ 25561,
+ 25562,
+ 25563,
+ 25564,
+ 25565,
+ 25567,
+ 25570,
+ 25572,
+ 25573,
+ 25574,
+ 25575,
+ 25576,
+ 25579,
+ 25580,
+ 25582,
+ 25583,
+ 25584,
+ 25585,
+ 25587,
+ 25589,
+ 25591,
+ 25593,
+ 25594,
+ 25595,
+ 25596,
+ 25598,
+ 25603,
+ 25604,
+ 25606,
+ 25607,
+ 25608,
+ 25609,
+ 25610,
+ 25613,
+ 25614,
+ 25617,
+ 25618,
+ 25621,
+ 25622,
+ 25623,
+ 25624,
+ 25625,
+ 25626,
+ 25629,
+ 25631,
+ 25634,
+ 25635,
+ 25636,
+ 0,
+ 25637,
+ 25639,
+ 25640,
+ 25641,
+ 25643,
+ 25646,
+ 25647,
+ 25648,
+ 25649,
+ 25650,
+ 25651,
+ 25653,
+ 25654,
+ 25655,
+ 25656,
+ 25657,
+ 25659,
+ 25660,
+ 25662,
+ 25664,
+ 25666,
+ 25667,
+ 25673,
+ 25675,
+ 25676,
+ 25677,
+ 25678,
+ 25679,
+ 25680,
+ 25681,
+ 25683,
+ 25685,
+ 25686,
+ 25687,
+ 25689,
+ 25690,
+ 25691,
+ 25692,
+ 25693,
+ 25695,
+ 25696,
+ 25697,
+ 25698,
+ 25699,
+ 25700,
+ 25701,
+ 25702,
+ 25704,
+ 25706,
+ 25707,
+ 25708,
+ 25710,
+ 25711,
+ 25712,
+ 25713,
+ 25714,
+ 25715,
+ 25716,
+ 25717,
+ 25718,
+ 25719,
+ 25723,
+ 25724,
+ 25725,
+ 25726,
+ 25727,
+ 25728,
+ 25729,
+ 25731,
+ 25734,
+ 25736,
+ 25737,
+ 25738,
+ 25739,
+ 25740,
+ 25741,
+ 25742,
+ 25743,
+ 25744,
+ 25747,
+ 25748,
+ 25751,
+ 25752,
+ 25754,
+ 25755,
+ 25756,
+ 25757,
+ 25759,
+ 25760,
+ 25761,
+ 25762,
+ 25763,
+ 25765,
+ 25766,
+ 25767,
+ 25768,
+ 25770,
+ 25771,
+ 25775,
+ 25777,
+ 25778,
+ 25779,
+ 25780,
+ 25782,
+ 25785,
+ 25787,
+ 25789,
+ 25790,
+ 25791,
+ 25793,
+ 25795,
+ 25796,
+ 25798,
+ 25799,
+ 25800,
+ 25801,
+ 25802,
+ 25803,
+ 25804,
+ 25807,
+ 25809,
+ 25811,
+ 25812,
+ 25813,
+ 25814,
+ 25817,
+ 25818,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 25819,
+ 25820,
+ 25821,
+ 25823,
+ 25824,
+ 25825,
+ 25827,
+ 25829,
+ 25831,
+ 25832,
+ 25833,
+ 25834,
+ 25835,
+ 25836,
+ 25837,
+ 25838,
+ 25839,
+ 25840,
+ 25841,
+ 25842,
+ 25843,
+ 25844,
+ 25845,
+ 25846,
+ 25847,
+ 25848,
+ 25849,
+ 25850,
+ 25851,
+ 25852,
+ 25853,
+ 25854,
+ 25855,
+ 25857,
+ 25858,
+ 25859,
+ 25860,
+ 25861,
+ 25862,
+ 25863,
+ 25864,
+ 25866,
+ 25867,
+ 25868,
+ 25869,
+ 25870,
+ 25871,
+ 25872,
+ 25873,
+ 25875,
+ 25876,
+ 25877,
+ 25878,
+ 25879,
+ 25881,
+ 25882,
+ 25883,
+ 25884,
+ 25885,
+ 25886,
+ 25887,
+ 25888,
+ 25889,
+ 0,
+ 25890,
+ 25891,
+ 25892,
+ 25894,
+ 25895,
+ 25896,
+ 25897,
+ 25898,
+ 25900,
+ 25901,
+ 25904,
+ 25905,
+ 25906,
+ 25907,
+ 25911,
+ 25914,
+ 25916,
+ 25917,
+ 25920,
+ 25921,
+ 25922,
+ 25923,
+ 25924,
+ 25926,
+ 25927,
+ 25930,
+ 25931,
+ 25933,
+ 25934,
+ 25936,
+ 25938,
+ 25939,
+ 25940,
+ 25943,
+ 25944,
+ 25946,
+ 25948,
+ 25951,
+ 25952,
+ 25953,
+ 25956,
+ 25957,
+ 25959,
+ 25960,
+ 25961,
+ 25962,
+ 25965,
+ 25966,
+ 25967,
+ 25969,
+ 25971,
+ 25973,
+ 25974,
+ 25976,
+ 25977,
+ 25978,
+ 25979,
+ 25980,
+ 25981,
+ 25982,
+ 25983,
+ 25984,
+ 25985,
+ 25986,
+ 25987,
+ 25988,
+ 25989,
+ 25990,
+ 25992,
+ 25993,
+ 25994,
+ 25997,
+ 25998,
+ 25999,
+ 26002,
+ 26004,
+ 26005,
+ 26006,
+ 26008,
+ 26010,
+ 26013,
+ 26014,
+ 26016,
+ 26018,
+ 26019,
+ 26022,
+ 26024,
+ 26026,
+ 26028,
+ 26030,
+ 26033,
+ 26034,
+ 26035,
+ 26036,
+ 26037,
+ 26038,
+ 26039,
+ 26040,
+ 26042,
+ 26043,
+ 26046,
+ 26047,
+ 26048,
+ 26050,
+ 26055,
+ 26056,
+ 26057,
+ 26058,
+ 26061,
+ 26064,
+ 26065,
+ 26067,
+ 26068,
+ 26069,
+ 26072,
+ 26073,
+ 26074,
+ 26075,
+ 26076,
+ 26077,
+ 26078,
+ 26079,
+ 26081,
+ 26083,
+ 26084,
+ 26090,
+ 26091,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 26098,
+ 26099,
+ 26100,
+ 26101,
+ 26104,
+ 26105,
+ 26107,
+ 26108,
+ 26109,
+ 26110,
+ 26111,
+ 26113,
+ 26116,
+ 26117,
+ 26119,
+ 26120,
+ 26121,
+ 26123,
+ 26125,
+ 26128,
+ 26129,
+ 26130,
+ 26134,
+ 26135,
+ 26136,
+ 26138,
+ 26139,
+ 26140,
+ 26142,
+ 26145,
+ 26146,
+ 26147,
+ 26148,
+ 26150,
+ 26153,
+ 26154,
+ 26155,
+ 26156,
+ 26158,
+ 26160,
+ 26162,
+ 26163,
+ 26167,
+ 26168,
+ 26169,
+ 26170,
+ 26171,
+ 26173,
+ 26175,
+ 26176,
+ 26178,
+ 26180,
+ 26181,
+ 26182,
+ 26183,
+ 26184,
+ 26185,
+ 26186,
+ 26189,
+ 26190,
+ 26192,
+ 26193,
+ 26200,
+ 0,
+ 26201,
+ 26203,
+ 26204,
+ 26205,
+ 26206,
+ 26208,
+ 26210,
+ 26211,
+ 26213,
+ 26215,
+ 26217,
+ 26218,
+ 26219,
+ 26220,
+ 26221,
+ 26225,
+ 26226,
+ 26227,
+ 26229,
+ 26232,
+ 26233,
+ 26235,
+ 26236,
+ 26237,
+ 26239,
+ 26240,
+ 26241,
+ 26243,
+ 26245,
+ 26246,
+ 26248,
+ 26249,
+ 26250,
+ 26251,
+ 26253,
+ 26254,
+ 26255,
+ 26256,
+ 26258,
+ 26259,
+ 26260,
+ 26261,
+ 26264,
+ 26265,
+ 26266,
+ 26267,
+ 26268,
+ 26270,
+ 26271,
+ 26272,
+ 26273,
+ 26274,
+ 26275,
+ 26276,
+ 26277,
+ 26278,
+ 26281,
+ 26282,
+ 26283,
+ 26284,
+ 26285,
+ 26287,
+ 26288,
+ 26289,
+ 26290,
+ 26291,
+ 26293,
+ 26294,
+ 26295,
+ 26296,
+ 26298,
+ 26299,
+ 26300,
+ 26301,
+ 26303,
+ 26304,
+ 26305,
+ 26306,
+ 26307,
+ 26308,
+ 26309,
+ 26310,
+ 26311,
+ 26312,
+ 26313,
+ 26314,
+ 26315,
+ 26316,
+ 26317,
+ 26318,
+ 26319,
+ 26320,
+ 26321,
+ 26322,
+ 26323,
+ 26324,
+ 26325,
+ 26326,
+ 26327,
+ 26328,
+ 26330,
+ 26334,
+ 26335,
+ 26336,
+ 26337,
+ 26338,
+ 26339,
+ 26340,
+ 26341,
+ 26343,
+ 26344,
+ 26346,
+ 26347,
+ 26348,
+ 26349,
+ 26350,
+ 26351,
+ 26353,
+ 26357,
+ 26358,
+ 26360,
+ 26362,
+ 26363,
+ 26365,
+ 26369,
+ 26370,
+ 26371,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 26372,
+ 26373,
+ 26374,
+ 26375,
+ 26380,
+ 26382,
+ 26383,
+ 26385,
+ 26386,
+ 26387,
+ 26390,
+ 26392,
+ 26393,
+ 26394,
+ 26396,
+ 26398,
+ 26400,
+ 26401,
+ 26402,
+ 26403,
+ 26404,
+ 26405,
+ 26407,
+ 26409,
+ 26414,
+ 26416,
+ 26418,
+ 26419,
+ 26422,
+ 26423,
+ 26424,
+ 26425,
+ 26427,
+ 26428,
+ 26430,
+ 26431,
+ 26433,
+ 26436,
+ 26437,
+ 26439,
+ 26442,
+ 26443,
+ 26445,
+ 26450,
+ 26452,
+ 26453,
+ 26455,
+ 26456,
+ 26457,
+ 26458,
+ 26459,
+ 26461,
+ 26466,
+ 26467,
+ 26468,
+ 26470,
+ 26471,
+ 26475,
+ 26476,
+ 26478,
+ 26481,
+ 26484,
+ 26486,
+ 0,
+ 26488,
+ 26489,
+ 26490,
+ 26491,
+ 26493,
+ 26496,
+ 26498,
+ 26499,
+ 26501,
+ 26502,
+ 26504,
+ 26506,
+ 26508,
+ 26509,
+ 26510,
+ 26511,
+ 26513,
+ 26514,
+ 26515,
+ 26516,
+ 26518,
+ 26521,
+ 26523,
+ 26527,
+ 26528,
+ 26529,
+ 26532,
+ 26534,
+ 26537,
+ 26540,
+ 26542,
+ 26545,
+ 26546,
+ 26548,
+ 26553,
+ 26554,
+ 26555,
+ 26556,
+ 26557,
+ 26558,
+ 26559,
+ 26560,
+ 26562,
+ 26565,
+ 26566,
+ 26567,
+ 26568,
+ 26569,
+ 26570,
+ 26571,
+ 26572,
+ 26573,
+ 26574,
+ 26581,
+ 26582,
+ 26583,
+ 26587,
+ 26591,
+ 26593,
+ 26595,
+ 26596,
+ 26598,
+ 26599,
+ 26600,
+ 26602,
+ 26603,
+ 26605,
+ 26606,
+ 26610,
+ 26613,
+ 26614,
+ 26615,
+ 26616,
+ 26617,
+ 26618,
+ 26619,
+ 26620,
+ 26622,
+ 26625,
+ 26626,
+ 26627,
+ 26628,
+ 26630,
+ 26637,
+ 26640,
+ 26642,
+ 26644,
+ 26645,
+ 26648,
+ 26649,
+ 26650,
+ 26651,
+ 26652,
+ 26654,
+ 26655,
+ 26656,
+ 26658,
+ 26659,
+ 26660,
+ 26661,
+ 26662,
+ 26663,
+ 26664,
+ 26667,
+ 26668,
+ 26669,
+ 26670,
+ 26671,
+ 26672,
+ 26673,
+ 26676,
+ 26677,
+ 26678,
+ 26682,
+ 26683,
+ 26687,
+ 26695,
+ 26699,
+ 26701,
+ 26703,
+ 26706,
+ 26710,
+ 26711,
+ 26712,
+ 26713,
+ 26714,
+ 26715,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 26716,
+ 26717,
+ 26718,
+ 26719,
+ 26730,
+ 26732,
+ 26733,
+ 26734,
+ 26735,
+ 26736,
+ 26737,
+ 26738,
+ 26739,
+ 26741,
+ 26744,
+ 26745,
+ 26746,
+ 26747,
+ 26748,
+ 26749,
+ 26750,
+ 26751,
+ 26752,
+ 26754,
+ 26756,
+ 26759,
+ 26760,
+ 26761,
+ 26762,
+ 26763,
+ 26764,
+ 26765,
+ 26766,
+ 26768,
+ 26769,
+ 26770,
+ 26772,
+ 26773,
+ 26774,
+ 26776,
+ 26777,
+ 26778,
+ 26779,
+ 26780,
+ 26781,
+ 26782,
+ 26783,
+ 26784,
+ 26785,
+ 26787,
+ 26788,
+ 26789,
+ 26793,
+ 26794,
+ 26795,
+ 26796,
+ 26798,
+ 26801,
+ 26802,
+ 26804,
+ 26806,
+ 26807,
+ 26808,
+ 0,
+ 26809,
+ 26810,
+ 26811,
+ 26812,
+ 26813,
+ 26814,
+ 26815,
+ 26817,
+ 26819,
+ 26820,
+ 26821,
+ 26822,
+ 26823,
+ 26824,
+ 26826,
+ 26828,
+ 26830,
+ 26831,
+ 26832,
+ 26833,
+ 26835,
+ 26836,
+ 26838,
+ 26839,
+ 26841,
+ 26843,
+ 26844,
+ 26845,
+ 26846,
+ 26847,
+ 26849,
+ 26850,
+ 26852,
+ 26853,
+ 26854,
+ 26855,
+ 26856,
+ 26857,
+ 26858,
+ 26859,
+ 26860,
+ 26861,
+ 26863,
+ 26866,
+ 26867,
+ 26868,
+ 26870,
+ 26871,
+ 26872,
+ 26875,
+ 26877,
+ 26878,
+ 26879,
+ 26880,
+ 26882,
+ 26883,
+ 26884,
+ 26886,
+ 26887,
+ 26888,
+ 26889,
+ 26890,
+ 26892,
+ 26895,
+ 26897,
+ 26899,
+ 26900,
+ 26901,
+ 26902,
+ 26903,
+ 26904,
+ 26905,
+ 26906,
+ 26907,
+ 26908,
+ 26909,
+ 26910,
+ 26913,
+ 26914,
+ 26915,
+ 26917,
+ 26918,
+ 26919,
+ 26920,
+ 26921,
+ 26922,
+ 26923,
+ 26924,
+ 26926,
+ 26927,
+ 26929,
+ 26930,
+ 26931,
+ 26933,
+ 26934,
+ 26935,
+ 26936,
+ 26938,
+ 26939,
+ 26940,
+ 26942,
+ 26944,
+ 26945,
+ 26947,
+ 26948,
+ 26949,
+ 26950,
+ 26951,
+ 26952,
+ 26953,
+ 26954,
+ 26955,
+ 26956,
+ 26957,
+ 26958,
+ 26959,
+ 26960,
+ 26961,
+ 26962,
+ 26963,
+ 26965,
+ 26966,
+ 26968,
+ 26969,
+ 26971,
+ 26972,
+ 26975,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 26977,
+ 26978,
+ 26980,
+ 26981,
+ 26983,
+ 26984,
+ 26985,
+ 26986,
+ 26988,
+ 26989,
+ 26991,
+ 26992,
+ 26994,
+ 26995,
+ 26996,
+ 26997,
+ 26998,
+ 27002,
+ 27003,
+ 27005,
+ 27006,
+ 27007,
+ 27009,
+ 27011,
+ 27013,
+ 27018,
+ 27019,
+ 27020,
+ 27022,
+ 27023,
+ 27024,
+ 27025,
+ 27026,
+ 27027,
+ 27030,
+ 27031,
+ 27033,
+ 27034,
+ 27037,
+ 27038,
+ 27039,
+ 27040,
+ 27041,
+ 27042,
+ 27043,
+ 27044,
+ 27045,
+ 27046,
+ 27049,
+ 27050,
+ 27052,
+ 27054,
+ 27055,
+ 27056,
+ 27058,
+ 27059,
+ 27061,
+ 27062,
+ 27064,
+ 27065,
+ 27066,
+ 27068,
+ 27069,
+ 0,
+ 27070,
+ 27071,
+ 27072,
+ 27074,
+ 27075,
+ 27076,
+ 27077,
+ 27078,
+ 27079,
+ 27080,
+ 27081,
+ 27083,
+ 27085,
+ 27087,
+ 27089,
+ 27090,
+ 27091,
+ 27093,
+ 27094,
+ 27095,
+ 27096,
+ 27097,
+ 27098,
+ 27100,
+ 27101,
+ 27102,
+ 27105,
+ 27106,
+ 27107,
+ 27108,
+ 27109,
+ 27110,
+ 27111,
+ 27112,
+ 27113,
+ 27114,
+ 27115,
+ 27116,
+ 27118,
+ 27119,
+ 27120,
+ 27121,
+ 27123,
+ 27124,
+ 27125,
+ 27126,
+ 27127,
+ 27128,
+ 27129,
+ 27130,
+ 27131,
+ 27132,
+ 27134,
+ 27136,
+ 27137,
+ 27138,
+ 27139,
+ 27140,
+ 27141,
+ 27142,
+ 27143,
+ 27144,
+ 27145,
+ 27147,
+ 27148,
+ 27149,
+ 27150,
+ 27151,
+ 27152,
+ 27153,
+ 27154,
+ 27155,
+ 27156,
+ 27157,
+ 27158,
+ 27161,
+ 27162,
+ 27163,
+ 27164,
+ 27165,
+ 27166,
+ 27168,
+ 27170,
+ 27171,
+ 27172,
+ 27173,
+ 27174,
+ 27175,
+ 27177,
+ 27179,
+ 27180,
+ 27181,
+ 27182,
+ 27184,
+ 27186,
+ 27187,
+ 27188,
+ 27190,
+ 27191,
+ 27192,
+ 27193,
+ 27194,
+ 27195,
+ 27196,
+ 27199,
+ 27200,
+ 27201,
+ 27202,
+ 27203,
+ 27205,
+ 27206,
+ 27208,
+ 27209,
+ 27210,
+ 27211,
+ 27212,
+ 27213,
+ 27214,
+ 27215,
+ 27217,
+ 27218,
+ 27219,
+ 27220,
+ 27221,
+ 27222,
+ 27223,
+ 27226,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 27228,
+ 27229,
+ 27230,
+ 27231,
+ 27232,
+ 27234,
+ 27235,
+ 27236,
+ 27238,
+ 27239,
+ 27240,
+ 27241,
+ 27242,
+ 27243,
+ 27244,
+ 27245,
+ 27246,
+ 27247,
+ 27248,
+ 27250,
+ 27251,
+ 27252,
+ 27253,
+ 27254,
+ 27255,
+ 27256,
+ 27258,
+ 27259,
+ 27261,
+ 27262,
+ 27263,
+ 27265,
+ 27266,
+ 27267,
+ 27269,
+ 27270,
+ 27271,
+ 27272,
+ 27273,
+ 27274,
+ 27275,
+ 27276,
+ 27277,
+ 27279,
+ 27282,
+ 27283,
+ 27284,
+ 27285,
+ 27286,
+ 27288,
+ 27289,
+ 27290,
+ 27291,
+ 27292,
+ 27293,
+ 27294,
+ 27295,
+ 27297,
+ 27298,
+ 27299,
+ 27300,
+ 27301,
+ 27302,
+ 0,
+ 27303,
+ 27304,
+ 27306,
+ 27309,
+ 27310,
+ 27311,
+ 27312,
+ 27313,
+ 27314,
+ 27315,
+ 27316,
+ 27317,
+ 27318,
+ 27319,
+ 27320,
+ 27321,
+ 27322,
+ 27323,
+ 27324,
+ 27325,
+ 27326,
+ 27327,
+ 27328,
+ 27329,
+ 27330,
+ 27331,
+ 27332,
+ 27333,
+ 27334,
+ 27335,
+ 27336,
+ 27337,
+ 27338,
+ 27339,
+ 27340,
+ 27341,
+ 27342,
+ 27343,
+ 27344,
+ 27345,
+ 27346,
+ 27347,
+ 27348,
+ 27349,
+ 27350,
+ 27351,
+ 27352,
+ 27353,
+ 27354,
+ 27355,
+ 27356,
+ 27357,
+ 27358,
+ 27359,
+ 27360,
+ 27361,
+ 27362,
+ 27363,
+ 27364,
+ 27365,
+ 27366,
+ 27367,
+ 27368,
+ 27369,
+ 27370,
+ 27371,
+ 27372,
+ 27373,
+ 27374,
+ 27375,
+ 27376,
+ 27377,
+ 27378,
+ 27379,
+ 27380,
+ 27381,
+ 27382,
+ 27383,
+ 27384,
+ 27385,
+ 27386,
+ 27387,
+ 27388,
+ 27389,
+ 27390,
+ 27391,
+ 27392,
+ 27393,
+ 27394,
+ 27395,
+ 27396,
+ 27397,
+ 27398,
+ 27399,
+ 27400,
+ 27401,
+ 27402,
+ 27403,
+ 27404,
+ 27405,
+ 27406,
+ 27407,
+ 27408,
+ 27409,
+ 27410,
+ 27411,
+ 27412,
+ 27413,
+ 27414,
+ 27415,
+ 27416,
+ 27417,
+ 27418,
+ 27419,
+ 27420,
+ 27421,
+ 27422,
+ 27423,
+ 27429,
+ 27430,
+ 27432,
+ 27433,
+ 27434,
+ 27435,
+ 27436,
+ 27437,
+ 27438,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 27439,
+ 27440,
+ 27441,
+ 27443,
+ 27444,
+ 27445,
+ 27446,
+ 27448,
+ 27451,
+ 27452,
+ 27453,
+ 27455,
+ 27456,
+ 27457,
+ 27458,
+ 27460,
+ 27461,
+ 27464,
+ 27466,
+ 27467,
+ 27469,
+ 27470,
+ 27471,
+ 27472,
+ 27473,
+ 27474,
+ 27475,
+ 27476,
+ 27477,
+ 27478,
+ 27479,
+ 27480,
+ 27482,
+ 27483,
+ 27484,
+ 27485,
+ 27486,
+ 27487,
+ 27488,
+ 27489,
+ 27496,
+ 27497,
+ 27499,
+ 27500,
+ 27501,
+ 27502,
+ 27503,
+ 27504,
+ 27505,
+ 27506,
+ 27507,
+ 27508,
+ 27509,
+ 27510,
+ 27511,
+ 27512,
+ 27514,
+ 27517,
+ 27518,
+ 27519,
+ 27520,
+ 27525,
+ 27528,
+ 0,
+ 27532,
+ 27534,
+ 27535,
+ 27536,
+ 27537,
+ 27540,
+ 27541,
+ 27543,
+ 27544,
+ 27545,
+ 27548,
+ 27549,
+ 27550,
+ 27551,
+ 27552,
+ 27554,
+ 27555,
+ 27556,
+ 27557,
+ 27558,
+ 27559,
+ 27560,
+ 27561,
+ 27563,
+ 27564,
+ 27565,
+ 27566,
+ 27567,
+ 27568,
+ 27569,
+ 27570,
+ 27574,
+ 27576,
+ 27577,
+ 27578,
+ 27579,
+ 27580,
+ 27581,
+ 27582,
+ 27584,
+ 27587,
+ 27588,
+ 27590,
+ 27591,
+ 27592,
+ 27593,
+ 27594,
+ 27596,
+ 27598,
+ 27600,
+ 27601,
+ 27608,
+ 27610,
+ 27612,
+ 27613,
+ 27614,
+ 27615,
+ 27616,
+ 27618,
+ 27619,
+ 27620,
+ 27621,
+ 27622,
+ 27623,
+ 27624,
+ 27625,
+ 27628,
+ 27629,
+ 27630,
+ 27632,
+ 27633,
+ 27634,
+ 27636,
+ 27638,
+ 27639,
+ 27640,
+ 27642,
+ 27643,
+ 27644,
+ 27646,
+ 27647,
+ 27648,
+ 27649,
+ 27650,
+ 27651,
+ 27652,
+ 27656,
+ 27657,
+ 27658,
+ 27659,
+ 27660,
+ 27662,
+ 27666,
+ 27671,
+ 27676,
+ 27677,
+ 27678,
+ 27680,
+ 27683,
+ 27685,
+ 27691,
+ 27692,
+ 27693,
+ 27697,
+ 27699,
+ 27702,
+ 27703,
+ 27705,
+ 27706,
+ 27707,
+ 27708,
+ 27710,
+ 27711,
+ 27715,
+ 27716,
+ 27717,
+ 27720,
+ 27723,
+ 27724,
+ 27725,
+ 27726,
+ 27727,
+ 27729,
+ 27730,
+ 27731,
+ 27734,
+ 27736,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 27737,
+ 27738,
+ 27746,
+ 27747,
+ 27749,
+ 27750,
+ 27751,
+ 27755,
+ 27756,
+ 27757,
+ 27758,
+ 27759,
+ 27761,
+ 27763,
+ 27765,
+ 27767,
+ 27768,
+ 27770,
+ 27771,
+ 27772,
+ 27775,
+ 27776,
+ 27780,
+ 27783,
+ 27786,
+ 27787,
+ 27789,
+ 27790,
+ 27793,
+ 27794,
+ 27797,
+ 27798,
+ 27799,
+ 27800,
+ 27802,
+ 27804,
+ 27805,
+ 27806,
+ 27808,
+ 27810,
+ 27816,
+ 27820,
+ 27823,
+ 27824,
+ 27828,
+ 27829,
+ 27830,
+ 27831,
+ 27834,
+ 27840,
+ 27841,
+ 27842,
+ 27843,
+ 27846,
+ 27847,
+ 27848,
+ 27851,
+ 27853,
+ 27854,
+ 27855,
+ 27857,
+ 27858,
+ 27864,
+ 0,
+ 27865,
+ 27866,
+ 27868,
+ 27869,
+ 27871,
+ 27876,
+ 27878,
+ 27879,
+ 27881,
+ 27884,
+ 27885,
+ 27890,
+ 27892,
+ 27897,
+ 27903,
+ 27904,
+ 27906,
+ 27907,
+ 27909,
+ 27910,
+ 27912,
+ 27913,
+ 27914,
+ 27917,
+ 27919,
+ 27920,
+ 27921,
+ 27923,
+ 27924,
+ 27925,
+ 27926,
+ 27928,
+ 27932,
+ 27933,
+ 27935,
+ 27936,
+ 27937,
+ 27938,
+ 27939,
+ 27940,
+ 27942,
+ 27944,
+ 27945,
+ 27948,
+ 27949,
+ 27951,
+ 27952,
+ 27956,
+ 27958,
+ 27959,
+ 27960,
+ 27962,
+ 27967,
+ 27968,
+ 27970,
+ 27972,
+ 27977,
+ 27980,
+ 27984,
+ 27989,
+ 27990,
+ 27991,
+ 27992,
+ 27995,
+ 27997,
+ 27999,
+ 28001,
+ 28002,
+ 28004,
+ 28005,
+ 28007,
+ 28008,
+ 28011,
+ 28012,
+ 28013,
+ 28016,
+ 28017,
+ 28018,
+ 28019,
+ 28021,
+ 28022,
+ 28025,
+ 28026,
+ 28027,
+ 28029,
+ 28030,
+ 28031,
+ 28032,
+ 28033,
+ 28035,
+ 28036,
+ 28038,
+ 28039,
+ 28042,
+ 28043,
+ 28045,
+ 28047,
+ 28048,
+ 28050,
+ 28054,
+ 28055,
+ 28056,
+ 28057,
+ 28058,
+ 28060,
+ 28066,
+ 28069,
+ 28076,
+ 28077,
+ 28080,
+ 28081,
+ 28083,
+ 28084,
+ 28086,
+ 28087,
+ 28089,
+ 28090,
+ 28091,
+ 28092,
+ 28093,
+ 28094,
+ 28097,
+ 28098,
+ 28099,
+ 28104,
+ 28105,
+ 28106,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 28109,
+ 28110,
+ 28111,
+ 28112,
+ 28114,
+ 28115,
+ 28116,
+ 28117,
+ 28119,
+ 28122,
+ 28123,
+ 28124,
+ 28127,
+ 28130,
+ 28131,
+ 28133,
+ 28135,
+ 28136,
+ 28137,
+ 28138,
+ 28141,
+ 28143,
+ 28144,
+ 28146,
+ 28148,
+ 28149,
+ 28150,
+ 28152,
+ 28154,
+ 28157,
+ 28158,
+ 28159,
+ 28160,
+ 28161,
+ 28162,
+ 28163,
+ 28164,
+ 28166,
+ 28167,
+ 28168,
+ 28169,
+ 28171,
+ 28175,
+ 28178,
+ 28179,
+ 28181,
+ 28184,
+ 28185,
+ 28187,
+ 28188,
+ 28190,
+ 28191,
+ 28194,
+ 28198,
+ 28199,
+ 28200,
+ 28202,
+ 28204,
+ 28206,
+ 28208,
+ 28209,
+ 28211,
+ 28213,
+ 0,
+ 28214,
+ 28215,
+ 28217,
+ 28219,
+ 28220,
+ 28221,
+ 28222,
+ 28223,
+ 28224,
+ 28225,
+ 28226,
+ 28229,
+ 28230,
+ 28231,
+ 28232,
+ 28233,
+ 28234,
+ 28235,
+ 28236,
+ 28239,
+ 28240,
+ 28241,
+ 28242,
+ 28245,
+ 28247,
+ 28249,
+ 28250,
+ 28252,
+ 28253,
+ 28254,
+ 28256,
+ 28257,
+ 28258,
+ 28259,
+ 28260,
+ 28261,
+ 28262,
+ 28263,
+ 28264,
+ 28265,
+ 28266,
+ 28268,
+ 28269,
+ 28271,
+ 28272,
+ 28273,
+ 28274,
+ 28275,
+ 28276,
+ 28277,
+ 28278,
+ 28279,
+ 28280,
+ 28281,
+ 28282,
+ 28283,
+ 28284,
+ 28285,
+ 28288,
+ 28289,
+ 28290,
+ 28292,
+ 28295,
+ 28296,
+ 28298,
+ 28299,
+ 28300,
+ 28301,
+ 28302,
+ 28305,
+ 28306,
+ 28307,
+ 28308,
+ 28309,
+ 28310,
+ 28311,
+ 28313,
+ 28314,
+ 28315,
+ 28317,
+ 28318,
+ 28320,
+ 28321,
+ 28323,
+ 28324,
+ 28326,
+ 28328,
+ 28329,
+ 28331,
+ 28332,
+ 28333,
+ 28334,
+ 28336,
+ 28339,
+ 28341,
+ 28344,
+ 28345,
+ 28348,
+ 28350,
+ 28351,
+ 28352,
+ 28355,
+ 28356,
+ 28357,
+ 28358,
+ 28360,
+ 28361,
+ 28362,
+ 28364,
+ 28365,
+ 28366,
+ 28368,
+ 28370,
+ 28374,
+ 28376,
+ 28377,
+ 28379,
+ 28380,
+ 28381,
+ 28387,
+ 28391,
+ 28394,
+ 28395,
+ 28396,
+ 28397,
+ 28398,
+ 28399,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 28400,
+ 28401,
+ 28402,
+ 28403,
+ 28405,
+ 28406,
+ 28407,
+ 28408,
+ 28410,
+ 28411,
+ 28412,
+ 28413,
+ 28414,
+ 28415,
+ 28416,
+ 28417,
+ 28419,
+ 28420,
+ 28421,
+ 28423,
+ 28424,
+ 28426,
+ 28427,
+ 28428,
+ 28429,
+ 28430,
+ 28432,
+ 28433,
+ 28434,
+ 28438,
+ 28439,
+ 28440,
+ 28441,
+ 28442,
+ 28443,
+ 28444,
+ 28445,
+ 28446,
+ 28447,
+ 28449,
+ 28450,
+ 28451,
+ 28453,
+ 28454,
+ 28455,
+ 28456,
+ 28460,
+ 28462,
+ 28464,
+ 28466,
+ 28468,
+ 28469,
+ 28471,
+ 28472,
+ 28473,
+ 28474,
+ 28475,
+ 28476,
+ 28477,
+ 28479,
+ 28480,
+ 28481,
+ 28482,
+ 0,
+ 28483,
+ 28484,
+ 28485,
+ 28488,
+ 28489,
+ 28490,
+ 28492,
+ 28494,
+ 28495,
+ 28496,
+ 28497,
+ 28498,
+ 28499,
+ 28500,
+ 28501,
+ 28502,
+ 28503,
+ 28505,
+ 28506,
+ 28507,
+ 28509,
+ 28511,
+ 28512,
+ 28513,
+ 28515,
+ 28516,
+ 28517,
+ 28519,
+ 28520,
+ 28521,
+ 28522,
+ 28523,
+ 28524,
+ 28527,
+ 28528,
+ 28529,
+ 28531,
+ 28533,
+ 28534,
+ 28535,
+ 28537,
+ 28539,
+ 28541,
+ 28542,
+ 28543,
+ 28544,
+ 28545,
+ 28546,
+ 28547,
+ 28549,
+ 28550,
+ 28551,
+ 28554,
+ 28555,
+ 28559,
+ 28560,
+ 28561,
+ 28562,
+ 28563,
+ 28564,
+ 28565,
+ 28566,
+ 28567,
+ 28568,
+ 28569,
+ 28570,
+ 28571,
+ 28573,
+ 28574,
+ 28575,
+ 28576,
+ 28578,
+ 28579,
+ 28580,
+ 28581,
+ 28582,
+ 28584,
+ 28585,
+ 28586,
+ 28587,
+ 28588,
+ 28589,
+ 28590,
+ 28591,
+ 28592,
+ 28593,
+ 28594,
+ 28596,
+ 28597,
+ 28599,
+ 28600,
+ 28602,
+ 28603,
+ 28604,
+ 28605,
+ 28606,
+ 28607,
+ 28609,
+ 28611,
+ 28612,
+ 28613,
+ 28614,
+ 28615,
+ 28616,
+ 28618,
+ 28619,
+ 28620,
+ 28621,
+ 28622,
+ 28623,
+ 28624,
+ 28627,
+ 28628,
+ 28629,
+ 28630,
+ 28631,
+ 28632,
+ 28633,
+ 28634,
+ 28635,
+ 28636,
+ 28637,
+ 28639,
+ 28642,
+ 28643,
+ 28644,
+ 28645,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 28646,
+ 28647,
+ 28648,
+ 28649,
+ 28650,
+ 28651,
+ 28652,
+ 28653,
+ 28656,
+ 28657,
+ 28658,
+ 28659,
+ 28660,
+ 28661,
+ 28662,
+ 28663,
+ 28664,
+ 28665,
+ 28666,
+ 28667,
+ 28668,
+ 28669,
+ 28670,
+ 28671,
+ 28672,
+ 28673,
+ 28674,
+ 28675,
+ 28676,
+ 28677,
+ 28678,
+ 28679,
+ 28680,
+ 28681,
+ 28682,
+ 28683,
+ 28684,
+ 28685,
+ 28686,
+ 28687,
+ 28688,
+ 28690,
+ 28691,
+ 28692,
+ 28693,
+ 28694,
+ 28695,
+ 28696,
+ 28697,
+ 28700,
+ 28701,
+ 28702,
+ 28703,
+ 28704,
+ 28705,
+ 28706,
+ 28708,
+ 28709,
+ 28710,
+ 28711,
+ 28712,
+ 28713,
+ 28714,
+ 0,
+ 28715,
+ 28716,
+ 28717,
+ 28718,
+ 28719,
+ 28720,
+ 28721,
+ 28722,
+ 28723,
+ 28724,
+ 28726,
+ 28727,
+ 28728,
+ 28730,
+ 28731,
+ 28732,
+ 28733,
+ 28734,
+ 28735,
+ 28736,
+ 28737,
+ 28738,
+ 28739,
+ 28740,
+ 28741,
+ 28742,
+ 28743,
+ 28744,
+ 28745,
+ 28746,
+ 28747,
+ 28749,
+ 28750,
+ 28752,
+ 28753,
+ 28754,
+ 28755,
+ 28756,
+ 28757,
+ 28758,
+ 28759,
+ 28760,
+ 28761,
+ 28762,
+ 28763,
+ 28764,
+ 28765,
+ 28767,
+ 28768,
+ 28769,
+ 28770,
+ 28771,
+ 28772,
+ 28773,
+ 28774,
+ 28775,
+ 28776,
+ 28777,
+ 28778,
+ 28782,
+ 28785,
+ 28786,
+ 28787,
+ 28788,
+ 28791,
+ 28793,
+ 28794,
+ 28795,
+ 28797,
+ 28801,
+ 28802,
+ 28803,
+ 28804,
+ 28806,
+ 28807,
+ 28808,
+ 28811,
+ 28812,
+ 28813,
+ 28815,
+ 28816,
+ 28817,
+ 28819,
+ 28823,
+ 28824,
+ 28826,
+ 28827,
+ 28830,
+ 28831,
+ 28832,
+ 28833,
+ 28834,
+ 28835,
+ 28836,
+ 28837,
+ 28838,
+ 28839,
+ 28840,
+ 28841,
+ 28842,
+ 28848,
+ 28850,
+ 28852,
+ 28853,
+ 28854,
+ 28858,
+ 28862,
+ 28863,
+ 28868,
+ 28869,
+ 28870,
+ 28871,
+ 28873,
+ 28875,
+ 28876,
+ 28877,
+ 28878,
+ 28879,
+ 28880,
+ 28881,
+ 28882,
+ 28883,
+ 28884,
+ 28885,
+ 28886,
+ 28887,
+ 28890,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 28892,
+ 28893,
+ 28894,
+ 28896,
+ 28897,
+ 28898,
+ 28899,
+ 28901,
+ 28906,
+ 28910,
+ 28912,
+ 28913,
+ 28914,
+ 28915,
+ 28916,
+ 28917,
+ 28918,
+ 28920,
+ 28922,
+ 28923,
+ 28924,
+ 28926,
+ 28927,
+ 28928,
+ 28929,
+ 28930,
+ 28931,
+ 28932,
+ 28933,
+ 28934,
+ 28935,
+ 28936,
+ 28939,
+ 28940,
+ 28941,
+ 28942,
+ 28943,
+ 28945,
+ 28946,
+ 28948,
+ 28951,
+ 28955,
+ 28956,
+ 28957,
+ 28958,
+ 28959,
+ 28960,
+ 28961,
+ 28962,
+ 28963,
+ 28964,
+ 28965,
+ 28967,
+ 28968,
+ 28969,
+ 28970,
+ 28971,
+ 28972,
+ 28973,
+ 28974,
+ 28978,
+ 28979,
+ 28980,
+ 0,
+ 28981,
+ 28983,
+ 28984,
+ 28985,
+ 28986,
+ 28987,
+ 28988,
+ 28989,
+ 28990,
+ 28991,
+ 28992,
+ 28993,
+ 28994,
+ 28995,
+ 28996,
+ 28998,
+ 28999,
+ 29000,
+ 29001,
+ 29003,
+ 29005,
+ 29007,
+ 29008,
+ 29009,
+ 29010,
+ 29011,
+ 29012,
+ 29013,
+ 29014,
+ 29015,
+ 29016,
+ 29017,
+ 29018,
+ 29019,
+ 29021,
+ 29023,
+ 29024,
+ 29025,
+ 29026,
+ 29027,
+ 29029,
+ 29033,
+ 29034,
+ 29035,
+ 29036,
+ 29037,
+ 29039,
+ 29040,
+ 29041,
+ 29044,
+ 29045,
+ 29046,
+ 29047,
+ 29049,
+ 29051,
+ 29052,
+ 29054,
+ 29055,
+ 29056,
+ 29057,
+ 29058,
+ 29059,
+ 29061,
+ 29062,
+ 29063,
+ 29064,
+ 29065,
+ 29067,
+ 29068,
+ 29069,
+ 29070,
+ 29072,
+ 29073,
+ 29074,
+ 29075,
+ 29077,
+ 29078,
+ 29079,
+ 29082,
+ 29083,
+ 29084,
+ 29085,
+ 29086,
+ 29089,
+ 29090,
+ 29091,
+ 29092,
+ 29093,
+ 29094,
+ 29095,
+ 29097,
+ 29098,
+ 29099,
+ 29101,
+ 29102,
+ 29103,
+ 29104,
+ 29105,
+ 29106,
+ 29108,
+ 29110,
+ 29111,
+ 29112,
+ 29114,
+ 29115,
+ 29116,
+ 29117,
+ 29118,
+ 29119,
+ 29120,
+ 29121,
+ 29122,
+ 29124,
+ 29125,
+ 29126,
+ 29127,
+ 29128,
+ 29129,
+ 29130,
+ 29131,
+ 29132,
+ 29133,
+ 29135,
+ 29136,
+ 29137,
+ 29138,
+ 29139,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 29142,
+ 29143,
+ 29144,
+ 29145,
+ 29146,
+ 29147,
+ 29148,
+ 29149,
+ 29150,
+ 29151,
+ 29153,
+ 29154,
+ 29155,
+ 29156,
+ 29158,
+ 29160,
+ 29161,
+ 29162,
+ 29163,
+ 29164,
+ 29165,
+ 29167,
+ 29168,
+ 29169,
+ 29170,
+ 29171,
+ 29172,
+ 29173,
+ 29174,
+ 29175,
+ 29176,
+ 29178,
+ 29179,
+ 29180,
+ 29181,
+ 29182,
+ 29183,
+ 29184,
+ 29185,
+ 29186,
+ 29187,
+ 29188,
+ 29189,
+ 29191,
+ 29192,
+ 29193,
+ 29194,
+ 29195,
+ 29196,
+ 29197,
+ 29198,
+ 29199,
+ 29200,
+ 29201,
+ 29202,
+ 29203,
+ 29204,
+ 29205,
+ 29206,
+ 29207,
+ 29208,
+ 29209,
+ 29210,
+ 0,
+ 29211,
+ 29212,
+ 29214,
+ 29215,
+ 29216,
+ 29217,
+ 29218,
+ 29219,
+ 29220,
+ 29221,
+ 29222,
+ 29223,
+ 29225,
+ 29227,
+ 29229,
+ 29230,
+ 29231,
+ 29234,
+ 29235,
+ 29236,
+ 29242,
+ 29244,
+ 29246,
+ 29248,
+ 29249,
+ 29250,
+ 29251,
+ 29252,
+ 29253,
+ 29254,
+ 29257,
+ 29258,
+ 29259,
+ 29262,
+ 29263,
+ 29264,
+ 29265,
+ 29267,
+ 29268,
+ 29269,
+ 29271,
+ 29272,
+ 29274,
+ 29276,
+ 29278,
+ 29280,
+ 29283,
+ 29284,
+ 29285,
+ 29288,
+ 29290,
+ 29291,
+ 29292,
+ 29293,
+ 29296,
+ 29297,
+ 29299,
+ 29300,
+ 29302,
+ 29303,
+ 29304,
+ 29307,
+ 29308,
+ 29309,
+ 29314,
+ 29315,
+ 29317,
+ 29318,
+ 29319,
+ 29320,
+ 29321,
+ 29324,
+ 29326,
+ 29328,
+ 29329,
+ 29331,
+ 29332,
+ 29333,
+ 29334,
+ 29335,
+ 29336,
+ 29337,
+ 29338,
+ 29339,
+ 29340,
+ 29341,
+ 29342,
+ 29344,
+ 29345,
+ 29346,
+ 29347,
+ 29348,
+ 29349,
+ 29350,
+ 29351,
+ 29352,
+ 29353,
+ 29354,
+ 29355,
+ 29358,
+ 29361,
+ 29362,
+ 29363,
+ 29365,
+ 29370,
+ 29371,
+ 29372,
+ 29373,
+ 29374,
+ 29375,
+ 29376,
+ 29381,
+ 29382,
+ 29383,
+ 29385,
+ 29386,
+ 29387,
+ 29388,
+ 29391,
+ 29393,
+ 29395,
+ 29396,
+ 29397,
+ 29398,
+ 29400,
+ 29402,
+ 29403,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 58566,
+ 58567,
+ 58568,
+ 58569,
+ 58570,
+ 58571,
+ 58572,
+ 58573,
+ 58574,
+ 58575,
+ 58576,
+ 58577,
+ 58578,
+ 58579,
+ 58580,
+ 58581,
+ 58582,
+ 58583,
+ 58584,
+ 58585,
+ 58586,
+ 58587,
+ 58588,
+ 58589,
+ 58590,
+ 58591,
+ 58592,
+ 58593,
+ 58594,
+ 58595,
+ 58596,
+ 58597,
+ 58598,
+ 58599,
+ 58600,
+ 58601,
+ 58602,
+ 58603,
+ 58604,
+ 58605,
+ 58606,
+ 58607,
+ 58608,
+ 58609,
+ 58610,
+ 58611,
+ 58612,
+ 58613,
+ 58614,
+ 58615,
+ 58616,
+ 58617,
+ 58618,
+ 58619,
+ 58620,
+ 58621,
+ 58622,
+ 58623,
+ 58624,
+ 58625,
+ 58626,
+ 58627,
+ 58628,
+ 0,
+ 58629,
+ 58630,
+ 58631,
+ 58632,
+ 58633,
+ 58634,
+ 58635,
+ 58636,
+ 58637,
+ 58638,
+ 58639,
+ 58640,
+ 58641,
+ 58642,
+ 58643,
+ 58644,
+ 58645,
+ 58646,
+ 58647,
+ 58648,
+ 58649,
+ 58650,
+ 58651,
+ 58652,
+ 58653,
+ 58654,
+ 58655,
+ 58656,
+ 58657,
+ 58658,
+ 58659,
+ 58660,
+ 58661,
+ 12288,
+ 12289,
+ 12290,
+ 183,
+ 713,
+ 711,
+ 168,
+ 12291,
+ 12293,
+ 8212,
+ 65374,
+ 8214,
+ 8230,
+ 8216,
+ 8217,
+ 8220,
+ 8221,
+ 12308,
+ 12309,
+ 12296,
+ 12297,
+ 12298,
+ 12299,
+ 12300,
+ 12301,
+ 12302,
+ 12303,
+ 12310,
+ 12311,
+ 12304,
+ 12305,
+ 177,
+ 215,
+ 247,
+ 8758,
+ 8743,
+ 8744,
+ 8721,
+ 8719,
+ 8746,
+ 8745,
+ 8712,
+ 8759,
+ 8730,
+ 8869,
+ 8741,
+ 8736,
+ 8978,
+ 8857,
+ 8747,
+ 8750,
+ 8801,
+ 8780,
+ 8776,
+ 8765,
+ 8733,
+ 8800,
+ 8814,
+ 8815,
+ 8804,
+ 8805,
+ 8734,
+ 8757,
+ 8756,
+ 9794,
+ 9792,
+ 176,
+ 8242,
+ 8243,
+ 8451,
+ 65284,
+ 164,
+ 65504,
+ 65505,
+ 8240,
+ 167,
+ 8470,
+ 9734,
+ 9733,
+ 9675,
+ 9679,
+ 9678,
+ 9671,
+ 9670,
+ 9633,
+ 9632,
+ 9651,
+ 9650,
+ 8251,
+ 8594,
+ 8592,
+ 8593,
+ 8595,
+ 12307,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 58662,
+ 58663,
+ 58664,
+ 58665,
+ 58666,
+ 58667,
+ 58668,
+ 58669,
+ 58670,
+ 58671,
+ 58672,
+ 58673,
+ 58674,
+ 58675,
+ 58676,
+ 58677,
+ 58678,
+ 58679,
+ 58680,
+ 58681,
+ 58682,
+ 58683,
+ 58684,
+ 58685,
+ 58686,
+ 58687,
+ 58688,
+ 58689,
+ 58690,
+ 58691,
+ 58692,
+ 58693,
+ 58694,
+ 58695,
+ 58696,
+ 58697,
+ 58698,
+ 58699,
+ 58700,
+ 58701,
+ 58702,
+ 58703,
+ 58704,
+ 58705,
+ 58706,
+ 58707,
+ 58708,
+ 58709,
+ 58710,
+ 58711,
+ 58712,
+ 58713,
+ 58714,
+ 58715,
+ 58716,
+ 58717,
+ 58718,
+ 58719,
+ 58720,
+ 58721,
+ 58722,
+ 58723,
+ 58724,
+ 0,
+ 58725,
+ 58726,
+ 58727,
+ 58728,
+ 58729,
+ 58730,
+ 58731,
+ 58732,
+ 58733,
+ 58734,
+ 58735,
+ 58736,
+ 58737,
+ 58738,
+ 58739,
+ 58740,
+ 58741,
+ 58742,
+ 58743,
+ 58744,
+ 58745,
+ 58746,
+ 58747,
+ 58748,
+ 58749,
+ 58750,
+ 58751,
+ 58752,
+ 58753,
+ 58754,
+ 58755,
+ 58756,
+ 58757,
+ 8560,
+ 8561,
+ 8562,
+ 8563,
+ 8564,
+ 8565,
+ 8566,
+ 8567,
+ 8568,
+ 8569,
+ 59238,
+ 59239,
+ 59240,
+ 59241,
+ 59242,
+ 59243,
+ 9352,
+ 9353,
+ 9354,
+ 9355,
+ 9356,
+ 9357,
+ 9358,
+ 9359,
+ 9360,
+ 9361,
+ 9362,
+ 9363,
+ 9364,
+ 9365,
+ 9366,
+ 9367,
+ 9368,
+ 9369,
+ 9370,
+ 9371,
+ 9332,
+ 9333,
+ 9334,
+ 9335,
+ 9336,
+ 9337,
+ 9338,
+ 9339,
+ 9340,
+ 9341,
+ 9342,
+ 9343,
+ 9344,
+ 9345,
+ 9346,
+ 9347,
+ 9348,
+ 9349,
+ 9350,
+ 9351,
+ 9312,
+ 9313,
+ 9314,
+ 9315,
+ 9316,
+ 9317,
+ 9318,
+ 9319,
+ 9320,
+ 9321,
+ 8364,
+ 59245,
+ 12832,
+ 12833,
+ 12834,
+ 12835,
+ 12836,
+ 12837,
+ 12838,
+ 12839,
+ 12840,
+ 12841,
+ 59246,
+ 59247,
+ 8544,
+ 8545,
+ 8546,
+ 8547,
+ 8548,
+ 8549,
+ 8550,
+ 8551,
+ 8552,
+ 8553,
+ 8554,
+ 8555,
+ 59248,
+ 59249,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 58758,
+ 58759,
+ 58760,
+ 58761,
+ 58762,
+ 58763,
+ 58764,
+ 58765,
+ 58766,
+ 58767,
+ 58768,
+ 58769,
+ 58770,
+ 58771,
+ 58772,
+ 58773,
+ 58774,
+ 58775,
+ 58776,
+ 58777,
+ 58778,
+ 58779,
+ 58780,
+ 58781,
+ 58782,
+ 58783,
+ 58784,
+ 58785,
+ 58786,
+ 58787,
+ 58788,
+ 58789,
+ 58790,
+ 58791,
+ 58792,
+ 58793,
+ 58794,
+ 58795,
+ 58796,
+ 58797,
+ 58798,
+ 58799,
+ 58800,
+ 58801,
+ 58802,
+ 58803,
+ 58804,
+ 58805,
+ 58806,
+ 58807,
+ 58808,
+ 58809,
+ 58810,
+ 58811,
+ 58812,
+ 58813,
+ 58814,
+ 58815,
+ 58816,
+ 58817,
+ 58818,
+ 58819,
+ 58820,
+ 0,
+ 58821,
+ 58822,
+ 58823,
+ 58824,
+ 58825,
+ 58826,
+ 58827,
+ 58828,
+ 58829,
+ 58830,
+ 58831,
+ 58832,
+ 58833,
+ 58834,
+ 58835,
+ 58836,
+ 58837,
+ 58838,
+ 58839,
+ 58840,
+ 58841,
+ 58842,
+ 58843,
+ 58844,
+ 58845,
+ 58846,
+ 58847,
+ 58848,
+ 58849,
+ 58850,
+ 58851,
+ 58852,
+ 58853,
+ 65281,
+ 65282,
+ 65283,
+ 65509,
+ 65285,
+ 65286,
+ 65287,
+ 65288,
+ 65289,
+ 65290,
+ 65291,
+ 65292,
+ 65293,
+ 65294,
+ 65295,
+ 65296,
+ 65297,
+ 65298,
+ 65299,
+ 65300,
+ 65301,
+ 65302,
+ 65303,
+ 65304,
+ 65305,
+ 65306,
+ 65307,
+ 65308,
+ 65309,
+ 65310,
+ 65311,
+ 65312,
+ 65313,
+ 65314,
+ 65315,
+ 65316,
+ 65317,
+ 65318,
+ 65319,
+ 65320,
+ 65321,
+ 65322,
+ 65323,
+ 65324,
+ 65325,
+ 65326,
+ 65327,
+ 65328,
+ 65329,
+ 65330,
+ 65331,
+ 65332,
+ 65333,
+ 65334,
+ 65335,
+ 65336,
+ 65337,
+ 65338,
+ 65339,
+ 65340,
+ 65341,
+ 65342,
+ 65343,
+ 65344,
+ 65345,
+ 65346,
+ 65347,
+ 65348,
+ 65349,
+ 65350,
+ 65351,
+ 65352,
+ 65353,
+ 65354,
+ 65355,
+ 65356,
+ 65357,
+ 65358,
+ 65359,
+ 65360,
+ 65361,
+ 65362,
+ 65363,
+ 65364,
+ 65365,
+ 65366,
+ 65367,
+ 65368,
+ 65369,
+ 65370,
+ 65371,
+ 65372,
+ 65373,
+ 65507,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 58854,
+ 58855,
+ 58856,
+ 58857,
+ 58858,
+ 58859,
+ 58860,
+ 58861,
+ 58862,
+ 58863,
+ 58864,
+ 58865,
+ 58866,
+ 58867,
+ 58868,
+ 58869,
+ 58870,
+ 58871,
+ 58872,
+ 58873,
+ 58874,
+ 58875,
+ 58876,
+ 58877,
+ 58878,
+ 58879,
+ 58880,
+ 58881,
+ 58882,
+ 58883,
+ 58884,
+ 58885,
+ 58886,
+ 58887,
+ 58888,
+ 58889,
+ 58890,
+ 58891,
+ 58892,
+ 58893,
+ 58894,
+ 58895,
+ 58896,
+ 58897,
+ 58898,
+ 58899,
+ 58900,
+ 58901,
+ 58902,
+ 58903,
+ 58904,
+ 58905,
+ 58906,
+ 58907,
+ 58908,
+ 58909,
+ 58910,
+ 58911,
+ 58912,
+ 58913,
+ 58914,
+ 58915,
+ 58916,
+ 0,
+ 58917,
+ 58918,
+ 58919,
+ 58920,
+ 58921,
+ 58922,
+ 58923,
+ 58924,
+ 58925,
+ 58926,
+ 58927,
+ 58928,
+ 58929,
+ 58930,
+ 58931,
+ 58932,
+ 58933,
+ 58934,
+ 58935,
+ 58936,
+ 58937,
+ 58938,
+ 58939,
+ 58940,
+ 58941,
+ 58942,
+ 58943,
+ 58944,
+ 58945,
+ 58946,
+ 58947,
+ 58948,
+ 58949,
+ 12353,
+ 12354,
+ 12355,
+ 12356,
+ 12357,
+ 12358,
+ 12359,
+ 12360,
+ 12361,
+ 12362,
+ 12363,
+ 12364,
+ 12365,
+ 12366,
+ 12367,
+ 12368,
+ 12369,
+ 12370,
+ 12371,
+ 12372,
+ 12373,
+ 12374,
+ 12375,
+ 12376,
+ 12377,
+ 12378,
+ 12379,
+ 12380,
+ 12381,
+ 12382,
+ 12383,
+ 12384,
+ 12385,
+ 12386,
+ 12387,
+ 12388,
+ 12389,
+ 12390,
+ 12391,
+ 12392,
+ 12393,
+ 12394,
+ 12395,
+ 12396,
+ 12397,
+ 12398,
+ 12399,
+ 12400,
+ 12401,
+ 12402,
+ 12403,
+ 12404,
+ 12405,
+ 12406,
+ 12407,
+ 12408,
+ 12409,
+ 12410,
+ 12411,
+ 12412,
+ 12413,
+ 12414,
+ 12415,
+ 12416,
+ 12417,
+ 12418,
+ 12419,
+ 12420,
+ 12421,
+ 12422,
+ 12423,
+ 12424,
+ 12425,
+ 12426,
+ 12427,
+ 12428,
+ 12429,
+ 12430,
+ 12431,
+ 12432,
+ 12433,
+ 12434,
+ 12435,
+ 59250,
+ 59251,
+ 59252,
+ 59253,
+ 59254,
+ 59255,
+ 59256,
+ 59257,
+ 59258,
+ 59259,
+ 59260,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 58950,
+ 58951,
+ 58952,
+ 58953,
+ 58954,
+ 58955,
+ 58956,
+ 58957,
+ 58958,
+ 58959,
+ 58960,
+ 58961,
+ 58962,
+ 58963,
+ 58964,
+ 58965,
+ 58966,
+ 58967,
+ 58968,
+ 58969,
+ 58970,
+ 58971,
+ 58972,
+ 58973,
+ 58974,
+ 58975,
+ 58976,
+ 58977,
+ 58978,
+ 58979,
+ 58980,
+ 58981,
+ 58982,
+ 58983,
+ 58984,
+ 58985,
+ 58986,
+ 58987,
+ 58988,
+ 58989,
+ 58990,
+ 58991,
+ 58992,
+ 58993,
+ 58994,
+ 58995,
+ 58996,
+ 58997,
+ 58998,
+ 58999,
+ 59000,
+ 59001,
+ 59002,
+ 59003,
+ 59004,
+ 59005,
+ 59006,
+ 59007,
+ 59008,
+ 59009,
+ 59010,
+ 59011,
+ 59012,
+ 0,
+ 59013,
+ 59014,
+ 59015,
+ 59016,
+ 59017,
+ 59018,
+ 59019,
+ 59020,
+ 59021,
+ 59022,
+ 59023,
+ 59024,
+ 59025,
+ 59026,
+ 59027,
+ 59028,
+ 59029,
+ 59030,
+ 59031,
+ 59032,
+ 59033,
+ 59034,
+ 59035,
+ 59036,
+ 59037,
+ 59038,
+ 59039,
+ 59040,
+ 59041,
+ 59042,
+ 59043,
+ 59044,
+ 59045,
+ 12449,
+ 12450,
+ 12451,
+ 12452,
+ 12453,
+ 12454,
+ 12455,
+ 12456,
+ 12457,
+ 12458,
+ 12459,
+ 12460,
+ 12461,
+ 12462,
+ 12463,
+ 12464,
+ 12465,
+ 12466,
+ 12467,
+ 12468,
+ 12469,
+ 12470,
+ 12471,
+ 12472,
+ 12473,
+ 12474,
+ 12475,
+ 12476,
+ 12477,
+ 12478,
+ 12479,
+ 12480,
+ 12481,
+ 12482,
+ 12483,
+ 12484,
+ 12485,
+ 12486,
+ 12487,
+ 12488,
+ 12489,
+ 12490,
+ 12491,
+ 12492,
+ 12493,
+ 12494,
+ 12495,
+ 12496,
+ 12497,
+ 12498,
+ 12499,
+ 12500,
+ 12501,
+ 12502,
+ 12503,
+ 12504,
+ 12505,
+ 12506,
+ 12507,
+ 12508,
+ 12509,
+ 12510,
+ 12511,
+ 12512,
+ 12513,
+ 12514,
+ 12515,
+ 12516,
+ 12517,
+ 12518,
+ 12519,
+ 12520,
+ 12521,
+ 12522,
+ 12523,
+ 12524,
+ 12525,
+ 12526,
+ 12527,
+ 12528,
+ 12529,
+ 12530,
+ 12531,
+ 12532,
+ 12533,
+ 12534,
+ 59261,
+ 59262,
+ 59263,
+ 59264,
+ 59265,
+ 59266,
+ 59267,
+ 59268,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 59046,
+ 59047,
+ 59048,
+ 59049,
+ 59050,
+ 59051,
+ 59052,
+ 59053,
+ 59054,
+ 59055,
+ 59056,
+ 59057,
+ 59058,
+ 59059,
+ 59060,
+ 59061,
+ 59062,
+ 59063,
+ 59064,
+ 59065,
+ 59066,
+ 59067,
+ 59068,
+ 59069,
+ 59070,
+ 59071,
+ 59072,
+ 59073,
+ 59074,
+ 59075,
+ 59076,
+ 59077,
+ 59078,
+ 59079,
+ 59080,
+ 59081,
+ 59082,
+ 59083,
+ 59084,
+ 59085,
+ 59086,
+ 59087,
+ 59088,
+ 59089,
+ 59090,
+ 59091,
+ 59092,
+ 59093,
+ 59094,
+ 59095,
+ 59096,
+ 59097,
+ 59098,
+ 59099,
+ 59100,
+ 59101,
+ 59102,
+ 59103,
+ 59104,
+ 59105,
+ 59106,
+ 59107,
+ 59108,
+ 0,
+ 59109,
+ 59110,
+ 59111,
+ 59112,
+ 59113,
+ 59114,
+ 59115,
+ 59116,
+ 59117,
+ 59118,
+ 59119,
+ 59120,
+ 59121,
+ 59122,
+ 59123,
+ 59124,
+ 59125,
+ 59126,
+ 59127,
+ 59128,
+ 59129,
+ 59130,
+ 59131,
+ 59132,
+ 59133,
+ 59134,
+ 59135,
+ 59136,
+ 59137,
+ 59138,
+ 59139,
+ 59140,
+ 59141,
+ 913,
+ 914,
+ 915,
+ 916,
+ 917,
+ 918,
+ 919,
+ 920,
+ 921,
+ 922,
+ 923,
+ 924,
+ 925,
+ 926,
+ 927,
+ 928,
+ 929,
+ 931,
+ 932,
+ 933,
+ 934,
+ 935,
+ 936,
+ 937,
+ 59269,
+ 59270,
+ 59271,
+ 59272,
+ 59273,
+ 59274,
+ 59275,
+ 59276,
+ 945,
+ 946,
+ 947,
+ 948,
+ 949,
+ 950,
+ 951,
+ 952,
+ 953,
+ 954,
+ 955,
+ 956,
+ 957,
+ 958,
+ 959,
+ 960,
+ 961,
+ 963,
+ 964,
+ 965,
+ 966,
+ 967,
+ 968,
+ 969,
+ 59277,
+ 59278,
+ 59279,
+ 59280,
+ 59281,
+ 59282,
+ 59283,
+ 65077,
+ 65078,
+ 65081,
+ 65082,
+ 65087,
+ 65088,
+ 65085,
+ 65086,
+ 65089,
+ 65090,
+ 65091,
+ 65092,
+ 59284,
+ 59285,
+ 65083,
+ 65084,
+ 65079,
+ 65080,
+ 65073,
+ 59286,
+ 65075,
+ 65076,
+ 59287,
+ 59288,
+ 59289,
+ 59290,
+ 59291,
+ 59292,
+ 59293,
+ 59294,
+ 59295,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 59142,
+ 59143,
+ 59144,
+ 59145,
+ 59146,
+ 59147,
+ 59148,
+ 59149,
+ 59150,
+ 59151,
+ 59152,
+ 59153,
+ 59154,
+ 59155,
+ 59156,
+ 59157,
+ 59158,
+ 59159,
+ 59160,
+ 59161,
+ 59162,
+ 59163,
+ 59164,
+ 59165,
+ 59166,
+ 59167,
+ 59168,
+ 59169,
+ 59170,
+ 59171,
+ 59172,
+ 59173,
+ 59174,
+ 59175,
+ 59176,
+ 59177,
+ 59178,
+ 59179,
+ 59180,
+ 59181,
+ 59182,
+ 59183,
+ 59184,
+ 59185,
+ 59186,
+ 59187,
+ 59188,
+ 59189,
+ 59190,
+ 59191,
+ 59192,
+ 59193,
+ 59194,
+ 59195,
+ 59196,
+ 59197,
+ 59198,
+ 59199,
+ 59200,
+ 59201,
+ 59202,
+ 59203,
+ 59204,
+ 0,
+ 59205,
+ 59206,
+ 59207,
+ 59208,
+ 59209,
+ 59210,
+ 59211,
+ 59212,
+ 59213,
+ 59214,
+ 59215,
+ 59216,
+ 59217,
+ 59218,
+ 59219,
+ 59220,
+ 59221,
+ 59222,
+ 59223,
+ 59224,
+ 59225,
+ 59226,
+ 59227,
+ 59228,
+ 59229,
+ 59230,
+ 59231,
+ 59232,
+ 59233,
+ 59234,
+ 59235,
+ 59236,
+ 59237,
+ 1040,
+ 1041,
+ 1042,
+ 1043,
+ 1044,
+ 1045,
+ 1025,
+ 1046,
+ 1047,
+ 1048,
+ 1049,
+ 1050,
+ 1051,
+ 1052,
+ 1053,
+ 1054,
+ 1055,
+ 1056,
+ 1057,
+ 1058,
+ 1059,
+ 1060,
+ 1061,
+ 1062,
+ 1063,
+ 1064,
+ 1065,
+ 1066,
+ 1067,
+ 1068,
+ 1069,
+ 1070,
+ 1071,
+ 59296,
+ 59297,
+ 59298,
+ 59299,
+ 59300,
+ 59301,
+ 59302,
+ 59303,
+ 59304,
+ 59305,
+ 59306,
+ 59307,
+ 59308,
+ 59309,
+ 59310,
+ 1072,
+ 1073,
+ 1074,
+ 1075,
+ 1076,
+ 1077,
+ 1105,
+ 1078,
+ 1079,
+ 1080,
+ 1081,
+ 1082,
+ 1083,
+ 1084,
+ 1085,
+ 1086,
+ 1087,
+ 1088,
+ 1089,
+ 1090,
+ 1091,
+ 1092,
+ 1093,
+ 1094,
+ 1095,
+ 1096,
+ 1097,
+ 1098,
+ 1099,
+ 1100,
+ 1101,
+ 1102,
+ 1103,
+ 59311,
+ 59312,
+ 59313,
+ 59314,
+ 59315,
+ 59316,
+ 59317,
+ 59318,
+ 59319,
+ 59320,
+ 59321,
+ 59322,
+ 59323,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 714,
+ 715,
+ 729,
+ 8211,
+ 8213,
+ 8229,
+ 8245,
+ 8453,
+ 8457,
+ 8598,
+ 8599,
+ 8600,
+ 8601,
+ 8725,
+ 8735,
+ 8739,
+ 8786,
+ 8806,
+ 8807,
+ 8895,
+ 9552,
+ 9553,
+ 9554,
+ 9555,
+ 9556,
+ 9557,
+ 9558,
+ 9559,
+ 9560,
+ 9561,
+ 9562,
+ 9563,
+ 9564,
+ 9565,
+ 9566,
+ 9567,
+ 9568,
+ 9569,
+ 9570,
+ 9571,
+ 9572,
+ 9573,
+ 9574,
+ 9575,
+ 9576,
+ 9577,
+ 9578,
+ 9579,
+ 9580,
+ 9581,
+ 9582,
+ 9583,
+ 9584,
+ 9585,
+ 9586,
+ 9587,
+ 9601,
+ 9602,
+ 9603,
+ 9604,
+ 9605,
+ 9606,
+ 9607,
+ 0,
+ 9608,
+ 9609,
+ 9610,
+ 9611,
+ 9612,
+ 9613,
+ 9614,
+ 9615,
+ 9619,
+ 9620,
+ 9621,
+ 9660,
+ 9661,
+ 9698,
+ 9699,
+ 9700,
+ 9701,
+ 9737,
+ 8853,
+ 12306,
+ 12317,
+ 12318,
+ 59324,
+ 59325,
+ 59326,
+ 59327,
+ 59328,
+ 59329,
+ 59330,
+ 59331,
+ 59332,
+ 59333,
+ 59334,
+ 257,
+ 225,
+ 462,
+ 224,
+ 275,
+ 233,
+ 283,
+ 232,
+ 299,
+ 237,
+ 464,
+ 236,
+ 333,
+ 243,
+ 466,
+ 242,
+ 363,
+ 250,
+ 468,
+ 249,
+ 470,
+ 472,
+ 474,
+ 476,
+ 252,
+ 234,
+ 593,
+ 59335,
+ 324,
+ 328,
+ 505,
+ 609,
+ 59337,
+ 59338,
+ 59339,
+ 59340,
+ 12549,
+ 12550,
+ 12551,
+ 12552,
+ 12553,
+ 12554,
+ 12555,
+ 12556,
+ 12557,
+ 12558,
+ 12559,
+ 12560,
+ 12561,
+ 12562,
+ 12563,
+ 12564,
+ 12565,
+ 12566,
+ 12567,
+ 12568,
+ 12569,
+ 12570,
+ 12571,
+ 12572,
+ 12573,
+ 12574,
+ 12575,
+ 12576,
+ 12577,
+ 12578,
+ 12579,
+ 12580,
+ 12581,
+ 12582,
+ 12583,
+ 12584,
+ 12585,
+ 59341,
+ 59342,
+ 59343,
+ 59344,
+ 59345,
+ 59346,
+ 59347,
+ 59348,
+ 59349,
+ 59350,
+ 59351,
+ 59352,
+ 59353,
+ 59354,
+ 59355,
+ 59356,
+ 59357,
+ 59358,
+ 59359,
+ 59360,
+ 59361,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 12321,
+ 12322,
+ 12323,
+ 12324,
+ 12325,
+ 12326,
+ 12327,
+ 12328,
+ 12329,
+ 12963,
+ 13198,
+ 13199,
+ 13212,
+ 13213,
+ 13214,
+ 13217,
+ 13252,
+ 13262,
+ 13265,
+ 13266,
+ 13269,
+ 65072,
+ 65506,
+ 65508,
+ 59362,
+ 8481,
+ 12849,
+ 59363,
+ 8208,
+ 59364,
+ 59365,
+ 59366,
+ 12540,
+ 12443,
+ 12444,
+ 12541,
+ 12542,
+ 12294,
+ 12445,
+ 12446,
+ 65097,
+ 65098,
+ 65099,
+ 65100,
+ 65101,
+ 65102,
+ 65103,
+ 65104,
+ 65105,
+ 65106,
+ 65108,
+ 65109,
+ 65110,
+ 65111,
+ 65113,
+ 65114,
+ 65115,
+ 65116,
+ 65117,
+ 65118,
+ 65119,
+ 65120,
+ 65121,
+ 0,
+ 65122,
+ 65123,
+ 65124,
+ 65125,
+ 65126,
+ 65128,
+ 65129,
+ 65130,
+ 65131,
+ 12350,
+ 12272,
+ 12273,
+ 12274,
+ 12275,
+ 12276,
+ 12277,
+ 12278,
+ 12279,
+ 12280,
+ 12281,
+ 12282,
+ 12283,
+ 12295,
+ 59380,
+ 59381,
+ 59382,
+ 59383,
+ 59384,
+ 59385,
+ 59386,
+ 59387,
+ 59388,
+ 59389,
+ 59390,
+ 59391,
+ 59392,
+ 9472,
+ 9473,
+ 9474,
+ 9475,
+ 9476,
+ 9477,
+ 9478,
+ 9479,
+ 9480,
+ 9481,
+ 9482,
+ 9483,
+ 9484,
+ 9485,
+ 9486,
+ 9487,
+ 9488,
+ 9489,
+ 9490,
+ 9491,
+ 9492,
+ 9493,
+ 9494,
+ 9495,
+ 9496,
+ 9497,
+ 9498,
+ 9499,
+ 9500,
+ 9501,
+ 9502,
+ 9503,
+ 9504,
+ 9505,
+ 9506,
+ 9507,
+ 9508,
+ 9509,
+ 9510,
+ 9511,
+ 9512,
+ 9513,
+ 9514,
+ 9515,
+ 9516,
+ 9517,
+ 9518,
+ 9519,
+ 9520,
+ 9521,
+ 9522,
+ 9523,
+ 9524,
+ 9525,
+ 9526,
+ 9527,
+ 9528,
+ 9529,
+ 9530,
+ 9531,
+ 9532,
+ 9533,
+ 9534,
+ 9535,
+ 9536,
+ 9537,
+ 9538,
+ 9539,
+ 9540,
+ 9541,
+ 9542,
+ 9543,
+ 9544,
+ 9545,
+ 9546,
+ 9547,
+ 59393,
+ 59394,
+ 59395,
+ 59396,
+ 59397,
+ 59398,
+ 59399,
+ 59400,
+ 59401,
+ 59402,
+ 59403,
+ 59404,
+ 59405,
+ 59406,
+ 59407,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 29404,
+ 29405,
+ 29407,
+ 29410,
+ 29411,
+ 29412,
+ 29413,
+ 29414,
+ 29415,
+ 29418,
+ 29419,
+ 29429,
+ 29430,
+ 29433,
+ 29437,
+ 29438,
+ 29439,
+ 29440,
+ 29442,
+ 29444,
+ 29445,
+ 29446,
+ 29447,
+ 29448,
+ 29449,
+ 29451,
+ 29452,
+ 29453,
+ 29455,
+ 29456,
+ 29457,
+ 29458,
+ 29460,
+ 29464,
+ 29465,
+ 29466,
+ 29471,
+ 29472,
+ 29475,
+ 29476,
+ 29478,
+ 29479,
+ 29480,
+ 29485,
+ 29487,
+ 29488,
+ 29490,
+ 29491,
+ 29493,
+ 29494,
+ 29498,
+ 29499,
+ 29500,
+ 29501,
+ 29504,
+ 29505,
+ 29506,
+ 29507,
+ 29508,
+ 29509,
+ 29510,
+ 29511,
+ 29512,
+ 0,
+ 29513,
+ 29514,
+ 29515,
+ 29516,
+ 29518,
+ 29519,
+ 29521,
+ 29523,
+ 29524,
+ 29525,
+ 29526,
+ 29528,
+ 29529,
+ 29530,
+ 29531,
+ 29532,
+ 29533,
+ 29534,
+ 29535,
+ 29537,
+ 29538,
+ 29539,
+ 29540,
+ 29541,
+ 29542,
+ 29543,
+ 29544,
+ 29545,
+ 29546,
+ 29547,
+ 29550,
+ 29552,
+ 29553,
+ 57344,
+ 57345,
+ 57346,
+ 57347,
+ 57348,
+ 57349,
+ 57350,
+ 57351,
+ 57352,
+ 57353,
+ 57354,
+ 57355,
+ 57356,
+ 57357,
+ 57358,
+ 57359,
+ 57360,
+ 57361,
+ 57362,
+ 57363,
+ 57364,
+ 57365,
+ 57366,
+ 57367,
+ 57368,
+ 57369,
+ 57370,
+ 57371,
+ 57372,
+ 57373,
+ 57374,
+ 57375,
+ 57376,
+ 57377,
+ 57378,
+ 57379,
+ 57380,
+ 57381,
+ 57382,
+ 57383,
+ 57384,
+ 57385,
+ 57386,
+ 57387,
+ 57388,
+ 57389,
+ 57390,
+ 57391,
+ 57392,
+ 57393,
+ 57394,
+ 57395,
+ 57396,
+ 57397,
+ 57398,
+ 57399,
+ 57400,
+ 57401,
+ 57402,
+ 57403,
+ 57404,
+ 57405,
+ 57406,
+ 57407,
+ 57408,
+ 57409,
+ 57410,
+ 57411,
+ 57412,
+ 57413,
+ 57414,
+ 57415,
+ 57416,
+ 57417,
+ 57418,
+ 57419,
+ 57420,
+ 57421,
+ 57422,
+ 57423,
+ 57424,
+ 57425,
+ 57426,
+ 57427,
+ 57428,
+ 57429,
+ 57430,
+ 57431,
+ 57432,
+ 57433,
+ 57434,
+ 57435,
+ 57436,
+ 57437,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 29554,
+ 29555,
+ 29556,
+ 29557,
+ 29558,
+ 29559,
+ 29560,
+ 29561,
+ 29562,
+ 29563,
+ 29564,
+ 29565,
+ 29567,
+ 29568,
+ 29569,
+ 29570,
+ 29571,
+ 29573,
+ 29574,
+ 29576,
+ 29578,
+ 29580,
+ 29581,
+ 29583,
+ 29584,
+ 29586,
+ 29587,
+ 29588,
+ 29589,
+ 29591,
+ 29592,
+ 29593,
+ 29594,
+ 29596,
+ 29597,
+ 29598,
+ 29600,
+ 29601,
+ 29603,
+ 29604,
+ 29605,
+ 29606,
+ 29607,
+ 29608,
+ 29610,
+ 29612,
+ 29613,
+ 29617,
+ 29620,
+ 29621,
+ 29622,
+ 29624,
+ 29625,
+ 29628,
+ 29629,
+ 29630,
+ 29631,
+ 29633,
+ 29635,
+ 29636,
+ 29637,
+ 29638,
+ 29639,
+ 0,
+ 29643,
+ 29644,
+ 29646,
+ 29650,
+ 29651,
+ 29652,
+ 29653,
+ 29654,
+ 29655,
+ 29656,
+ 29658,
+ 29659,
+ 29660,
+ 29661,
+ 29663,
+ 29665,
+ 29666,
+ 29667,
+ 29668,
+ 29670,
+ 29672,
+ 29674,
+ 29675,
+ 29676,
+ 29678,
+ 29679,
+ 29680,
+ 29681,
+ 29683,
+ 29684,
+ 29685,
+ 29686,
+ 29687,
+ 57438,
+ 57439,
+ 57440,
+ 57441,
+ 57442,
+ 57443,
+ 57444,
+ 57445,
+ 57446,
+ 57447,
+ 57448,
+ 57449,
+ 57450,
+ 57451,
+ 57452,
+ 57453,
+ 57454,
+ 57455,
+ 57456,
+ 57457,
+ 57458,
+ 57459,
+ 57460,
+ 57461,
+ 57462,
+ 57463,
+ 57464,
+ 57465,
+ 57466,
+ 57467,
+ 57468,
+ 57469,
+ 57470,
+ 57471,
+ 57472,
+ 57473,
+ 57474,
+ 57475,
+ 57476,
+ 57477,
+ 57478,
+ 57479,
+ 57480,
+ 57481,
+ 57482,
+ 57483,
+ 57484,
+ 57485,
+ 57486,
+ 57487,
+ 57488,
+ 57489,
+ 57490,
+ 57491,
+ 57492,
+ 57493,
+ 57494,
+ 57495,
+ 57496,
+ 57497,
+ 57498,
+ 57499,
+ 57500,
+ 57501,
+ 57502,
+ 57503,
+ 57504,
+ 57505,
+ 57506,
+ 57507,
+ 57508,
+ 57509,
+ 57510,
+ 57511,
+ 57512,
+ 57513,
+ 57514,
+ 57515,
+ 57516,
+ 57517,
+ 57518,
+ 57519,
+ 57520,
+ 57521,
+ 57522,
+ 57523,
+ 57524,
+ 57525,
+ 57526,
+ 57527,
+ 57528,
+ 57529,
+ 57530,
+ 57531,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 29688,
+ 29689,
+ 29690,
+ 29691,
+ 29692,
+ 29693,
+ 29694,
+ 29695,
+ 29696,
+ 29697,
+ 29698,
+ 29700,
+ 29703,
+ 29704,
+ 29707,
+ 29708,
+ 29709,
+ 29710,
+ 29713,
+ 29714,
+ 29715,
+ 29716,
+ 29717,
+ 29718,
+ 29719,
+ 29720,
+ 29721,
+ 29724,
+ 29725,
+ 29726,
+ 29727,
+ 29728,
+ 29729,
+ 29731,
+ 29732,
+ 29735,
+ 29737,
+ 29739,
+ 29741,
+ 29743,
+ 29745,
+ 29746,
+ 29751,
+ 29752,
+ 29753,
+ 29754,
+ 29755,
+ 29757,
+ 29758,
+ 29759,
+ 29760,
+ 29762,
+ 29763,
+ 29764,
+ 29765,
+ 29766,
+ 29767,
+ 29768,
+ 29769,
+ 29770,
+ 29771,
+ 29772,
+ 29773,
+ 0,
+ 29774,
+ 29775,
+ 29776,
+ 29777,
+ 29778,
+ 29779,
+ 29780,
+ 29782,
+ 29784,
+ 29789,
+ 29792,
+ 29793,
+ 29794,
+ 29795,
+ 29796,
+ 29797,
+ 29798,
+ 29799,
+ 29800,
+ 29801,
+ 29802,
+ 29803,
+ 29804,
+ 29806,
+ 29807,
+ 29809,
+ 29810,
+ 29811,
+ 29812,
+ 29813,
+ 29816,
+ 29817,
+ 29818,
+ 57532,
+ 57533,
+ 57534,
+ 57535,
+ 57536,
+ 57537,
+ 57538,
+ 57539,
+ 57540,
+ 57541,
+ 57542,
+ 57543,
+ 57544,
+ 57545,
+ 57546,
+ 57547,
+ 57548,
+ 57549,
+ 57550,
+ 57551,
+ 57552,
+ 57553,
+ 57554,
+ 57555,
+ 57556,
+ 57557,
+ 57558,
+ 57559,
+ 57560,
+ 57561,
+ 57562,
+ 57563,
+ 57564,
+ 57565,
+ 57566,
+ 57567,
+ 57568,
+ 57569,
+ 57570,
+ 57571,
+ 57572,
+ 57573,
+ 57574,
+ 57575,
+ 57576,
+ 57577,
+ 57578,
+ 57579,
+ 57580,
+ 57581,
+ 57582,
+ 57583,
+ 57584,
+ 57585,
+ 57586,
+ 57587,
+ 57588,
+ 57589,
+ 57590,
+ 57591,
+ 57592,
+ 57593,
+ 57594,
+ 57595,
+ 57596,
+ 57597,
+ 57598,
+ 57599,
+ 57600,
+ 57601,
+ 57602,
+ 57603,
+ 57604,
+ 57605,
+ 57606,
+ 57607,
+ 57608,
+ 57609,
+ 57610,
+ 57611,
+ 57612,
+ 57613,
+ 57614,
+ 57615,
+ 57616,
+ 57617,
+ 57618,
+ 57619,
+ 57620,
+ 57621,
+ 57622,
+ 57623,
+ 57624,
+ 57625,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 29819,
+ 29820,
+ 29821,
+ 29823,
+ 29826,
+ 29828,
+ 29829,
+ 29830,
+ 29832,
+ 29833,
+ 29834,
+ 29836,
+ 29837,
+ 29839,
+ 29841,
+ 29842,
+ 29843,
+ 29844,
+ 29845,
+ 29846,
+ 29847,
+ 29848,
+ 29849,
+ 29850,
+ 29851,
+ 29853,
+ 29855,
+ 29856,
+ 29857,
+ 29858,
+ 29859,
+ 29860,
+ 29861,
+ 29862,
+ 29866,
+ 29867,
+ 29868,
+ 29869,
+ 29870,
+ 29871,
+ 29872,
+ 29873,
+ 29874,
+ 29875,
+ 29876,
+ 29877,
+ 29878,
+ 29879,
+ 29880,
+ 29881,
+ 29883,
+ 29884,
+ 29885,
+ 29886,
+ 29887,
+ 29888,
+ 29889,
+ 29890,
+ 29891,
+ 29892,
+ 29893,
+ 29894,
+ 29895,
+ 0,
+ 29896,
+ 29897,
+ 29898,
+ 29899,
+ 29900,
+ 29901,
+ 29902,
+ 29903,
+ 29904,
+ 29905,
+ 29907,
+ 29908,
+ 29909,
+ 29910,
+ 29911,
+ 29912,
+ 29913,
+ 29914,
+ 29915,
+ 29917,
+ 29919,
+ 29921,
+ 29925,
+ 29927,
+ 29928,
+ 29929,
+ 29930,
+ 29931,
+ 29932,
+ 29933,
+ 29936,
+ 29937,
+ 29938,
+ 57626,
+ 57627,
+ 57628,
+ 57629,
+ 57630,
+ 57631,
+ 57632,
+ 57633,
+ 57634,
+ 57635,
+ 57636,
+ 57637,
+ 57638,
+ 57639,
+ 57640,
+ 57641,
+ 57642,
+ 57643,
+ 57644,
+ 57645,
+ 57646,
+ 57647,
+ 57648,
+ 57649,
+ 57650,
+ 57651,
+ 57652,
+ 57653,
+ 57654,
+ 57655,
+ 57656,
+ 57657,
+ 57658,
+ 57659,
+ 57660,
+ 57661,
+ 57662,
+ 57663,
+ 57664,
+ 57665,
+ 57666,
+ 57667,
+ 57668,
+ 57669,
+ 57670,
+ 57671,
+ 57672,
+ 57673,
+ 57674,
+ 57675,
+ 57676,
+ 57677,
+ 57678,
+ 57679,
+ 57680,
+ 57681,
+ 57682,
+ 57683,
+ 57684,
+ 57685,
+ 57686,
+ 57687,
+ 57688,
+ 57689,
+ 57690,
+ 57691,
+ 57692,
+ 57693,
+ 57694,
+ 57695,
+ 57696,
+ 57697,
+ 57698,
+ 57699,
+ 57700,
+ 57701,
+ 57702,
+ 57703,
+ 57704,
+ 57705,
+ 57706,
+ 57707,
+ 57708,
+ 57709,
+ 57710,
+ 57711,
+ 57712,
+ 57713,
+ 57714,
+ 57715,
+ 57716,
+ 57717,
+ 57718,
+ 57719,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 29939,
+ 29941,
+ 29944,
+ 29945,
+ 29946,
+ 29947,
+ 29948,
+ 29949,
+ 29950,
+ 29952,
+ 29953,
+ 29954,
+ 29955,
+ 29957,
+ 29958,
+ 29959,
+ 29960,
+ 29961,
+ 29962,
+ 29963,
+ 29964,
+ 29966,
+ 29968,
+ 29970,
+ 29972,
+ 29973,
+ 29974,
+ 29975,
+ 29979,
+ 29981,
+ 29982,
+ 29984,
+ 29985,
+ 29986,
+ 29987,
+ 29988,
+ 29990,
+ 29991,
+ 29994,
+ 29998,
+ 30004,
+ 30006,
+ 30009,
+ 30012,
+ 30013,
+ 30015,
+ 30017,
+ 30018,
+ 30019,
+ 30020,
+ 30022,
+ 30023,
+ 30025,
+ 30026,
+ 30029,
+ 30032,
+ 30033,
+ 30034,
+ 30035,
+ 30037,
+ 30038,
+ 30039,
+ 30040,
+ 0,
+ 30045,
+ 30046,
+ 30047,
+ 30048,
+ 30049,
+ 30050,
+ 30051,
+ 30052,
+ 30055,
+ 30056,
+ 30057,
+ 30059,
+ 30060,
+ 30061,
+ 30062,
+ 30063,
+ 30064,
+ 30065,
+ 30067,
+ 30069,
+ 30070,
+ 30071,
+ 30074,
+ 30075,
+ 30076,
+ 30077,
+ 30078,
+ 30080,
+ 30081,
+ 30082,
+ 30084,
+ 30085,
+ 30087,
+ 57720,
+ 57721,
+ 57722,
+ 57723,
+ 57724,
+ 57725,
+ 57726,
+ 57727,
+ 57728,
+ 57729,
+ 57730,
+ 57731,
+ 57732,
+ 57733,
+ 57734,
+ 57735,
+ 57736,
+ 57737,
+ 57738,
+ 57739,
+ 57740,
+ 57741,
+ 57742,
+ 57743,
+ 57744,
+ 57745,
+ 57746,
+ 57747,
+ 57748,
+ 57749,
+ 57750,
+ 57751,
+ 57752,
+ 57753,
+ 57754,
+ 57755,
+ 57756,
+ 57757,
+ 57758,
+ 57759,
+ 57760,
+ 57761,
+ 57762,
+ 57763,
+ 57764,
+ 57765,
+ 57766,
+ 57767,
+ 57768,
+ 57769,
+ 57770,
+ 57771,
+ 57772,
+ 57773,
+ 57774,
+ 57775,
+ 57776,
+ 57777,
+ 57778,
+ 57779,
+ 57780,
+ 57781,
+ 57782,
+ 57783,
+ 57784,
+ 57785,
+ 57786,
+ 57787,
+ 57788,
+ 57789,
+ 57790,
+ 57791,
+ 57792,
+ 57793,
+ 57794,
+ 57795,
+ 57796,
+ 57797,
+ 57798,
+ 57799,
+ 57800,
+ 57801,
+ 57802,
+ 57803,
+ 57804,
+ 57805,
+ 57806,
+ 57807,
+ 57808,
+ 57809,
+ 57810,
+ 57811,
+ 57812,
+ 57813,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 30088,
+ 30089,
+ 30090,
+ 30092,
+ 30093,
+ 30094,
+ 30096,
+ 30099,
+ 30101,
+ 30104,
+ 30107,
+ 30108,
+ 30110,
+ 30114,
+ 30118,
+ 30119,
+ 30120,
+ 30121,
+ 30122,
+ 30125,
+ 30134,
+ 30135,
+ 30138,
+ 30139,
+ 30143,
+ 30144,
+ 30145,
+ 30150,
+ 30155,
+ 30156,
+ 30158,
+ 30159,
+ 30160,
+ 30161,
+ 30163,
+ 30167,
+ 30169,
+ 30170,
+ 30172,
+ 30173,
+ 30175,
+ 30176,
+ 30177,
+ 30181,
+ 30185,
+ 30188,
+ 30189,
+ 30190,
+ 30191,
+ 30194,
+ 30195,
+ 30197,
+ 30198,
+ 30199,
+ 30200,
+ 30202,
+ 30203,
+ 30205,
+ 30206,
+ 30210,
+ 30212,
+ 30214,
+ 30215,
+ 0,
+ 30216,
+ 30217,
+ 30219,
+ 30221,
+ 30222,
+ 30223,
+ 30225,
+ 30226,
+ 30227,
+ 30228,
+ 30230,
+ 30234,
+ 30236,
+ 30237,
+ 30238,
+ 30241,
+ 30243,
+ 30247,
+ 30248,
+ 30252,
+ 30254,
+ 30255,
+ 30257,
+ 30258,
+ 30262,
+ 30263,
+ 30265,
+ 30266,
+ 30267,
+ 30269,
+ 30273,
+ 30274,
+ 30276,
+ 57814,
+ 57815,
+ 57816,
+ 57817,
+ 57818,
+ 57819,
+ 57820,
+ 57821,
+ 57822,
+ 57823,
+ 57824,
+ 57825,
+ 57826,
+ 57827,
+ 57828,
+ 57829,
+ 57830,
+ 57831,
+ 57832,
+ 57833,
+ 57834,
+ 57835,
+ 57836,
+ 57837,
+ 57838,
+ 57839,
+ 57840,
+ 57841,
+ 57842,
+ 57843,
+ 57844,
+ 57845,
+ 57846,
+ 57847,
+ 57848,
+ 57849,
+ 57850,
+ 57851,
+ 57852,
+ 57853,
+ 57854,
+ 57855,
+ 57856,
+ 57857,
+ 57858,
+ 57859,
+ 57860,
+ 57861,
+ 57862,
+ 57863,
+ 57864,
+ 57865,
+ 57866,
+ 57867,
+ 57868,
+ 57869,
+ 57870,
+ 57871,
+ 57872,
+ 57873,
+ 57874,
+ 57875,
+ 57876,
+ 57877,
+ 57878,
+ 57879,
+ 57880,
+ 57881,
+ 57882,
+ 57883,
+ 57884,
+ 57885,
+ 57886,
+ 57887,
+ 57888,
+ 57889,
+ 57890,
+ 57891,
+ 57892,
+ 57893,
+ 57894,
+ 57895,
+ 57896,
+ 57897,
+ 57898,
+ 57899,
+ 57900,
+ 57901,
+ 57902,
+ 57903,
+ 57904,
+ 57905,
+ 57906,
+ 57907,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 30277,
+ 30278,
+ 30279,
+ 30280,
+ 30281,
+ 30282,
+ 30283,
+ 30286,
+ 30287,
+ 30288,
+ 30289,
+ 30290,
+ 30291,
+ 30293,
+ 30295,
+ 30296,
+ 30297,
+ 30298,
+ 30299,
+ 30301,
+ 30303,
+ 30304,
+ 30305,
+ 30306,
+ 30308,
+ 30309,
+ 30310,
+ 30311,
+ 30312,
+ 30313,
+ 30314,
+ 30316,
+ 30317,
+ 30318,
+ 30320,
+ 30321,
+ 30322,
+ 30323,
+ 30324,
+ 30325,
+ 30326,
+ 30327,
+ 30329,
+ 30330,
+ 30332,
+ 30335,
+ 30336,
+ 30337,
+ 30339,
+ 30341,
+ 30345,
+ 30346,
+ 30348,
+ 30349,
+ 30351,
+ 30352,
+ 30354,
+ 30356,
+ 30357,
+ 30359,
+ 30360,
+ 30362,
+ 30363,
+ 0,
+ 30364,
+ 30365,
+ 30366,
+ 30367,
+ 30368,
+ 30369,
+ 30370,
+ 30371,
+ 30373,
+ 30374,
+ 30375,
+ 30376,
+ 30377,
+ 30378,
+ 30379,
+ 30380,
+ 30381,
+ 30383,
+ 30384,
+ 30387,
+ 30389,
+ 30390,
+ 30391,
+ 30392,
+ 30393,
+ 30394,
+ 30395,
+ 30396,
+ 30397,
+ 30398,
+ 30400,
+ 30401,
+ 30403,
+ 21834,
+ 38463,
+ 22467,
+ 25384,
+ 21710,
+ 21769,
+ 21696,
+ 30353,
+ 30284,
+ 34108,
+ 30702,
+ 33406,
+ 30861,
+ 29233,
+ 38552,
+ 38797,
+ 27688,
+ 23433,
+ 20474,
+ 25353,
+ 26263,
+ 23736,
+ 33018,
+ 26696,
+ 32942,
+ 26114,
+ 30414,
+ 20985,
+ 25942,
+ 29100,
+ 32753,
+ 34948,
+ 20658,
+ 22885,
+ 25034,
+ 28595,
+ 33453,
+ 25420,
+ 25170,
+ 21485,
+ 21543,
+ 31494,
+ 20843,
+ 30116,
+ 24052,
+ 25300,
+ 36299,
+ 38774,
+ 25226,
+ 32793,
+ 22365,
+ 38712,
+ 32610,
+ 29240,
+ 30333,
+ 26575,
+ 30334,
+ 25670,
+ 20336,
+ 36133,
+ 25308,
+ 31255,
+ 26001,
+ 29677,
+ 25644,
+ 25203,
+ 33324,
+ 39041,
+ 26495,
+ 29256,
+ 25198,
+ 25292,
+ 20276,
+ 29923,
+ 21322,
+ 21150,
+ 32458,
+ 37030,
+ 24110,
+ 26758,
+ 27036,
+ 33152,
+ 32465,
+ 26834,
+ 30917,
+ 34444,
+ 38225,
+ 20621,
+ 35876,
+ 33502,
+ 32990,
+ 21253,
+ 35090,
+ 21093,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 30404,
+ 30407,
+ 30409,
+ 30411,
+ 30412,
+ 30419,
+ 30421,
+ 30425,
+ 30426,
+ 30428,
+ 30429,
+ 30430,
+ 30432,
+ 30433,
+ 30434,
+ 30435,
+ 30436,
+ 30438,
+ 30439,
+ 30440,
+ 30441,
+ 30442,
+ 30443,
+ 30444,
+ 30445,
+ 30448,
+ 30451,
+ 30453,
+ 30454,
+ 30455,
+ 30458,
+ 30459,
+ 30461,
+ 30463,
+ 30464,
+ 30466,
+ 30467,
+ 30469,
+ 30470,
+ 30474,
+ 30476,
+ 30478,
+ 30479,
+ 30480,
+ 30481,
+ 30482,
+ 30483,
+ 30484,
+ 30485,
+ 30486,
+ 30487,
+ 30488,
+ 30491,
+ 30492,
+ 30493,
+ 30494,
+ 30497,
+ 30499,
+ 30500,
+ 30501,
+ 30503,
+ 30506,
+ 30507,
+ 0,
+ 30508,
+ 30510,
+ 30512,
+ 30513,
+ 30514,
+ 30515,
+ 30516,
+ 30521,
+ 30523,
+ 30525,
+ 30526,
+ 30527,
+ 30530,
+ 30532,
+ 30533,
+ 30534,
+ 30536,
+ 30537,
+ 30538,
+ 30539,
+ 30540,
+ 30541,
+ 30542,
+ 30543,
+ 30546,
+ 30547,
+ 30548,
+ 30549,
+ 30550,
+ 30551,
+ 30552,
+ 30553,
+ 30556,
+ 34180,
+ 38649,
+ 20445,
+ 22561,
+ 39281,
+ 23453,
+ 25265,
+ 25253,
+ 26292,
+ 35961,
+ 40077,
+ 29190,
+ 26479,
+ 30865,
+ 24754,
+ 21329,
+ 21271,
+ 36744,
+ 32972,
+ 36125,
+ 38049,
+ 20493,
+ 29384,
+ 22791,
+ 24811,
+ 28953,
+ 34987,
+ 22868,
+ 33519,
+ 26412,
+ 31528,
+ 23849,
+ 32503,
+ 29997,
+ 27893,
+ 36454,
+ 36856,
+ 36924,
+ 40763,
+ 27604,
+ 37145,
+ 31508,
+ 24444,
+ 30887,
+ 34006,
+ 34109,
+ 27605,
+ 27609,
+ 27606,
+ 24065,
+ 24199,
+ 30201,
+ 38381,
+ 25949,
+ 24330,
+ 24517,
+ 36767,
+ 22721,
+ 33218,
+ 36991,
+ 38491,
+ 38829,
+ 36793,
+ 32534,
+ 36140,
+ 25153,
+ 20415,
+ 21464,
+ 21342,
+ 36776,
+ 36777,
+ 36779,
+ 36941,
+ 26631,
+ 24426,
+ 33176,
+ 34920,
+ 40150,
+ 24971,
+ 21035,
+ 30250,
+ 24428,
+ 25996,
+ 28626,
+ 28392,
+ 23486,
+ 25672,
+ 20853,
+ 20912,
+ 26564,
+ 19993,
+ 31177,
+ 39292,
+ 28851,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 30557,
+ 30558,
+ 30559,
+ 30560,
+ 30564,
+ 30567,
+ 30569,
+ 30570,
+ 30573,
+ 30574,
+ 30575,
+ 30576,
+ 30577,
+ 30578,
+ 30579,
+ 30580,
+ 30581,
+ 30582,
+ 30583,
+ 30584,
+ 30586,
+ 30587,
+ 30588,
+ 30593,
+ 30594,
+ 30595,
+ 30598,
+ 30599,
+ 30600,
+ 30601,
+ 30602,
+ 30603,
+ 30607,
+ 30608,
+ 30611,
+ 30612,
+ 30613,
+ 30614,
+ 30615,
+ 30616,
+ 30617,
+ 30618,
+ 30619,
+ 30620,
+ 30621,
+ 30622,
+ 30625,
+ 30627,
+ 30628,
+ 30630,
+ 30632,
+ 30635,
+ 30637,
+ 30638,
+ 30639,
+ 30641,
+ 30642,
+ 30644,
+ 30646,
+ 30647,
+ 30648,
+ 30649,
+ 30650,
+ 0,
+ 30652,
+ 30654,
+ 30656,
+ 30657,
+ 30658,
+ 30659,
+ 30660,
+ 30661,
+ 30662,
+ 30663,
+ 30664,
+ 30665,
+ 30666,
+ 30667,
+ 30668,
+ 30670,
+ 30671,
+ 30672,
+ 30673,
+ 30674,
+ 30675,
+ 30676,
+ 30677,
+ 30678,
+ 30680,
+ 30681,
+ 30682,
+ 30685,
+ 30686,
+ 30687,
+ 30688,
+ 30689,
+ 30692,
+ 30149,
+ 24182,
+ 29627,
+ 33760,
+ 25773,
+ 25320,
+ 38069,
+ 27874,
+ 21338,
+ 21187,
+ 25615,
+ 38082,
+ 31636,
+ 20271,
+ 24091,
+ 33334,
+ 33046,
+ 33162,
+ 28196,
+ 27850,
+ 39539,
+ 25429,
+ 21340,
+ 21754,
+ 34917,
+ 22496,
+ 19981,
+ 24067,
+ 27493,
+ 31807,
+ 37096,
+ 24598,
+ 25830,
+ 29468,
+ 35009,
+ 26448,
+ 25165,
+ 36130,
+ 30572,
+ 36393,
+ 37319,
+ 24425,
+ 33756,
+ 34081,
+ 39184,
+ 21442,
+ 34453,
+ 27531,
+ 24813,
+ 24808,
+ 28799,
+ 33485,
+ 33329,
+ 20179,
+ 27815,
+ 34255,
+ 25805,
+ 31961,
+ 27133,
+ 26361,
+ 33609,
+ 21397,
+ 31574,
+ 20391,
+ 20876,
+ 27979,
+ 23618,
+ 36461,
+ 25554,
+ 21449,
+ 33580,
+ 33590,
+ 26597,
+ 30900,
+ 25661,
+ 23519,
+ 23700,
+ 24046,
+ 35815,
+ 25286,
+ 26612,
+ 35962,
+ 25600,
+ 25530,
+ 34633,
+ 39307,
+ 35863,
+ 32544,
+ 38130,
+ 20135,
+ 38416,
+ 39076,
+ 26124,
+ 29462,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 30694,
+ 30696,
+ 30698,
+ 30703,
+ 30704,
+ 30705,
+ 30706,
+ 30708,
+ 30709,
+ 30711,
+ 30713,
+ 30714,
+ 30715,
+ 30716,
+ 30723,
+ 30724,
+ 30725,
+ 30726,
+ 30727,
+ 30728,
+ 30730,
+ 30731,
+ 30734,
+ 30735,
+ 30736,
+ 30739,
+ 30741,
+ 30745,
+ 30747,
+ 30750,
+ 30752,
+ 30753,
+ 30754,
+ 30756,
+ 30760,
+ 30762,
+ 30763,
+ 30766,
+ 30767,
+ 30769,
+ 30770,
+ 30771,
+ 30773,
+ 30774,
+ 30781,
+ 30783,
+ 30785,
+ 30786,
+ 30787,
+ 30788,
+ 30790,
+ 30792,
+ 30793,
+ 30794,
+ 30795,
+ 30797,
+ 30799,
+ 30801,
+ 30803,
+ 30804,
+ 30808,
+ 30809,
+ 30810,
+ 0,
+ 30811,
+ 30812,
+ 30814,
+ 30815,
+ 30816,
+ 30817,
+ 30818,
+ 30819,
+ 30820,
+ 30821,
+ 30822,
+ 30823,
+ 30824,
+ 30825,
+ 30831,
+ 30832,
+ 30833,
+ 30834,
+ 30835,
+ 30836,
+ 30837,
+ 30838,
+ 30840,
+ 30841,
+ 30842,
+ 30843,
+ 30845,
+ 30846,
+ 30847,
+ 30848,
+ 30849,
+ 30850,
+ 30851,
+ 22330,
+ 23581,
+ 24120,
+ 38271,
+ 20607,
+ 32928,
+ 21378,
+ 25950,
+ 30021,
+ 21809,
+ 20513,
+ 36229,
+ 25220,
+ 38046,
+ 26397,
+ 22066,
+ 28526,
+ 24034,
+ 21557,
+ 28818,
+ 36710,
+ 25199,
+ 25764,
+ 25507,
+ 24443,
+ 28552,
+ 37108,
+ 33251,
+ 36784,
+ 23576,
+ 26216,
+ 24561,
+ 27785,
+ 38472,
+ 36225,
+ 34924,
+ 25745,
+ 31216,
+ 22478,
+ 27225,
+ 25104,
+ 21576,
+ 20056,
+ 31243,
+ 24809,
+ 28548,
+ 35802,
+ 25215,
+ 36894,
+ 39563,
+ 31204,
+ 21507,
+ 30196,
+ 25345,
+ 21273,
+ 27744,
+ 36831,
+ 24347,
+ 39536,
+ 32827,
+ 40831,
+ 20360,
+ 23610,
+ 36196,
+ 32709,
+ 26021,
+ 28861,
+ 20805,
+ 20914,
+ 34411,
+ 23815,
+ 23456,
+ 25277,
+ 37228,
+ 30068,
+ 36364,
+ 31264,
+ 24833,
+ 31609,
+ 20167,
+ 32504,
+ 30597,
+ 19985,
+ 33261,
+ 21021,
+ 20986,
+ 27249,
+ 21416,
+ 36487,
+ 38148,
+ 38607,
+ 28353,
+ 38500,
+ 26970,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 30852,
+ 30853,
+ 30854,
+ 30856,
+ 30858,
+ 30859,
+ 30863,
+ 30864,
+ 30866,
+ 30868,
+ 30869,
+ 30870,
+ 30873,
+ 30877,
+ 30878,
+ 30880,
+ 30882,
+ 30884,
+ 30886,
+ 30888,
+ 30889,
+ 30890,
+ 30891,
+ 30892,
+ 30893,
+ 30894,
+ 30895,
+ 30901,
+ 30902,
+ 30903,
+ 30904,
+ 30906,
+ 30907,
+ 30908,
+ 30909,
+ 30911,
+ 30912,
+ 30914,
+ 30915,
+ 30916,
+ 30918,
+ 30919,
+ 30920,
+ 30924,
+ 30925,
+ 30926,
+ 30927,
+ 30929,
+ 30930,
+ 30931,
+ 30934,
+ 30935,
+ 30936,
+ 30938,
+ 30939,
+ 30940,
+ 30941,
+ 30942,
+ 30943,
+ 30944,
+ 30945,
+ 30946,
+ 30947,
+ 0,
+ 30948,
+ 30949,
+ 30950,
+ 30951,
+ 30953,
+ 30954,
+ 30955,
+ 30957,
+ 30958,
+ 30959,
+ 30960,
+ 30961,
+ 30963,
+ 30965,
+ 30966,
+ 30968,
+ 30969,
+ 30971,
+ 30972,
+ 30973,
+ 30974,
+ 30975,
+ 30976,
+ 30978,
+ 30979,
+ 30980,
+ 30982,
+ 30983,
+ 30984,
+ 30985,
+ 30986,
+ 30987,
+ 30988,
+ 30784,
+ 20648,
+ 30679,
+ 25616,
+ 35302,
+ 22788,
+ 25571,
+ 24029,
+ 31359,
+ 26941,
+ 20256,
+ 33337,
+ 21912,
+ 20018,
+ 30126,
+ 31383,
+ 24162,
+ 24202,
+ 38383,
+ 21019,
+ 21561,
+ 28810,
+ 25462,
+ 38180,
+ 22402,
+ 26149,
+ 26943,
+ 37255,
+ 21767,
+ 28147,
+ 32431,
+ 34850,
+ 25139,
+ 32496,
+ 30133,
+ 33576,
+ 30913,
+ 38604,
+ 36766,
+ 24904,
+ 29943,
+ 35789,
+ 27492,
+ 21050,
+ 36176,
+ 27425,
+ 32874,
+ 33905,
+ 22257,
+ 21254,
+ 20174,
+ 19995,
+ 20945,
+ 31895,
+ 37259,
+ 31751,
+ 20419,
+ 36479,
+ 31713,
+ 31388,
+ 25703,
+ 23828,
+ 20652,
+ 33030,
+ 30209,
+ 31929,
+ 28140,
+ 32736,
+ 26449,
+ 23384,
+ 23544,
+ 30923,
+ 25774,
+ 25619,
+ 25514,
+ 25387,
+ 38169,
+ 25645,
+ 36798,
+ 31572,
+ 30249,
+ 25171,
+ 22823,
+ 21574,
+ 27513,
+ 20643,
+ 25140,
+ 24102,
+ 27526,
+ 20195,
+ 36151,
+ 34955,
+ 24453,
+ 36910,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 30989,
+ 30990,
+ 30991,
+ 30992,
+ 30993,
+ 30994,
+ 30996,
+ 30997,
+ 30998,
+ 30999,
+ 31000,
+ 31001,
+ 31002,
+ 31003,
+ 31004,
+ 31005,
+ 31007,
+ 31008,
+ 31009,
+ 31010,
+ 31011,
+ 31013,
+ 31014,
+ 31015,
+ 31016,
+ 31017,
+ 31018,
+ 31019,
+ 31020,
+ 31021,
+ 31022,
+ 31023,
+ 31024,
+ 31025,
+ 31026,
+ 31027,
+ 31029,
+ 31030,
+ 31031,
+ 31032,
+ 31033,
+ 31037,
+ 31039,
+ 31042,
+ 31043,
+ 31044,
+ 31045,
+ 31047,
+ 31050,
+ 31051,
+ 31052,
+ 31053,
+ 31054,
+ 31055,
+ 31056,
+ 31057,
+ 31058,
+ 31060,
+ 31061,
+ 31064,
+ 31065,
+ 31073,
+ 31075,
+ 0,
+ 31076,
+ 31078,
+ 31081,
+ 31082,
+ 31083,
+ 31084,
+ 31086,
+ 31088,
+ 31089,
+ 31090,
+ 31091,
+ 31092,
+ 31093,
+ 31094,
+ 31097,
+ 31099,
+ 31100,
+ 31101,
+ 31102,
+ 31103,
+ 31106,
+ 31107,
+ 31110,
+ 31111,
+ 31112,
+ 31113,
+ 31115,
+ 31116,
+ 31117,
+ 31118,
+ 31120,
+ 31121,
+ 31122,
+ 24608,
+ 32829,
+ 25285,
+ 20025,
+ 21333,
+ 37112,
+ 25528,
+ 32966,
+ 26086,
+ 27694,
+ 20294,
+ 24814,
+ 28129,
+ 35806,
+ 24377,
+ 34507,
+ 24403,
+ 25377,
+ 20826,
+ 33633,
+ 26723,
+ 20992,
+ 25443,
+ 36424,
+ 20498,
+ 23707,
+ 31095,
+ 23548,
+ 21040,
+ 31291,
+ 24764,
+ 36947,
+ 30423,
+ 24503,
+ 24471,
+ 30340,
+ 36460,
+ 28783,
+ 30331,
+ 31561,
+ 30634,
+ 20979,
+ 37011,
+ 22564,
+ 20302,
+ 28404,
+ 36842,
+ 25932,
+ 31515,
+ 29380,
+ 28068,
+ 32735,
+ 23265,
+ 25269,
+ 24213,
+ 22320,
+ 33922,
+ 31532,
+ 24093,
+ 24351,
+ 36882,
+ 32532,
+ 39072,
+ 25474,
+ 28359,
+ 30872,
+ 28857,
+ 20856,
+ 38747,
+ 22443,
+ 30005,
+ 20291,
+ 30008,
+ 24215,
+ 24806,
+ 22880,
+ 28096,
+ 27583,
+ 30857,
+ 21500,
+ 38613,
+ 20939,
+ 20993,
+ 25481,
+ 21514,
+ 38035,
+ 35843,
+ 36300,
+ 29241,
+ 30879,
+ 34678,
+ 36845,
+ 35853,
+ 21472,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 31123,
+ 31124,
+ 31125,
+ 31126,
+ 31127,
+ 31128,
+ 31129,
+ 31131,
+ 31132,
+ 31133,
+ 31134,
+ 31135,
+ 31136,
+ 31137,
+ 31138,
+ 31139,
+ 31140,
+ 31141,
+ 31142,
+ 31144,
+ 31145,
+ 31146,
+ 31147,
+ 31148,
+ 31149,
+ 31150,
+ 31151,
+ 31152,
+ 31153,
+ 31154,
+ 31156,
+ 31157,
+ 31158,
+ 31159,
+ 31160,
+ 31164,
+ 31167,
+ 31170,
+ 31172,
+ 31173,
+ 31175,
+ 31176,
+ 31178,
+ 31180,
+ 31182,
+ 31183,
+ 31184,
+ 31187,
+ 31188,
+ 31190,
+ 31191,
+ 31193,
+ 31194,
+ 31195,
+ 31196,
+ 31197,
+ 31198,
+ 31200,
+ 31201,
+ 31202,
+ 31205,
+ 31208,
+ 31210,
+ 0,
+ 31212,
+ 31214,
+ 31217,
+ 31218,
+ 31219,
+ 31220,
+ 31221,
+ 31222,
+ 31223,
+ 31225,
+ 31226,
+ 31228,
+ 31230,
+ 31231,
+ 31233,
+ 31236,
+ 31237,
+ 31239,
+ 31240,
+ 31241,
+ 31242,
+ 31244,
+ 31247,
+ 31248,
+ 31249,
+ 31250,
+ 31251,
+ 31253,
+ 31254,
+ 31256,
+ 31257,
+ 31259,
+ 31260,
+ 19969,
+ 30447,
+ 21486,
+ 38025,
+ 39030,
+ 40718,
+ 38189,
+ 23450,
+ 35746,
+ 20002,
+ 19996,
+ 20908,
+ 33891,
+ 25026,
+ 21160,
+ 26635,
+ 20375,
+ 24683,
+ 20923,
+ 27934,
+ 20828,
+ 25238,
+ 26007,
+ 38497,
+ 35910,
+ 36887,
+ 30168,
+ 37117,
+ 30563,
+ 27602,
+ 29322,
+ 29420,
+ 35835,
+ 22581,
+ 30585,
+ 36172,
+ 26460,
+ 38208,
+ 32922,
+ 24230,
+ 28193,
+ 22930,
+ 31471,
+ 30701,
+ 38203,
+ 27573,
+ 26029,
+ 32526,
+ 22534,
+ 20817,
+ 38431,
+ 23545,
+ 22697,
+ 21544,
+ 36466,
+ 25958,
+ 39039,
+ 22244,
+ 38045,
+ 30462,
+ 36929,
+ 25479,
+ 21702,
+ 22810,
+ 22842,
+ 22427,
+ 36530,
+ 26421,
+ 36346,
+ 33333,
+ 21057,
+ 24816,
+ 22549,
+ 34558,
+ 23784,
+ 40517,
+ 20420,
+ 39069,
+ 35769,
+ 23077,
+ 24694,
+ 21380,
+ 25212,
+ 36943,
+ 37122,
+ 39295,
+ 24681,
+ 32780,
+ 20799,
+ 32819,
+ 23572,
+ 39285,
+ 27953,
+ 20108,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 31261,
+ 31263,
+ 31265,
+ 31266,
+ 31268,
+ 31269,
+ 31270,
+ 31271,
+ 31272,
+ 31273,
+ 31274,
+ 31275,
+ 31276,
+ 31277,
+ 31278,
+ 31279,
+ 31280,
+ 31281,
+ 31282,
+ 31284,
+ 31285,
+ 31286,
+ 31288,
+ 31290,
+ 31294,
+ 31296,
+ 31297,
+ 31298,
+ 31299,
+ 31300,
+ 31301,
+ 31303,
+ 31304,
+ 31305,
+ 31306,
+ 31307,
+ 31308,
+ 31309,
+ 31310,
+ 31311,
+ 31312,
+ 31314,
+ 31315,
+ 31316,
+ 31317,
+ 31318,
+ 31320,
+ 31321,
+ 31322,
+ 31323,
+ 31324,
+ 31325,
+ 31326,
+ 31327,
+ 31328,
+ 31329,
+ 31330,
+ 31331,
+ 31332,
+ 31333,
+ 31334,
+ 31335,
+ 31336,
+ 0,
+ 31337,
+ 31338,
+ 31339,
+ 31340,
+ 31341,
+ 31342,
+ 31343,
+ 31345,
+ 31346,
+ 31347,
+ 31349,
+ 31355,
+ 31356,
+ 31357,
+ 31358,
+ 31362,
+ 31365,
+ 31367,
+ 31369,
+ 31370,
+ 31371,
+ 31372,
+ 31374,
+ 31375,
+ 31376,
+ 31379,
+ 31380,
+ 31385,
+ 31386,
+ 31387,
+ 31390,
+ 31393,
+ 31394,
+ 36144,
+ 21457,
+ 32602,
+ 31567,
+ 20240,
+ 20047,
+ 38400,
+ 27861,
+ 29648,
+ 34281,
+ 24070,
+ 30058,
+ 32763,
+ 27146,
+ 30718,
+ 38034,
+ 32321,
+ 20961,
+ 28902,
+ 21453,
+ 36820,
+ 33539,
+ 36137,
+ 29359,
+ 39277,
+ 27867,
+ 22346,
+ 33459,
+ 26041,
+ 32938,
+ 25151,
+ 38450,
+ 22952,
+ 20223,
+ 35775,
+ 32442,
+ 25918,
+ 33778,
+ 38750,
+ 21857,
+ 39134,
+ 32933,
+ 21290,
+ 35837,
+ 21536,
+ 32954,
+ 24223,
+ 27832,
+ 36153,
+ 33452,
+ 37210,
+ 21545,
+ 27675,
+ 20998,
+ 32439,
+ 22367,
+ 28954,
+ 27774,
+ 31881,
+ 22859,
+ 20221,
+ 24575,
+ 24868,
+ 31914,
+ 20016,
+ 23553,
+ 26539,
+ 34562,
+ 23792,
+ 38155,
+ 39118,
+ 30127,
+ 28925,
+ 36898,
+ 20911,
+ 32541,
+ 35773,
+ 22857,
+ 20964,
+ 20315,
+ 21542,
+ 22827,
+ 25975,
+ 32932,
+ 23413,
+ 25206,
+ 25282,
+ 36752,
+ 24133,
+ 27679,
+ 31526,
+ 20239,
+ 20440,
+ 26381,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 31395,
+ 31396,
+ 31399,
+ 31401,
+ 31402,
+ 31403,
+ 31406,
+ 31407,
+ 31408,
+ 31409,
+ 31410,
+ 31412,
+ 31413,
+ 31414,
+ 31415,
+ 31416,
+ 31417,
+ 31418,
+ 31419,
+ 31420,
+ 31421,
+ 31422,
+ 31424,
+ 31425,
+ 31426,
+ 31427,
+ 31428,
+ 31429,
+ 31430,
+ 31431,
+ 31432,
+ 31433,
+ 31434,
+ 31436,
+ 31437,
+ 31438,
+ 31439,
+ 31440,
+ 31441,
+ 31442,
+ 31443,
+ 31444,
+ 31445,
+ 31447,
+ 31448,
+ 31450,
+ 31451,
+ 31452,
+ 31453,
+ 31457,
+ 31458,
+ 31460,
+ 31463,
+ 31464,
+ 31465,
+ 31466,
+ 31467,
+ 31468,
+ 31470,
+ 31472,
+ 31473,
+ 31474,
+ 31475,
+ 0,
+ 31476,
+ 31477,
+ 31478,
+ 31479,
+ 31480,
+ 31483,
+ 31484,
+ 31486,
+ 31488,
+ 31489,
+ 31490,
+ 31493,
+ 31495,
+ 31497,
+ 31500,
+ 31501,
+ 31502,
+ 31504,
+ 31506,
+ 31507,
+ 31510,
+ 31511,
+ 31512,
+ 31514,
+ 31516,
+ 31517,
+ 31519,
+ 31521,
+ 31522,
+ 31523,
+ 31527,
+ 31529,
+ 31533,
+ 28014,
+ 28074,
+ 31119,
+ 34993,
+ 24343,
+ 29995,
+ 25242,
+ 36741,
+ 20463,
+ 37340,
+ 26023,
+ 33071,
+ 33105,
+ 24220,
+ 33104,
+ 36212,
+ 21103,
+ 35206,
+ 36171,
+ 22797,
+ 20613,
+ 20184,
+ 38428,
+ 29238,
+ 33145,
+ 36127,
+ 23500,
+ 35747,
+ 38468,
+ 22919,
+ 32538,
+ 21648,
+ 22134,
+ 22030,
+ 35813,
+ 25913,
+ 27010,
+ 38041,
+ 30422,
+ 28297,
+ 24178,
+ 29976,
+ 26438,
+ 26577,
+ 31487,
+ 32925,
+ 36214,
+ 24863,
+ 31174,
+ 25954,
+ 36195,
+ 20872,
+ 21018,
+ 38050,
+ 32568,
+ 32923,
+ 32434,
+ 23703,
+ 28207,
+ 26464,
+ 31705,
+ 30347,
+ 39640,
+ 33167,
+ 32660,
+ 31957,
+ 25630,
+ 38224,
+ 31295,
+ 21578,
+ 21733,
+ 27468,
+ 25601,
+ 25096,
+ 40509,
+ 33011,
+ 30105,
+ 21106,
+ 38761,
+ 33883,
+ 26684,
+ 34532,
+ 38401,
+ 38548,
+ 38124,
+ 20010,
+ 21508,
+ 32473,
+ 26681,
+ 36319,
+ 32789,
+ 26356,
+ 24218,
+ 32697,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 31535,
+ 31536,
+ 31538,
+ 31540,
+ 31541,
+ 31542,
+ 31543,
+ 31545,
+ 31547,
+ 31549,
+ 31551,
+ 31552,
+ 31553,
+ 31554,
+ 31555,
+ 31556,
+ 31558,
+ 31560,
+ 31562,
+ 31565,
+ 31566,
+ 31571,
+ 31573,
+ 31575,
+ 31577,
+ 31580,
+ 31582,
+ 31583,
+ 31585,
+ 31587,
+ 31588,
+ 31589,
+ 31590,
+ 31591,
+ 31592,
+ 31593,
+ 31594,
+ 31595,
+ 31596,
+ 31597,
+ 31599,
+ 31600,
+ 31603,
+ 31604,
+ 31606,
+ 31608,
+ 31610,
+ 31612,
+ 31613,
+ 31615,
+ 31617,
+ 31618,
+ 31619,
+ 31620,
+ 31622,
+ 31623,
+ 31624,
+ 31625,
+ 31626,
+ 31627,
+ 31628,
+ 31630,
+ 31631,
+ 0,
+ 31633,
+ 31634,
+ 31635,
+ 31638,
+ 31640,
+ 31641,
+ 31642,
+ 31643,
+ 31646,
+ 31647,
+ 31648,
+ 31651,
+ 31652,
+ 31653,
+ 31662,
+ 31663,
+ 31664,
+ 31666,
+ 31667,
+ 31669,
+ 31670,
+ 31671,
+ 31673,
+ 31674,
+ 31675,
+ 31676,
+ 31677,
+ 31678,
+ 31679,
+ 31680,
+ 31682,
+ 31683,
+ 31684,
+ 22466,
+ 32831,
+ 26775,
+ 24037,
+ 25915,
+ 21151,
+ 24685,
+ 40858,
+ 20379,
+ 36524,
+ 20844,
+ 23467,
+ 24339,
+ 24041,
+ 27742,
+ 25329,
+ 36129,
+ 20849,
+ 38057,
+ 21246,
+ 27807,
+ 33503,
+ 29399,
+ 22434,
+ 26500,
+ 36141,
+ 22815,
+ 36764,
+ 33735,
+ 21653,
+ 31629,
+ 20272,
+ 27837,
+ 23396,
+ 22993,
+ 40723,
+ 21476,
+ 34506,
+ 39592,
+ 35895,
+ 32929,
+ 25925,
+ 39038,
+ 22266,
+ 38599,
+ 21038,
+ 29916,
+ 21072,
+ 23521,
+ 25346,
+ 35074,
+ 20054,
+ 25296,
+ 24618,
+ 26874,
+ 20851,
+ 23448,
+ 20896,
+ 35266,
+ 31649,
+ 39302,
+ 32592,
+ 24815,
+ 28748,
+ 36143,
+ 20809,
+ 24191,
+ 36891,
+ 29808,
+ 35268,
+ 22317,
+ 30789,
+ 24402,
+ 40863,
+ 38394,
+ 36712,
+ 39740,
+ 35809,
+ 30328,
+ 26690,
+ 26588,
+ 36330,
+ 36149,
+ 21053,
+ 36746,
+ 28378,
+ 26829,
+ 38149,
+ 37101,
+ 22269,
+ 26524,
+ 35065,
+ 36807,
+ 21704,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 31685,
+ 31688,
+ 31689,
+ 31690,
+ 31691,
+ 31693,
+ 31694,
+ 31695,
+ 31696,
+ 31698,
+ 31700,
+ 31701,
+ 31702,
+ 31703,
+ 31704,
+ 31707,
+ 31708,
+ 31710,
+ 31711,
+ 31712,
+ 31714,
+ 31715,
+ 31716,
+ 31719,
+ 31720,
+ 31721,
+ 31723,
+ 31724,
+ 31725,
+ 31727,
+ 31728,
+ 31730,
+ 31731,
+ 31732,
+ 31733,
+ 31734,
+ 31736,
+ 31737,
+ 31738,
+ 31739,
+ 31741,
+ 31743,
+ 31744,
+ 31745,
+ 31746,
+ 31747,
+ 31748,
+ 31749,
+ 31750,
+ 31752,
+ 31753,
+ 31754,
+ 31757,
+ 31758,
+ 31760,
+ 31761,
+ 31762,
+ 31763,
+ 31764,
+ 31765,
+ 31767,
+ 31768,
+ 31769,
+ 0,
+ 31770,
+ 31771,
+ 31772,
+ 31773,
+ 31774,
+ 31776,
+ 31777,
+ 31778,
+ 31779,
+ 31780,
+ 31781,
+ 31784,
+ 31785,
+ 31787,
+ 31788,
+ 31789,
+ 31790,
+ 31791,
+ 31792,
+ 31793,
+ 31794,
+ 31795,
+ 31796,
+ 31797,
+ 31798,
+ 31799,
+ 31801,
+ 31802,
+ 31803,
+ 31804,
+ 31805,
+ 31806,
+ 31810,
+ 39608,
+ 23401,
+ 28023,
+ 27686,
+ 20133,
+ 23475,
+ 39559,
+ 37219,
+ 25000,
+ 37039,
+ 38889,
+ 21547,
+ 28085,
+ 23506,
+ 20989,
+ 21898,
+ 32597,
+ 32752,
+ 25788,
+ 25421,
+ 26097,
+ 25022,
+ 24717,
+ 28938,
+ 27735,
+ 27721,
+ 22831,
+ 26477,
+ 33322,
+ 22741,
+ 22158,
+ 35946,
+ 27627,
+ 37085,
+ 22909,
+ 32791,
+ 21495,
+ 28009,
+ 21621,
+ 21917,
+ 33655,
+ 33743,
+ 26680,
+ 31166,
+ 21644,
+ 20309,
+ 21512,
+ 30418,
+ 35977,
+ 38402,
+ 27827,
+ 28088,
+ 36203,
+ 35088,
+ 40548,
+ 36154,
+ 22079,
+ 40657,
+ 30165,
+ 24456,
+ 29408,
+ 24680,
+ 21756,
+ 20136,
+ 27178,
+ 34913,
+ 24658,
+ 36720,
+ 21700,
+ 28888,
+ 34425,
+ 40511,
+ 27946,
+ 23439,
+ 24344,
+ 32418,
+ 21897,
+ 20399,
+ 29492,
+ 21564,
+ 21402,
+ 20505,
+ 21518,
+ 21628,
+ 20046,
+ 24573,
+ 29786,
+ 22774,
+ 33899,
+ 32993,
+ 34676,
+ 29392,
+ 31946,
+ 28246,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 31811,
+ 31812,
+ 31813,
+ 31814,
+ 31815,
+ 31816,
+ 31817,
+ 31818,
+ 31819,
+ 31820,
+ 31822,
+ 31823,
+ 31824,
+ 31825,
+ 31826,
+ 31827,
+ 31828,
+ 31829,
+ 31830,
+ 31831,
+ 31832,
+ 31833,
+ 31834,
+ 31835,
+ 31836,
+ 31837,
+ 31838,
+ 31839,
+ 31840,
+ 31841,
+ 31842,
+ 31843,
+ 31844,
+ 31845,
+ 31846,
+ 31847,
+ 31848,
+ 31849,
+ 31850,
+ 31851,
+ 31852,
+ 31853,
+ 31854,
+ 31855,
+ 31856,
+ 31857,
+ 31858,
+ 31861,
+ 31862,
+ 31863,
+ 31864,
+ 31865,
+ 31866,
+ 31870,
+ 31871,
+ 31872,
+ 31873,
+ 31874,
+ 31875,
+ 31876,
+ 31877,
+ 31878,
+ 31879,
+ 0,
+ 31880,
+ 31882,
+ 31883,
+ 31884,
+ 31885,
+ 31886,
+ 31887,
+ 31888,
+ 31891,
+ 31892,
+ 31894,
+ 31897,
+ 31898,
+ 31899,
+ 31904,
+ 31905,
+ 31907,
+ 31910,
+ 31911,
+ 31912,
+ 31913,
+ 31915,
+ 31916,
+ 31917,
+ 31919,
+ 31920,
+ 31924,
+ 31925,
+ 31926,
+ 31927,
+ 31928,
+ 31930,
+ 31931,
+ 24359,
+ 34382,
+ 21804,
+ 25252,
+ 20114,
+ 27818,
+ 25143,
+ 33457,
+ 21719,
+ 21326,
+ 29502,
+ 28369,
+ 30011,
+ 21010,
+ 21270,
+ 35805,
+ 27088,
+ 24458,
+ 24576,
+ 28142,
+ 22351,
+ 27426,
+ 29615,
+ 26707,
+ 36824,
+ 32531,
+ 25442,
+ 24739,
+ 21796,
+ 30186,
+ 35938,
+ 28949,
+ 28067,
+ 23462,
+ 24187,
+ 33618,
+ 24908,
+ 40644,
+ 30970,
+ 34647,
+ 31783,
+ 30343,
+ 20976,
+ 24822,
+ 29004,
+ 26179,
+ 24140,
+ 24653,
+ 35854,
+ 28784,
+ 25381,
+ 36745,
+ 24509,
+ 24674,
+ 34516,
+ 22238,
+ 27585,
+ 24724,
+ 24935,
+ 21321,
+ 24800,
+ 26214,
+ 36159,
+ 31229,
+ 20250,
+ 28905,
+ 27719,
+ 35763,
+ 35826,
+ 32472,
+ 33636,
+ 26127,
+ 23130,
+ 39746,
+ 27985,
+ 28151,
+ 35905,
+ 27963,
+ 20249,
+ 28779,
+ 33719,
+ 25110,
+ 24785,
+ 38669,
+ 36135,
+ 31096,
+ 20987,
+ 22334,
+ 22522,
+ 26426,
+ 30072,
+ 31293,
+ 31215,
+ 31637,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 31935,
+ 31936,
+ 31938,
+ 31939,
+ 31940,
+ 31942,
+ 31945,
+ 31947,
+ 31950,
+ 31951,
+ 31952,
+ 31953,
+ 31954,
+ 31955,
+ 31956,
+ 31960,
+ 31962,
+ 31963,
+ 31965,
+ 31966,
+ 31969,
+ 31970,
+ 31971,
+ 31972,
+ 31973,
+ 31974,
+ 31975,
+ 31977,
+ 31978,
+ 31979,
+ 31980,
+ 31981,
+ 31982,
+ 31984,
+ 31985,
+ 31986,
+ 31987,
+ 31988,
+ 31989,
+ 31990,
+ 31991,
+ 31993,
+ 31994,
+ 31996,
+ 31997,
+ 31998,
+ 31999,
+ 32000,
+ 32001,
+ 32002,
+ 32003,
+ 32004,
+ 32005,
+ 32006,
+ 32007,
+ 32008,
+ 32009,
+ 32011,
+ 32012,
+ 32013,
+ 32014,
+ 32015,
+ 32016,
+ 0,
+ 32017,
+ 32018,
+ 32019,
+ 32020,
+ 32021,
+ 32022,
+ 32023,
+ 32024,
+ 32025,
+ 32026,
+ 32027,
+ 32028,
+ 32029,
+ 32030,
+ 32031,
+ 32033,
+ 32035,
+ 32036,
+ 32037,
+ 32038,
+ 32040,
+ 32041,
+ 32042,
+ 32044,
+ 32045,
+ 32046,
+ 32048,
+ 32049,
+ 32050,
+ 32051,
+ 32052,
+ 32053,
+ 32054,
+ 32908,
+ 39269,
+ 36857,
+ 28608,
+ 35749,
+ 40481,
+ 23020,
+ 32489,
+ 32521,
+ 21513,
+ 26497,
+ 26840,
+ 36753,
+ 31821,
+ 38598,
+ 21450,
+ 24613,
+ 30142,
+ 27762,
+ 21363,
+ 23241,
+ 32423,
+ 25380,
+ 20960,
+ 33034,
+ 24049,
+ 34015,
+ 25216,
+ 20864,
+ 23395,
+ 20238,
+ 31085,
+ 21058,
+ 24760,
+ 27982,
+ 23492,
+ 23490,
+ 35745,
+ 35760,
+ 26082,
+ 24524,
+ 38469,
+ 22931,
+ 32487,
+ 32426,
+ 22025,
+ 26551,
+ 22841,
+ 20339,
+ 23478,
+ 21152,
+ 33626,
+ 39050,
+ 36158,
+ 30002,
+ 38078,
+ 20551,
+ 31292,
+ 20215,
+ 26550,
+ 39550,
+ 23233,
+ 27516,
+ 30417,
+ 22362,
+ 23574,
+ 31546,
+ 38388,
+ 29006,
+ 20860,
+ 32937,
+ 33392,
+ 22904,
+ 32516,
+ 33575,
+ 26816,
+ 26604,
+ 30897,
+ 30839,
+ 25315,
+ 25441,
+ 31616,
+ 20461,
+ 21098,
+ 20943,
+ 33616,
+ 27099,
+ 37492,
+ 36341,
+ 36145,
+ 35265,
+ 38190,
+ 31661,
+ 20214,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 32055,
+ 32056,
+ 32057,
+ 32058,
+ 32059,
+ 32060,
+ 32061,
+ 32062,
+ 32063,
+ 32064,
+ 32065,
+ 32066,
+ 32067,
+ 32068,
+ 32069,
+ 32070,
+ 32071,
+ 32072,
+ 32073,
+ 32074,
+ 32075,
+ 32076,
+ 32077,
+ 32078,
+ 32079,
+ 32080,
+ 32081,
+ 32082,
+ 32083,
+ 32084,
+ 32085,
+ 32086,
+ 32087,
+ 32088,
+ 32089,
+ 32090,
+ 32091,
+ 32092,
+ 32093,
+ 32094,
+ 32095,
+ 32096,
+ 32097,
+ 32098,
+ 32099,
+ 32100,
+ 32101,
+ 32102,
+ 32103,
+ 32104,
+ 32105,
+ 32106,
+ 32107,
+ 32108,
+ 32109,
+ 32111,
+ 32112,
+ 32113,
+ 32114,
+ 32115,
+ 32116,
+ 32117,
+ 32118,
+ 0,
+ 32120,
+ 32121,
+ 32122,
+ 32123,
+ 32124,
+ 32125,
+ 32126,
+ 32127,
+ 32128,
+ 32129,
+ 32130,
+ 32131,
+ 32132,
+ 32133,
+ 32134,
+ 32135,
+ 32136,
+ 32137,
+ 32138,
+ 32139,
+ 32140,
+ 32141,
+ 32142,
+ 32143,
+ 32144,
+ 32145,
+ 32146,
+ 32147,
+ 32148,
+ 32149,
+ 32150,
+ 32151,
+ 32152,
+ 20581,
+ 33328,
+ 21073,
+ 39279,
+ 28176,
+ 28293,
+ 28071,
+ 24314,
+ 20725,
+ 23004,
+ 23558,
+ 27974,
+ 27743,
+ 30086,
+ 33931,
+ 26728,
+ 22870,
+ 35762,
+ 21280,
+ 37233,
+ 38477,
+ 34121,
+ 26898,
+ 30977,
+ 28966,
+ 33014,
+ 20132,
+ 37066,
+ 27975,
+ 39556,
+ 23047,
+ 22204,
+ 25605,
+ 38128,
+ 30699,
+ 20389,
+ 33050,
+ 29409,
+ 35282,
+ 39290,
+ 32564,
+ 32478,
+ 21119,
+ 25945,
+ 37237,
+ 36735,
+ 36739,
+ 21483,
+ 31382,
+ 25581,
+ 25509,
+ 30342,
+ 31224,
+ 34903,
+ 38454,
+ 25130,
+ 21163,
+ 33410,
+ 26708,
+ 26480,
+ 25463,
+ 30571,
+ 31469,
+ 27905,
+ 32467,
+ 35299,
+ 22992,
+ 25106,
+ 34249,
+ 33445,
+ 30028,
+ 20511,
+ 20171,
+ 30117,
+ 35819,
+ 23626,
+ 24062,
+ 31563,
+ 26020,
+ 37329,
+ 20170,
+ 27941,
+ 35167,
+ 32039,
+ 38182,
+ 20165,
+ 35880,
+ 36827,
+ 38771,
+ 26187,
+ 31105,
+ 36817,
+ 28908,
+ 28024,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 32153,
+ 32154,
+ 32155,
+ 32156,
+ 32157,
+ 32158,
+ 32159,
+ 32160,
+ 32161,
+ 32162,
+ 32163,
+ 32164,
+ 32165,
+ 32167,
+ 32168,
+ 32169,
+ 32170,
+ 32171,
+ 32172,
+ 32173,
+ 32175,
+ 32176,
+ 32177,
+ 32178,
+ 32179,
+ 32180,
+ 32181,
+ 32182,
+ 32183,
+ 32184,
+ 32185,
+ 32186,
+ 32187,
+ 32188,
+ 32189,
+ 32190,
+ 32191,
+ 32192,
+ 32193,
+ 32194,
+ 32195,
+ 32196,
+ 32197,
+ 32198,
+ 32199,
+ 32200,
+ 32201,
+ 32202,
+ 32203,
+ 32204,
+ 32205,
+ 32206,
+ 32207,
+ 32208,
+ 32209,
+ 32210,
+ 32211,
+ 32212,
+ 32213,
+ 32214,
+ 32215,
+ 32216,
+ 32217,
+ 0,
+ 32218,
+ 32219,
+ 32220,
+ 32221,
+ 32222,
+ 32223,
+ 32224,
+ 32225,
+ 32226,
+ 32227,
+ 32228,
+ 32229,
+ 32230,
+ 32231,
+ 32232,
+ 32233,
+ 32234,
+ 32235,
+ 32236,
+ 32237,
+ 32238,
+ 32239,
+ 32240,
+ 32241,
+ 32242,
+ 32243,
+ 32244,
+ 32245,
+ 32246,
+ 32247,
+ 32248,
+ 32249,
+ 32250,
+ 23613,
+ 21170,
+ 33606,
+ 20834,
+ 33550,
+ 30555,
+ 26230,
+ 40120,
+ 20140,
+ 24778,
+ 31934,
+ 31923,
+ 32463,
+ 20117,
+ 35686,
+ 26223,
+ 39048,
+ 38745,
+ 22659,
+ 25964,
+ 38236,
+ 24452,
+ 30153,
+ 38742,
+ 31455,
+ 31454,
+ 20928,
+ 28847,
+ 31384,
+ 25578,
+ 31350,
+ 32416,
+ 29590,
+ 38893,
+ 20037,
+ 28792,
+ 20061,
+ 37202,
+ 21417,
+ 25937,
+ 26087,
+ 33276,
+ 33285,
+ 21646,
+ 23601,
+ 30106,
+ 38816,
+ 25304,
+ 29401,
+ 30141,
+ 23621,
+ 39545,
+ 33738,
+ 23616,
+ 21632,
+ 30697,
+ 20030,
+ 27822,
+ 32858,
+ 25298,
+ 25454,
+ 24040,
+ 20855,
+ 36317,
+ 36382,
+ 38191,
+ 20465,
+ 21477,
+ 24807,
+ 28844,
+ 21095,
+ 25424,
+ 40515,
+ 23071,
+ 20518,
+ 30519,
+ 21367,
+ 32482,
+ 25733,
+ 25899,
+ 25225,
+ 25496,
+ 20500,
+ 29237,
+ 35273,
+ 20915,
+ 35776,
+ 32477,
+ 22343,
+ 33740,
+ 38055,
+ 20891,
+ 21531,
+ 23803,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 32251,
+ 32252,
+ 32253,
+ 32254,
+ 32255,
+ 32256,
+ 32257,
+ 32258,
+ 32259,
+ 32260,
+ 32261,
+ 32262,
+ 32263,
+ 32264,
+ 32265,
+ 32266,
+ 32267,
+ 32268,
+ 32269,
+ 32270,
+ 32271,
+ 32272,
+ 32273,
+ 32274,
+ 32275,
+ 32276,
+ 32277,
+ 32278,
+ 32279,
+ 32280,
+ 32281,
+ 32282,
+ 32283,
+ 32284,
+ 32285,
+ 32286,
+ 32287,
+ 32288,
+ 32289,
+ 32290,
+ 32291,
+ 32292,
+ 32293,
+ 32294,
+ 32295,
+ 32296,
+ 32297,
+ 32298,
+ 32299,
+ 32300,
+ 32301,
+ 32302,
+ 32303,
+ 32304,
+ 32305,
+ 32306,
+ 32307,
+ 32308,
+ 32309,
+ 32310,
+ 32311,
+ 32312,
+ 32313,
+ 0,
+ 32314,
+ 32316,
+ 32317,
+ 32318,
+ 32319,
+ 32320,
+ 32322,
+ 32323,
+ 32324,
+ 32325,
+ 32326,
+ 32328,
+ 32329,
+ 32330,
+ 32331,
+ 32332,
+ 32333,
+ 32334,
+ 32335,
+ 32336,
+ 32337,
+ 32338,
+ 32339,
+ 32340,
+ 32341,
+ 32342,
+ 32343,
+ 32344,
+ 32345,
+ 32346,
+ 32347,
+ 32348,
+ 32349,
+ 20426,
+ 31459,
+ 27994,
+ 37089,
+ 39567,
+ 21888,
+ 21654,
+ 21345,
+ 21679,
+ 24320,
+ 25577,
+ 26999,
+ 20975,
+ 24936,
+ 21002,
+ 22570,
+ 21208,
+ 22350,
+ 30733,
+ 30475,
+ 24247,
+ 24951,
+ 31968,
+ 25179,
+ 25239,
+ 20130,
+ 28821,
+ 32771,
+ 25335,
+ 28900,
+ 38752,
+ 22391,
+ 33499,
+ 26607,
+ 26869,
+ 30933,
+ 39063,
+ 31185,
+ 22771,
+ 21683,
+ 21487,
+ 28212,
+ 20811,
+ 21051,
+ 23458,
+ 35838,
+ 32943,
+ 21827,
+ 22438,
+ 24691,
+ 22353,
+ 21549,
+ 31354,
+ 24656,
+ 23380,
+ 25511,
+ 25248,
+ 21475,
+ 25187,
+ 23495,
+ 26543,
+ 21741,
+ 31391,
+ 33510,
+ 37239,
+ 24211,
+ 35044,
+ 22840,
+ 22446,
+ 25358,
+ 36328,
+ 33007,
+ 22359,
+ 31607,
+ 20393,
+ 24555,
+ 23485,
+ 27454,
+ 21281,
+ 31568,
+ 29378,
+ 26694,
+ 30719,
+ 30518,
+ 26103,
+ 20917,
+ 20111,
+ 30420,
+ 23743,
+ 31397,
+ 33909,
+ 22862,
+ 39745,
+ 20608,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 32350,
+ 32351,
+ 32352,
+ 32353,
+ 32354,
+ 32355,
+ 32356,
+ 32357,
+ 32358,
+ 32359,
+ 32360,
+ 32361,
+ 32362,
+ 32363,
+ 32364,
+ 32365,
+ 32366,
+ 32367,
+ 32368,
+ 32369,
+ 32370,
+ 32371,
+ 32372,
+ 32373,
+ 32374,
+ 32375,
+ 32376,
+ 32377,
+ 32378,
+ 32379,
+ 32380,
+ 32381,
+ 32382,
+ 32383,
+ 32384,
+ 32385,
+ 32387,
+ 32388,
+ 32389,
+ 32390,
+ 32391,
+ 32392,
+ 32393,
+ 32394,
+ 32395,
+ 32396,
+ 32397,
+ 32398,
+ 32399,
+ 32400,
+ 32401,
+ 32402,
+ 32403,
+ 32404,
+ 32405,
+ 32406,
+ 32407,
+ 32408,
+ 32409,
+ 32410,
+ 32412,
+ 32413,
+ 32414,
+ 0,
+ 32430,
+ 32436,
+ 32443,
+ 32444,
+ 32470,
+ 32484,
+ 32492,
+ 32505,
+ 32522,
+ 32528,
+ 32542,
+ 32567,
+ 32569,
+ 32571,
+ 32572,
+ 32573,
+ 32574,
+ 32575,
+ 32576,
+ 32577,
+ 32579,
+ 32582,
+ 32583,
+ 32584,
+ 32585,
+ 32586,
+ 32587,
+ 32588,
+ 32589,
+ 32590,
+ 32591,
+ 32594,
+ 32595,
+ 39304,
+ 24871,
+ 28291,
+ 22372,
+ 26118,
+ 25414,
+ 22256,
+ 25324,
+ 25193,
+ 24275,
+ 38420,
+ 22403,
+ 25289,
+ 21895,
+ 34593,
+ 33098,
+ 36771,
+ 21862,
+ 33713,
+ 26469,
+ 36182,
+ 34013,
+ 23146,
+ 26639,
+ 25318,
+ 31726,
+ 38417,
+ 20848,
+ 28572,
+ 35888,
+ 25597,
+ 35272,
+ 25042,
+ 32518,
+ 28866,
+ 28389,
+ 29701,
+ 27028,
+ 29436,
+ 24266,
+ 37070,
+ 26391,
+ 28010,
+ 25438,
+ 21171,
+ 29282,
+ 32769,
+ 20332,
+ 23013,
+ 37226,
+ 28889,
+ 28061,
+ 21202,
+ 20048,
+ 38647,
+ 38253,
+ 34174,
+ 30922,
+ 32047,
+ 20769,
+ 22418,
+ 25794,
+ 32907,
+ 31867,
+ 27882,
+ 26865,
+ 26974,
+ 20919,
+ 21400,
+ 26792,
+ 29313,
+ 40654,
+ 31729,
+ 29432,
+ 31163,
+ 28435,
+ 29702,
+ 26446,
+ 37324,
+ 40100,
+ 31036,
+ 33673,
+ 33620,
+ 21519,
+ 26647,
+ 20029,
+ 21385,
+ 21169,
+ 30782,
+ 21382,
+ 21033,
+ 20616,
+ 20363,
+ 20432,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 32598,
+ 32601,
+ 32603,
+ 32604,
+ 32605,
+ 32606,
+ 32608,
+ 32611,
+ 32612,
+ 32613,
+ 32614,
+ 32615,
+ 32619,
+ 32620,
+ 32621,
+ 32623,
+ 32624,
+ 32627,
+ 32629,
+ 32630,
+ 32631,
+ 32632,
+ 32634,
+ 32635,
+ 32636,
+ 32637,
+ 32639,
+ 32640,
+ 32642,
+ 32643,
+ 32644,
+ 32645,
+ 32646,
+ 32647,
+ 32648,
+ 32649,
+ 32651,
+ 32653,
+ 32655,
+ 32656,
+ 32657,
+ 32658,
+ 32659,
+ 32661,
+ 32662,
+ 32663,
+ 32664,
+ 32665,
+ 32667,
+ 32668,
+ 32672,
+ 32674,
+ 32675,
+ 32677,
+ 32678,
+ 32680,
+ 32681,
+ 32682,
+ 32683,
+ 32684,
+ 32685,
+ 32686,
+ 32689,
+ 0,
+ 32691,
+ 32692,
+ 32693,
+ 32694,
+ 32695,
+ 32698,
+ 32699,
+ 32702,
+ 32704,
+ 32706,
+ 32707,
+ 32708,
+ 32710,
+ 32711,
+ 32712,
+ 32713,
+ 32715,
+ 32717,
+ 32719,
+ 32720,
+ 32721,
+ 32722,
+ 32723,
+ 32726,
+ 32727,
+ 32729,
+ 32730,
+ 32731,
+ 32732,
+ 32733,
+ 32734,
+ 32738,
+ 32739,
+ 30178,
+ 31435,
+ 31890,
+ 27813,
+ 38582,
+ 21147,
+ 29827,
+ 21737,
+ 20457,
+ 32852,
+ 33714,
+ 36830,
+ 38256,
+ 24265,
+ 24604,
+ 28063,
+ 24088,
+ 25947,
+ 33080,
+ 38142,
+ 24651,
+ 28860,
+ 32451,
+ 31918,
+ 20937,
+ 26753,
+ 31921,
+ 33391,
+ 20004,
+ 36742,
+ 37327,
+ 26238,
+ 20142,
+ 35845,
+ 25769,
+ 32842,
+ 20698,
+ 30103,
+ 29134,
+ 23525,
+ 36797,
+ 28518,
+ 20102,
+ 25730,
+ 38243,
+ 24278,
+ 26009,
+ 21015,
+ 35010,
+ 28872,
+ 21155,
+ 29454,
+ 29747,
+ 26519,
+ 30967,
+ 38678,
+ 20020,
+ 37051,
+ 40158,
+ 28107,
+ 20955,
+ 36161,
+ 21533,
+ 25294,
+ 29618,
+ 33777,
+ 38646,
+ 40836,
+ 38083,
+ 20278,
+ 32666,
+ 20940,
+ 28789,
+ 38517,
+ 23725,
+ 39046,
+ 21478,
+ 20196,
+ 28316,
+ 29705,
+ 27060,
+ 30827,
+ 39311,
+ 30041,
+ 21016,
+ 30244,
+ 27969,
+ 26611,
+ 20845,
+ 40857,
+ 32843,
+ 21657,
+ 31548,
+ 31423,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 32740,
+ 32743,
+ 32744,
+ 32746,
+ 32747,
+ 32748,
+ 32749,
+ 32751,
+ 32754,
+ 32756,
+ 32757,
+ 32758,
+ 32759,
+ 32760,
+ 32761,
+ 32762,
+ 32765,
+ 32766,
+ 32767,
+ 32770,
+ 32775,
+ 32776,
+ 32777,
+ 32778,
+ 32782,
+ 32783,
+ 32785,
+ 32787,
+ 32794,
+ 32795,
+ 32797,
+ 32798,
+ 32799,
+ 32801,
+ 32803,
+ 32804,
+ 32811,
+ 32812,
+ 32813,
+ 32814,
+ 32815,
+ 32816,
+ 32818,
+ 32820,
+ 32825,
+ 32826,
+ 32828,
+ 32830,
+ 32832,
+ 32833,
+ 32836,
+ 32837,
+ 32839,
+ 32840,
+ 32841,
+ 32846,
+ 32847,
+ 32848,
+ 32849,
+ 32851,
+ 32853,
+ 32854,
+ 32855,
+ 0,
+ 32857,
+ 32859,
+ 32860,
+ 32861,
+ 32862,
+ 32863,
+ 32864,
+ 32865,
+ 32866,
+ 32867,
+ 32868,
+ 32869,
+ 32870,
+ 32871,
+ 32872,
+ 32875,
+ 32876,
+ 32877,
+ 32878,
+ 32879,
+ 32880,
+ 32882,
+ 32883,
+ 32884,
+ 32885,
+ 32886,
+ 32887,
+ 32888,
+ 32889,
+ 32890,
+ 32891,
+ 32892,
+ 32893,
+ 38534,
+ 22404,
+ 25314,
+ 38471,
+ 27004,
+ 23044,
+ 25602,
+ 31699,
+ 28431,
+ 38475,
+ 33446,
+ 21346,
+ 39045,
+ 24208,
+ 28809,
+ 25523,
+ 21348,
+ 34383,
+ 40065,
+ 40595,
+ 30860,
+ 38706,
+ 36335,
+ 36162,
+ 40575,
+ 28510,
+ 31108,
+ 24405,
+ 38470,
+ 25134,
+ 39540,
+ 21525,
+ 38109,
+ 20387,
+ 26053,
+ 23653,
+ 23649,
+ 32533,
+ 34385,
+ 27695,
+ 24459,
+ 29575,
+ 28388,
+ 32511,
+ 23782,
+ 25371,
+ 23402,
+ 28390,
+ 21365,
+ 20081,
+ 25504,
+ 30053,
+ 25249,
+ 36718,
+ 20262,
+ 20177,
+ 27814,
+ 32438,
+ 35770,
+ 33821,
+ 34746,
+ 32599,
+ 36923,
+ 38179,
+ 31657,
+ 39585,
+ 35064,
+ 33853,
+ 27931,
+ 39558,
+ 32476,
+ 22920,
+ 40635,
+ 29595,
+ 30721,
+ 34434,
+ 39532,
+ 39554,
+ 22043,
+ 21527,
+ 22475,
+ 20080,
+ 40614,
+ 21334,
+ 36808,
+ 33033,
+ 30610,
+ 39314,
+ 34542,
+ 28385,
+ 34067,
+ 26364,
+ 24930,
+ 28459,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 32894,
+ 32897,
+ 32898,
+ 32901,
+ 32904,
+ 32906,
+ 32909,
+ 32910,
+ 32911,
+ 32912,
+ 32913,
+ 32914,
+ 32916,
+ 32917,
+ 32919,
+ 32921,
+ 32926,
+ 32931,
+ 32934,
+ 32935,
+ 32936,
+ 32940,
+ 32944,
+ 32947,
+ 32949,
+ 32950,
+ 32952,
+ 32953,
+ 32955,
+ 32965,
+ 32967,
+ 32968,
+ 32969,
+ 32970,
+ 32971,
+ 32975,
+ 32976,
+ 32977,
+ 32978,
+ 32979,
+ 32980,
+ 32981,
+ 32984,
+ 32991,
+ 32992,
+ 32994,
+ 32995,
+ 32998,
+ 33006,
+ 33013,
+ 33015,
+ 33017,
+ 33019,
+ 33022,
+ 33023,
+ 33024,
+ 33025,
+ 33027,
+ 33028,
+ 33029,
+ 33031,
+ 33032,
+ 33035,
+ 0,
+ 33036,
+ 33045,
+ 33047,
+ 33049,
+ 33051,
+ 33052,
+ 33053,
+ 33055,
+ 33056,
+ 33057,
+ 33058,
+ 33059,
+ 33060,
+ 33061,
+ 33062,
+ 33063,
+ 33064,
+ 33065,
+ 33066,
+ 33067,
+ 33069,
+ 33070,
+ 33072,
+ 33075,
+ 33076,
+ 33077,
+ 33079,
+ 33081,
+ 33082,
+ 33083,
+ 33084,
+ 33085,
+ 33087,
+ 35881,
+ 33426,
+ 33579,
+ 30450,
+ 27667,
+ 24537,
+ 33725,
+ 29483,
+ 33541,
+ 38170,
+ 27611,
+ 30683,
+ 38086,
+ 21359,
+ 33538,
+ 20882,
+ 24125,
+ 35980,
+ 36152,
+ 20040,
+ 29611,
+ 26522,
+ 26757,
+ 37238,
+ 38665,
+ 29028,
+ 27809,
+ 30473,
+ 23186,
+ 38209,
+ 27599,
+ 32654,
+ 26151,
+ 23504,
+ 22969,
+ 23194,
+ 38376,
+ 38391,
+ 20204,
+ 33804,
+ 33945,
+ 27308,
+ 30431,
+ 38192,
+ 29467,
+ 26790,
+ 23391,
+ 30511,
+ 37274,
+ 38753,
+ 31964,
+ 36855,
+ 35868,
+ 24357,
+ 31859,
+ 31192,
+ 35269,
+ 27852,
+ 34588,
+ 23494,
+ 24130,
+ 26825,
+ 30496,
+ 32501,
+ 20885,
+ 20813,
+ 21193,
+ 23081,
+ 32517,
+ 38754,
+ 33495,
+ 25551,
+ 30596,
+ 34256,
+ 31186,
+ 28218,
+ 24217,
+ 22937,
+ 34065,
+ 28781,
+ 27665,
+ 25279,
+ 30399,
+ 25935,
+ 24751,
+ 38397,
+ 26126,
+ 34719,
+ 40483,
+ 38125,
+ 21517,
+ 21629,
+ 35884,
+ 25720,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 33088,
+ 33089,
+ 33090,
+ 33091,
+ 33092,
+ 33093,
+ 33095,
+ 33097,
+ 33101,
+ 33102,
+ 33103,
+ 33106,
+ 33110,
+ 33111,
+ 33112,
+ 33115,
+ 33116,
+ 33117,
+ 33118,
+ 33119,
+ 33121,
+ 33122,
+ 33123,
+ 33124,
+ 33126,
+ 33128,
+ 33130,
+ 33131,
+ 33132,
+ 33135,
+ 33138,
+ 33139,
+ 33141,
+ 33142,
+ 33143,
+ 33144,
+ 33153,
+ 33155,
+ 33156,
+ 33157,
+ 33158,
+ 33159,
+ 33161,
+ 33163,
+ 33164,
+ 33165,
+ 33166,
+ 33168,
+ 33170,
+ 33171,
+ 33172,
+ 33173,
+ 33174,
+ 33175,
+ 33177,
+ 33178,
+ 33182,
+ 33183,
+ 33184,
+ 33185,
+ 33186,
+ 33188,
+ 33189,
+ 0,
+ 33191,
+ 33193,
+ 33195,
+ 33196,
+ 33197,
+ 33198,
+ 33199,
+ 33200,
+ 33201,
+ 33202,
+ 33204,
+ 33205,
+ 33206,
+ 33207,
+ 33208,
+ 33209,
+ 33212,
+ 33213,
+ 33214,
+ 33215,
+ 33220,
+ 33221,
+ 33223,
+ 33224,
+ 33225,
+ 33227,
+ 33229,
+ 33230,
+ 33231,
+ 33232,
+ 33233,
+ 33234,
+ 33235,
+ 25721,
+ 34321,
+ 27169,
+ 33180,
+ 30952,
+ 25705,
+ 39764,
+ 25273,
+ 26411,
+ 33707,
+ 22696,
+ 40664,
+ 27819,
+ 28448,
+ 23518,
+ 38476,
+ 35851,
+ 29279,
+ 26576,
+ 25287,
+ 29281,
+ 20137,
+ 22982,
+ 27597,
+ 22675,
+ 26286,
+ 24149,
+ 21215,
+ 24917,
+ 26408,
+ 30446,
+ 30566,
+ 29287,
+ 31302,
+ 25343,
+ 21738,
+ 21584,
+ 38048,
+ 37027,
+ 23068,
+ 32435,
+ 27670,
+ 20035,
+ 22902,
+ 32784,
+ 22856,
+ 21335,
+ 30007,
+ 38590,
+ 22218,
+ 25376,
+ 33041,
+ 24700,
+ 38393,
+ 28118,
+ 21602,
+ 39297,
+ 20869,
+ 23273,
+ 33021,
+ 22958,
+ 38675,
+ 20522,
+ 27877,
+ 23612,
+ 25311,
+ 20320,
+ 21311,
+ 33147,
+ 36870,
+ 28346,
+ 34091,
+ 25288,
+ 24180,
+ 30910,
+ 25781,
+ 25467,
+ 24565,
+ 23064,
+ 37247,
+ 40479,
+ 23615,
+ 25423,
+ 32834,
+ 23421,
+ 21870,
+ 38218,
+ 38221,
+ 28037,
+ 24744,
+ 26592,
+ 29406,
+ 20957,
+ 23425,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 33236,
+ 33237,
+ 33238,
+ 33239,
+ 33240,
+ 33241,
+ 33242,
+ 33243,
+ 33244,
+ 33245,
+ 33246,
+ 33247,
+ 33248,
+ 33249,
+ 33250,
+ 33252,
+ 33253,
+ 33254,
+ 33256,
+ 33257,
+ 33259,
+ 33262,
+ 33263,
+ 33264,
+ 33265,
+ 33266,
+ 33269,
+ 33270,
+ 33271,
+ 33272,
+ 33273,
+ 33274,
+ 33277,
+ 33279,
+ 33283,
+ 33287,
+ 33288,
+ 33289,
+ 33290,
+ 33291,
+ 33294,
+ 33295,
+ 33297,
+ 33299,
+ 33301,
+ 33302,
+ 33303,
+ 33304,
+ 33305,
+ 33306,
+ 33309,
+ 33312,
+ 33316,
+ 33317,
+ 33318,
+ 33319,
+ 33321,
+ 33326,
+ 33330,
+ 33338,
+ 33340,
+ 33341,
+ 33343,
+ 0,
+ 33344,
+ 33345,
+ 33346,
+ 33347,
+ 33349,
+ 33350,
+ 33352,
+ 33354,
+ 33356,
+ 33357,
+ 33358,
+ 33360,
+ 33361,
+ 33362,
+ 33363,
+ 33364,
+ 33365,
+ 33366,
+ 33367,
+ 33369,
+ 33371,
+ 33372,
+ 33373,
+ 33374,
+ 33376,
+ 33377,
+ 33378,
+ 33379,
+ 33380,
+ 33381,
+ 33382,
+ 33383,
+ 33385,
+ 25319,
+ 27870,
+ 29275,
+ 25197,
+ 38062,
+ 32445,
+ 33043,
+ 27987,
+ 20892,
+ 24324,
+ 22900,
+ 21162,
+ 24594,
+ 22899,
+ 26262,
+ 34384,
+ 30111,
+ 25386,
+ 25062,
+ 31983,
+ 35834,
+ 21734,
+ 27431,
+ 40485,
+ 27572,
+ 34261,
+ 21589,
+ 20598,
+ 27812,
+ 21866,
+ 36276,
+ 29228,
+ 24085,
+ 24597,
+ 29750,
+ 25293,
+ 25490,
+ 29260,
+ 24472,
+ 28227,
+ 27966,
+ 25856,
+ 28504,
+ 30424,
+ 30928,
+ 30460,
+ 30036,
+ 21028,
+ 21467,
+ 20051,
+ 24222,
+ 26049,
+ 32810,
+ 32982,
+ 25243,
+ 21638,
+ 21032,
+ 28846,
+ 34957,
+ 36305,
+ 27873,
+ 21624,
+ 32986,
+ 22521,
+ 35060,
+ 36180,
+ 38506,
+ 37197,
+ 20329,
+ 27803,
+ 21943,
+ 30406,
+ 30768,
+ 25256,
+ 28921,
+ 28558,
+ 24429,
+ 34028,
+ 26842,
+ 30844,
+ 31735,
+ 33192,
+ 26379,
+ 40527,
+ 25447,
+ 30896,
+ 22383,
+ 30738,
+ 38713,
+ 25209,
+ 25259,
+ 21128,
+ 29749,
+ 27607,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 33386,
+ 33387,
+ 33388,
+ 33389,
+ 33393,
+ 33397,
+ 33398,
+ 33399,
+ 33400,
+ 33403,
+ 33404,
+ 33408,
+ 33409,
+ 33411,
+ 33413,
+ 33414,
+ 33415,
+ 33417,
+ 33420,
+ 33424,
+ 33427,
+ 33428,
+ 33429,
+ 33430,
+ 33434,
+ 33435,
+ 33438,
+ 33440,
+ 33442,
+ 33443,
+ 33447,
+ 33458,
+ 33461,
+ 33462,
+ 33466,
+ 33467,
+ 33468,
+ 33471,
+ 33472,
+ 33474,
+ 33475,
+ 33477,
+ 33478,
+ 33481,
+ 33488,
+ 33494,
+ 33497,
+ 33498,
+ 33501,
+ 33506,
+ 33511,
+ 33512,
+ 33513,
+ 33514,
+ 33516,
+ 33517,
+ 33518,
+ 33520,
+ 33522,
+ 33523,
+ 33525,
+ 33526,
+ 33528,
+ 0,
+ 33530,
+ 33532,
+ 33533,
+ 33534,
+ 33535,
+ 33536,
+ 33546,
+ 33547,
+ 33549,
+ 33552,
+ 33554,
+ 33555,
+ 33558,
+ 33560,
+ 33561,
+ 33565,
+ 33566,
+ 33567,
+ 33568,
+ 33569,
+ 33570,
+ 33571,
+ 33572,
+ 33573,
+ 33574,
+ 33577,
+ 33578,
+ 33582,
+ 33584,
+ 33586,
+ 33591,
+ 33595,
+ 33597,
+ 21860,
+ 33086,
+ 30130,
+ 30382,
+ 21305,
+ 30174,
+ 20731,
+ 23617,
+ 35692,
+ 31687,
+ 20559,
+ 29255,
+ 39575,
+ 39128,
+ 28418,
+ 29922,
+ 31080,
+ 25735,
+ 30629,
+ 25340,
+ 39057,
+ 36139,
+ 21697,
+ 32856,
+ 20050,
+ 22378,
+ 33529,
+ 33805,
+ 24179,
+ 20973,
+ 29942,
+ 35780,
+ 23631,
+ 22369,
+ 27900,
+ 39047,
+ 23110,
+ 30772,
+ 39748,
+ 36843,
+ 31893,
+ 21078,
+ 25169,
+ 38138,
+ 20166,
+ 33670,
+ 33889,
+ 33769,
+ 33970,
+ 22484,
+ 26420,
+ 22275,
+ 26222,
+ 28006,
+ 35889,
+ 26333,
+ 28689,
+ 26399,
+ 27450,
+ 26646,
+ 25114,
+ 22971,
+ 19971,
+ 20932,
+ 28422,
+ 26578,
+ 27791,
+ 20854,
+ 26827,
+ 22855,
+ 27495,
+ 30054,
+ 23822,
+ 33040,
+ 40784,
+ 26071,
+ 31048,
+ 31041,
+ 39569,
+ 36215,
+ 23682,
+ 20062,
+ 20225,
+ 21551,
+ 22865,
+ 30732,
+ 22120,
+ 27668,
+ 36804,
+ 24323,
+ 27773,
+ 27875,
+ 35755,
+ 25488,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 33598,
+ 33599,
+ 33601,
+ 33602,
+ 33604,
+ 33605,
+ 33608,
+ 33610,
+ 33611,
+ 33612,
+ 33613,
+ 33614,
+ 33619,
+ 33621,
+ 33622,
+ 33623,
+ 33624,
+ 33625,
+ 33629,
+ 33634,
+ 33648,
+ 33649,
+ 33650,
+ 33651,
+ 33652,
+ 33653,
+ 33654,
+ 33657,
+ 33658,
+ 33662,
+ 33663,
+ 33664,
+ 33665,
+ 33666,
+ 33667,
+ 33668,
+ 33671,
+ 33672,
+ 33674,
+ 33675,
+ 33676,
+ 33677,
+ 33679,
+ 33680,
+ 33681,
+ 33684,
+ 33685,
+ 33686,
+ 33687,
+ 33689,
+ 33690,
+ 33693,
+ 33695,
+ 33697,
+ 33698,
+ 33699,
+ 33700,
+ 33701,
+ 33702,
+ 33703,
+ 33708,
+ 33709,
+ 33710,
+ 0,
+ 33711,
+ 33717,
+ 33723,
+ 33726,
+ 33727,
+ 33730,
+ 33731,
+ 33732,
+ 33734,
+ 33736,
+ 33737,
+ 33739,
+ 33741,
+ 33742,
+ 33744,
+ 33745,
+ 33746,
+ 33747,
+ 33749,
+ 33751,
+ 33753,
+ 33754,
+ 33755,
+ 33758,
+ 33762,
+ 33763,
+ 33764,
+ 33766,
+ 33767,
+ 33768,
+ 33771,
+ 33772,
+ 33773,
+ 24688,
+ 27965,
+ 29301,
+ 25190,
+ 38030,
+ 38085,
+ 21315,
+ 36801,
+ 31614,
+ 20191,
+ 35878,
+ 20094,
+ 40660,
+ 38065,
+ 38067,
+ 21069,
+ 28508,
+ 36963,
+ 27973,
+ 35892,
+ 22545,
+ 23884,
+ 27424,
+ 27465,
+ 26538,
+ 21595,
+ 33108,
+ 32652,
+ 22681,
+ 34103,
+ 24378,
+ 25250,
+ 27207,
+ 38201,
+ 25970,
+ 24708,
+ 26725,
+ 30631,
+ 20052,
+ 20392,
+ 24039,
+ 38808,
+ 25772,
+ 32728,
+ 23789,
+ 20431,
+ 31373,
+ 20999,
+ 33540,
+ 19988,
+ 24623,
+ 31363,
+ 38054,
+ 20405,
+ 20146,
+ 31206,
+ 29748,
+ 21220,
+ 33465,
+ 25810,
+ 31165,
+ 23517,
+ 27777,
+ 38738,
+ 36731,
+ 27682,
+ 20542,
+ 21375,
+ 28165,
+ 25806,
+ 26228,
+ 27696,
+ 24773,
+ 39031,
+ 35831,
+ 24198,
+ 29756,
+ 31351,
+ 31179,
+ 19992,
+ 37041,
+ 29699,
+ 27714,
+ 22234,
+ 37195,
+ 27845,
+ 36235,
+ 21306,
+ 34502,
+ 26354,
+ 36527,
+ 23624,
+ 39537,
+ 28192,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 33774,
+ 33775,
+ 33779,
+ 33780,
+ 33781,
+ 33782,
+ 33783,
+ 33786,
+ 33787,
+ 33788,
+ 33790,
+ 33791,
+ 33792,
+ 33794,
+ 33797,
+ 33799,
+ 33800,
+ 33801,
+ 33802,
+ 33808,
+ 33810,
+ 33811,
+ 33812,
+ 33813,
+ 33814,
+ 33815,
+ 33817,
+ 33818,
+ 33819,
+ 33822,
+ 33823,
+ 33824,
+ 33825,
+ 33826,
+ 33827,
+ 33833,
+ 33834,
+ 33835,
+ 33836,
+ 33837,
+ 33838,
+ 33839,
+ 33840,
+ 33842,
+ 33843,
+ 33844,
+ 33845,
+ 33846,
+ 33847,
+ 33849,
+ 33850,
+ 33851,
+ 33854,
+ 33855,
+ 33856,
+ 33857,
+ 33858,
+ 33859,
+ 33860,
+ 33861,
+ 33863,
+ 33864,
+ 33865,
+ 0,
+ 33866,
+ 33867,
+ 33868,
+ 33869,
+ 33870,
+ 33871,
+ 33872,
+ 33874,
+ 33875,
+ 33876,
+ 33877,
+ 33878,
+ 33880,
+ 33885,
+ 33886,
+ 33887,
+ 33888,
+ 33890,
+ 33892,
+ 33893,
+ 33894,
+ 33895,
+ 33896,
+ 33898,
+ 33902,
+ 33903,
+ 33904,
+ 33906,
+ 33908,
+ 33911,
+ 33913,
+ 33915,
+ 33916,
+ 21462,
+ 23094,
+ 40843,
+ 36259,
+ 21435,
+ 22280,
+ 39079,
+ 26435,
+ 37275,
+ 27849,
+ 20840,
+ 30154,
+ 25331,
+ 29356,
+ 21048,
+ 21149,
+ 32570,
+ 28820,
+ 30264,
+ 21364,
+ 40522,
+ 27063,
+ 30830,
+ 38592,
+ 35033,
+ 32676,
+ 28982,
+ 29123,
+ 20873,
+ 26579,
+ 29924,
+ 22756,
+ 25880,
+ 22199,
+ 35753,
+ 39286,
+ 25200,
+ 32469,
+ 24825,
+ 28909,
+ 22764,
+ 20161,
+ 20154,
+ 24525,
+ 38887,
+ 20219,
+ 35748,
+ 20995,
+ 22922,
+ 32427,
+ 25172,
+ 20173,
+ 26085,
+ 25102,
+ 33592,
+ 33993,
+ 33635,
+ 34701,
+ 29076,
+ 28342,
+ 23481,
+ 32466,
+ 20887,
+ 25545,
+ 26580,
+ 32905,
+ 33593,
+ 34837,
+ 20754,
+ 23418,
+ 22914,
+ 36785,
+ 20083,
+ 27741,
+ 20837,
+ 35109,
+ 36719,
+ 38446,
+ 34122,
+ 29790,
+ 38160,
+ 38384,
+ 28070,
+ 33509,
+ 24369,
+ 25746,
+ 27922,
+ 33832,
+ 33134,
+ 40131,
+ 22622,
+ 36187,
+ 19977,
+ 21441,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 33917,
+ 33918,
+ 33919,
+ 33920,
+ 33921,
+ 33923,
+ 33924,
+ 33925,
+ 33926,
+ 33930,
+ 33933,
+ 33935,
+ 33936,
+ 33937,
+ 33938,
+ 33939,
+ 33940,
+ 33941,
+ 33942,
+ 33944,
+ 33946,
+ 33947,
+ 33949,
+ 33950,
+ 33951,
+ 33952,
+ 33954,
+ 33955,
+ 33956,
+ 33957,
+ 33958,
+ 33959,
+ 33960,
+ 33961,
+ 33962,
+ 33963,
+ 33964,
+ 33965,
+ 33966,
+ 33968,
+ 33969,
+ 33971,
+ 33973,
+ 33974,
+ 33975,
+ 33979,
+ 33980,
+ 33982,
+ 33984,
+ 33986,
+ 33987,
+ 33989,
+ 33990,
+ 33991,
+ 33992,
+ 33995,
+ 33996,
+ 33998,
+ 33999,
+ 34002,
+ 34004,
+ 34005,
+ 34007,
+ 0,
+ 34008,
+ 34009,
+ 34010,
+ 34011,
+ 34012,
+ 34014,
+ 34017,
+ 34018,
+ 34020,
+ 34023,
+ 34024,
+ 34025,
+ 34026,
+ 34027,
+ 34029,
+ 34030,
+ 34031,
+ 34033,
+ 34034,
+ 34035,
+ 34036,
+ 34037,
+ 34038,
+ 34039,
+ 34040,
+ 34041,
+ 34042,
+ 34043,
+ 34045,
+ 34046,
+ 34048,
+ 34049,
+ 34050,
+ 20254,
+ 25955,
+ 26705,
+ 21971,
+ 20007,
+ 25620,
+ 39578,
+ 25195,
+ 23234,
+ 29791,
+ 33394,
+ 28073,
+ 26862,
+ 20711,
+ 33678,
+ 30722,
+ 26432,
+ 21049,
+ 27801,
+ 32433,
+ 20667,
+ 21861,
+ 29022,
+ 31579,
+ 26194,
+ 29642,
+ 33515,
+ 26441,
+ 23665,
+ 21024,
+ 29053,
+ 34923,
+ 38378,
+ 38485,
+ 25797,
+ 36193,
+ 33203,
+ 21892,
+ 27733,
+ 25159,
+ 32558,
+ 22674,
+ 20260,
+ 21830,
+ 36175,
+ 26188,
+ 19978,
+ 23578,
+ 35059,
+ 26786,
+ 25422,
+ 31245,
+ 28903,
+ 33421,
+ 21242,
+ 38902,
+ 23569,
+ 21736,
+ 37045,
+ 32461,
+ 22882,
+ 36170,
+ 34503,
+ 33292,
+ 33293,
+ 36198,
+ 25668,
+ 23556,
+ 24913,
+ 28041,
+ 31038,
+ 35774,
+ 30775,
+ 30003,
+ 21627,
+ 20280,
+ 36523,
+ 28145,
+ 23072,
+ 32453,
+ 31070,
+ 27784,
+ 23457,
+ 23158,
+ 29978,
+ 32958,
+ 24910,
+ 28183,
+ 22768,
+ 29983,
+ 29989,
+ 29298,
+ 21319,
+ 32499,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 34051,
+ 34052,
+ 34053,
+ 34054,
+ 34055,
+ 34056,
+ 34057,
+ 34058,
+ 34059,
+ 34061,
+ 34062,
+ 34063,
+ 34064,
+ 34066,
+ 34068,
+ 34069,
+ 34070,
+ 34072,
+ 34073,
+ 34075,
+ 34076,
+ 34077,
+ 34078,
+ 34080,
+ 34082,
+ 34083,
+ 34084,
+ 34085,
+ 34086,
+ 34087,
+ 34088,
+ 34089,
+ 34090,
+ 34093,
+ 34094,
+ 34095,
+ 34096,
+ 34097,
+ 34098,
+ 34099,
+ 34100,
+ 34101,
+ 34102,
+ 34110,
+ 34111,
+ 34112,
+ 34113,
+ 34114,
+ 34116,
+ 34117,
+ 34118,
+ 34119,
+ 34123,
+ 34124,
+ 34125,
+ 34126,
+ 34127,
+ 34128,
+ 34129,
+ 34130,
+ 34131,
+ 34132,
+ 34133,
+ 0,
+ 34135,
+ 34136,
+ 34138,
+ 34139,
+ 34140,
+ 34141,
+ 34143,
+ 34144,
+ 34145,
+ 34146,
+ 34147,
+ 34149,
+ 34150,
+ 34151,
+ 34153,
+ 34154,
+ 34155,
+ 34156,
+ 34157,
+ 34158,
+ 34159,
+ 34160,
+ 34161,
+ 34163,
+ 34165,
+ 34166,
+ 34167,
+ 34168,
+ 34172,
+ 34173,
+ 34175,
+ 34176,
+ 34177,
+ 30465,
+ 30427,
+ 21097,
+ 32988,
+ 22307,
+ 24072,
+ 22833,
+ 29422,
+ 26045,
+ 28287,
+ 35799,
+ 23608,
+ 34417,
+ 21313,
+ 30707,
+ 25342,
+ 26102,
+ 20160,
+ 39135,
+ 34432,
+ 23454,
+ 35782,
+ 21490,
+ 30690,
+ 20351,
+ 23630,
+ 39542,
+ 22987,
+ 24335,
+ 31034,
+ 22763,
+ 19990,
+ 26623,
+ 20107,
+ 25325,
+ 35475,
+ 36893,
+ 21183,
+ 26159,
+ 21980,
+ 22124,
+ 36866,
+ 20181,
+ 20365,
+ 37322,
+ 39280,
+ 27663,
+ 24066,
+ 24643,
+ 23460,
+ 35270,
+ 35797,
+ 25910,
+ 25163,
+ 39318,
+ 23432,
+ 23551,
+ 25480,
+ 21806,
+ 21463,
+ 30246,
+ 20861,
+ 34092,
+ 26530,
+ 26803,
+ 27530,
+ 25234,
+ 36755,
+ 21460,
+ 33298,
+ 28113,
+ 30095,
+ 20070,
+ 36174,
+ 23408,
+ 29087,
+ 34223,
+ 26257,
+ 26329,
+ 32626,
+ 34560,
+ 40653,
+ 40736,
+ 23646,
+ 26415,
+ 36848,
+ 26641,
+ 26463,
+ 25101,
+ 31446,
+ 22661,
+ 24246,
+ 25968,
+ 28465,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 34178,
+ 34179,
+ 34182,
+ 34184,
+ 34185,
+ 34186,
+ 34187,
+ 34188,
+ 34189,
+ 34190,
+ 34192,
+ 34193,
+ 34194,
+ 34195,
+ 34196,
+ 34197,
+ 34198,
+ 34199,
+ 34200,
+ 34201,
+ 34202,
+ 34205,
+ 34206,
+ 34207,
+ 34208,
+ 34209,
+ 34210,
+ 34211,
+ 34213,
+ 34214,
+ 34215,
+ 34217,
+ 34219,
+ 34220,
+ 34221,
+ 34225,
+ 34226,
+ 34227,
+ 34228,
+ 34229,
+ 34230,
+ 34232,
+ 34234,
+ 34235,
+ 34236,
+ 34237,
+ 34238,
+ 34239,
+ 34240,
+ 34242,
+ 34243,
+ 34244,
+ 34245,
+ 34246,
+ 34247,
+ 34248,
+ 34250,
+ 34251,
+ 34252,
+ 34253,
+ 34254,
+ 34257,
+ 34258,
+ 0,
+ 34260,
+ 34262,
+ 34263,
+ 34264,
+ 34265,
+ 34266,
+ 34267,
+ 34269,
+ 34270,
+ 34271,
+ 34272,
+ 34273,
+ 34274,
+ 34275,
+ 34277,
+ 34278,
+ 34279,
+ 34280,
+ 34282,
+ 34283,
+ 34284,
+ 34285,
+ 34286,
+ 34287,
+ 34288,
+ 34289,
+ 34290,
+ 34291,
+ 34292,
+ 34293,
+ 34294,
+ 34295,
+ 34296,
+ 24661,
+ 21047,
+ 32781,
+ 25684,
+ 34928,
+ 29993,
+ 24069,
+ 26643,
+ 25332,
+ 38684,
+ 21452,
+ 29245,
+ 35841,
+ 27700,
+ 30561,
+ 31246,
+ 21550,
+ 30636,
+ 39034,
+ 33308,
+ 35828,
+ 30805,
+ 26388,
+ 28865,
+ 26031,
+ 25749,
+ 22070,
+ 24605,
+ 31169,
+ 21496,
+ 19997,
+ 27515,
+ 32902,
+ 23546,
+ 21987,
+ 22235,
+ 20282,
+ 20284,
+ 39282,
+ 24051,
+ 26494,
+ 32824,
+ 24578,
+ 39042,
+ 36865,
+ 23435,
+ 35772,
+ 35829,
+ 25628,
+ 33368,
+ 25822,
+ 22013,
+ 33487,
+ 37221,
+ 20439,
+ 32032,
+ 36895,
+ 31903,
+ 20723,
+ 22609,
+ 28335,
+ 23487,
+ 35785,
+ 32899,
+ 37240,
+ 33948,
+ 31639,
+ 34429,
+ 38539,
+ 38543,
+ 32485,
+ 39635,
+ 30862,
+ 23681,
+ 31319,
+ 36930,
+ 38567,
+ 31071,
+ 23385,
+ 25439,
+ 31499,
+ 34001,
+ 26797,
+ 21766,
+ 32553,
+ 29712,
+ 32034,
+ 38145,
+ 25152,
+ 22604,
+ 20182,
+ 23427,
+ 22905,
+ 22612,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 34297,
+ 34298,
+ 34300,
+ 34301,
+ 34302,
+ 34304,
+ 34305,
+ 34306,
+ 34307,
+ 34308,
+ 34310,
+ 34311,
+ 34312,
+ 34313,
+ 34314,
+ 34315,
+ 34316,
+ 34317,
+ 34318,
+ 34319,
+ 34320,
+ 34322,
+ 34323,
+ 34324,
+ 34325,
+ 34327,
+ 34328,
+ 34329,
+ 34330,
+ 34331,
+ 34332,
+ 34333,
+ 34334,
+ 34335,
+ 34336,
+ 34337,
+ 34338,
+ 34339,
+ 34340,
+ 34341,
+ 34342,
+ 34344,
+ 34346,
+ 34347,
+ 34348,
+ 34349,
+ 34350,
+ 34351,
+ 34352,
+ 34353,
+ 34354,
+ 34355,
+ 34356,
+ 34357,
+ 34358,
+ 34359,
+ 34361,
+ 34362,
+ 34363,
+ 34365,
+ 34366,
+ 34367,
+ 34368,
+ 0,
+ 34369,
+ 34370,
+ 34371,
+ 34372,
+ 34373,
+ 34374,
+ 34375,
+ 34376,
+ 34377,
+ 34378,
+ 34379,
+ 34380,
+ 34386,
+ 34387,
+ 34389,
+ 34390,
+ 34391,
+ 34392,
+ 34393,
+ 34395,
+ 34396,
+ 34397,
+ 34399,
+ 34400,
+ 34401,
+ 34403,
+ 34404,
+ 34405,
+ 34406,
+ 34407,
+ 34408,
+ 34409,
+ 34410,
+ 29549,
+ 25374,
+ 36427,
+ 36367,
+ 32974,
+ 33492,
+ 25260,
+ 21488,
+ 27888,
+ 37214,
+ 22826,
+ 24577,
+ 27760,
+ 22349,
+ 25674,
+ 36138,
+ 30251,
+ 28393,
+ 22363,
+ 27264,
+ 30192,
+ 28525,
+ 35885,
+ 35848,
+ 22374,
+ 27631,
+ 34962,
+ 30899,
+ 25506,
+ 21497,
+ 28845,
+ 27748,
+ 22616,
+ 25642,
+ 22530,
+ 26848,
+ 33179,
+ 21776,
+ 31958,
+ 20504,
+ 36538,
+ 28108,
+ 36255,
+ 28907,
+ 25487,
+ 28059,
+ 28372,
+ 32486,
+ 33796,
+ 26691,
+ 36867,
+ 28120,
+ 38518,
+ 35752,
+ 22871,
+ 29305,
+ 34276,
+ 33150,
+ 30140,
+ 35466,
+ 26799,
+ 21076,
+ 36386,
+ 38161,
+ 25552,
+ 39064,
+ 36420,
+ 21884,
+ 20307,
+ 26367,
+ 22159,
+ 24789,
+ 28053,
+ 21059,
+ 23625,
+ 22825,
+ 28155,
+ 22635,
+ 30000,
+ 29980,
+ 24684,
+ 33300,
+ 33094,
+ 25361,
+ 26465,
+ 36834,
+ 30522,
+ 36339,
+ 36148,
+ 38081,
+ 24086,
+ 21381,
+ 21548,
+ 28867,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 34413,
+ 34415,
+ 34416,
+ 34418,
+ 34419,
+ 34420,
+ 34421,
+ 34422,
+ 34423,
+ 34424,
+ 34435,
+ 34436,
+ 34437,
+ 34438,
+ 34439,
+ 34440,
+ 34441,
+ 34446,
+ 34447,
+ 34448,
+ 34449,
+ 34450,
+ 34452,
+ 34454,
+ 34455,
+ 34456,
+ 34457,
+ 34458,
+ 34459,
+ 34462,
+ 34463,
+ 34464,
+ 34465,
+ 34466,
+ 34469,
+ 34470,
+ 34475,
+ 34477,
+ 34478,
+ 34482,
+ 34483,
+ 34487,
+ 34488,
+ 34489,
+ 34491,
+ 34492,
+ 34493,
+ 34494,
+ 34495,
+ 34497,
+ 34498,
+ 34499,
+ 34501,
+ 34504,
+ 34508,
+ 34509,
+ 34514,
+ 34515,
+ 34517,
+ 34518,
+ 34519,
+ 34522,
+ 34524,
+ 0,
+ 34525,
+ 34528,
+ 34529,
+ 34530,
+ 34531,
+ 34533,
+ 34534,
+ 34535,
+ 34536,
+ 34538,
+ 34539,
+ 34540,
+ 34543,
+ 34549,
+ 34550,
+ 34551,
+ 34554,
+ 34555,
+ 34556,
+ 34557,
+ 34559,
+ 34561,
+ 34564,
+ 34565,
+ 34566,
+ 34571,
+ 34572,
+ 34574,
+ 34575,
+ 34576,
+ 34577,
+ 34580,
+ 34582,
+ 27712,
+ 24311,
+ 20572,
+ 20141,
+ 24237,
+ 25402,
+ 33351,
+ 36890,
+ 26704,
+ 37230,
+ 30643,
+ 21516,
+ 38108,
+ 24420,
+ 31461,
+ 26742,
+ 25413,
+ 31570,
+ 32479,
+ 30171,
+ 20599,
+ 25237,
+ 22836,
+ 36879,
+ 20984,
+ 31171,
+ 31361,
+ 22270,
+ 24466,
+ 36884,
+ 28034,
+ 23648,
+ 22303,
+ 21520,
+ 20820,
+ 28237,
+ 22242,
+ 25512,
+ 39059,
+ 33151,
+ 34581,
+ 35114,
+ 36864,
+ 21534,
+ 23663,
+ 33216,
+ 25302,
+ 25176,
+ 33073,
+ 40501,
+ 38464,
+ 39534,
+ 39548,
+ 26925,
+ 22949,
+ 25299,
+ 21822,
+ 25366,
+ 21703,
+ 34521,
+ 27964,
+ 23043,
+ 29926,
+ 34972,
+ 27498,
+ 22806,
+ 35916,
+ 24367,
+ 28286,
+ 29609,
+ 39037,
+ 20024,
+ 28919,
+ 23436,
+ 30871,
+ 25405,
+ 26202,
+ 30358,
+ 24779,
+ 23451,
+ 23113,
+ 19975,
+ 33109,
+ 27754,
+ 29579,
+ 20129,
+ 26505,
+ 32593,
+ 24448,
+ 26106,
+ 26395,
+ 24536,
+ 22916,
+ 23041,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 34585,
+ 34587,
+ 34589,
+ 34591,
+ 34592,
+ 34596,
+ 34598,
+ 34599,
+ 34600,
+ 34602,
+ 34603,
+ 34604,
+ 34605,
+ 34607,
+ 34608,
+ 34610,
+ 34611,
+ 34613,
+ 34614,
+ 34616,
+ 34617,
+ 34618,
+ 34620,
+ 34621,
+ 34624,
+ 34625,
+ 34626,
+ 34627,
+ 34628,
+ 34629,
+ 34630,
+ 34634,
+ 34635,
+ 34637,
+ 34639,
+ 34640,
+ 34641,
+ 34642,
+ 34644,
+ 34645,
+ 34646,
+ 34648,
+ 34650,
+ 34651,
+ 34652,
+ 34653,
+ 34654,
+ 34655,
+ 34657,
+ 34658,
+ 34662,
+ 34663,
+ 34664,
+ 34665,
+ 34666,
+ 34667,
+ 34668,
+ 34669,
+ 34671,
+ 34673,
+ 34674,
+ 34675,
+ 34677,
+ 0,
+ 34679,
+ 34680,
+ 34681,
+ 34682,
+ 34687,
+ 34688,
+ 34689,
+ 34692,
+ 34694,
+ 34695,
+ 34697,
+ 34698,
+ 34700,
+ 34702,
+ 34703,
+ 34704,
+ 34705,
+ 34706,
+ 34708,
+ 34709,
+ 34710,
+ 34712,
+ 34713,
+ 34714,
+ 34715,
+ 34716,
+ 34717,
+ 34718,
+ 34720,
+ 34721,
+ 34722,
+ 34723,
+ 34724,
+ 24013,
+ 24494,
+ 21361,
+ 38886,
+ 36829,
+ 26693,
+ 22260,
+ 21807,
+ 24799,
+ 20026,
+ 28493,
+ 32500,
+ 33479,
+ 33806,
+ 22996,
+ 20255,
+ 20266,
+ 23614,
+ 32428,
+ 26410,
+ 34074,
+ 21619,
+ 30031,
+ 32963,
+ 21890,
+ 39759,
+ 20301,
+ 28205,
+ 35859,
+ 23561,
+ 24944,
+ 21355,
+ 30239,
+ 28201,
+ 34442,
+ 25991,
+ 38395,
+ 32441,
+ 21563,
+ 31283,
+ 32010,
+ 38382,
+ 21985,
+ 32705,
+ 29934,
+ 25373,
+ 34583,
+ 28065,
+ 31389,
+ 25105,
+ 26017,
+ 21351,
+ 25569,
+ 27779,
+ 24043,
+ 21596,
+ 38056,
+ 20044,
+ 27745,
+ 35820,
+ 23627,
+ 26080,
+ 33436,
+ 26791,
+ 21566,
+ 21556,
+ 27595,
+ 27494,
+ 20116,
+ 25410,
+ 21320,
+ 33310,
+ 20237,
+ 20398,
+ 22366,
+ 25098,
+ 38654,
+ 26212,
+ 29289,
+ 21247,
+ 21153,
+ 24735,
+ 35823,
+ 26132,
+ 29081,
+ 26512,
+ 35199,
+ 30802,
+ 30717,
+ 26224,
+ 22075,
+ 21560,
+ 38177,
+ 29306,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 34725,
+ 34726,
+ 34727,
+ 34729,
+ 34730,
+ 34734,
+ 34736,
+ 34737,
+ 34738,
+ 34740,
+ 34742,
+ 34743,
+ 34744,
+ 34745,
+ 34747,
+ 34748,
+ 34750,
+ 34751,
+ 34753,
+ 34754,
+ 34755,
+ 34756,
+ 34757,
+ 34759,
+ 34760,
+ 34761,
+ 34764,
+ 34765,
+ 34766,
+ 34767,
+ 34768,
+ 34772,
+ 34773,
+ 34774,
+ 34775,
+ 34776,
+ 34777,
+ 34778,
+ 34780,
+ 34781,
+ 34782,
+ 34783,
+ 34785,
+ 34786,
+ 34787,
+ 34788,
+ 34790,
+ 34791,
+ 34792,
+ 34793,
+ 34795,
+ 34796,
+ 34797,
+ 34799,
+ 34800,
+ 34801,
+ 34802,
+ 34803,
+ 34804,
+ 34805,
+ 34806,
+ 34807,
+ 34808,
+ 0,
+ 34810,
+ 34811,
+ 34812,
+ 34813,
+ 34815,
+ 34816,
+ 34817,
+ 34818,
+ 34820,
+ 34821,
+ 34822,
+ 34823,
+ 34824,
+ 34825,
+ 34827,
+ 34828,
+ 34829,
+ 34830,
+ 34831,
+ 34832,
+ 34833,
+ 34834,
+ 34836,
+ 34839,
+ 34840,
+ 34841,
+ 34842,
+ 34844,
+ 34845,
+ 34846,
+ 34847,
+ 34848,
+ 34851,
+ 31232,
+ 24687,
+ 24076,
+ 24713,
+ 33181,
+ 22805,
+ 24796,
+ 29060,
+ 28911,
+ 28330,
+ 27728,
+ 29312,
+ 27268,
+ 34989,
+ 24109,
+ 20064,
+ 23219,
+ 21916,
+ 38115,
+ 27927,
+ 31995,
+ 38553,
+ 25103,
+ 32454,
+ 30606,
+ 34430,
+ 21283,
+ 38686,
+ 36758,
+ 26247,
+ 23777,
+ 20384,
+ 29421,
+ 19979,
+ 21414,
+ 22799,
+ 21523,
+ 25472,
+ 38184,
+ 20808,
+ 20185,
+ 40092,
+ 32420,
+ 21688,
+ 36132,
+ 34900,
+ 33335,
+ 38386,
+ 28046,
+ 24358,
+ 23244,
+ 26174,
+ 38505,
+ 29616,
+ 29486,
+ 21439,
+ 33146,
+ 39301,
+ 32673,
+ 23466,
+ 38519,
+ 38480,
+ 32447,
+ 30456,
+ 21410,
+ 38262,
+ 39321,
+ 31665,
+ 35140,
+ 28248,
+ 20065,
+ 32724,
+ 31077,
+ 35814,
+ 24819,
+ 21709,
+ 20139,
+ 39033,
+ 24055,
+ 27233,
+ 20687,
+ 21521,
+ 35937,
+ 33831,
+ 30813,
+ 38660,
+ 21066,
+ 21742,
+ 22179,
+ 38144,
+ 28040,
+ 23477,
+ 28102,
+ 26195,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 34852,
+ 34853,
+ 34854,
+ 34855,
+ 34856,
+ 34857,
+ 34858,
+ 34859,
+ 34860,
+ 34861,
+ 34862,
+ 34863,
+ 34864,
+ 34865,
+ 34867,
+ 34868,
+ 34869,
+ 34870,
+ 34871,
+ 34872,
+ 34874,
+ 34875,
+ 34877,
+ 34878,
+ 34879,
+ 34881,
+ 34882,
+ 34883,
+ 34886,
+ 34887,
+ 34888,
+ 34889,
+ 34890,
+ 34891,
+ 34894,
+ 34895,
+ 34896,
+ 34897,
+ 34898,
+ 34899,
+ 34901,
+ 34902,
+ 34904,
+ 34906,
+ 34907,
+ 34908,
+ 34909,
+ 34910,
+ 34911,
+ 34912,
+ 34918,
+ 34919,
+ 34922,
+ 34925,
+ 34927,
+ 34929,
+ 34931,
+ 34932,
+ 34933,
+ 34934,
+ 34936,
+ 34937,
+ 34938,
+ 0,
+ 34939,
+ 34940,
+ 34944,
+ 34947,
+ 34950,
+ 34951,
+ 34953,
+ 34954,
+ 34956,
+ 34958,
+ 34959,
+ 34960,
+ 34961,
+ 34963,
+ 34964,
+ 34965,
+ 34967,
+ 34968,
+ 34969,
+ 34970,
+ 34971,
+ 34973,
+ 34974,
+ 34975,
+ 34976,
+ 34977,
+ 34979,
+ 34981,
+ 34982,
+ 34983,
+ 34984,
+ 34985,
+ 34986,
+ 23567,
+ 23389,
+ 26657,
+ 32918,
+ 21880,
+ 31505,
+ 25928,
+ 26964,
+ 20123,
+ 27463,
+ 34638,
+ 38795,
+ 21327,
+ 25375,
+ 25658,
+ 37034,
+ 26012,
+ 32961,
+ 35856,
+ 20889,
+ 26800,
+ 21368,
+ 34809,
+ 25032,
+ 27844,
+ 27899,
+ 35874,
+ 23633,
+ 34218,
+ 33455,
+ 38156,
+ 27427,
+ 36763,
+ 26032,
+ 24571,
+ 24515,
+ 20449,
+ 34885,
+ 26143,
+ 33125,
+ 29481,
+ 24826,
+ 20852,
+ 21009,
+ 22411,
+ 24418,
+ 37026,
+ 34892,
+ 37266,
+ 24184,
+ 26447,
+ 24615,
+ 22995,
+ 20804,
+ 20982,
+ 33016,
+ 21256,
+ 27769,
+ 38596,
+ 29066,
+ 20241,
+ 20462,
+ 32670,
+ 26429,
+ 21957,
+ 38152,
+ 31168,
+ 34966,
+ 32483,
+ 22687,
+ 25100,
+ 38656,
+ 34394,
+ 22040,
+ 39035,
+ 24464,
+ 35768,
+ 33988,
+ 37207,
+ 21465,
+ 26093,
+ 24207,
+ 30044,
+ 24676,
+ 32110,
+ 23167,
+ 32490,
+ 32493,
+ 36713,
+ 21927,
+ 23459,
+ 24748,
+ 26059,
+ 29572,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 34988,
+ 34990,
+ 34991,
+ 34992,
+ 34994,
+ 34995,
+ 34996,
+ 34997,
+ 34998,
+ 35000,
+ 35001,
+ 35002,
+ 35003,
+ 35005,
+ 35006,
+ 35007,
+ 35008,
+ 35011,
+ 35012,
+ 35015,
+ 35016,
+ 35018,
+ 35019,
+ 35020,
+ 35021,
+ 35023,
+ 35024,
+ 35025,
+ 35027,
+ 35030,
+ 35031,
+ 35034,
+ 35035,
+ 35036,
+ 35037,
+ 35038,
+ 35040,
+ 35041,
+ 35046,
+ 35047,
+ 35049,
+ 35050,
+ 35051,
+ 35052,
+ 35053,
+ 35054,
+ 35055,
+ 35058,
+ 35061,
+ 35062,
+ 35063,
+ 35066,
+ 35067,
+ 35069,
+ 35071,
+ 35072,
+ 35073,
+ 35075,
+ 35076,
+ 35077,
+ 35078,
+ 35079,
+ 35080,
+ 0,
+ 35081,
+ 35083,
+ 35084,
+ 35085,
+ 35086,
+ 35087,
+ 35089,
+ 35092,
+ 35093,
+ 35094,
+ 35095,
+ 35096,
+ 35100,
+ 35101,
+ 35102,
+ 35103,
+ 35104,
+ 35106,
+ 35107,
+ 35108,
+ 35110,
+ 35111,
+ 35112,
+ 35113,
+ 35116,
+ 35117,
+ 35118,
+ 35119,
+ 35121,
+ 35122,
+ 35123,
+ 35125,
+ 35127,
+ 36873,
+ 30307,
+ 30505,
+ 32474,
+ 38772,
+ 34203,
+ 23398,
+ 31348,
+ 38634,
+ 34880,
+ 21195,
+ 29071,
+ 24490,
+ 26092,
+ 35810,
+ 23547,
+ 39535,
+ 24033,
+ 27529,
+ 27739,
+ 35757,
+ 35759,
+ 36874,
+ 36805,
+ 21387,
+ 25276,
+ 40486,
+ 40493,
+ 21568,
+ 20011,
+ 33469,
+ 29273,
+ 34460,
+ 23830,
+ 34905,
+ 28079,
+ 38597,
+ 21713,
+ 20122,
+ 35766,
+ 28937,
+ 21693,
+ 38409,
+ 28895,
+ 28153,
+ 30416,
+ 20005,
+ 30740,
+ 34578,
+ 23721,
+ 24310,
+ 35328,
+ 39068,
+ 38414,
+ 28814,
+ 27839,
+ 22852,
+ 25513,
+ 30524,
+ 34893,
+ 28436,
+ 33395,
+ 22576,
+ 29141,
+ 21388,
+ 30746,
+ 38593,
+ 21761,
+ 24422,
+ 28976,
+ 23476,
+ 35866,
+ 39564,
+ 27523,
+ 22830,
+ 40495,
+ 31207,
+ 26472,
+ 25196,
+ 20335,
+ 30113,
+ 32650,
+ 27915,
+ 38451,
+ 27687,
+ 20208,
+ 30162,
+ 20859,
+ 26679,
+ 28478,
+ 36992,
+ 33136,
+ 22934,
+ 29814,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 35128,
+ 35129,
+ 35130,
+ 35131,
+ 35132,
+ 35133,
+ 35134,
+ 35135,
+ 35136,
+ 35138,
+ 35139,
+ 35141,
+ 35142,
+ 35143,
+ 35144,
+ 35145,
+ 35146,
+ 35147,
+ 35148,
+ 35149,
+ 35150,
+ 35151,
+ 35152,
+ 35153,
+ 35154,
+ 35155,
+ 35156,
+ 35157,
+ 35158,
+ 35159,
+ 35160,
+ 35161,
+ 35162,
+ 35163,
+ 35164,
+ 35165,
+ 35168,
+ 35169,
+ 35170,
+ 35171,
+ 35172,
+ 35173,
+ 35175,
+ 35176,
+ 35177,
+ 35178,
+ 35179,
+ 35180,
+ 35181,
+ 35182,
+ 35183,
+ 35184,
+ 35185,
+ 35186,
+ 35187,
+ 35188,
+ 35189,
+ 35190,
+ 35191,
+ 35192,
+ 35193,
+ 35194,
+ 35196,
+ 0,
+ 35197,
+ 35198,
+ 35200,
+ 35202,
+ 35204,
+ 35205,
+ 35207,
+ 35208,
+ 35209,
+ 35210,
+ 35211,
+ 35212,
+ 35213,
+ 35214,
+ 35215,
+ 35216,
+ 35217,
+ 35218,
+ 35219,
+ 35220,
+ 35221,
+ 35222,
+ 35223,
+ 35224,
+ 35225,
+ 35226,
+ 35227,
+ 35228,
+ 35229,
+ 35230,
+ 35231,
+ 35232,
+ 35233,
+ 25671,
+ 23591,
+ 36965,
+ 31377,
+ 35875,
+ 23002,
+ 21676,
+ 33280,
+ 33647,
+ 35201,
+ 32768,
+ 26928,
+ 22094,
+ 32822,
+ 29239,
+ 37326,
+ 20918,
+ 20063,
+ 39029,
+ 25494,
+ 19994,
+ 21494,
+ 26355,
+ 33099,
+ 22812,
+ 28082,
+ 19968,
+ 22777,
+ 21307,
+ 25558,
+ 38129,
+ 20381,
+ 20234,
+ 34915,
+ 39056,
+ 22839,
+ 36951,
+ 31227,
+ 20202,
+ 33008,
+ 30097,
+ 27778,
+ 23452,
+ 23016,
+ 24413,
+ 26885,
+ 34433,
+ 20506,
+ 24050,
+ 20057,
+ 30691,
+ 20197,
+ 33402,
+ 25233,
+ 26131,
+ 37009,
+ 23673,
+ 20159,
+ 24441,
+ 33222,
+ 36920,
+ 32900,
+ 30123,
+ 20134,
+ 35028,
+ 24847,
+ 27589,
+ 24518,
+ 20041,
+ 30410,
+ 28322,
+ 35811,
+ 35758,
+ 35850,
+ 35793,
+ 24322,
+ 32764,
+ 32716,
+ 32462,
+ 33589,
+ 33643,
+ 22240,
+ 27575,
+ 38899,
+ 38452,
+ 23035,
+ 21535,
+ 38134,
+ 28139,
+ 23493,
+ 39278,
+ 23609,
+ 24341,
+ 38544,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 35234,
+ 35235,
+ 35236,
+ 35237,
+ 35238,
+ 35239,
+ 35240,
+ 35241,
+ 35242,
+ 35243,
+ 35244,
+ 35245,
+ 35246,
+ 35247,
+ 35248,
+ 35249,
+ 35250,
+ 35251,
+ 35252,
+ 35253,
+ 35254,
+ 35255,
+ 35256,
+ 35257,
+ 35258,
+ 35259,
+ 35260,
+ 35261,
+ 35262,
+ 35263,
+ 35264,
+ 35267,
+ 35277,
+ 35283,
+ 35284,
+ 35285,
+ 35287,
+ 35288,
+ 35289,
+ 35291,
+ 35293,
+ 35295,
+ 35296,
+ 35297,
+ 35298,
+ 35300,
+ 35303,
+ 35304,
+ 35305,
+ 35306,
+ 35308,
+ 35309,
+ 35310,
+ 35312,
+ 35313,
+ 35314,
+ 35316,
+ 35317,
+ 35318,
+ 35319,
+ 35320,
+ 35321,
+ 35322,
+ 0,
+ 35323,
+ 35324,
+ 35325,
+ 35326,
+ 35327,
+ 35329,
+ 35330,
+ 35331,
+ 35332,
+ 35333,
+ 35334,
+ 35336,
+ 35337,
+ 35338,
+ 35339,
+ 35340,
+ 35341,
+ 35342,
+ 35343,
+ 35344,
+ 35345,
+ 35346,
+ 35347,
+ 35348,
+ 35349,
+ 35350,
+ 35351,
+ 35352,
+ 35353,
+ 35354,
+ 35355,
+ 35356,
+ 35357,
+ 21360,
+ 33521,
+ 27185,
+ 23156,
+ 40560,
+ 24212,
+ 32552,
+ 33721,
+ 33828,
+ 33829,
+ 33639,
+ 34631,
+ 36814,
+ 36194,
+ 30408,
+ 24433,
+ 39062,
+ 30828,
+ 26144,
+ 21727,
+ 25317,
+ 20323,
+ 33219,
+ 30152,
+ 24248,
+ 38605,
+ 36362,
+ 34553,
+ 21647,
+ 27891,
+ 28044,
+ 27704,
+ 24703,
+ 21191,
+ 29992,
+ 24189,
+ 20248,
+ 24736,
+ 24551,
+ 23588,
+ 30001,
+ 37038,
+ 38080,
+ 29369,
+ 27833,
+ 28216,
+ 37193,
+ 26377,
+ 21451,
+ 21491,
+ 20305,
+ 37321,
+ 35825,
+ 21448,
+ 24188,
+ 36802,
+ 28132,
+ 20110,
+ 30402,
+ 27014,
+ 34398,
+ 24858,
+ 33286,
+ 20313,
+ 20446,
+ 36926,
+ 40060,
+ 24841,
+ 28189,
+ 28180,
+ 38533,
+ 20104,
+ 23089,
+ 38632,
+ 19982,
+ 23679,
+ 31161,
+ 23431,
+ 35821,
+ 32701,
+ 29577,
+ 22495,
+ 33419,
+ 37057,
+ 21505,
+ 36935,
+ 21947,
+ 23786,
+ 24481,
+ 24840,
+ 27442,
+ 29425,
+ 32946,
+ 35465,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 35358,
+ 35359,
+ 35360,
+ 35361,
+ 35362,
+ 35363,
+ 35364,
+ 35365,
+ 35366,
+ 35367,
+ 35368,
+ 35369,
+ 35370,
+ 35371,
+ 35372,
+ 35373,
+ 35374,
+ 35375,
+ 35376,
+ 35377,
+ 35378,
+ 35379,
+ 35380,
+ 35381,
+ 35382,
+ 35383,
+ 35384,
+ 35385,
+ 35386,
+ 35387,
+ 35388,
+ 35389,
+ 35391,
+ 35392,
+ 35393,
+ 35394,
+ 35395,
+ 35396,
+ 35397,
+ 35398,
+ 35399,
+ 35401,
+ 35402,
+ 35403,
+ 35404,
+ 35405,
+ 35406,
+ 35407,
+ 35408,
+ 35409,
+ 35410,
+ 35411,
+ 35412,
+ 35413,
+ 35414,
+ 35415,
+ 35416,
+ 35417,
+ 35418,
+ 35419,
+ 35420,
+ 35421,
+ 35422,
+ 0,
+ 35423,
+ 35424,
+ 35425,
+ 35426,
+ 35427,
+ 35428,
+ 35429,
+ 35430,
+ 35431,
+ 35432,
+ 35433,
+ 35434,
+ 35435,
+ 35436,
+ 35437,
+ 35438,
+ 35439,
+ 35440,
+ 35441,
+ 35442,
+ 35443,
+ 35444,
+ 35445,
+ 35446,
+ 35447,
+ 35448,
+ 35450,
+ 35451,
+ 35452,
+ 35453,
+ 35454,
+ 35455,
+ 35456,
+ 28020,
+ 23507,
+ 35029,
+ 39044,
+ 35947,
+ 39533,
+ 40499,
+ 28170,
+ 20900,
+ 20803,
+ 22435,
+ 34945,
+ 21407,
+ 25588,
+ 36757,
+ 22253,
+ 21592,
+ 22278,
+ 29503,
+ 28304,
+ 32536,
+ 36828,
+ 33489,
+ 24895,
+ 24616,
+ 38498,
+ 26352,
+ 32422,
+ 36234,
+ 36291,
+ 38053,
+ 23731,
+ 31908,
+ 26376,
+ 24742,
+ 38405,
+ 32792,
+ 20113,
+ 37095,
+ 21248,
+ 38504,
+ 20801,
+ 36816,
+ 34164,
+ 37213,
+ 26197,
+ 38901,
+ 23381,
+ 21277,
+ 30776,
+ 26434,
+ 26685,
+ 21705,
+ 28798,
+ 23472,
+ 36733,
+ 20877,
+ 22312,
+ 21681,
+ 25874,
+ 26242,
+ 36190,
+ 36163,
+ 33039,
+ 33900,
+ 36973,
+ 31967,
+ 20991,
+ 34299,
+ 26531,
+ 26089,
+ 28577,
+ 34468,
+ 36481,
+ 22122,
+ 36896,
+ 30338,
+ 28790,
+ 29157,
+ 36131,
+ 25321,
+ 21017,
+ 27901,
+ 36156,
+ 24590,
+ 22686,
+ 24974,
+ 26366,
+ 36192,
+ 25166,
+ 21939,
+ 28195,
+ 26413,
+ 36711,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 35457,
+ 35458,
+ 35459,
+ 35460,
+ 35461,
+ 35462,
+ 35463,
+ 35464,
+ 35467,
+ 35468,
+ 35469,
+ 35470,
+ 35471,
+ 35472,
+ 35473,
+ 35474,
+ 35476,
+ 35477,
+ 35478,
+ 35479,
+ 35480,
+ 35481,
+ 35482,
+ 35483,
+ 35484,
+ 35485,
+ 35486,
+ 35487,
+ 35488,
+ 35489,
+ 35490,
+ 35491,
+ 35492,
+ 35493,
+ 35494,
+ 35495,
+ 35496,
+ 35497,
+ 35498,
+ 35499,
+ 35500,
+ 35501,
+ 35502,
+ 35503,
+ 35504,
+ 35505,
+ 35506,
+ 35507,
+ 35508,
+ 35509,
+ 35510,
+ 35511,
+ 35512,
+ 35513,
+ 35514,
+ 35515,
+ 35516,
+ 35517,
+ 35518,
+ 35519,
+ 35520,
+ 35521,
+ 35522,
+ 0,
+ 35523,
+ 35524,
+ 35525,
+ 35526,
+ 35527,
+ 35528,
+ 35529,
+ 35530,
+ 35531,
+ 35532,
+ 35533,
+ 35534,
+ 35535,
+ 35536,
+ 35537,
+ 35538,
+ 35539,
+ 35540,
+ 35541,
+ 35542,
+ 35543,
+ 35544,
+ 35545,
+ 35546,
+ 35547,
+ 35548,
+ 35549,
+ 35550,
+ 35551,
+ 35552,
+ 35553,
+ 35554,
+ 35555,
+ 38113,
+ 38392,
+ 30504,
+ 26629,
+ 27048,
+ 21643,
+ 20045,
+ 28856,
+ 35784,
+ 25688,
+ 25995,
+ 23429,
+ 31364,
+ 20538,
+ 23528,
+ 30651,
+ 27617,
+ 35449,
+ 31896,
+ 27838,
+ 30415,
+ 26025,
+ 36759,
+ 23853,
+ 23637,
+ 34360,
+ 26632,
+ 21344,
+ 25112,
+ 31449,
+ 28251,
+ 32509,
+ 27167,
+ 31456,
+ 24432,
+ 28467,
+ 24352,
+ 25484,
+ 28072,
+ 26454,
+ 19976,
+ 24080,
+ 36134,
+ 20183,
+ 32960,
+ 30260,
+ 38556,
+ 25307,
+ 26157,
+ 25214,
+ 27836,
+ 36213,
+ 29031,
+ 32617,
+ 20806,
+ 32903,
+ 21484,
+ 36974,
+ 25240,
+ 21746,
+ 34544,
+ 36761,
+ 32773,
+ 38167,
+ 34071,
+ 36825,
+ 27993,
+ 29645,
+ 26015,
+ 30495,
+ 29956,
+ 30759,
+ 33275,
+ 36126,
+ 38024,
+ 20390,
+ 26517,
+ 30137,
+ 35786,
+ 38663,
+ 25391,
+ 38215,
+ 38453,
+ 33976,
+ 25379,
+ 30529,
+ 24449,
+ 29424,
+ 20105,
+ 24596,
+ 25972,
+ 25327,
+ 27491,
+ 25919,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 35556,
+ 35557,
+ 35558,
+ 35559,
+ 35560,
+ 35561,
+ 35562,
+ 35563,
+ 35564,
+ 35565,
+ 35566,
+ 35567,
+ 35568,
+ 35569,
+ 35570,
+ 35571,
+ 35572,
+ 35573,
+ 35574,
+ 35575,
+ 35576,
+ 35577,
+ 35578,
+ 35579,
+ 35580,
+ 35581,
+ 35582,
+ 35583,
+ 35584,
+ 35585,
+ 35586,
+ 35587,
+ 35588,
+ 35589,
+ 35590,
+ 35592,
+ 35593,
+ 35594,
+ 35595,
+ 35596,
+ 35597,
+ 35598,
+ 35599,
+ 35600,
+ 35601,
+ 35602,
+ 35603,
+ 35604,
+ 35605,
+ 35606,
+ 35607,
+ 35608,
+ 35609,
+ 35610,
+ 35611,
+ 35612,
+ 35613,
+ 35614,
+ 35615,
+ 35616,
+ 35617,
+ 35618,
+ 35619,
+ 0,
+ 35620,
+ 35621,
+ 35623,
+ 35624,
+ 35625,
+ 35626,
+ 35627,
+ 35628,
+ 35629,
+ 35630,
+ 35631,
+ 35632,
+ 35633,
+ 35634,
+ 35635,
+ 35636,
+ 35637,
+ 35638,
+ 35639,
+ 35640,
+ 35641,
+ 35642,
+ 35643,
+ 35644,
+ 35645,
+ 35646,
+ 35647,
+ 35648,
+ 35649,
+ 35650,
+ 35651,
+ 35652,
+ 35653,
+ 24103,
+ 30151,
+ 37073,
+ 35777,
+ 33437,
+ 26525,
+ 25903,
+ 21553,
+ 34584,
+ 30693,
+ 32930,
+ 33026,
+ 27713,
+ 20043,
+ 32455,
+ 32844,
+ 30452,
+ 26893,
+ 27542,
+ 25191,
+ 20540,
+ 20356,
+ 22336,
+ 25351,
+ 27490,
+ 36286,
+ 21482,
+ 26088,
+ 32440,
+ 24535,
+ 25370,
+ 25527,
+ 33267,
+ 33268,
+ 32622,
+ 24092,
+ 23769,
+ 21046,
+ 26234,
+ 31209,
+ 31258,
+ 36136,
+ 28825,
+ 30164,
+ 28382,
+ 27835,
+ 31378,
+ 20013,
+ 30405,
+ 24544,
+ 38047,
+ 34935,
+ 32456,
+ 31181,
+ 32959,
+ 37325,
+ 20210,
+ 20247,
+ 33311,
+ 21608,
+ 24030,
+ 27954,
+ 35788,
+ 31909,
+ 36724,
+ 32920,
+ 24090,
+ 21650,
+ 30385,
+ 23449,
+ 26172,
+ 39588,
+ 29664,
+ 26666,
+ 34523,
+ 26417,
+ 29482,
+ 35832,
+ 35803,
+ 36880,
+ 31481,
+ 28891,
+ 29038,
+ 25284,
+ 30633,
+ 22065,
+ 20027,
+ 33879,
+ 26609,
+ 21161,
+ 34496,
+ 36142,
+ 38136,
+ 31569,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 35654,
+ 35655,
+ 35656,
+ 35657,
+ 35658,
+ 35659,
+ 35660,
+ 35661,
+ 35662,
+ 35663,
+ 35664,
+ 35665,
+ 35666,
+ 35667,
+ 35668,
+ 35669,
+ 35670,
+ 35671,
+ 35672,
+ 35673,
+ 35674,
+ 35675,
+ 35676,
+ 35677,
+ 35678,
+ 35679,
+ 35680,
+ 35681,
+ 35682,
+ 35683,
+ 35684,
+ 35685,
+ 35687,
+ 35688,
+ 35689,
+ 35690,
+ 35691,
+ 35693,
+ 35694,
+ 35695,
+ 35696,
+ 35697,
+ 35698,
+ 35699,
+ 35700,
+ 35701,
+ 35702,
+ 35703,
+ 35704,
+ 35705,
+ 35706,
+ 35707,
+ 35708,
+ 35709,
+ 35710,
+ 35711,
+ 35712,
+ 35713,
+ 35714,
+ 35715,
+ 35716,
+ 35717,
+ 35718,
+ 0,
+ 35719,
+ 35720,
+ 35721,
+ 35722,
+ 35723,
+ 35724,
+ 35725,
+ 35726,
+ 35727,
+ 35728,
+ 35729,
+ 35730,
+ 35731,
+ 35732,
+ 35733,
+ 35734,
+ 35735,
+ 35736,
+ 35737,
+ 35738,
+ 35739,
+ 35740,
+ 35741,
+ 35742,
+ 35743,
+ 35756,
+ 35761,
+ 35771,
+ 35783,
+ 35792,
+ 35818,
+ 35849,
+ 35870,
+ 20303,
+ 27880,
+ 31069,
+ 39547,
+ 25235,
+ 29226,
+ 25341,
+ 19987,
+ 30742,
+ 36716,
+ 25776,
+ 36186,
+ 31686,
+ 26729,
+ 24196,
+ 35013,
+ 22918,
+ 25758,
+ 22766,
+ 29366,
+ 26894,
+ 38181,
+ 36861,
+ 36184,
+ 22368,
+ 32512,
+ 35846,
+ 20934,
+ 25417,
+ 25305,
+ 21331,
+ 26700,
+ 29730,
+ 33537,
+ 37196,
+ 21828,
+ 30528,
+ 28796,
+ 27978,
+ 20857,
+ 21672,
+ 36164,
+ 23039,
+ 28363,
+ 28100,
+ 23388,
+ 32043,
+ 20180,
+ 31869,
+ 28371,
+ 23376,
+ 33258,
+ 28173,
+ 23383,
+ 39683,
+ 26837,
+ 36394,
+ 23447,
+ 32508,
+ 24635,
+ 32437,
+ 37049,
+ 36208,
+ 22863,
+ 25549,
+ 31199,
+ 36275,
+ 21330,
+ 26063,
+ 31062,
+ 35781,
+ 38459,
+ 32452,
+ 38075,
+ 32386,
+ 22068,
+ 37257,
+ 26368,
+ 32618,
+ 23562,
+ 36981,
+ 26152,
+ 24038,
+ 20304,
+ 26590,
+ 20570,
+ 20316,
+ 22352,
+ 24231,
+ 59408,
+ 59409,
+ 59410,
+ 59411,
+ 59412,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 35896,
+ 35897,
+ 35898,
+ 35899,
+ 35900,
+ 35901,
+ 35902,
+ 35903,
+ 35904,
+ 35906,
+ 35907,
+ 35908,
+ 35909,
+ 35912,
+ 35914,
+ 35915,
+ 35917,
+ 35918,
+ 35919,
+ 35920,
+ 35921,
+ 35922,
+ 35923,
+ 35924,
+ 35926,
+ 35927,
+ 35928,
+ 35929,
+ 35931,
+ 35932,
+ 35933,
+ 35934,
+ 35935,
+ 35936,
+ 35939,
+ 35940,
+ 35941,
+ 35942,
+ 35943,
+ 35944,
+ 35945,
+ 35948,
+ 35949,
+ 35950,
+ 35951,
+ 35952,
+ 35953,
+ 35954,
+ 35956,
+ 35957,
+ 35958,
+ 35959,
+ 35963,
+ 35964,
+ 35965,
+ 35966,
+ 35967,
+ 35968,
+ 35969,
+ 35971,
+ 35972,
+ 35974,
+ 35975,
+ 0,
+ 35976,
+ 35979,
+ 35981,
+ 35982,
+ 35983,
+ 35984,
+ 35985,
+ 35986,
+ 35987,
+ 35989,
+ 35990,
+ 35991,
+ 35993,
+ 35994,
+ 35995,
+ 35996,
+ 35997,
+ 35998,
+ 35999,
+ 36000,
+ 36001,
+ 36002,
+ 36003,
+ 36004,
+ 36005,
+ 36006,
+ 36007,
+ 36008,
+ 36009,
+ 36010,
+ 36011,
+ 36012,
+ 36013,
+ 20109,
+ 19980,
+ 20800,
+ 19984,
+ 24319,
+ 21317,
+ 19989,
+ 20120,
+ 19998,
+ 39730,
+ 23404,
+ 22121,
+ 20008,
+ 31162,
+ 20031,
+ 21269,
+ 20039,
+ 22829,
+ 29243,
+ 21358,
+ 27664,
+ 22239,
+ 32996,
+ 39319,
+ 27603,
+ 30590,
+ 40727,
+ 20022,
+ 20127,
+ 40720,
+ 20060,
+ 20073,
+ 20115,
+ 33416,
+ 23387,
+ 21868,
+ 22031,
+ 20164,
+ 21389,
+ 21405,
+ 21411,
+ 21413,
+ 21422,
+ 38757,
+ 36189,
+ 21274,
+ 21493,
+ 21286,
+ 21294,
+ 21310,
+ 36188,
+ 21350,
+ 21347,
+ 20994,
+ 21000,
+ 21006,
+ 21037,
+ 21043,
+ 21055,
+ 21056,
+ 21068,
+ 21086,
+ 21089,
+ 21084,
+ 33967,
+ 21117,
+ 21122,
+ 21121,
+ 21136,
+ 21139,
+ 20866,
+ 32596,
+ 20155,
+ 20163,
+ 20169,
+ 20162,
+ 20200,
+ 20193,
+ 20203,
+ 20190,
+ 20251,
+ 20211,
+ 20258,
+ 20324,
+ 20213,
+ 20261,
+ 20263,
+ 20233,
+ 20267,
+ 20318,
+ 20327,
+ 25912,
+ 20314,
+ 20317,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 36014,
+ 36015,
+ 36016,
+ 36017,
+ 36018,
+ 36019,
+ 36020,
+ 36021,
+ 36022,
+ 36023,
+ 36024,
+ 36025,
+ 36026,
+ 36027,
+ 36028,
+ 36029,
+ 36030,
+ 36031,
+ 36032,
+ 36033,
+ 36034,
+ 36035,
+ 36036,
+ 36037,
+ 36038,
+ 36039,
+ 36040,
+ 36041,
+ 36042,
+ 36043,
+ 36044,
+ 36045,
+ 36046,
+ 36047,
+ 36048,
+ 36049,
+ 36050,
+ 36051,
+ 36052,
+ 36053,
+ 36054,
+ 36055,
+ 36056,
+ 36057,
+ 36058,
+ 36059,
+ 36060,
+ 36061,
+ 36062,
+ 36063,
+ 36064,
+ 36065,
+ 36066,
+ 36067,
+ 36068,
+ 36069,
+ 36070,
+ 36071,
+ 36072,
+ 36073,
+ 36074,
+ 36075,
+ 36076,
+ 0,
+ 36077,
+ 36078,
+ 36079,
+ 36080,
+ 36081,
+ 36082,
+ 36083,
+ 36084,
+ 36085,
+ 36086,
+ 36087,
+ 36088,
+ 36089,
+ 36090,
+ 36091,
+ 36092,
+ 36093,
+ 36094,
+ 36095,
+ 36096,
+ 36097,
+ 36098,
+ 36099,
+ 36100,
+ 36101,
+ 36102,
+ 36103,
+ 36104,
+ 36105,
+ 36106,
+ 36107,
+ 36108,
+ 36109,
+ 20319,
+ 20311,
+ 20274,
+ 20285,
+ 20342,
+ 20340,
+ 20369,
+ 20361,
+ 20355,
+ 20367,
+ 20350,
+ 20347,
+ 20394,
+ 20348,
+ 20396,
+ 20372,
+ 20454,
+ 20456,
+ 20458,
+ 20421,
+ 20442,
+ 20451,
+ 20444,
+ 20433,
+ 20447,
+ 20472,
+ 20521,
+ 20556,
+ 20467,
+ 20524,
+ 20495,
+ 20526,
+ 20525,
+ 20478,
+ 20508,
+ 20492,
+ 20517,
+ 20520,
+ 20606,
+ 20547,
+ 20565,
+ 20552,
+ 20558,
+ 20588,
+ 20603,
+ 20645,
+ 20647,
+ 20649,
+ 20666,
+ 20694,
+ 20742,
+ 20717,
+ 20716,
+ 20710,
+ 20718,
+ 20743,
+ 20747,
+ 20189,
+ 27709,
+ 20312,
+ 20325,
+ 20430,
+ 40864,
+ 27718,
+ 31860,
+ 20846,
+ 24061,
+ 40649,
+ 39320,
+ 20865,
+ 22804,
+ 21241,
+ 21261,
+ 35335,
+ 21264,
+ 20971,
+ 22809,
+ 20821,
+ 20128,
+ 20822,
+ 20147,
+ 34926,
+ 34980,
+ 20149,
+ 33044,
+ 35026,
+ 31104,
+ 23348,
+ 34819,
+ 32696,
+ 20907,
+ 20913,
+ 20925,
+ 20924,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 36110,
+ 36111,
+ 36112,
+ 36113,
+ 36114,
+ 36115,
+ 36116,
+ 36117,
+ 36118,
+ 36119,
+ 36120,
+ 36121,
+ 36122,
+ 36123,
+ 36124,
+ 36128,
+ 36177,
+ 36178,
+ 36183,
+ 36191,
+ 36197,
+ 36200,
+ 36201,
+ 36202,
+ 36204,
+ 36206,
+ 36207,
+ 36209,
+ 36210,
+ 36216,
+ 36217,
+ 36218,
+ 36219,
+ 36220,
+ 36221,
+ 36222,
+ 36223,
+ 36224,
+ 36226,
+ 36227,
+ 36230,
+ 36231,
+ 36232,
+ 36233,
+ 36236,
+ 36237,
+ 36238,
+ 36239,
+ 36240,
+ 36242,
+ 36243,
+ 36245,
+ 36246,
+ 36247,
+ 36248,
+ 36249,
+ 36250,
+ 36251,
+ 36252,
+ 36253,
+ 36254,
+ 36256,
+ 36257,
+ 0,
+ 36258,
+ 36260,
+ 36261,
+ 36262,
+ 36263,
+ 36264,
+ 36265,
+ 36266,
+ 36267,
+ 36268,
+ 36269,
+ 36270,
+ 36271,
+ 36272,
+ 36274,
+ 36278,
+ 36279,
+ 36281,
+ 36283,
+ 36285,
+ 36288,
+ 36289,
+ 36290,
+ 36293,
+ 36295,
+ 36296,
+ 36297,
+ 36298,
+ 36301,
+ 36304,
+ 36306,
+ 36307,
+ 36308,
+ 20935,
+ 20886,
+ 20898,
+ 20901,
+ 35744,
+ 35750,
+ 35751,
+ 35754,
+ 35764,
+ 35765,
+ 35767,
+ 35778,
+ 35779,
+ 35787,
+ 35791,
+ 35790,
+ 35794,
+ 35795,
+ 35796,
+ 35798,
+ 35800,
+ 35801,
+ 35804,
+ 35807,
+ 35808,
+ 35812,
+ 35816,
+ 35817,
+ 35822,
+ 35824,
+ 35827,
+ 35830,
+ 35833,
+ 35836,
+ 35839,
+ 35840,
+ 35842,
+ 35844,
+ 35847,
+ 35852,
+ 35855,
+ 35857,
+ 35858,
+ 35860,
+ 35861,
+ 35862,
+ 35865,
+ 35867,
+ 35864,
+ 35869,
+ 35871,
+ 35872,
+ 35873,
+ 35877,
+ 35879,
+ 35882,
+ 35883,
+ 35886,
+ 35887,
+ 35890,
+ 35891,
+ 35893,
+ 35894,
+ 21353,
+ 21370,
+ 38429,
+ 38434,
+ 38433,
+ 38449,
+ 38442,
+ 38461,
+ 38460,
+ 38466,
+ 38473,
+ 38484,
+ 38495,
+ 38503,
+ 38508,
+ 38514,
+ 38516,
+ 38536,
+ 38541,
+ 38551,
+ 38576,
+ 37015,
+ 37019,
+ 37021,
+ 37017,
+ 37036,
+ 37025,
+ 37044,
+ 37043,
+ 37046,
+ 37050,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 36309,
+ 36312,
+ 36313,
+ 36316,
+ 36320,
+ 36321,
+ 36322,
+ 36325,
+ 36326,
+ 36327,
+ 36329,
+ 36333,
+ 36334,
+ 36336,
+ 36337,
+ 36338,
+ 36340,
+ 36342,
+ 36348,
+ 36350,
+ 36351,
+ 36352,
+ 36353,
+ 36354,
+ 36355,
+ 36356,
+ 36358,
+ 36359,
+ 36360,
+ 36363,
+ 36365,
+ 36366,
+ 36368,
+ 36369,
+ 36370,
+ 36371,
+ 36373,
+ 36374,
+ 36375,
+ 36376,
+ 36377,
+ 36378,
+ 36379,
+ 36380,
+ 36384,
+ 36385,
+ 36388,
+ 36389,
+ 36390,
+ 36391,
+ 36392,
+ 36395,
+ 36397,
+ 36400,
+ 36402,
+ 36403,
+ 36404,
+ 36406,
+ 36407,
+ 36408,
+ 36411,
+ 36412,
+ 36414,
+ 0,
+ 36415,
+ 36419,
+ 36421,
+ 36422,
+ 36428,
+ 36429,
+ 36430,
+ 36431,
+ 36432,
+ 36435,
+ 36436,
+ 36437,
+ 36438,
+ 36439,
+ 36440,
+ 36442,
+ 36443,
+ 36444,
+ 36445,
+ 36446,
+ 36447,
+ 36448,
+ 36449,
+ 36450,
+ 36451,
+ 36452,
+ 36453,
+ 36455,
+ 36456,
+ 36458,
+ 36459,
+ 36462,
+ 36465,
+ 37048,
+ 37040,
+ 37071,
+ 37061,
+ 37054,
+ 37072,
+ 37060,
+ 37063,
+ 37075,
+ 37094,
+ 37090,
+ 37084,
+ 37079,
+ 37083,
+ 37099,
+ 37103,
+ 37118,
+ 37124,
+ 37154,
+ 37150,
+ 37155,
+ 37169,
+ 37167,
+ 37177,
+ 37187,
+ 37190,
+ 21005,
+ 22850,
+ 21154,
+ 21164,
+ 21165,
+ 21182,
+ 21759,
+ 21200,
+ 21206,
+ 21232,
+ 21471,
+ 29166,
+ 30669,
+ 24308,
+ 20981,
+ 20988,
+ 39727,
+ 21430,
+ 24321,
+ 30042,
+ 24047,
+ 22348,
+ 22441,
+ 22433,
+ 22654,
+ 22716,
+ 22725,
+ 22737,
+ 22313,
+ 22316,
+ 22314,
+ 22323,
+ 22329,
+ 22318,
+ 22319,
+ 22364,
+ 22331,
+ 22338,
+ 22377,
+ 22405,
+ 22379,
+ 22406,
+ 22396,
+ 22395,
+ 22376,
+ 22381,
+ 22390,
+ 22387,
+ 22445,
+ 22436,
+ 22412,
+ 22450,
+ 22479,
+ 22439,
+ 22452,
+ 22419,
+ 22432,
+ 22485,
+ 22488,
+ 22490,
+ 22489,
+ 22482,
+ 22456,
+ 22516,
+ 22511,
+ 22520,
+ 22500,
+ 22493,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 36467,
+ 36469,
+ 36471,
+ 36472,
+ 36473,
+ 36474,
+ 36475,
+ 36477,
+ 36478,
+ 36480,
+ 36482,
+ 36483,
+ 36484,
+ 36486,
+ 36488,
+ 36489,
+ 36490,
+ 36491,
+ 36492,
+ 36493,
+ 36494,
+ 36497,
+ 36498,
+ 36499,
+ 36501,
+ 36502,
+ 36503,
+ 36504,
+ 36505,
+ 36506,
+ 36507,
+ 36509,
+ 36511,
+ 36512,
+ 36513,
+ 36514,
+ 36515,
+ 36516,
+ 36517,
+ 36518,
+ 36519,
+ 36520,
+ 36521,
+ 36522,
+ 36525,
+ 36526,
+ 36528,
+ 36529,
+ 36531,
+ 36532,
+ 36533,
+ 36534,
+ 36535,
+ 36536,
+ 36537,
+ 36539,
+ 36540,
+ 36541,
+ 36542,
+ 36543,
+ 36544,
+ 36545,
+ 36546,
+ 0,
+ 36547,
+ 36548,
+ 36549,
+ 36550,
+ 36551,
+ 36552,
+ 36553,
+ 36554,
+ 36555,
+ 36556,
+ 36557,
+ 36559,
+ 36560,
+ 36561,
+ 36562,
+ 36563,
+ 36564,
+ 36565,
+ 36566,
+ 36567,
+ 36568,
+ 36569,
+ 36570,
+ 36571,
+ 36572,
+ 36573,
+ 36574,
+ 36575,
+ 36576,
+ 36577,
+ 36578,
+ 36579,
+ 36580,
+ 22539,
+ 22541,
+ 22525,
+ 22509,
+ 22528,
+ 22558,
+ 22553,
+ 22596,
+ 22560,
+ 22629,
+ 22636,
+ 22657,
+ 22665,
+ 22682,
+ 22656,
+ 39336,
+ 40729,
+ 25087,
+ 33401,
+ 33405,
+ 33407,
+ 33423,
+ 33418,
+ 33448,
+ 33412,
+ 33422,
+ 33425,
+ 33431,
+ 33433,
+ 33451,
+ 33464,
+ 33470,
+ 33456,
+ 33480,
+ 33482,
+ 33507,
+ 33432,
+ 33463,
+ 33454,
+ 33483,
+ 33484,
+ 33473,
+ 33449,
+ 33460,
+ 33441,
+ 33450,
+ 33439,
+ 33476,
+ 33486,
+ 33444,
+ 33505,
+ 33545,
+ 33527,
+ 33508,
+ 33551,
+ 33543,
+ 33500,
+ 33524,
+ 33490,
+ 33496,
+ 33548,
+ 33531,
+ 33491,
+ 33553,
+ 33562,
+ 33542,
+ 33556,
+ 33557,
+ 33504,
+ 33493,
+ 33564,
+ 33617,
+ 33627,
+ 33628,
+ 33544,
+ 33682,
+ 33596,
+ 33588,
+ 33585,
+ 33691,
+ 33630,
+ 33583,
+ 33615,
+ 33607,
+ 33603,
+ 33631,
+ 33600,
+ 33559,
+ 33632,
+ 33581,
+ 33594,
+ 33587,
+ 33638,
+ 33637,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 36581,
+ 36582,
+ 36583,
+ 36584,
+ 36585,
+ 36586,
+ 36587,
+ 36588,
+ 36589,
+ 36590,
+ 36591,
+ 36592,
+ 36593,
+ 36594,
+ 36595,
+ 36596,
+ 36597,
+ 36598,
+ 36599,
+ 36600,
+ 36601,
+ 36602,
+ 36603,
+ 36604,
+ 36605,
+ 36606,
+ 36607,
+ 36608,
+ 36609,
+ 36610,
+ 36611,
+ 36612,
+ 36613,
+ 36614,
+ 36615,
+ 36616,
+ 36617,
+ 36618,
+ 36619,
+ 36620,
+ 36621,
+ 36622,
+ 36623,
+ 36624,
+ 36625,
+ 36626,
+ 36627,
+ 36628,
+ 36629,
+ 36630,
+ 36631,
+ 36632,
+ 36633,
+ 36634,
+ 36635,
+ 36636,
+ 36637,
+ 36638,
+ 36639,
+ 36640,
+ 36641,
+ 36642,
+ 36643,
+ 0,
+ 36644,
+ 36645,
+ 36646,
+ 36647,
+ 36648,
+ 36649,
+ 36650,
+ 36651,
+ 36652,
+ 36653,
+ 36654,
+ 36655,
+ 36656,
+ 36657,
+ 36658,
+ 36659,
+ 36660,
+ 36661,
+ 36662,
+ 36663,
+ 36664,
+ 36665,
+ 36666,
+ 36667,
+ 36668,
+ 36669,
+ 36670,
+ 36671,
+ 36672,
+ 36673,
+ 36674,
+ 36675,
+ 36676,
+ 33640,
+ 33563,
+ 33641,
+ 33644,
+ 33642,
+ 33645,
+ 33646,
+ 33712,
+ 33656,
+ 33715,
+ 33716,
+ 33696,
+ 33706,
+ 33683,
+ 33692,
+ 33669,
+ 33660,
+ 33718,
+ 33705,
+ 33661,
+ 33720,
+ 33659,
+ 33688,
+ 33694,
+ 33704,
+ 33722,
+ 33724,
+ 33729,
+ 33793,
+ 33765,
+ 33752,
+ 22535,
+ 33816,
+ 33803,
+ 33757,
+ 33789,
+ 33750,
+ 33820,
+ 33848,
+ 33809,
+ 33798,
+ 33748,
+ 33759,
+ 33807,
+ 33795,
+ 33784,
+ 33785,
+ 33770,
+ 33733,
+ 33728,
+ 33830,
+ 33776,
+ 33761,
+ 33884,
+ 33873,
+ 33882,
+ 33881,
+ 33907,
+ 33927,
+ 33928,
+ 33914,
+ 33929,
+ 33912,
+ 33852,
+ 33862,
+ 33897,
+ 33910,
+ 33932,
+ 33934,
+ 33841,
+ 33901,
+ 33985,
+ 33997,
+ 34000,
+ 34022,
+ 33981,
+ 34003,
+ 33994,
+ 33983,
+ 33978,
+ 34016,
+ 33953,
+ 33977,
+ 33972,
+ 33943,
+ 34021,
+ 34019,
+ 34060,
+ 29965,
+ 34104,
+ 34032,
+ 34105,
+ 34079,
+ 34106,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 36677,
+ 36678,
+ 36679,
+ 36680,
+ 36681,
+ 36682,
+ 36683,
+ 36684,
+ 36685,
+ 36686,
+ 36687,
+ 36688,
+ 36689,
+ 36690,
+ 36691,
+ 36692,
+ 36693,
+ 36694,
+ 36695,
+ 36696,
+ 36697,
+ 36698,
+ 36699,
+ 36700,
+ 36701,
+ 36702,
+ 36703,
+ 36704,
+ 36705,
+ 36706,
+ 36707,
+ 36708,
+ 36709,
+ 36714,
+ 36736,
+ 36748,
+ 36754,
+ 36765,
+ 36768,
+ 36769,
+ 36770,
+ 36772,
+ 36773,
+ 36774,
+ 36775,
+ 36778,
+ 36780,
+ 36781,
+ 36782,
+ 36783,
+ 36786,
+ 36787,
+ 36788,
+ 36789,
+ 36791,
+ 36792,
+ 36794,
+ 36795,
+ 36796,
+ 36799,
+ 36800,
+ 36803,
+ 36806,
+ 0,
+ 36809,
+ 36810,
+ 36811,
+ 36812,
+ 36813,
+ 36815,
+ 36818,
+ 36822,
+ 36823,
+ 36826,
+ 36832,
+ 36833,
+ 36835,
+ 36839,
+ 36844,
+ 36847,
+ 36849,
+ 36850,
+ 36852,
+ 36853,
+ 36854,
+ 36858,
+ 36859,
+ 36860,
+ 36862,
+ 36863,
+ 36871,
+ 36872,
+ 36876,
+ 36878,
+ 36883,
+ 36885,
+ 36888,
+ 34134,
+ 34107,
+ 34047,
+ 34044,
+ 34137,
+ 34120,
+ 34152,
+ 34148,
+ 34142,
+ 34170,
+ 30626,
+ 34115,
+ 34162,
+ 34171,
+ 34212,
+ 34216,
+ 34183,
+ 34191,
+ 34169,
+ 34222,
+ 34204,
+ 34181,
+ 34233,
+ 34231,
+ 34224,
+ 34259,
+ 34241,
+ 34268,
+ 34303,
+ 34343,
+ 34309,
+ 34345,
+ 34326,
+ 34364,
+ 24318,
+ 24328,
+ 22844,
+ 22849,
+ 32823,
+ 22869,
+ 22874,
+ 22872,
+ 21263,
+ 23586,
+ 23589,
+ 23596,
+ 23604,
+ 25164,
+ 25194,
+ 25247,
+ 25275,
+ 25290,
+ 25306,
+ 25303,
+ 25326,
+ 25378,
+ 25334,
+ 25401,
+ 25419,
+ 25411,
+ 25517,
+ 25590,
+ 25457,
+ 25466,
+ 25486,
+ 25524,
+ 25453,
+ 25516,
+ 25482,
+ 25449,
+ 25518,
+ 25532,
+ 25586,
+ 25592,
+ 25568,
+ 25599,
+ 25540,
+ 25566,
+ 25550,
+ 25682,
+ 25542,
+ 25534,
+ 25669,
+ 25665,
+ 25611,
+ 25627,
+ 25632,
+ 25612,
+ 25638,
+ 25633,
+ 25694,
+ 25732,
+ 25709,
+ 25750,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 36889,
+ 36892,
+ 36899,
+ 36900,
+ 36901,
+ 36903,
+ 36904,
+ 36905,
+ 36906,
+ 36907,
+ 36908,
+ 36912,
+ 36913,
+ 36914,
+ 36915,
+ 36916,
+ 36919,
+ 36921,
+ 36922,
+ 36925,
+ 36927,
+ 36928,
+ 36931,
+ 36933,
+ 36934,
+ 36936,
+ 36937,
+ 36938,
+ 36939,
+ 36940,
+ 36942,
+ 36948,
+ 36949,
+ 36950,
+ 36953,
+ 36954,
+ 36956,
+ 36957,
+ 36958,
+ 36959,
+ 36960,
+ 36961,
+ 36964,
+ 36966,
+ 36967,
+ 36969,
+ 36970,
+ 36971,
+ 36972,
+ 36975,
+ 36976,
+ 36977,
+ 36978,
+ 36979,
+ 36982,
+ 36983,
+ 36984,
+ 36985,
+ 36986,
+ 36987,
+ 36988,
+ 36990,
+ 36993,
+ 0,
+ 36996,
+ 36997,
+ 36998,
+ 36999,
+ 37001,
+ 37002,
+ 37004,
+ 37005,
+ 37006,
+ 37007,
+ 37008,
+ 37010,
+ 37012,
+ 37014,
+ 37016,
+ 37018,
+ 37020,
+ 37022,
+ 37023,
+ 37024,
+ 37028,
+ 37029,
+ 37031,
+ 37032,
+ 37033,
+ 37035,
+ 37037,
+ 37042,
+ 37047,
+ 37052,
+ 37053,
+ 37055,
+ 37056,
+ 25722,
+ 25783,
+ 25784,
+ 25753,
+ 25786,
+ 25792,
+ 25808,
+ 25815,
+ 25828,
+ 25826,
+ 25865,
+ 25893,
+ 25902,
+ 24331,
+ 24530,
+ 29977,
+ 24337,
+ 21343,
+ 21489,
+ 21501,
+ 21481,
+ 21480,
+ 21499,
+ 21522,
+ 21526,
+ 21510,
+ 21579,
+ 21586,
+ 21587,
+ 21588,
+ 21590,
+ 21571,
+ 21537,
+ 21591,
+ 21593,
+ 21539,
+ 21554,
+ 21634,
+ 21652,
+ 21623,
+ 21617,
+ 21604,
+ 21658,
+ 21659,
+ 21636,
+ 21622,
+ 21606,
+ 21661,
+ 21712,
+ 21677,
+ 21698,
+ 21684,
+ 21714,
+ 21671,
+ 21670,
+ 21715,
+ 21716,
+ 21618,
+ 21667,
+ 21717,
+ 21691,
+ 21695,
+ 21708,
+ 21721,
+ 21722,
+ 21724,
+ 21673,
+ 21674,
+ 21668,
+ 21725,
+ 21711,
+ 21726,
+ 21787,
+ 21735,
+ 21792,
+ 21757,
+ 21780,
+ 21747,
+ 21794,
+ 21795,
+ 21775,
+ 21777,
+ 21799,
+ 21802,
+ 21863,
+ 21903,
+ 21941,
+ 21833,
+ 21869,
+ 21825,
+ 21845,
+ 21823,
+ 21840,
+ 21820,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37058,
+ 37059,
+ 37062,
+ 37064,
+ 37065,
+ 37067,
+ 37068,
+ 37069,
+ 37074,
+ 37076,
+ 37077,
+ 37078,
+ 37080,
+ 37081,
+ 37082,
+ 37086,
+ 37087,
+ 37088,
+ 37091,
+ 37092,
+ 37093,
+ 37097,
+ 37098,
+ 37100,
+ 37102,
+ 37104,
+ 37105,
+ 37106,
+ 37107,
+ 37109,
+ 37110,
+ 37111,
+ 37113,
+ 37114,
+ 37115,
+ 37116,
+ 37119,
+ 37120,
+ 37121,
+ 37123,
+ 37125,
+ 37126,
+ 37127,
+ 37128,
+ 37129,
+ 37130,
+ 37131,
+ 37132,
+ 37133,
+ 37134,
+ 37135,
+ 37136,
+ 37137,
+ 37138,
+ 37139,
+ 37140,
+ 37141,
+ 37142,
+ 37143,
+ 37144,
+ 37146,
+ 37147,
+ 37148,
+ 0,
+ 37149,
+ 37151,
+ 37152,
+ 37153,
+ 37156,
+ 37157,
+ 37158,
+ 37159,
+ 37160,
+ 37161,
+ 37162,
+ 37163,
+ 37164,
+ 37165,
+ 37166,
+ 37168,
+ 37170,
+ 37171,
+ 37172,
+ 37173,
+ 37174,
+ 37175,
+ 37176,
+ 37178,
+ 37179,
+ 37180,
+ 37181,
+ 37182,
+ 37183,
+ 37184,
+ 37185,
+ 37186,
+ 37188,
+ 21815,
+ 21846,
+ 21877,
+ 21878,
+ 21879,
+ 21811,
+ 21808,
+ 21852,
+ 21899,
+ 21970,
+ 21891,
+ 21937,
+ 21945,
+ 21896,
+ 21889,
+ 21919,
+ 21886,
+ 21974,
+ 21905,
+ 21883,
+ 21983,
+ 21949,
+ 21950,
+ 21908,
+ 21913,
+ 21994,
+ 22007,
+ 21961,
+ 22047,
+ 21969,
+ 21995,
+ 21996,
+ 21972,
+ 21990,
+ 21981,
+ 21956,
+ 21999,
+ 21989,
+ 22002,
+ 22003,
+ 21964,
+ 21965,
+ 21992,
+ 22005,
+ 21988,
+ 36756,
+ 22046,
+ 22024,
+ 22028,
+ 22017,
+ 22052,
+ 22051,
+ 22014,
+ 22016,
+ 22055,
+ 22061,
+ 22104,
+ 22073,
+ 22103,
+ 22060,
+ 22093,
+ 22114,
+ 22105,
+ 22108,
+ 22092,
+ 22100,
+ 22150,
+ 22116,
+ 22129,
+ 22123,
+ 22139,
+ 22140,
+ 22149,
+ 22163,
+ 22191,
+ 22228,
+ 22231,
+ 22237,
+ 22241,
+ 22261,
+ 22251,
+ 22265,
+ 22271,
+ 22276,
+ 22282,
+ 22281,
+ 22300,
+ 24079,
+ 24089,
+ 24084,
+ 24081,
+ 24113,
+ 24123,
+ 24124,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37189,
+ 37191,
+ 37192,
+ 37201,
+ 37203,
+ 37204,
+ 37205,
+ 37206,
+ 37208,
+ 37209,
+ 37211,
+ 37212,
+ 37215,
+ 37216,
+ 37222,
+ 37223,
+ 37224,
+ 37227,
+ 37229,
+ 37235,
+ 37242,
+ 37243,
+ 37244,
+ 37248,
+ 37249,
+ 37250,
+ 37251,
+ 37252,
+ 37254,
+ 37256,
+ 37258,
+ 37262,
+ 37263,
+ 37267,
+ 37268,
+ 37269,
+ 37270,
+ 37271,
+ 37272,
+ 37273,
+ 37276,
+ 37277,
+ 37278,
+ 37279,
+ 37280,
+ 37281,
+ 37284,
+ 37285,
+ 37286,
+ 37287,
+ 37288,
+ 37289,
+ 37291,
+ 37292,
+ 37296,
+ 37297,
+ 37298,
+ 37299,
+ 37302,
+ 37303,
+ 37304,
+ 37305,
+ 37307,
+ 0,
+ 37308,
+ 37309,
+ 37310,
+ 37311,
+ 37312,
+ 37313,
+ 37314,
+ 37315,
+ 37316,
+ 37317,
+ 37318,
+ 37320,
+ 37323,
+ 37328,
+ 37330,
+ 37331,
+ 37332,
+ 37333,
+ 37334,
+ 37335,
+ 37336,
+ 37337,
+ 37338,
+ 37339,
+ 37341,
+ 37342,
+ 37343,
+ 37344,
+ 37345,
+ 37346,
+ 37347,
+ 37348,
+ 37349,
+ 24119,
+ 24132,
+ 24148,
+ 24155,
+ 24158,
+ 24161,
+ 23692,
+ 23674,
+ 23693,
+ 23696,
+ 23702,
+ 23688,
+ 23704,
+ 23705,
+ 23697,
+ 23706,
+ 23708,
+ 23733,
+ 23714,
+ 23741,
+ 23724,
+ 23723,
+ 23729,
+ 23715,
+ 23745,
+ 23735,
+ 23748,
+ 23762,
+ 23780,
+ 23755,
+ 23781,
+ 23810,
+ 23811,
+ 23847,
+ 23846,
+ 23854,
+ 23844,
+ 23838,
+ 23814,
+ 23835,
+ 23896,
+ 23870,
+ 23860,
+ 23869,
+ 23916,
+ 23899,
+ 23919,
+ 23901,
+ 23915,
+ 23883,
+ 23882,
+ 23913,
+ 23924,
+ 23938,
+ 23961,
+ 23965,
+ 35955,
+ 23991,
+ 24005,
+ 24435,
+ 24439,
+ 24450,
+ 24455,
+ 24457,
+ 24460,
+ 24469,
+ 24473,
+ 24476,
+ 24488,
+ 24493,
+ 24501,
+ 24508,
+ 34914,
+ 24417,
+ 29357,
+ 29360,
+ 29364,
+ 29367,
+ 29368,
+ 29379,
+ 29377,
+ 29390,
+ 29389,
+ 29394,
+ 29416,
+ 29423,
+ 29417,
+ 29426,
+ 29428,
+ 29431,
+ 29441,
+ 29427,
+ 29443,
+ 29434,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37350,
+ 37351,
+ 37352,
+ 37353,
+ 37354,
+ 37355,
+ 37356,
+ 37357,
+ 37358,
+ 37359,
+ 37360,
+ 37361,
+ 37362,
+ 37363,
+ 37364,
+ 37365,
+ 37366,
+ 37367,
+ 37368,
+ 37369,
+ 37370,
+ 37371,
+ 37372,
+ 37373,
+ 37374,
+ 37375,
+ 37376,
+ 37377,
+ 37378,
+ 37379,
+ 37380,
+ 37381,
+ 37382,
+ 37383,
+ 37384,
+ 37385,
+ 37386,
+ 37387,
+ 37388,
+ 37389,
+ 37390,
+ 37391,
+ 37392,
+ 37393,
+ 37394,
+ 37395,
+ 37396,
+ 37397,
+ 37398,
+ 37399,
+ 37400,
+ 37401,
+ 37402,
+ 37403,
+ 37404,
+ 37405,
+ 37406,
+ 37407,
+ 37408,
+ 37409,
+ 37410,
+ 37411,
+ 37412,
+ 0,
+ 37413,
+ 37414,
+ 37415,
+ 37416,
+ 37417,
+ 37418,
+ 37419,
+ 37420,
+ 37421,
+ 37422,
+ 37423,
+ 37424,
+ 37425,
+ 37426,
+ 37427,
+ 37428,
+ 37429,
+ 37430,
+ 37431,
+ 37432,
+ 37433,
+ 37434,
+ 37435,
+ 37436,
+ 37437,
+ 37438,
+ 37439,
+ 37440,
+ 37441,
+ 37442,
+ 37443,
+ 37444,
+ 37445,
+ 29435,
+ 29463,
+ 29459,
+ 29473,
+ 29450,
+ 29470,
+ 29469,
+ 29461,
+ 29474,
+ 29497,
+ 29477,
+ 29484,
+ 29496,
+ 29489,
+ 29520,
+ 29517,
+ 29527,
+ 29536,
+ 29548,
+ 29551,
+ 29566,
+ 33307,
+ 22821,
+ 39143,
+ 22820,
+ 22786,
+ 39267,
+ 39271,
+ 39272,
+ 39273,
+ 39274,
+ 39275,
+ 39276,
+ 39284,
+ 39287,
+ 39293,
+ 39296,
+ 39300,
+ 39303,
+ 39306,
+ 39309,
+ 39312,
+ 39313,
+ 39315,
+ 39316,
+ 39317,
+ 24192,
+ 24209,
+ 24203,
+ 24214,
+ 24229,
+ 24224,
+ 24249,
+ 24245,
+ 24254,
+ 24243,
+ 36179,
+ 24274,
+ 24273,
+ 24283,
+ 24296,
+ 24298,
+ 33210,
+ 24516,
+ 24521,
+ 24534,
+ 24527,
+ 24579,
+ 24558,
+ 24580,
+ 24545,
+ 24548,
+ 24574,
+ 24581,
+ 24582,
+ 24554,
+ 24557,
+ 24568,
+ 24601,
+ 24629,
+ 24614,
+ 24603,
+ 24591,
+ 24589,
+ 24617,
+ 24619,
+ 24586,
+ 24639,
+ 24609,
+ 24696,
+ 24697,
+ 24699,
+ 24698,
+ 24642,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37446,
+ 37447,
+ 37448,
+ 37449,
+ 37450,
+ 37451,
+ 37452,
+ 37453,
+ 37454,
+ 37455,
+ 37456,
+ 37457,
+ 37458,
+ 37459,
+ 37460,
+ 37461,
+ 37462,
+ 37463,
+ 37464,
+ 37465,
+ 37466,
+ 37467,
+ 37468,
+ 37469,
+ 37470,
+ 37471,
+ 37472,
+ 37473,
+ 37474,
+ 37475,
+ 37476,
+ 37477,
+ 37478,
+ 37479,
+ 37480,
+ 37481,
+ 37482,
+ 37483,
+ 37484,
+ 37485,
+ 37486,
+ 37487,
+ 37488,
+ 37489,
+ 37490,
+ 37491,
+ 37493,
+ 37494,
+ 37495,
+ 37496,
+ 37497,
+ 37498,
+ 37499,
+ 37500,
+ 37501,
+ 37502,
+ 37503,
+ 37504,
+ 37505,
+ 37506,
+ 37507,
+ 37508,
+ 37509,
+ 0,
+ 37510,
+ 37511,
+ 37512,
+ 37513,
+ 37514,
+ 37515,
+ 37516,
+ 37517,
+ 37519,
+ 37520,
+ 37521,
+ 37522,
+ 37523,
+ 37524,
+ 37525,
+ 37526,
+ 37527,
+ 37528,
+ 37529,
+ 37530,
+ 37531,
+ 37532,
+ 37533,
+ 37534,
+ 37535,
+ 37536,
+ 37537,
+ 37538,
+ 37539,
+ 37540,
+ 37541,
+ 37542,
+ 37543,
+ 24682,
+ 24701,
+ 24726,
+ 24730,
+ 24749,
+ 24733,
+ 24707,
+ 24722,
+ 24716,
+ 24731,
+ 24812,
+ 24763,
+ 24753,
+ 24797,
+ 24792,
+ 24774,
+ 24794,
+ 24756,
+ 24864,
+ 24870,
+ 24853,
+ 24867,
+ 24820,
+ 24832,
+ 24846,
+ 24875,
+ 24906,
+ 24949,
+ 25004,
+ 24980,
+ 24999,
+ 25015,
+ 25044,
+ 25077,
+ 24541,
+ 38579,
+ 38377,
+ 38379,
+ 38385,
+ 38387,
+ 38389,
+ 38390,
+ 38396,
+ 38398,
+ 38403,
+ 38404,
+ 38406,
+ 38408,
+ 38410,
+ 38411,
+ 38412,
+ 38413,
+ 38415,
+ 38418,
+ 38421,
+ 38422,
+ 38423,
+ 38425,
+ 38426,
+ 20012,
+ 29247,
+ 25109,
+ 27701,
+ 27732,
+ 27740,
+ 27722,
+ 27811,
+ 27781,
+ 27792,
+ 27796,
+ 27788,
+ 27752,
+ 27753,
+ 27764,
+ 27766,
+ 27782,
+ 27817,
+ 27856,
+ 27860,
+ 27821,
+ 27895,
+ 27896,
+ 27889,
+ 27863,
+ 27826,
+ 27872,
+ 27862,
+ 27898,
+ 27883,
+ 27886,
+ 27825,
+ 27859,
+ 27887,
+ 27902,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37544,
+ 37545,
+ 37546,
+ 37547,
+ 37548,
+ 37549,
+ 37551,
+ 37552,
+ 37553,
+ 37554,
+ 37555,
+ 37556,
+ 37557,
+ 37558,
+ 37559,
+ 37560,
+ 37561,
+ 37562,
+ 37563,
+ 37564,
+ 37565,
+ 37566,
+ 37567,
+ 37568,
+ 37569,
+ 37570,
+ 37571,
+ 37572,
+ 37573,
+ 37574,
+ 37575,
+ 37577,
+ 37578,
+ 37579,
+ 37580,
+ 37581,
+ 37582,
+ 37583,
+ 37584,
+ 37585,
+ 37586,
+ 37587,
+ 37588,
+ 37589,
+ 37590,
+ 37591,
+ 37592,
+ 37593,
+ 37594,
+ 37595,
+ 37596,
+ 37597,
+ 37598,
+ 37599,
+ 37600,
+ 37601,
+ 37602,
+ 37603,
+ 37604,
+ 37605,
+ 37606,
+ 37607,
+ 37608,
+ 0,
+ 37609,
+ 37610,
+ 37611,
+ 37612,
+ 37613,
+ 37614,
+ 37615,
+ 37616,
+ 37617,
+ 37618,
+ 37619,
+ 37620,
+ 37621,
+ 37622,
+ 37623,
+ 37624,
+ 37625,
+ 37626,
+ 37627,
+ 37628,
+ 37629,
+ 37630,
+ 37631,
+ 37632,
+ 37633,
+ 37634,
+ 37635,
+ 37636,
+ 37637,
+ 37638,
+ 37639,
+ 37640,
+ 37641,
+ 27961,
+ 27943,
+ 27916,
+ 27971,
+ 27976,
+ 27911,
+ 27908,
+ 27929,
+ 27918,
+ 27947,
+ 27981,
+ 27950,
+ 27957,
+ 27930,
+ 27983,
+ 27986,
+ 27988,
+ 27955,
+ 28049,
+ 28015,
+ 28062,
+ 28064,
+ 27998,
+ 28051,
+ 28052,
+ 27996,
+ 28000,
+ 28028,
+ 28003,
+ 28186,
+ 28103,
+ 28101,
+ 28126,
+ 28174,
+ 28095,
+ 28128,
+ 28177,
+ 28134,
+ 28125,
+ 28121,
+ 28182,
+ 28075,
+ 28172,
+ 28078,
+ 28203,
+ 28270,
+ 28238,
+ 28267,
+ 28338,
+ 28255,
+ 28294,
+ 28243,
+ 28244,
+ 28210,
+ 28197,
+ 28228,
+ 28383,
+ 28337,
+ 28312,
+ 28384,
+ 28461,
+ 28386,
+ 28325,
+ 28327,
+ 28349,
+ 28347,
+ 28343,
+ 28375,
+ 28340,
+ 28367,
+ 28303,
+ 28354,
+ 28319,
+ 28514,
+ 28486,
+ 28487,
+ 28452,
+ 28437,
+ 28409,
+ 28463,
+ 28470,
+ 28491,
+ 28532,
+ 28458,
+ 28425,
+ 28457,
+ 28553,
+ 28557,
+ 28556,
+ 28536,
+ 28530,
+ 28540,
+ 28538,
+ 28625,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37642,
+ 37643,
+ 37644,
+ 37645,
+ 37646,
+ 37647,
+ 37648,
+ 37649,
+ 37650,
+ 37651,
+ 37652,
+ 37653,
+ 37654,
+ 37655,
+ 37656,
+ 37657,
+ 37658,
+ 37659,
+ 37660,
+ 37661,
+ 37662,
+ 37663,
+ 37664,
+ 37665,
+ 37666,
+ 37667,
+ 37668,
+ 37669,
+ 37670,
+ 37671,
+ 37672,
+ 37673,
+ 37674,
+ 37675,
+ 37676,
+ 37677,
+ 37678,
+ 37679,
+ 37680,
+ 37681,
+ 37682,
+ 37683,
+ 37684,
+ 37685,
+ 37686,
+ 37687,
+ 37688,
+ 37689,
+ 37690,
+ 37691,
+ 37692,
+ 37693,
+ 37695,
+ 37696,
+ 37697,
+ 37698,
+ 37699,
+ 37700,
+ 37701,
+ 37702,
+ 37703,
+ 37704,
+ 37705,
+ 0,
+ 37706,
+ 37707,
+ 37708,
+ 37709,
+ 37710,
+ 37711,
+ 37712,
+ 37713,
+ 37714,
+ 37715,
+ 37716,
+ 37717,
+ 37718,
+ 37719,
+ 37720,
+ 37721,
+ 37722,
+ 37723,
+ 37724,
+ 37725,
+ 37726,
+ 37727,
+ 37728,
+ 37729,
+ 37730,
+ 37731,
+ 37732,
+ 37733,
+ 37734,
+ 37735,
+ 37736,
+ 37737,
+ 37739,
+ 28617,
+ 28583,
+ 28601,
+ 28598,
+ 28610,
+ 28641,
+ 28654,
+ 28638,
+ 28640,
+ 28655,
+ 28698,
+ 28707,
+ 28699,
+ 28729,
+ 28725,
+ 28751,
+ 28766,
+ 23424,
+ 23428,
+ 23445,
+ 23443,
+ 23461,
+ 23480,
+ 29999,
+ 39582,
+ 25652,
+ 23524,
+ 23534,
+ 35120,
+ 23536,
+ 36423,
+ 35591,
+ 36790,
+ 36819,
+ 36821,
+ 36837,
+ 36846,
+ 36836,
+ 36841,
+ 36838,
+ 36851,
+ 36840,
+ 36869,
+ 36868,
+ 36875,
+ 36902,
+ 36881,
+ 36877,
+ 36886,
+ 36897,
+ 36917,
+ 36918,
+ 36909,
+ 36911,
+ 36932,
+ 36945,
+ 36946,
+ 36944,
+ 36968,
+ 36952,
+ 36962,
+ 36955,
+ 26297,
+ 36980,
+ 36989,
+ 36994,
+ 37000,
+ 36995,
+ 37003,
+ 24400,
+ 24407,
+ 24406,
+ 24408,
+ 23611,
+ 21675,
+ 23632,
+ 23641,
+ 23409,
+ 23651,
+ 23654,
+ 32700,
+ 24362,
+ 24361,
+ 24365,
+ 33396,
+ 24380,
+ 39739,
+ 23662,
+ 22913,
+ 22915,
+ 22925,
+ 22953,
+ 22954,
+ 22947,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37740,
+ 37741,
+ 37742,
+ 37743,
+ 37744,
+ 37745,
+ 37746,
+ 37747,
+ 37748,
+ 37749,
+ 37750,
+ 37751,
+ 37752,
+ 37753,
+ 37754,
+ 37755,
+ 37756,
+ 37757,
+ 37758,
+ 37759,
+ 37760,
+ 37761,
+ 37762,
+ 37763,
+ 37764,
+ 37765,
+ 37766,
+ 37767,
+ 37768,
+ 37769,
+ 37770,
+ 37771,
+ 37772,
+ 37773,
+ 37774,
+ 37776,
+ 37777,
+ 37778,
+ 37779,
+ 37780,
+ 37781,
+ 37782,
+ 37783,
+ 37784,
+ 37785,
+ 37786,
+ 37787,
+ 37788,
+ 37789,
+ 37790,
+ 37791,
+ 37792,
+ 37793,
+ 37794,
+ 37795,
+ 37796,
+ 37797,
+ 37798,
+ 37799,
+ 37800,
+ 37801,
+ 37802,
+ 37803,
+ 0,
+ 37804,
+ 37805,
+ 37806,
+ 37807,
+ 37808,
+ 37809,
+ 37810,
+ 37811,
+ 37812,
+ 37813,
+ 37814,
+ 37815,
+ 37816,
+ 37817,
+ 37818,
+ 37819,
+ 37820,
+ 37821,
+ 37822,
+ 37823,
+ 37824,
+ 37825,
+ 37826,
+ 37827,
+ 37828,
+ 37829,
+ 37830,
+ 37831,
+ 37832,
+ 37833,
+ 37835,
+ 37836,
+ 37837,
+ 22935,
+ 22986,
+ 22955,
+ 22942,
+ 22948,
+ 22994,
+ 22962,
+ 22959,
+ 22999,
+ 22974,
+ 23045,
+ 23046,
+ 23005,
+ 23048,
+ 23011,
+ 23000,
+ 23033,
+ 23052,
+ 23049,
+ 23090,
+ 23092,
+ 23057,
+ 23075,
+ 23059,
+ 23104,
+ 23143,
+ 23114,
+ 23125,
+ 23100,
+ 23138,
+ 23157,
+ 33004,
+ 23210,
+ 23195,
+ 23159,
+ 23162,
+ 23230,
+ 23275,
+ 23218,
+ 23250,
+ 23252,
+ 23224,
+ 23264,
+ 23267,
+ 23281,
+ 23254,
+ 23270,
+ 23256,
+ 23260,
+ 23305,
+ 23319,
+ 23318,
+ 23346,
+ 23351,
+ 23360,
+ 23573,
+ 23580,
+ 23386,
+ 23397,
+ 23411,
+ 23377,
+ 23379,
+ 23394,
+ 39541,
+ 39543,
+ 39544,
+ 39546,
+ 39551,
+ 39549,
+ 39552,
+ 39553,
+ 39557,
+ 39560,
+ 39562,
+ 39568,
+ 39570,
+ 39571,
+ 39574,
+ 39576,
+ 39579,
+ 39580,
+ 39581,
+ 39583,
+ 39584,
+ 39586,
+ 39587,
+ 39589,
+ 39591,
+ 32415,
+ 32417,
+ 32419,
+ 32421,
+ 32424,
+ 32425,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37838,
+ 37839,
+ 37840,
+ 37841,
+ 37842,
+ 37843,
+ 37844,
+ 37845,
+ 37847,
+ 37848,
+ 37849,
+ 37850,
+ 37851,
+ 37852,
+ 37853,
+ 37854,
+ 37855,
+ 37856,
+ 37857,
+ 37858,
+ 37859,
+ 37860,
+ 37861,
+ 37862,
+ 37863,
+ 37864,
+ 37865,
+ 37866,
+ 37867,
+ 37868,
+ 37869,
+ 37870,
+ 37871,
+ 37872,
+ 37873,
+ 37874,
+ 37875,
+ 37876,
+ 37877,
+ 37878,
+ 37879,
+ 37880,
+ 37881,
+ 37882,
+ 37883,
+ 37884,
+ 37885,
+ 37886,
+ 37887,
+ 37888,
+ 37889,
+ 37890,
+ 37891,
+ 37892,
+ 37893,
+ 37894,
+ 37895,
+ 37896,
+ 37897,
+ 37898,
+ 37899,
+ 37900,
+ 37901,
+ 0,
+ 37902,
+ 37903,
+ 37904,
+ 37905,
+ 37906,
+ 37907,
+ 37908,
+ 37909,
+ 37910,
+ 37911,
+ 37912,
+ 37913,
+ 37914,
+ 37915,
+ 37916,
+ 37917,
+ 37918,
+ 37919,
+ 37920,
+ 37921,
+ 37922,
+ 37923,
+ 37924,
+ 37925,
+ 37926,
+ 37927,
+ 37928,
+ 37929,
+ 37930,
+ 37931,
+ 37932,
+ 37933,
+ 37934,
+ 32429,
+ 32432,
+ 32446,
+ 32448,
+ 32449,
+ 32450,
+ 32457,
+ 32459,
+ 32460,
+ 32464,
+ 32468,
+ 32471,
+ 32475,
+ 32480,
+ 32481,
+ 32488,
+ 32491,
+ 32494,
+ 32495,
+ 32497,
+ 32498,
+ 32525,
+ 32502,
+ 32506,
+ 32507,
+ 32510,
+ 32513,
+ 32514,
+ 32515,
+ 32519,
+ 32520,
+ 32523,
+ 32524,
+ 32527,
+ 32529,
+ 32530,
+ 32535,
+ 32537,
+ 32540,
+ 32539,
+ 32543,
+ 32545,
+ 32546,
+ 32547,
+ 32548,
+ 32549,
+ 32550,
+ 32551,
+ 32554,
+ 32555,
+ 32556,
+ 32557,
+ 32559,
+ 32560,
+ 32561,
+ 32562,
+ 32563,
+ 32565,
+ 24186,
+ 30079,
+ 24027,
+ 30014,
+ 37013,
+ 29582,
+ 29585,
+ 29614,
+ 29602,
+ 29599,
+ 29647,
+ 29634,
+ 29649,
+ 29623,
+ 29619,
+ 29632,
+ 29641,
+ 29640,
+ 29669,
+ 29657,
+ 39036,
+ 29706,
+ 29673,
+ 29671,
+ 29662,
+ 29626,
+ 29682,
+ 29711,
+ 29738,
+ 29787,
+ 29734,
+ 29733,
+ 29736,
+ 29744,
+ 29742,
+ 29740,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 37935,
+ 37936,
+ 37937,
+ 37938,
+ 37939,
+ 37940,
+ 37941,
+ 37942,
+ 37943,
+ 37944,
+ 37945,
+ 37946,
+ 37947,
+ 37948,
+ 37949,
+ 37951,
+ 37952,
+ 37953,
+ 37954,
+ 37955,
+ 37956,
+ 37957,
+ 37958,
+ 37959,
+ 37960,
+ 37961,
+ 37962,
+ 37963,
+ 37964,
+ 37965,
+ 37966,
+ 37967,
+ 37968,
+ 37969,
+ 37970,
+ 37971,
+ 37972,
+ 37973,
+ 37974,
+ 37975,
+ 37976,
+ 37977,
+ 37978,
+ 37979,
+ 37980,
+ 37981,
+ 37982,
+ 37983,
+ 37984,
+ 37985,
+ 37986,
+ 37987,
+ 37988,
+ 37989,
+ 37990,
+ 37991,
+ 37992,
+ 37993,
+ 37994,
+ 37996,
+ 37997,
+ 37998,
+ 37999,
+ 0,
+ 38000,
+ 38001,
+ 38002,
+ 38003,
+ 38004,
+ 38005,
+ 38006,
+ 38007,
+ 38008,
+ 38009,
+ 38010,
+ 38011,
+ 38012,
+ 38013,
+ 38014,
+ 38015,
+ 38016,
+ 38017,
+ 38018,
+ 38019,
+ 38020,
+ 38033,
+ 38038,
+ 38040,
+ 38087,
+ 38095,
+ 38099,
+ 38100,
+ 38106,
+ 38118,
+ 38139,
+ 38172,
+ 38176,
+ 29723,
+ 29722,
+ 29761,
+ 29788,
+ 29783,
+ 29781,
+ 29785,
+ 29815,
+ 29805,
+ 29822,
+ 29852,
+ 29838,
+ 29824,
+ 29825,
+ 29831,
+ 29835,
+ 29854,
+ 29864,
+ 29865,
+ 29840,
+ 29863,
+ 29906,
+ 29882,
+ 38890,
+ 38891,
+ 38892,
+ 26444,
+ 26451,
+ 26462,
+ 26440,
+ 26473,
+ 26533,
+ 26503,
+ 26474,
+ 26483,
+ 26520,
+ 26535,
+ 26485,
+ 26536,
+ 26526,
+ 26541,
+ 26507,
+ 26487,
+ 26492,
+ 26608,
+ 26633,
+ 26584,
+ 26634,
+ 26601,
+ 26544,
+ 26636,
+ 26585,
+ 26549,
+ 26586,
+ 26547,
+ 26589,
+ 26624,
+ 26563,
+ 26552,
+ 26594,
+ 26638,
+ 26561,
+ 26621,
+ 26674,
+ 26675,
+ 26720,
+ 26721,
+ 26702,
+ 26722,
+ 26692,
+ 26724,
+ 26755,
+ 26653,
+ 26709,
+ 26726,
+ 26689,
+ 26727,
+ 26688,
+ 26686,
+ 26698,
+ 26697,
+ 26665,
+ 26805,
+ 26767,
+ 26740,
+ 26743,
+ 26771,
+ 26731,
+ 26818,
+ 26990,
+ 26876,
+ 26911,
+ 26912,
+ 26873,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 38183,
+ 38195,
+ 38205,
+ 38211,
+ 38216,
+ 38219,
+ 38229,
+ 38234,
+ 38240,
+ 38254,
+ 38260,
+ 38261,
+ 38263,
+ 38264,
+ 38265,
+ 38266,
+ 38267,
+ 38268,
+ 38269,
+ 38270,
+ 38272,
+ 38273,
+ 38274,
+ 38275,
+ 38276,
+ 38277,
+ 38278,
+ 38279,
+ 38280,
+ 38281,
+ 38282,
+ 38283,
+ 38284,
+ 38285,
+ 38286,
+ 38287,
+ 38288,
+ 38289,
+ 38290,
+ 38291,
+ 38292,
+ 38293,
+ 38294,
+ 38295,
+ 38296,
+ 38297,
+ 38298,
+ 38299,
+ 38300,
+ 38301,
+ 38302,
+ 38303,
+ 38304,
+ 38305,
+ 38306,
+ 38307,
+ 38308,
+ 38309,
+ 38310,
+ 38311,
+ 38312,
+ 38313,
+ 38314,
+ 0,
+ 38315,
+ 38316,
+ 38317,
+ 38318,
+ 38319,
+ 38320,
+ 38321,
+ 38322,
+ 38323,
+ 38324,
+ 38325,
+ 38326,
+ 38327,
+ 38328,
+ 38329,
+ 38330,
+ 38331,
+ 38332,
+ 38333,
+ 38334,
+ 38335,
+ 38336,
+ 38337,
+ 38338,
+ 38339,
+ 38340,
+ 38341,
+ 38342,
+ 38343,
+ 38344,
+ 38345,
+ 38346,
+ 38347,
+ 26916,
+ 26864,
+ 26891,
+ 26881,
+ 26967,
+ 26851,
+ 26896,
+ 26993,
+ 26937,
+ 26976,
+ 26946,
+ 26973,
+ 27012,
+ 26987,
+ 27008,
+ 27032,
+ 27000,
+ 26932,
+ 27084,
+ 27015,
+ 27016,
+ 27086,
+ 27017,
+ 26982,
+ 26979,
+ 27001,
+ 27035,
+ 27047,
+ 27067,
+ 27051,
+ 27053,
+ 27092,
+ 27057,
+ 27073,
+ 27082,
+ 27103,
+ 27029,
+ 27104,
+ 27021,
+ 27135,
+ 27183,
+ 27117,
+ 27159,
+ 27160,
+ 27237,
+ 27122,
+ 27204,
+ 27198,
+ 27296,
+ 27216,
+ 27227,
+ 27189,
+ 27278,
+ 27257,
+ 27197,
+ 27176,
+ 27224,
+ 27260,
+ 27281,
+ 27280,
+ 27305,
+ 27287,
+ 27307,
+ 29495,
+ 29522,
+ 27521,
+ 27522,
+ 27527,
+ 27524,
+ 27538,
+ 27539,
+ 27533,
+ 27546,
+ 27547,
+ 27553,
+ 27562,
+ 36715,
+ 36717,
+ 36721,
+ 36722,
+ 36723,
+ 36725,
+ 36726,
+ 36728,
+ 36727,
+ 36729,
+ 36730,
+ 36732,
+ 36734,
+ 36737,
+ 36738,
+ 36740,
+ 36743,
+ 36747,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 38348,
+ 38349,
+ 38350,
+ 38351,
+ 38352,
+ 38353,
+ 38354,
+ 38355,
+ 38356,
+ 38357,
+ 38358,
+ 38359,
+ 38360,
+ 38361,
+ 38362,
+ 38363,
+ 38364,
+ 38365,
+ 38366,
+ 38367,
+ 38368,
+ 38369,
+ 38370,
+ 38371,
+ 38372,
+ 38373,
+ 38374,
+ 38375,
+ 38380,
+ 38399,
+ 38407,
+ 38419,
+ 38424,
+ 38427,
+ 38430,
+ 38432,
+ 38435,
+ 38436,
+ 38437,
+ 38438,
+ 38439,
+ 38440,
+ 38441,
+ 38443,
+ 38444,
+ 38445,
+ 38447,
+ 38448,
+ 38455,
+ 38456,
+ 38457,
+ 38458,
+ 38462,
+ 38465,
+ 38467,
+ 38474,
+ 38478,
+ 38479,
+ 38481,
+ 38482,
+ 38483,
+ 38486,
+ 38487,
+ 0,
+ 38488,
+ 38489,
+ 38490,
+ 38492,
+ 38493,
+ 38494,
+ 38496,
+ 38499,
+ 38501,
+ 38502,
+ 38507,
+ 38509,
+ 38510,
+ 38511,
+ 38512,
+ 38513,
+ 38515,
+ 38520,
+ 38521,
+ 38522,
+ 38523,
+ 38524,
+ 38525,
+ 38526,
+ 38527,
+ 38528,
+ 38529,
+ 38530,
+ 38531,
+ 38532,
+ 38535,
+ 38537,
+ 38538,
+ 36749,
+ 36750,
+ 36751,
+ 36760,
+ 36762,
+ 36558,
+ 25099,
+ 25111,
+ 25115,
+ 25119,
+ 25122,
+ 25121,
+ 25125,
+ 25124,
+ 25132,
+ 33255,
+ 29935,
+ 29940,
+ 29951,
+ 29967,
+ 29969,
+ 29971,
+ 25908,
+ 26094,
+ 26095,
+ 26096,
+ 26122,
+ 26137,
+ 26482,
+ 26115,
+ 26133,
+ 26112,
+ 28805,
+ 26359,
+ 26141,
+ 26164,
+ 26161,
+ 26166,
+ 26165,
+ 32774,
+ 26207,
+ 26196,
+ 26177,
+ 26191,
+ 26198,
+ 26209,
+ 26199,
+ 26231,
+ 26244,
+ 26252,
+ 26279,
+ 26269,
+ 26302,
+ 26331,
+ 26332,
+ 26342,
+ 26345,
+ 36146,
+ 36147,
+ 36150,
+ 36155,
+ 36157,
+ 36160,
+ 36165,
+ 36166,
+ 36168,
+ 36169,
+ 36167,
+ 36173,
+ 36181,
+ 36185,
+ 35271,
+ 35274,
+ 35275,
+ 35276,
+ 35278,
+ 35279,
+ 35280,
+ 35281,
+ 29294,
+ 29343,
+ 29277,
+ 29286,
+ 29295,
+ 29310,
+ 29311,
+ 29316,
+ 29323,
+ 29325,
+ 29327,
+ 29330,
+ 25352,
+ 25394,
+ 25520,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 38540,
+ 38542,
+ 38545,
+ 38546,
+ 38547,
+ 38549,
+ 38550,
+ 38554,
+ 38555,
+ 38557,
+ 38558,
+ 38559,
+ 38560,
+ 38561,
+ 38562,
+ 38563,
+ 38564,
+ 38565,
+ 38566,
+ 38568,
+ 38569,
+ 38570,
+ 38571,
+ 38572,
+ 38573,
+ 38574,
+ 38575,
+ 38577,
+ 38578,
+ 38580,
+ 38581,
+ 38583,
+ 38584,
+ 38586,
+ 38587,
+ 38591,
+ 38594,
+ 38595,
+ 38600,
+ 38602,
+ 38603,
+ 38608,
+ 38609,
+ 38611,
+ 38612,
+ 38614,
+ 38615,
+ 38616,
+ 38617,
+ 38618,
+ 38619,
+ 38620,
+ 38621,
+ 38622,
+ 38623,
+ 38625,
+ 38626,
+ 38627,
+ 38628,
+ 38629,
+ 38630,
+ 38631,
+ 38635,
+ 0,
+ 38636,
+ 38637,
+ 38638,
+ 38640,
+ 38641,
+ 38642,
+ 38644,
+ 38645,
+ 38648,
+ 38650,
+ 38651,
+ 38652,
+ 38653,
+ 38655,
+ 38658,
+ 38659,
+ 38661,
+ 38666,
+ 38667,
+ 38668,
+ 38672,
+ 38673,
+ 38674,
+ 38676,
+ 38677,
+ 38679,
+ 38680,
+ 38681,
+ 38682,
+ 38683,
+ 38685,
+ 38687,
+ 38688,
+ 25663,
+ 25816,
+ 32772,
+ 27626,
+ 27635,
+ 27645,
+ 27637,
+ 27641,
+ 27653,
+ 27655,
+ 27654,
+ 27661,
+ 27669,
+ 27672,
+ 27673,
+ 27674,
+ 27681,
+ 27689,
+ 27684,
+ 27690,
+ 27698,
+ 25909,
+ 25941,
+ 25963,
+ 29261,
+ 29266,
+ 29270,
+ 29232,
+ 34402,
+ 21014,
+ 32927,
+ 32924,
+ 32915,
+ 32956,
+ 26378,
+ 32957,
+ 32945,
+ 32939,
+ 32941,
+ 32948,
+ 32951,
+ 32999,
+ 33000,
+ 33001,
+ 33002,
+ 32987,
+ 32962,
+ 32964,
+ 32985,
+ 32973,
+ 32983,
+ 26384,
+ 32989,
+ 33003,
+ 33009,
+ 33012,
+ 33005,
+ 33037,
+ 33038,
+ 33010,
+ 33020,
+ 26389,
+ 33042,
+ 35930,
+ 33078,
+ 33054,
+ 33068,
+ 33048,
+ 33074,
+ 33096,
+ 33100,
+ 33107,
+ 33140,
+ 33113,
+ 33114,
+ 33137,
+ 33120,
+ 33129,
+ 33148,
+ 33149,
+ 33133,
+ 33127,
+ 22605,
+ 23221,
+ 33160,
+ 33154,
+ 33169,
+ 28373,
+ 33187,
+ 33194,
+ 33228,
+ 26406,
+ 33226,
+ 33211,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 38689,
+ 38690,
+ 38691,
+ 38692,
+ 38693,
+ 38694,
+ 38695,
+ 38696,
+ 38697,
+ 38699,
+ 38700,
+ 38702,
+ 38703,
+ 38705,
+ 38707,
+ 38708,
+ 38709,
+ 38710,
+ 38711,
+ 38714,
+ 38715,
+ 38716,
+ 38717,
+ 38719,
+ 38720,
+ 38721,
+ 38722,
+ 38723,
+ 38724,
+ 38725,
+ 38726,
+ 38727,
+ 38728,
+ 38729,
+ 38730,
+ 38731,
+ 38732,
+ 38733,
+ 38734,
+ 38735,
+ 38736,
+ 38737,
+ 38740,
+ 38741,
+ 38743,
+ 38744,
+ 38746,
+ 38748,
+ 38749,
+ 38751,
+ 38755,
+ 38756,
+ 38758,
+ 38759,
+ 38760,
+ 38762,
+ 38763,
+ 38764,
+ 38765,
+ 38766,
+ 38767,
+ 38768,
+ 38769,
+ 0,
+ 38770,
+ 38773,
+ 38775,
+ 38776,
+ 38777,
+ 38778,
+ 38779,
+ 38781,
+ 38782,
+ 38783,
+ 38784,
+ 38785,
+ 38786,
+ 38787,
+ 38788,
+ 38790,
+ 38791,
+ 38792,
+ 38793,
+ 38794,
+ 38796,
+ 38798,
+ 38799,
+ 38800,
+ 38803,
+ 38805,
+ 38806,
+ 38807,
+ 38809,
+ 38810,
+ 38811,
+ 38812,
+ 38813,
+ 33217,
+ 33190,
+ 27428,
+ 27447,
+ 27449,
+ 27459,
+ 27462,
+ 27481,
+ 39121,
+ 39122,
+ 39123,
+ 39125,
+ 39129,
+ 39130,
+ 27571,
+ 24384,
+ 27586,
+ 35315,
+ 26000,
+ 40785,
+ 26003,
+ 26044,
+ 26054,
+ 26052,
+ 26051,
+ 26060,
+ 26062,
+ 26066,
+ 26070,
+ 28800,
+ 28828,
+ 28822,
+ 28829,
+ 28859,
+ 28864,
+ 28855,
+ 28843,
+ 28849,
+ 28904,
+ 28874,
+ 28944,
+ 28947,
+ 28950,
+ 28975,
+ 28977,
+ 29043,
+ 29020,
+ 29032,
+ 28997,
+ 29042,
+ 29002,
+ 29048,
+ 29050,
+ 29080,
+ 29107,
+ 29109,
+ 29096,
+ 29088,
+ 29152,
+ 29140,
+ 29159,
+ 29177,
+ 29213,
+ 29224,
+ 28780,
+ 28952,
+ 29030,
+ 29113,
+ 25150,
+ 25149,
+ 25155,
+ 25160,
+ 25161,
+ 31035,
+ 31040,
+ 31046,
+ 31049,
+ 31067,
+ 31068,
+ 31059,
+ 31066,
+ 31074,
+ 31063,
+ 31072,
+ 31087,
+ 31079,
+ 31098,
+ 31109,
+ 31114,
+ 31130,
+ 31143,
+ 31155,
+ 24529,
+ 24528,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 38814,
+ 38815,
+ 38817,
+ 38818,
+ 38820,
+ 38821,
+ 38822,
+ 38823,
+ 38824,
+ 38825,
+ 38826,
+ 38828,
+ 38830,
+ 38832,
+ 38833,
+ 38835,
+ 38837,
+ 38838,
+ 38839,
+ 38840,
+ 38841,
+ 38842,
+ 38843,
+ 38844,
+ 38845,
+ 38846,
+ 38847,
+ 38848,
+ 38849,
+ 38850,
+ 38851,
+ 38852,
+ 38853,
+ 38854,
+ 38855,
+ 38856,
+ 38857,
+ 38858,
+ 38859,
+ 38860,
+ 38861,
+ 38862,
+ 38863,
+ 38864,
+ 38865,
+ 38866,
+ 38867,
+ 38868,
+ 38869,
+ 38870,
+ 38871,
+ 38872,
+ 38873,
+ 38874,
+ 38875,
+ 38876,
+ 38877,
+ 38878,
+ 38879,
+ 38880,
+ 38881,
+ 38882,
+ 38883,
+ 0,
+ 38884,
+ 38885,
+ 38888,
+ 38894,
+ 38895,
+ 38896,
+ 38897,
+ 38898,
+ 38900,
+ 38903,
+ 38904,
+ 38905,
+ 38906,
+ 38907,
+ 38908,
+ 38909,
+ 38910,
+ 38911,
+ 38912,
+ 38913,
+ 38914,
+ 38915,
+ 38916,
+ 38917,
+ 38918,
+ 38919,
+ 38920,
+ 38921,
+ 38922,
+ 38923,
+ 38924,
+ 38925,
+ 38926,
+ 24636,
+ 24669,
+ 24666,
+ 24679,
+ 24641,
+ 24665,
+ 24675,
+ 24747,
+ 24838,
+ 24845,
+ 24925,
+ 25001,
+ 24989,
+ 25035,
+ 25041,
+ 25094,
+ 32896,
+ 32895,
+ 27795,
+ 27894,
+ 28156,
+ 30710,
+ 30712,
+ 30720,
+ 30729,
+ 30743,
+ 30744,
+ 30737,
+ 26027,
+ 30765,
+ 30748,
+ 30749,
+ 30777,
+ 30778,
+ 30779,
+ 30751,
+ 30780,
+ 30757,
+ 30764,
+ 30755,
+ 30761,
+ 30798,
+ 30829,
+ 30806,
+ 30807,
+ 30758,
+ 30800,
+ 30791,
+ 30796,
+ 30826,
+ 30875,
+ 30867,
+ 30874,
+ 30855,
+ 30876,
+ 30881,
+ 30883,
+ 30898,
+ 30905,
+ 30885,
+ 30932,
+ 30937,
+ 30921,
+ 30956,
+ 30962,
+ 30981,
+ 30964,
+ 30995,
+ 31012,
+ 31006,
+ 31028,
+ 40859,
+ 40697,
+ 40699,
+ 40700,
+ 30449,
+ 30468,
+ 30477,
+ 30457,
+ 30471,
+ 30472,
+ 30490,
+ 30498,
+ 30489,
+ 30509,
+ 30502,
+ 30517,
+ 30520,
+ 30544,
+ 30545,
+ 30535,
+ 30531,
+ 30554,
+ 30568,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 38927,
+ 38928,
+ 38929,
+ 38930,
+ 38931,
+ 38932,
+ 38933,
+ 38934,
+ 38935,
+ 38936,
+ 38937,
+ 38938,
+ 38939,
+ 38940,
+ 38941,
+ 38942,
+ 38943,
+ 38944,
+ 38945,
+ 38946,
+ 38947,
+ 38948,
+ 38949,
+ 38950,
+ 38951,
+ 38952,
+ 38953,
+ 38954,
+ 38955,
+ 38956,
+ 38957,
+ 38958,
+ 38959,
+ 38960,
+ 38961,
+ 38962,
+ 38963,
+ 38964,
+ 38965,
+ 38966,
+ 38967,
+ 38968,
+ 38969,
+ 38970,
+ 38971,
+ 38972,
+ 38973,
+ 38974,
+ 38975,
+ 38976,
+ 38977,
+ 38978,
+ 38979,
+ 38980,
+ 38981,
+ 38982,
+ 38983,
+ 38984,
+ 38985,
+ 38986,
+ 38987,
+ 38988,
+ 38989,
+ 0,
+ 38990,
+ 38991,
+ 38992,
+ 38993,
+ 38994,
+ 38995,
+ 38996,
+ 38997,
+ 38998,
+ 38999,
+ 39000,
+ 39001,
+ 39002,
+ 39003,
+ 39004,
+ 39005,
+ 39006,
+ 39007,
+ 39008,
+ 39009,
+ 39010,
+ 39011,
+ 39012,
+ 39013,
+ 39014,
+ 39015,
+ 39016,
+ 39017,
+ 39018,
+ 39019,
+ 39020,
+ 39021,
+ 39022,
+ 30562,
+ 30565,
+ 30591,
+ 30605,
+ 30589,
+ 30592,
+ 30604,
+ 30609,
+ 30623,
+ 30624,
+ 30640,
+ 30645,
+ 30653,
+ 30010,
+ 30016,
+ 30030,
+ 30027,
+ 30024,
+ 30043,
+ 30066,
+ 30073,
+ 30083,
+ 32600,
+ 32609,
+ 32607,
+ 35400,
+ 32616,
+ 32628,
+ 32625,
+ 32633,
+ 32641,
+ 32638,
+ 30413,
+ 30437,
+ 34866,
+ 38021,
+ 38022,
+ 38023,
+ 38027,
+ 38026,
+ 38028,
+ 38029,
+ 38031,
+ 38032,
+ 38036,
+ 38039,
+ 38037,
+ 38042,
+ 38043,
+ 38044,
+ 38051,
+ 38052,
+ 38059,
+ 38058,
+ 38061,
+ 38060,
+ 38063,
+ 38064,
+ 38066,
+ 38068,
+ 38070,
+ 38071,
+ 38072,
+ 38073,
+ 38074,
+ 38076,
+ 38077,
+ 38079,
+ 38084,
+ 38088,
+ 38089,
+ 38090,
+ 38091,
+ 38092,
+ 38093,
+ 38094,
+ 38096,
+ 38097,
+ 38098,
+ 38101,
+ 38102,
+ 38103,
+ 38105,
+ 38104,
+ 38107,
+ 38110,
+ 38111,
+ 38112,
+ 38114,
+ 38116,
+ 38117,
+ 38119,
+ 38120,
+ 38122,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39023,
+ 39024,
+ 39025,
+ 39026,
+ 39027,
+ 39028,
+ 39051,
+ 39054,
+ 39058,
+ 39061,
+ 39065,
+ 39075,
+ 39080,
+ 39081,
+ 39082,
+ 39083,
+ 39084,
+ 39085,
+ 39086,
+ 39087,
+ 39088,
+ 39089,
+ 39090,
+ 39091,
+ 39092,
+ 39093,
+ 39094,
+ 39095,
+ 39096,
+ 39097,
+ 39098,
+ 39099,
+ 39100,
+ 39101,
+ 39102,
+ 39103,
+ 39104,
+ 39105,
+ 39106,
+ 39107,
+ 39108,
+ 39109,
+ 39110,
+ 39111,
+ 39112,
+ 39113,
+ 39114,
+ 39115,
+ 39116,
+ 39117,
+ 39119,
+ 39120,
+ 39124,
+ 39126,
+ 39127,
+ 39131,
+ 39132,
+ 39133,
+ 39136,
+ 39137,
+ 39138,
+ 39139,
+ 39140,
+ 0,
+ 39141,
+ 39142,
+ 39145,
+ 39146,
+ 39147,
+ 39148,
+ 39149,
+ 39150,
+ 39151,
+ 39152,
+ 39153,
+ 39154,
+ 39155,
+ 39156,
+ 39157,
+ 39158,
+ 39159,
+ 39160,
+ 39161,
+ 39162,
+ 39163,
+ 39164,
+ 39165,
+ 39166,
+ 39167,
+ 39168,
+ 39169,
+ 39170,
+ 39171,
+ 39172,
+ 39173,
+ 39174,
+ 39175,
+ 38121,
+ 38123,
+ 38126,
+ 38127,
+ 38131,
+ 38132,
+ 38133,
+ 38135,
+ 38137,
+ 38140,
+ 38141,
+ 38143,
+ 38147,
+ 38146,
+ 38150,
+ 38151,
+ 38153,
+ 38154,
+ 38157,
+ 38158,
+ 38159,
+ 38162,
+ 38163,
+ 38164,
+ 38165,
+ 38166,
+ 38168,
+ 38171,
+ 38173,
+ 38174,
+ 38175,
+ 38178,
+ 38186,
+ 38187,
+ 38185,
+ 38188,
+ 38193,
+ 38194,
+ 38196,
+ 38198,
+ 38199,
+ 38200,
+ 38204,
+ 38206,
+ 38207,
+ 38210,
+ 38197,
+ 38212,
+ 38213,
+ 38214,
+ 38217,
+ 38220,
+ 38222,
+ 38223,
+ 38226,
+ 38227,
+ 38228,
+ 38230,
+ 38231,
+ 38232,
+ 38233,
+ 38235,
+ 38238,
+ 38239,
+ 38237,
+ 38241,
+ 38242,
+ 38244,
+ 38245,
+ 38246,
+ 38247,
+ 38248,
+ 38249,
+ 38250,
+ 38251,
+ 38252,
+ 38255,
+ 38257,
+ 38258,
+ 38259,
+ 38202,
+ 30695,
+ 30700,
+ 38601,
+ 31189,
+ 31213,
+ 31203,
+ 31211,
+ 31238,
+ 23879,
+ 31235,
+ 31234,
+ 31262,
+ 31252,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39176,
+ 39177,
+ 39178,
+ 39179,
+ 39180,
+ 39182,
+ 39183,
+ 39185,
+ 39186,
+ 39187,
+ 39188,
+ 39189,
+ 39190,
+ 39191,
+ 39192,
+ 39193,
+ 39194,
+ 39195,
+ 39196,
+ 39197,
+ 39198,
+ 39199,
+ 39200,
+ 39201,
+ 39202,
+ 39203,
+ 39204,
+ 39205,
+ 39206,
+ 39207,
+ 39208,
+ 39209,
+ 39210,
+ 39211,
+ 39212,
+ 39213,
+ 39215,
+ 39216,
+ 39217,
+ 39218,
+ 39219,
+ 39220,
+ 39221,
+ 39222,
+ 39223,
+ 39224,
+ 39225,
+ 39226,
+ 39227,
+ 39228,
+ 39229,
+ 39230,
+ 39231,
+ 39232,
+ 39233,
+ 39234,
+ 39235,
+ 39236,
+ 39237,
+ 39238,
+ 39239,
+ 39240,
+ 39241,
+ 0,
+ 39242,
+ 39243,
+ 39244,
+ 39245,
+ 39246,
+ 39247,
+ 39248,
+ 39249,
+ 39250,
+ 39251,
+ 39254,
+ 39255,
+ 39256,
+ 39257,
+ 39258,
+ 39259,
+ 39260,
+ 39261,
+ 39262,
+ 39263,
+ 39264,
+ 39265,
+ 39266,
+ 39268,
+ 39270,
+ 39283,
+ 39288,
+ 39289,
+ 39291,
+ 39294,
+ 39298,
+ 39299,
+ 39305,
+ 31289,
+ 31287,
+ 31313,
+ 40655,
+ 39333,
+ 31344,
+ 30344,
+ 30350,
+ 30355,
+ 30361,
+ 30372,
+ 29918,
+ 29920,
+ 29996,
+ 40480,
+ 40482,
+ 40488,
+ 40489,
+ 40490,
+ 40491,
+ 40492,
+ 40498,
+ 40497,
+ 40502,
+ 40504,
+ 40503,
+ 40505,
+ 40506,
+ 40510,
+ 40513,
+ 40514,
+ 40516,
+ 40518,
+ 40519,
+ 40520,
+ 40521,
+ 40523,
+ 40524,
+ 40526,
+ 40529,
+ 40533,
+ 40535,
+ 40538,
+ 40539,
+ 40540,
+ 40542,
+ 40547,
+ 40550,
+ 40551,
+ 40552,
+ 40553,
+ 40554,
+ 40555,
+ 40556,
+ 40561,
+ 40557,
+ 40563,
+ 30098,
+ 30100,
+ 30102,
+ 30112,
+ 30109,
+ 30124,
+ 30115,
+ 30131,
+ 30132,
+ 30136,
+ 30148,
+ 30129,
+ 30128,
+ 30147,
+ 30146,
+ 30166,
+ 30157,
+ 30179,
+ 30184,
+ 30182,
+ 30180,
+ 30187,
+ 30183,
+ 30211,
+ 30193,
+ 30204,
+ 30207,
+ 30224,
+ 30208,
+ 30213,
+ 30220,
+ 30231,
+ 30218,
+ 30245,
+ 30232,
+ 30229,
+ 30233,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39308,
+ 39310,
+ 39322,
+ 39323,
+ 39324,
+ 39325,
+ 39326,
+ 39327,
+ 39328,
+ 39329,
+ 39330,
+ 39331,
+ 39332,
+ 39334,
+ 39335,
+ 39337,
+ 39338,
+ 39339,
+ 39340,
+ 39341,
+ 39342,
+ 39343,
+ 39344,
+ 39345,
+ 39346,
+ 39347,
+ 39348,
+ 39349,
+ 39350,
+ 39351,
+ 39352,
+ 39353,
+ 39354,
+ 39355,
+ 39356,
+ 39357,
+ 39358,
+ 39359,
+ 39360,
+ 39361,
+ 39362,
+ 39363,
+ 39364,
+ 39365,
+ 39366,
+ 39367,
+ 39368,
+ 39369,
+ 39370,
+ 39371,
+ 39372,
+ 39373,
+ 39374,
+ 39375,
+ 39376,
+ 39377,
+ 39378,
+ 39379,
+ 39380,
+ 39381,
+ 39382,
+ 39383,
+ 39384,
+ 0,
+ 39385,
+ 39386,
+ 39387,
+ 39388,
+ 39389,
+ 39390,
+ 39391,
+ 39392,
+ 39393,
+ 39394,
+ 39395,
+ 39396,
+ 39397,
+ 39398,
+ 39399,
+ 39400,
+ 39401,
+ 39402,
+ 39403,
+ 39404,
+ 39405,
+ 39406,
+ 39407,
+ 39408,
+ 39409,
+ 39410,
+ 39411,
+ 39412,
+ 39413,
+ 39414,
+ 39415,
+ 39416,
+ 39417,
+ 30235,
+ 30268,
+ 30242,
+ 30240,
+ 30272,
+ 30253,
+ 30256,
+ 30271,
+ 30261,
+ 30275,
+ 30270,
+ 30259,
+ 30285,
+ 30302,
+ 30292,
+ 30300,
+ 30294,
+ 30315,
+ 30319,
+ 32714,
+ 31462,
+ 31352,
+ 31353,
+ 31360,
+ 31366,
+ 31368,
+ 31381,
+ 31398,
+ 31392,
+ 31404,
+ 31400,
+ 31405,
+ 31411,
+ 34916,
+ 34921,
+ 34930,
+ 34941,
+ 34943,
+ 34946,
+ 34978,
+ 35014,
+ 34999,
+ 35004,
+ 35017,
+ 35042,
+ 35022,
+ 35043,
+ 35045,
+ 35057,
+ 35098,
+ 35068,
+ 35048,
+ 35070,
+ 35056,
+ 35105,
+ 35097,
+ 35091,
+ 35099,
+ 35082,
+ 35124,
+ 35115,
+ 35126,
+ 35137,
+ 35174,
+ 35195,
+ 30091,
+ 32997,
+ 30386,
+ 30388,
+ 30684,
+ 32786,
+ 32788,
+ 32790,
+ 32796,
+ 32800,
+ 32802,
+ 32805,
+ 32806,
+ 32807,
+ 32809,
+ 32808,
+ 32817,
+ 32779,
+ 32821,
+ 32835,
+ 32838,
+ 32845,
+ 32850,
+ 32873,
+ 32881,
+ 35203,
+ 39032,
+ 39040,
+ 39043,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39418,
+ 39419,
+ 39420,
+ 39421,
+ 39422,
+ 39423,
+ 39424,
+ 39425,
+ 39426,
+ 39427,
+ 39428,
+ 39429,
+ 39430,
+ 39431,
+ 39432,
+ 39433,
+ 39434,
+ 39435,
+ 39436,
+ 39437,
+ 39438,
+ 39439,
+ 39440,
+ 39441,
+ 39442,
+ 39443,
+ 39444,
+ 39445,
+ 39446,
+ 39447,
+ 39448,
+ 39449,
+ 39450,
+ 39451,
+ 39452,
+ 39453,
+ 39454,
+ 39455,
+ 39456,
+ 39457,
+ 39458,
+ 39459,
+ 39460,
+ 39461,
+ 39462,
+ 39463,
+ 39464,
+ 39465,
+ 39466,
+ 39467,
+ 39468,
+ 39469,
+ 39470,
+ 39471,
+ 39472,
+ 39473,
+ 39474,
+ 39475,
+ 39476,
+ 39477,
+ 39478,
+ 39479,
+ 39480,
+ 0,
+ 39481,
+ 39482,
+ 39483,
+ 39484,
+ 39485,
+ 39486,
+ 39487,
+ 39488,
+ 39489,
+ 39490,
+ 39491,
+ 39492,
+ 39493,
+ 39494,
+ 39495,
+ 39496,
+ 39497,
+ 39498,
+ 39499,
+ 39500,
+ 39501,
+ 39502,
+ 39503,
+ 39504,
+ 39505,
+ 39506,
+ 39507,
+ 39508,
+ 39509,
+ 39510,
+ 39511,
+ 39512,
+ 39513,
+ 39049,
+ 39052,
+ 39053,
+ 39055,
+ 39060,
+ 39066,
+ 39067,
+ 39070,
+ 39071,
+ 39073,
+ 39074,
+ 39077,
+ 39078,
+ 34381,
+ 34388,
+ 34412,
+ 34414,
+ 34431,
+ 34426,
+ 34428,
+ 34427,
+ 34472,
+ 34445,
+ 34443,
+ 34476,
+ 34461,
+ 34471,
+ 34467,
+ 34474,
+ 34451,
+ 34473,
+ 34486,
+ 34500,
+ 34485,
+ 34510,
+ 34480,
+ 34490,
+ 34481,
+ 34479,
+ 34505,
+ 34511,
+ 34484,
+ 34537,
+ 34545,
+ 34546,
+ 34541,
+ 34547,
+ 34512,
+ 34579,
+ 34526,
+ 34548,
+ 34527,
+ 34520,
+ 34513,
+ 34563,
+ 34567,
+ 34552,
+ 34568,
+ 34570,
+ 34573,
+ 34569,
+ 34595,
+ 34619,
+ 34590,
+ 34597,
+ 34606,
+ 34586,
+ 34622,
+ 34632,
+ 34612,
+ 34609,
+ 34601,
+ 34615,
+ 34623,
+ 34690,
+ 34594,
+ 34685,
+ 34686,
+ 34683,
+ 34656,
+ 34672,
+ 34636,
+ 34670,
+ 34699,
+ 34643,
+ 34659,
+ 34684,
+ 34660,
+ 34649,
+ 34661,
+ 34707,
+ 34735,
+ 34728,
+ 34770,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39514,
+ 39515,
+ 39516,
+ 39517,
+ 39518,
+ 39519,
+ 39520,
+ 39521,
+ 39522,
+ 39523,
+ 39524,
+ 39525,
+ 39526,
+ 39527,
+ 39528,
+ 39529,
+ 39530,
+ 39531,
+ 39538,
+ 39555,
+ 39561,
+ 39565,
+ 39566,
+ 39572,
+ 39573,
+ 39577,
+ 39590,
+ 39593,
+ 39594,
+ 39595,
+ 39596,
+ 39597,
+ 39598,
+ 39599,
+ 39602,
+ 39603,
+ 39604,
+ 39605,
+ 39609,
+ 39611,
+ 39613,
+ 39614,
+ 39615,
+ 39619,
+ 39620,
+ 39622,
+ 39623,
+ 39624,
+ 39625,
+ 39626,
+ 39629,
+ 39630,
+ 39631,
+ 39632,
+ 39634,
+ 39636,
+ 39637,
+ 39638,
+ 39639,
+ 39641,
+ 39642,
+ 39643,
+ 39644,
+ 0,
+ 39645,
+ 39646,
+ 39648,
+ 39650,
+ 39651,
+ 39652,
+ 39653,
+ 39655,
+ 39656,
+ 39657,
+ 39658,
+ 39660,
+ 39662,
+ 39664,
+ 39665,
+ 39666,
+ 39667,
+ 39668,
+ 39669,
+ 39670,
+ 39671,
+ 39672,
+ 39674,
+ 39676,
+ 39677,
+ 39678,
+ 39679,
+ 39680,
+ 39681,
+ 39682,
+ 39684,
+ 39685,
+ 39686,
+ 34758,
+ 34696,
+ 34693,
+ 34733,
+ 34711,
+ 34691,
+ 34731,
+ 34789,
+ 34732,
+ 34741,
+ 34739,
+ 34763,
+ 34771,
+ 34749,
+ 34769,
+ 34752,
+ 34762,
+ 34779,
+ 34794,
+ 34784,
+ 34798,
+ 34838,
+ 34835,
+ 34814,
+ 34826,
+ 34843,
+ 34849,
+ 34873,
+ 34876,
+ 32566,
+ 32578,
+ 32580,
+ 32581,
+ 33296,
+ 31482,
+ 31485,
+ 31496,
+ 31491,
+ 31492,
+ 31509,
+ 31498,
+ 31531,
+ 31503,
+ 31559,
+ 31544,
+ 31530,
+ 31513,
+ 31534,
+ 31537,
+ 31520,
+ 31525,
+ 31524,
+ 31539,
+ 31550,
+ 31518,
+ 31576,
+ 31578,
+ 31557,
+ 31605,
+ 31564,
+ 31581,
+ 31584,
+ 31598,
+ 31611,
+ 31586,
+ 31602,
+ 31601,
+ 31632,
+ 31654,
+ 31655,
+ 31672,
+ 31660,
+ 31645,
+ 31656,
+ 31621,
+ 31658,
+ 31644,
+ 31650,
+ 31659,
+ 31668,
+ 31697,
+ 31681,
+ 31692,
+ 31709,
+ 31706,
+ 31717,
+ 31718,
+ 31722,
+ 31756,
+ 31742,
+ 31740,
+ 31759,
+ 31766,
+ 31755,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39687,
+ 39689,
+ 39690,
+ 39691,
+ 39692,
+ 39693,
+ 39694,
+ 39696,
+ 39697,
+ 39698,
+ 39700,
+ 39701,
+ 39702,
+ 39703,
+ 39704,
+ 39705,
+ 39706,
+ 39707,
+ 39708,
+ 39709,
+ 39710,
+ 39712,
+ 39713,
+ 39714,
+ 39716,
+ 39717,
+ 39718,
+ 39719,
+ 39720,
+ 39721,
+ 39722,
+ 39723,
+ 39724,
+ 39725,
+ 39726,
+ 39728,
+ 39729,
+ 39731,
+ 39732,
+ 39733,
+ 39734,
+ 39735,
+ 39736,
+ 39737,
+ 39738,
+ 39741,
+ 39742,
+ 39743,
+ 39744,
+ 39750,
+ 39754,
+ 39755,
+ 39756,
+ 39758,
+ 39760,
+ 39762,
+ 39763,
+ 39765,
+ 39766,
+ 39767,
+ 39768,
+ 39769,
+ 39770,
+ 0,
+ 39771,
+ 39772,
+ 39773,
+ 39774,
+ 39775,
+ 39776,
+ 39777,
+ 39778,
+ 39779,
+ 39780,
+ 39781,
+ 39782,
+ 39783,
+ 39784,
+ 39785,
+ 39786,
+ 39787,
+ 39788,
+ 39789,
+ 39790,
+ 39791,
+ 39792,
+ 39793,
+ 39794,
+ 39795,
+ 39796,
+ 39797,
+ 39798,
+ 39799,
+ 39800,
+ 39801,
+ 39802,
+ 39803,
+ 31775,
+ 31786,
+ 31782,
+ 31800,
+ 31809,
+ 31808,
+ 33278,
+ 33281,
+ 33282,
+ 33284,
+ 33260,
+ 34884,
+ 33313,
+ 33314,
+ 33315,
+ 33325,
+ 33327,
+ 33320,
+ 33323,
+ 33336,
+ 33339,
+ 33331,
+ 33332,
+ 33342,
+ 33348,
+ 33353,
+ 33355,
+ 33359,
+ 33370,
+ 33375,
+ 33384,
+ 34942,
+ 34949,
+ 34952,
+ 35032,
+ 35039,
+ 35166,
+ 32669,
+ 32671,
+ 32679,
+ 32687,
+ 32688,
+ 32690,
+ 31868,
+ 25929,
+ 31889,
+ 31901,
+ 31900,
+ 31902,
+ 31906,
+ 31922,
+ 31932,
+ 31933,
+ 31937,
+ 31943,
+ 31948,
+ 31949,
+ 31944,
+ 31941,
+ 31959,
+ 31976,
+ 33390,
+ 26280,
+ 32703,
+ 32718,
+ 32725,
+ 32741,
+ 32737,
+ 32742,
+ 32745,
+ 32750,
+ 32755,
+ 31992,
+ 32119,
+ 32166,
+ 32174,
+ 32327,
+ 32411,
+ 40632,
+ 40628,
+ 36211,
+ 36228,
+ 36244,
+ 36241,
+ 36273,
+ 36199,
+ 36205,
+ 35911,
+ 35913,
+ 37194,
+ 37200,
+ 37198,
+ 37199,
+ 37220,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39804,
+ 39805,
+ 39806,
+ 39807,
+ 39808,
+ 39809,
+ 39810,
+ 39811,
+ 39812,
+ 39813,
+ 39814,
+ 39815,
+ 39816,
+ 39817,
+ 39818,
+ 39819,
+ 39820,
+ 39821,
+ 39822,
+ 39823,
+ 39824,
+ 39825,
+ 39826,
+ 39827,
+ 39828,
+ 39829,
+ 39830,
+ 39831,
+ 39832,
+ 39833,
+ 39834,
+ 39835,
+ 39836,
+ 39837,
+ 39838,
+ 39839,
+ 39840,
+ 39841,
+ 39842,
+ 39843,
+ 39844,
+ 39845,
+ 39846,
+ 39847,
+ 39848,
+ 39849,
+ 39850,
+ 39851,
+ 39852,
+ 39853,
+ 39854,
+ 39855,
+ 39856,
+ 39857,
+ 39858,
+ 39859,
+ 39860,
+ 39861,
+ 39862,
+ 39863,
+ 39864,
+ 39865,
+ 39866,
+ 0,
+ 39867,
+ 39868,
+ 39869,
+ 39870,
+ 39871,
+ 39872,
+ 39873,
+ 39874,
+ 39875,
+ 39876,
+ 39877,
+ 39878,
+ 39879,
+ 39880,
+ 39881,
+ 39882,
+ 39883,
+ 39884,
+ 39885,
+ 39886,
+ 39887,
+ 39888,
+ 39889,
+ 39890,
+ 39891,
+ 39892,
+ 39893,
+ 39894,
+ 39895,
+ 39896,
+ 39897,
+ 39898,
+ 39899,
+ 37218,
+ 37217,
+ 37232,
+ 37225,
+ 37231,
+ 37245,
+ 37246,
+ 37234,
+ 37236,
+ 37241,
+ 37260,
+ 37253,
+ 37264,
+ 37261,
+ 37265,
+ 37282,
+ 37283,
+ 37290,
+ 37293,
+ 37294,
+ 37295,
+ 37301,
+ 37300,
+ 37306,
+ 35925,
+ 40574,
+ 36280,
+ 36331,
+ 36357,
+ 36441,
+ 36457,
+ 36277,
+ 36287,
+ 36284,
+ 36282,
+ 36292,
+ 36310,
+ 36311,
+ 36314,
+ 36318,
+ 36302,
+ 36303,
+ 36315,
+ 36294,
+ 36332,
+ 36343,
+ 36344,
+ 36323,
+ 36345,
+ 36347,
+ 36324,
+ 36361,
+ 36349,
+ 36372,
+ 36381,
+ 36383,
+ 36396,
+ 36398,
+ 36387,
+ 36399,
+ 36410,
+ 36416,
+ 36409,
+ 36405,
+ 36413,
+ 36401,
+ 36425,
+ 36417,
+ 36418,
+ 36433,
+ 36434,
+ 36426,
+ 36464,
+ 36470,
+ 36476,
+ 36463,
+ 36468,
+ 36485,
+ 36495,
+ 36500,
+ 36496,
+ 36508,
+ 36510,
+ 35960,
+ 35970,
+ 35978,
+ 35973,
+ 35992,
+ 35988,
+ 26011,
+ 35286,
+ 35294,
+ 35290,
+ 35292,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39900,
+ 39901,
+ 39902,
+ 39903,
+ 39904,
+ 39905,
+ 39906,
+ 39907,
+ 39908,
+ 39909,
+ 39910,
+ 39911,
+ 39912,
+ 39913,
+ 39914,
+ 39915,
+ 39916,
+ 39917,
+ 39918,
+ 39919,
+ 39920,
+ 39921,
+ 39922,
+ 39923,
+ 39924,
+ 39925,
+ 39926,
+ 39927,
+ 39928,
+ 39929,
+ 39930,
+ 39931,
+ 39932,
+ 39933,
+ 39934,
+ 39935,
+ 39936,
+ 39937,
+ 39938,
+ 39939,
+ 39940,
+ 39941,
+ 39942,
+ 39943,
+ 39944,
+ 39945,
+ 39946,
+ 39947,
+ 39948,
+ 39949,
+ 39950,
+ 39951,
+ 39952,
+ 39953,
+ 39954,
+ 39955,
+ 39956,
+ 39957,
+ 39958,
+ 39959,
+ 39960,
+ 39961,
+ 39962,
+ 0,
+ 39963,
+ 39964,
+ 39965,
+ 39966,
+ 39967,
+ 39968,
+ 39969,
+ 39970,
+ 39971,
+ 39972,
+ 39973,
+ 39974,
+ 39975,
+ 39976,
+ 39977,
+ 39978,
+ 39979,
+ 39980,
+ 39981,
+ 39982,
+ 39983,
+ 39984,
+ 39985,
+ 39986,
+ 39987,
+ 39988,
+ 39989,
+ 39990,
+ 39991,
+ 39992,
+ 39993,
+ 39994,
+ 39995,
+ 35301,
+ 35307,
+ 35311,
+ 35390,
+ 35622,
+ 38739,
+ 38633,
+ 38643,
+ 38639,
+ 38662,
+ 38657,
+ 38664,
+ 38671,
+ 38670,
+ 38698,
+ 38701,
+ 38704,
+ 38718,
+ 40832,
+ 40835,
+ 40837,
+ 40838,
+ 40839,
+ 40840,
+ 40841,
+ 40842,
+ 40844,
+ 40702,
+ 40715,
+ 40717,
+ 38585,
+ 38588,
+ 38589,
+ 38606,
+ 38610,
+ 30655,
+ 38624,
+ 37518,
+ 37550,
+ 37576,
+ 37694,
+ 37738,
+ 37834,
+ 37775,
+ 37950,
+ 37995,
+ 40063,
+ 40066,
+ 40069,
+ 40070,
+ 40071,
+ 40072,
+ 31267,
+ 40075,
+ 40078,
+ 40080,
+ 40081,
+ 40082,
+ 40084,
+ 40085,
+ 40090,
+ 40091,
+ 40094,
+ 40095,
+ 40096,
+ 40097,
+ 40098,
+ 40099,
+ 40101,
+ 40102,
+ 40103,
+ 40104,
+ 40105,
+ 40107,
+ 40109,
+ 40110,
+ 40112,
+ 40113,
+ 40114,
+ 40115,
+ 40116,
+ 40117,
+ 40118,
+ 40119,
+ 40122,
+ 40123,
+ 40124,
+ 40125,
+ 40132,
+ 40133,
+ 40134,
+ 40135,
+ 40138,
+ 40139,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 39996,
+ 39997,
+ 39998,
+ 39999,
+ 40000,
+ 40001,
+ 40002,
+ 40003,
+ 40004,
+ 40005,
+ 40006,
+ 40007,
+ 40008,
+ 40009,
+ 40010,
+ 40011,
+ 40012,
+ 40013,
+ 40014,
+ 40015,
+ 40016,
+ 40017,
+ 40018,
+ 40019,
+ 40020,
+ 40021,
+ 40022,
+ 40023,
+ 40024,
+ 40025,
+ 40026,
+ 40027,
+ 40028,
+ 40029,
+ 40030,
+ 40031,
+ 40032,
+ 40033,
+ 40034,
+ 40035,
+ 40036,
+ 40037,
+ 40038,
+ 40039,
+ 40040,
+ 40041,
+ 40042,
+ 40043,
+ 40044,
+ 40045,
+ 40046,
+ 40047,
+ 40048,
+ 40049,
+ 40050,
+ 40051,
+ 40052,
+ 40053,
+ 40054,
+ 40055,
+ 40056,
+ 40057,
+ 40058,
+ 0,
+ 40059,
+ 40061,
+ 40062,
+ 40064,
+ 40067,
+ 40068,
+ 40073,
+ 40074,
+ 40076,
+ 40079,
+ 40083,
+ 40086,
+ 40087,
+ 40088,
+ 40089,
+ 40093,
+ 40106,
+ 40108,
+ 40111,
+ 40121,
+ 40126,
+ 40127,
+ 40128,
+ 40129,
+ 40130,
+ 40136,
+ 40137,
+ 40145,
+ 40146,
+ 40154,
+ 40155,
+ 40160,
+ 40161,
+ 40140,
+ 40141,
+ 40142,
+ 40143,
+ 40144,
+ 40147,
+ 40148,
+ 40149,
+ 40151,
+ 40152,
+ 40153,
+ 40156,
+ 40157,
+ 40159,
+ 40162,
+ 38780,
+ 38789,
+ 38801,
+ 38802,
+ 38804,
+ 38831,
+ 38827,
+ 38819,
+ 38834,
+ 38836,
+ 39601,
+ 39600,
+ 39607,
+ 40536,
+ 39606,
+ 39610,
+ 39612,
+ 39617,
+ 39616,
+ 39621,
+ 39618,
+ 39627,
+ 39628,
+ 39633,
+ 39749,
+ 39747,
+ 39751,
+ 39753,
+ 39752,
+ 39757,
+ 39761,
+ 39144,
+ 39181,
+ 39214,
+ 39253,
+ 39252,
+ 39647,
+ 39649,
+ 39654,
+ 39663,
+ 39659,
+ 39675,
+ 39661,
+ 39673,
+ 39688,
+ 39695,
+ 39699,
+ 39711,
+ 39715,
+ 40637,
+ 40638,
+ 32315,
+ 40578,
+ 40583,
+ 40584,
+ 40587,
+ 40594,
+ 37846,
+ 40605,
+ 40607,
+ 40667,
+ 40668,
+ 40669,
+ 40672,
+ 40671,
+ 40674,
+ 40681,
+ 40679,
+ 40677,
+ 40682,
+ 40687,
+ 40738,
+ 40748,
+ 40751,
+ 40761,
+ 40759,
+ 40765,
+ 40766,
+ 40772,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 40163,
+ 40164,
+ 40165,
+ 40166,
+ 40167,
+ 40168,
+ 40169,
+ 40170,
+ 40171,
+ 40172,
+ 40173,
+ 40174,
+ 40175,
+ 40176,
+ 40177,
+ 40178,
+ 40179,
+ 40180,
+ 40181,
+ 40182,
+ 40183,
+ 40184,
+ 40185,
+ 40186,
+ 40187,
+ 40188,
+ 40189,
+ 40190,
+ 40191,
+ 40192,
+ 40193,
+ 40194,
+ 40195,
+ 40196,
+ 40197,
+ 40198,
+ 40199,
+ 40200,
+ 40201,
+ 40202,
+ 40203,
+ 40204,
+ 40205,
+ 40206,
+ 40207,
+ 40208,
+ 40209,
+ 40210,
+ 40211,
+ 40212,
+ 40213,
+ 40214,
+ 40215,
+ 40216,
+ 40217,
+ 40218,
+ 40219,
+ 40220,
+ 40221,
+ 40222,
+ 40223,
+ 40224,
+ 40225,
+ 0,
+ 40226,
+ 40227,
+ 40228,
+ 40229,
+ 40230,
+ 40231,
+ 40232,
+ 40233,
+ 40234,
+ 40235,
+ 40236,
+ 40237,
+ 40238,
+ 40239,
+ 40240,
+ 40241,
+ 40242,
+ 40243,
+ 40244,
+ 40245,
+ 40246,
+ 40247,
+ 40248,
+ 40249,
+ 40250,
+ 40251,
+ 40252,
+ 40253,
+ 40254,
+ 40255,
+ 40256,
+ 40257,
+ 40258,
+ 57908,
+ 57909,
+ 57910,
+ 57911,
+ 57912,
+ 57913,
+ 57914,
+ 57915,
+ 57916,
+ 57917,
+ 57918,
+ 57919,
+ 57920,
+ 57921,
+ 57922,
+ 57923,
+ 57924,
+ 57925,
+ 57926,
+ 57927,
+ 57928,
+ 57929,
+ 57930,
+ 57931,
+ 57932,
+ 57933,
+ 57934,
+ 57935,
+ 57936,
+ 57937,
+ 57938,
+ 57939,
+ 57940,
+ 57941,
+ 57942,
+ 57943,
+ 57944,
+ 57945,
+ 57946,
+ 57947,
+ 57948,
+ 57949,
+ 57950,
+ 57951,
+ 57952,
+ 57953,
+ 57954,
+ 57955,
+ 57956,
+ 57957,
+ 57958,
+ 57959,
+ 57960,
+ 57961,
+ 57962,
+ 57963,
+ 57964,
+ 57965,
+ 57966,
+ 57967,
+ 57968,
+ 57969,
+ 57970,
+ 57971,
+ 57972,
+ 57973,
+ 57974,
+ 57975,
+ 57976,
+ 57977,
+ 57978,
+ 57979,
+ 57980,
+ 57981,
+ 57982,
+ 57983,
+ 57984,
+ 57985,
+ 57986,
+ 57987,
+ 57988,
+ 57989,
+ 57990,
+ 57991,
+ 57992,
+ 57993,
+ 57994,
+ 57995,
+ 57996,
+ 57997,
+ 57998,
+ 57999,
+ 58000,
+ 58001,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 40259,
+ 40260,
+ 40261,
+ 40262,
+ 40263,
+ 40264,
+ 40265,
+ 40266,
+ 40267,
+ 40268,
+ 40269,
+ 40270,
+ 40271,
+ 40272,
+ 40273,
+ 40274,
+ 40275,
+ 40276,
+ 40277,
+ 40278,
+ 40279,
+ 40280,
+ 40281,
+ 40282,
+ 40283,
+ 40284,
+ 40285,
+ 40286,
+ 40287,
+ 40288,
+ 40289,
+ 40290,
+ 40291,
+ 40292,
+ 40293,
+ 40294,
+ 40295,
+ 40296,
+ 40297,
+ 40298,
+ 40299,
+ 40300,
+ 40301,
+ 40302,
+ 40303,
+ 40304,
+ 40305,
+ 40306,
+ 40307,
+ 40308,
+ 40309,
+ 40310,
+ 40311,
+ 40312,
+ 40313,
+ 40314,
+ 40315,
+ 40316,
+ 40317,
+ 40318,
+ 40319,
+ 40320,
+ 40321,
+ 0,
+ 40322,
+ 40323,
+ 40324,
+ 40325,
+ 40326,
+ 40327,
+ 40328,
+ 40329,
+ 40330,
+ 40331,
+ 40332,
+ 40333,
+ 40334,
+ 40335,
+ 40336,
+ 40337,
+ 40338,
+ 40339,
+ 40340,
+ 40341,
+ 40342,
+ 40343,
+ 40344,
+ 40345,
+ 40346,
+ 40347,
+ 40348,
+ 40349,
+ 40350,
+ 40351,
+ 40352,
+ 40353,
+ 40354,
+ 58002,
+ 58003,
+ 58004,
+ 58005,
+ 58006,
+ 58007,
+ 58008,
+ 58009,
+ 58010,
+ 58011,
+ 58012,
+ 58013,
+ 58014,
+ 58015,
+ 58016,
+ 58017,
+ 58018,
+ 58019,
+ 58020,
+ 58021,
+ 58022,
+ 58023,
+ 58024,
+ 58025,
+ 58026,
+ 58027,
+ 58028,
+ 58029,
+ 58030,
+ 58031,
+ 58032,
+ 58033,
+ 58034,
+ 58035,
+ 58036,
+ 58037,
+ 58038,
+ 58039,
+ 58040,
+ 58041,
+ 58042,
+ 58043,
+ 58044,
+ 58045,
+ 58046,
+ 58047,
+ 58048,
+ 58049,
+ 58050,
+ 58051,
+ 58052,
+ 58053,
+ 58054,
+ 58055,
+ 58056,
+ 58057,
+ 58058,
+ 58059,
+ 58060,
+ 58061,
+ 58062,
+ 58063,
+ 58064,
+ 58065,
+ 58066,
+ 58067,
+ 58068,
+ 58069,
+ 58070,
+ 58071,
+ 58072,
+ 58073,
+ 58074,
+ 58075,
+ 58076,
+ 58077,
+ 58078,
+ 58079,
+ 58080,
+ 58081,
+ 58082,
+ 58083,
+ 58084,
+ 58085,
+ 58086,
+ 58087,
+ 58088,
+ 58089,
+ 58090,
+ 58091,
+ 58092,
+ 58093,
+ 58094,
+ 58095,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 40355,
+ 40356,
+ 40357,
+ 40358,
+ 40359,
+ 40360,
+ 40361,
+ 40362,
+ 40363,
+ 40364,
+ 40365,
+ 40366,
+ 40367,
+ 40368,
+ 40369,
+ 40370,
+ 40371,
+ 40372,
+ 40373,
+ 40374,
+ 40375,
+ 40376,
+ 40377,
+ 40378,
+ 40379,
+ 40380,
+ 40381,
+ 40382,
+ 40383,
+ 40384,
+ 40385,
+ 40386,
+ 40387,
+ 40388,
+ 40389,
+ 40390,
+ 40391,
+ 40392,
+ 40393,
+ 40394,
+ 40395,
+ 40396,
+ 40397,
+ 40398,
+ 40399,
+ 40400,
+ 40401,
+ 40402,
+ 40403,
+ 40404,
+ 40405,
+ 40406,
+ 40407,
+ 40408,
+ 40409,
+ 40410,
+ 40411,
+ 40412,
+ 40413,
+ 40414,
+ 40415,
+ 40416,
+ 40417,
+ 0,
+ 40418,
+ 40419,
+ 40420,
+ 40421,
+ 40422,
+ 40423,
+ 40424,
+ 40425,
+ 40426,
+ 40427,
+ 40428,
+ 40429,
+ 40430,
+ 40431,
+ 40432,
+ 40433,
+ 40434,
+ 40435,
+ 40436,
+ 40437,
+ 40438,
+ 40439,
+ 40440,
+ 40441,
+ 40442,
+ 40443,
+ 40444,
+ 40445,
+ 40446,
+ 40447,
+ 40448,
+ 40449,
+ 40450,
+ 58096,
+ 58097,
+ 58098,
+ 58099,
+ 58100,
+ 58101,
+ 58102,
+ 58103,
+ 58104,
+ 58105,
+ 58106,
+ 58107,
+ 58108,
+ 58109,
+ 58110,
+ 58111,
+ 58112,
+ 58113,
+ 58114,
+ 58115,
+ 58116,
+ 58117,
+ 58118,
+ 58119,
+ 58120,
+ 58121,
+ 58122,
+ 58123,
+ 58124,
+ 58125,
+ 58126,
+ 58127,
+ 58128,
+ 58129,
+ 58130,
+ 58131,
+ 58132,
+ 58133,
+ 58134,
+ 58135,
+ 58136,
+ 58137,
+ 58138,
+ 58139,
+ 58140,
+ 58141,
+ 58142,
+ 58143,
+ 58144,
+ 58145,
+ 58146,
+ 58147,
+ 58148,
+ 58149,
+ 58150,
+ 58151,
+ 58152,
+ 58153,
+ 58154,
+ 58155,
+ 58156,
+ 58157,
+ 58158,
+ 58159,
+ 58160,
+ 58161,
+ 58162,
+ 58163,
+ 58164,
+ 58165,
+ 58166,
+ 58167,
+ 58168,
+ 58169,
+ 58170,
+ 58171,
+ 58172,
+ 58173,
+ 58174,
+ 58175,
+ 58176,
+ 58177,
+ 58178,
+ 58179,
+ 58180,
+ 58181,
+ 58182,
+ 58183,
+ 58184,
+ 58185,
+ 58186,
+ 58187,
+ 58188,
+ 58189,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 40451,
+ 40452,
+ 40453,
+ 40454,
+ 40455,
+ 40456,
+ 40457,
+ 40458,
+ 40459,
+ 40460,
+ 40461,
+ 40462,
+ 40463,
+ 40464,
+ 40465,
+ 40466,
+ 40467,
+ 40468,
+ 40469,
+ 40470,
+ 40471,
+ 40472,
+ 40473,
+ 40474,
+ 40475,
+ 40476,
+ 40477,
+ 40478,
+ 40484,
+ 40487,
+ 40494,
+ 40496,
+ 40500,
+ 40507,
+ 40508,
+ 40512,
+ 40525,
+ 40528,
+ 40530,
+ 40531,
+ 40532,
+ 40534,
+ 40537,
+ 40541,
+ 40543,
+ 40544,
+ 40545,
+ 40546,
+ 40549,
+ 40558,
+ 40559,
+ 40562,
+ 40564,
+ 40565,
+ 40566,
+ 40567,
+ 40568,
+ 40569,
+ 40570,
+ 40571,
+ 40572,
+ 40573,
+ 40576,
+ 0,
+ 40577,
+ 40579,
+ 40580,
+ 40581,
+ 40582,
+ 40585,
+ 40586,
+ 40588,
+ 40589,
+ 40590,
+ 40591,
+ 40592,
+ 40593,
+ 40596,
+ 40597,
+ 40598,
+ 40599,
+ 40600,
+ 40601,
+ 40602,
+ 40603,
+ 40604,
+ 40606,
+ 40608,
+ 40609,
+ 40610,
+ 40611,
+ 40612,
+ 40613,
+ 40615,
+ 40616,
+ 40617,
+ 40618,
+ 58190,
+ 58191,
+ 58192,
+ 58193,
+ 58194,
+ 58195,
+ 58196,
+ 58197,
+ 58198,
+ 58199,
+ 58200,
+ 58201,
+ 58202,
+ 58203,
+ 58204,
+ 58205,
+ 58206,
+ 58207,
+ 58208,
+ 58209,
+ 58210,
+ 58211,
+ 58212,
+ 58213,
+ 58214,
+ 58215,
+ 58216,
+ 58217,
+ 58218,
+ 58219,
+ 58220,
+ 58221,
+ 58222,
+ 58223,
+ 58224,
+ 58225,
+ 58226,
+ 58227,
+ 58228,
+ 58229,
+ 58230,
+ 58231,
+ 58232,
+ 58233,
+ 58234,
+ 58235,
+ 58236,
+ 58237,
+ 58238,
+ 58239,
+ 58240,
+ 58241,
+ 58242,
+ 58243,
+ 58244,
+ 58245,
+ 58246,
+ 58247,
+ 58248,
+ 58249,
+ 58250,
+ 58251,
+ 58252,
+ 58253,
+ 58254,
+ 58255,
+ 58256,
+ 58257,
+ 58258,
+ 58259,
+ 58260,
+ 58261,
+ 58262,
+ 58263,
+ 58264,
+ 58265,
+ 58266,
+ 58267,
+ 58268,
+ 58269,
+ 58270,
+ 58271,
+ 58272,
+ 58273,
+ 58274,
+ 58275,
+ 58276,
+ 58277,
+ 58278,
+ 58279,
+ 58280,
+ 58281,
+ 58282,
+ 58283,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 40619,
+ 40620,
+ 40621,
+ 40622,
+ 40623,
+ 40624,
+ 40625,
+ 40626,
+ 40627,
+ 40629,
+ 40630,
+ 40631,
+ 40633,
+ 40634,
+ 40636,
+ 40639,
+ 40640,
+ 40641,
+ 40642,
+ 40643,
+ 40645,
+ 40646,
+ 40647,
+ 40648,
+ 40650,
+ 40651,
+ 40652,
+ 40656,
+ 40658,
+ 40659,
+ 40661,
+ 40662,
+ 40663,
+ 40665,
+ 40666,
+ 40670,
+ 40673,
+ 40675,
+ 40676,
+ 40678,
+ 40680,
+ 40683,
+ 40684,
+ 40685,
+ 40686,
+ 40688,
+ 40689,
+ 40690,
+ 40691,
+ 40692,
+ 40693,
+ 40694,
+ 40695,
+ 40696,
+ 40698,
+ 40701,
+ 40703,
+ 40704,
+ 40705,
+ 40706,
+ 40707,
+ 40708,
+ 40709,
+ 0,
+ 40710,
+ 40711,
+ 40712,
+ 40713,
+ 40714,
+ 40716,
+ 40719,
+ 40721,
+ 40722,
+ 40724,
+ 40725,
+ 40726,
+ 40728,
+ 40730,
+ 40731,
+ 40732,
+ 40733,
+ 40734,
+ 40735,
+ 40737,
+ 40739,
+ 40740,
+ 40741,
+ 40742,
+ 40743,
+ 40744,
+ 40745,
+ 40746,
+ 40747,
+ 40749,
+ 40750,
+ 40752,
+ 40753,
+ 58284,
+ 58285,
+ 58286,
+ 58287,
+ 58288,
+ 58289,
+ 58290,
+ 58291,
+ 58292,
+ 58293,
+ 58294,
+ 58295,
+ 58296,
+ 58297,
+ 58298,
+ 58299,
+ 58300,
+ 58301,
+ 58302,
+ 58303,
+ 58304,
+ 58305,
+ 58306,
+ 58307,
+ 58308,
+ 58309,
+ 58310,
+ 58311,
+ 58312,
+ 58313,
+ 58314,
+ 58315,
+ 58316,
+ 58317,
+ 58318,
+ 58319,
+ 58320,
+ 58321,
+ 58322,
+ 58323,
+ 58324,
+ 58325,
+ 58326,
+ 58327,
+ 58328,
+ 58329,
+ 58330,
+ 58331,
+ 58332,
+ 58333,
+ 58334,
+ 58335,
+ 58336,
+ 58337,
+ 58338,
+ 58339,
+ 58340,
+ 58341,
+ 58342,
+ 58343,
+ 58344,
+ 58345,
+ 58346,
+ 58347,
+ 58348,
+ 58349,
+ 58350,
+ 58351,
+ 58352,
+ 58353,
+ 58354,
+ 58355,
+ 58356,
+ 58357,
+ 58358,
+ 58359,
+ 58360,
+ 58361,
+ 58362,
+ 58363,
+ 58364,
+ 58365,
+ 58366,
+ 58367,
+ 58368,
+ 58369,
+ 58370,
+ 58371,
+ 58372,
+ 58373,
+ 58374,
+ 58375,
+ 58376,
+ 58377,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 40754,
+ 40755,
+ 40756,
+ 40757,
+ 40758,
+ 40760,
+ 40762,
+ 40764,
+ 40767,
+ 40768,
+ 40769,
+ 40770,
+ 40771,
+ 40773,
+ 40774,
+ 40775,
+ 40776,
+ 40777,
+ 40778,
+ 40779,
+ 40780,
+ 40781,
+ 40782,
+ 40783,
+ 40786,
+ 40787,
+ 40788,
+ 40789,
+ 40790,
+ 40791,
+ 40792,
+ 40793,
+ 40794,
+ 40795,
+ 40796,
+ 40797,
+ 40798,
+ 40799,
+ 40800,
+ 40801,
+ 40802,
+ 40803,
+ 40804,
+ 40805,
+ 40806,
+ 40807,
+ 40808,
+ 40809,
+ 40810,
+ 40811,
+ 40812,
+ 40813,
+ 40814,
+ 40815,
+ 40816,
+ 40817,
+ 40818,
+ 40819,
+ 40820,
+ 40821,
+ 40822,
+ 40823,
+ 40824,
+ 0,
+ 40825,
+ 40826,
+ 40827,
+ 40828,
+ 40829,
+ 40830,
+ 40833,
+ 40834,
+ 40845,
+ 40846,
+ 40847,
+ 40848,
+ 40849,
+ 40850,
+ 40851,
+ 40852,
+ 40853,
+ 40854,
+ 40855,
+ 40856,
+ 40860,
+ 40861,
+ 40862,
+ 40865,
+ 40866,
+ 40867,
+ 40868,
+ 40869,
+ 63788,
+ 63865,
+ 63893,
+ 63975,
+ 63985,
+ 58378,
+ 58379,
+ 58380,
+ 58381,
+ 58382,
+ 58383,
+ 58384,
+ 58385,
+ 58386,
+ 58387,
+ 58388,
+ 58389,
+ 58390,
+ 58391,
+ 58392,
+ 58393,
+ 58394,
+ 58395,
+ 58396,
+ 58397,
+ 58398,
+ 58399,
+ 58400,
+ 58401,
+ 58402,
+ 58403,
+ 58404,
+ 58405,
+ 58406,
+ 58407,
+ 58408,
+ 58409,
+ 58410,
+ 58411,
+ 58412,
+ 58413,
+ 58414,
+ 58415,
+ 58416,
+ 58417,
+ 58418,
+ 58419,
+ 58420,
+ 58421,
+ 58422,
+ 58423,
+ 58424,
+ 58425,
+ 58426,
+ 58427,
+ 58428,
+ 58429,
+ 58430,
+ 58431,
+ 58432,
+ 58433,
+ 58434,
+ 58435,
+ 58436,
+ 58437,
+ 58438,
+ 58439,
+ 58440,
+ 58441,
+ 58442,
+ 58443,
+ 58444,
+ 58445,
+ 58446,
+ 58447,
+ 58448,
+ 58449,
+ 58450,
+ 58451,
+ 58452,
+ 58453,
+ 58454,
+ 58455,
+ 58456,
+ 58457,
+ 58458,
+ 58459,
+ 58460,
+ 58461,
+ 58462,
+ 58463,
+ 58464,
+ 58465,
+ 58466,
+ 58467,
+ 58468,
+ 58469,
+ 58470,
+ 58471,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 64012,
+ 64013,
+ 64014,
+ 64015,
+ 64017,
+ 64019,
+ 64020,
+ 64024,
+ 64031,
+ 64032,
+ 64033,
+ 64035,
+ 64036,
+ 64039,
+ 64040,
+ 64041,
+ 11905,
+ 59414,
+ 59415,
+ 59416,
+ 11908,
+ 13427,
+ 13383,
+ 11912,
+ 11915,
+ 59422,
+ 13726,
+ 13850,
+ 13838,
+ 11916,
+ 11927,
+ 14702,
+ 14616,
+ 59430,
+ 14799,
+ 14815,
+ 14963,
+ 14800,
+ 59435,
+ 59436,
+ 15182,
+ 15470,
+ 15584,
+ 11943,
+ 59441,
+ 59442,
+ 11946,
+ 16470,
+ 16735,
+ 11950,
+ 17207,
+ 11955,
+ 11958,
+ 11959,
+ 59451,
+ 17329,
+ 17324,
+ 11963,
+ 17373,
+ 17622,
+ 18017,
+ 17996,
+ 59459,
+ 0,
+ 18211,
+ 18217,
+ 18300,
+ 18317,
+ 11978,
+ 18759,
+ 18810,
+ 18813,
+ 18818,
+ 18819,
+ 18821,
+ 18822,
+ 18847,
+ 18843,
+ 18871,
+ 18870,
+ 59476,
+ 59477,
+ 19619,
+ 19615,
+ 19616,
+ 19617,
+ 19575,
+ 19618,
+ 19731,
+ 19732,
+ 19733,
+ 19734,
+ 19735,
+ 19736,
+ 19737,
+ 19886
+};
+
+
+char g_zte_traffic_DigAscMap[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+};
+
+const unsigned short zte_traffic_GSMDefault_To_UCS2_Table_Ex[][2] = {
+ { 0x0A, 0x000C }, /* FORM FEED */
+ { 0x14, 0x005E }, /* CIRCUMFLEX ACCENT */
+ { 0x28, 0x007B }, /* LEFT CURLY BRACKET */
+ { 0x29, 0x007D }, /* RIGHT CURLY BRACKET */
+ { 0x2F, 0x005C }, /* REVERSE SOLIDUS */
+ { 0x3C, 0x005B }, /* LEFT SQUARE BRACKET */
+ { 0x3D, 0x007E }, /* TILDE */
+ { 0x3E, 0x005D }, /* RIGHT SQUARE BRACKET */
+ { 0x40, 0x007C }, /* VERTICAL LINE */
+ { 0x65, 0x20AC }, /* EURO SIGN */
+};
+
+
+const unsigned short zte_traffic_GSMDefault_To_UCS2_Table[] = {
+ /* 0x00 */ 0x0040, /* COMMERCIAL AT */
+ /* 0x01 */ 0x00A3, /* POUND SIGN */
+ /* 0x02 */ 0x0024, /* DOLLAR SIGN */
+ /* 0x03 */ 0x00A5, /* YEN SIGN */
+ /* 0x04 */ 0x00E8, /* LATIN SMALL LETTER E WITH GRAVE */
+ /* 0x05 */ 0x00E9, /* LATIN SMALL LETTER E WITH ACUTE */
+ /* 0x06 */ 0x00F9, /* LATIN SMALL LETTER U WITH GRAVE */
+ /* 0x07 */ 0x00EC, /* LATIN SMALL LETTER I WITH GRAVE */
+ /* 0x08 */ 0x00F2, /* LATIN SMALL LETTER O WITH GRAVE */
+ /* 0x09 */ 0x00C7, /* LATIN SMALL LETTER C WITH CEDILLA */
+ /* 0x0A */ 0x000A, /* LINE FEED */
+ /* 0x0B */ 0x00D8, /* LATIN CAPITAL LETTER O WITH STROKE */
+ /* 0x0C */ 0x00F8, /* LATIN SMALL LETTER O WITH STROKE */
+ /* 0x0D */ 0x000D, /* CARRIAGE RETURN */
+ /* 0x0E */ 0x00C5, /* LATIN CAPITAL LETTER A WITH RING ABOVE */
+ /* 0x0F */ 0x00E5, /* LATIN SMALL LETTER A WITH RING ABOVE */
+ /* 0x10 */ 0x0394, /* GREEK CAPITAL LETTER DELTA */
+ /* 0x11 */ 0x005F, /* LOW LINE */
+ /* 0x12 */ 0x03A6, /* GREEK CAPITAL LETTER PHI */
+ /* 0x13 */ 0x0393, /* GREEK CAPITAL LETTER GAMMA */
+ /* 0x14 */ 0x039B, /* GREEK CAPITAL LETTER LAMDA */
+ /* 0x15 */ 0x03A9, /* GREEK CAPITAL LETTER OMEGA */
+ /* 0x16 */ 0x03A0, /* GREEK CAPITAL LETTER PI */
+ /* 0x17 */ 0x03A8, /* GREEK CAPITAL LETTER PSI */
+ /* 0x18 */ 0x03A3, /* GREEK CAPITAL LETTER SIGMA */
+ /* 0x19 */ 0x0398, /* GREEK CAPITAL LETTER THETA */
+ /* 0x1A */ 0x039E, /* GREEK CAPITAL LETTER XI */
+ /* 0x1B */ 0x00A0, /* ESCAPE TO EXTENSION TABLE */
+ /* 0x1C */ 0x00C6, /* LATIN CAPITAL LETTER AE */
+ /* 0x1D */ 0x00E6, /* LATIN SMALL LETTER AE */
+ /* 0x1E */ 0x00DF, /* LATIN SMALL LETTER SHARP S (German) */
+ /* 0x1F */ 0x00C9, /* LATIN CAPITAL LETTER E WITH ACUTE */
+ /* 0x20 */ 0x0020, /* SPACE */
+ /* 0x21 */ 0x0021, /* EXCLAMATION MARK */
+ /* 0x22 */ 0x0022, /* QUOTATION MARK */
+ /* 0x23 */ 0x0023, /* NUMBER SIGN */
+ /* 0x24 */ 0x00A4, /* CURRENCY SIGN */
+ /* 0x25 */ 0x0025, /* PERCENT SIGN */
+ /* 0x26 */ 0x0026, /* AMPERSAND */
+ /* 0x27 */ 0x0027, /* APOSTROPHE */
+ /* 0x28 */ 0x0028, /* LEFT PARENTHESIS */
+ /* 0x29 */ 0x0029, /* RIGHT PARENTHESIS */
+ /* 0x2A */ 0x002A, /* ASTERISK */
+ /* 0x2B */ 0x002B, /* PLUS SIGN */
+ /* 0x2C */ 0x002C, /* COMMA */
+ /* 0x2D */ 0x002D, /* HYPHEN-MINUS */
+ /* 0x2E */ 0x002E, /* FULL STOP */
+ /* 0x2F */ 0x002F, /* SOLIDUS */
+ /* 0x30 */ 0x0030, /* DIGIT ZERO */
+ /* 0x31 */ 0x0031, /* DIGIT ONE */
+ /* 0x32 */ 0x0032, /* DIGIT TWO */
+ /* 0x33 */ 0x0033, /* DIGIT THREE */
+ /* 0x34 */ 0x0034, /* DIGIT FOUR */
+ /* 0x35 */ 0x0035, /* DIGIT FIVE */
+ /* 0x36 */ 0x0036, /* DIGIT SIX */
+ /* 0x37 */ 0x0037, /* DIGIT SEVEN */
+ /* 0x38 */ 0x0038, /* DIGIT EIGHT */
+ /* 0x39 */ 0x0039, /* DIGIT NINE */
+ /* 0x3A */ 0x003A, /* COLON */
+ /* 0x3B */ 0x003B, /* SEMICOLON */
+ /* 0x3C */ 0x003C, /* LESS-THAN SIGN */
+ /* 0x3D */ 0x003D, /* EQUALS SIGN */
+ /* 0x3E */ 0x003E, /* GREATER-THAN SIGN */
+ /* 0x3F */ 0x003F, /* QUESTION MARK */
+ /* 0x40 */ 0x00A1, /* INVERTED EXCLAMATION MARK */
+ /* 0x41 */ 0x0041, /* LATIN CAPITAL LETTER A */
+ /* 0x42 */ 0x0042, /* LATIN CAPITAL LETTER B */
+ /* 0x43 */ 0x0043, /* LATIN CAPITAL LETTER C */
+ /* 0x44 */ 0x0044, /* LATIN CAPITAL LETTER D */
+ /* 0x45 */ 0x0045, /* LATIN CAPITAL LETTER E */
+ /* 0x46 */ 0x0046, /* LATIN CAPITAL LETTER F */
+ /* 0x47 */ 0x0047, /* LATIN CAPITAL LETTER G */
+ /* 0x48 */ 0x0048, /* LATIN CAPITAL LETTER H */
+ /* 0x49 */ 0x0049, /* LATIN CAPITAL LETTER I */
+ /* 0x4A */ 0x004A, /* LATIN CAPITAL LETTER J */
+ /* 0x4B */ 0x004B, /* LATIN CAPITAL LETTER K */
+ /* 0x4C */ 0x004C, /* LATIN CAPITAL LETTER L */
+ /* 0x4D */ 0x004D, /* LATIN CAPITAL LETTER M */
+ /* 0x4E */ 0x004E, /* LATIN CAPITAL LETTER N */
+ /* 0x4F */ 0x004F, /* LATIN CAPITAL LETTER O */
+ /* 0x50 */ 0x0050, /* LATIN CAPITAL LETTER P */
+ /* 0x51 */ 0x0051, /* LATIN CAPITAL LETTER Q */
+ /* 0x52 */ 0x0052, /* LATIN CAPITAL LETTER R */
+ /* 0x53 */ 0x0053, /* LATIN CAPITAL LETTER S */
+ /* 0x54 */ 0x0054, /* LATIN CAPITAL LETTER T */
+ /* 0x55 */ 0x0055, /* LATIN CAPITAL LETTER U */
+ /* 0x56 */ 0x0056, /* LATIN CAPITAL LETTER V */
+ /* 0x57 */ 0x0057, /* LATIN CAPITAL LETTER W */
+ /* 0x58 */ 0x0058, /* LATIN CAPITAL LETTER X */
+ /* 0x59 */ 0x0059, /* LATIN CAPITAL LETTER Y */
+ /* 0x5A */ 0x005A, /* LATIN CAPITAL LETTER Z */
+ /* 0x5B */ 0x00C4, /* LATIN CAPITAL LETTER A WITH DIAERESIS */
+ /* 0x5C */ 0x00D6, /* LATIN CAPITAL LETTER O WITH DIAERESIS */
+ /* 0x5D */ 0x00D1, /* LATIN CAPITAL LETTER N WITH TILDE */
+ /* 0x5E */ 0x00DC, /* LATIN CAPITAL LETTER U WITH DIAERESIS */
+ /* 0x5F */ 0x00A7, /* SECTION SIGN */
+ /* 0x60 */ 0x00BF, /* INVERTED QUESTION MARK */
+ /* 0x61 */ 0x0061, /* LATIN SMALL LETTER A */
+ /* 0x62 */ 0x0062, /* LATIN SMALL LETTER B */
+ /* 0x63 */ 0x0063, /* LATIN SMALL LETTER C */
+ /* 0x64 */ 0x0064, /* LATIN SMALL LETTER D */
+ /* 0x65 */ 0x0065, /* LATIN SMALL LETTER E */
+ /* 0x66 */ 0x0066, /* LATIN SMALL LETTER F */
+ /* 0x67 */ 0x0067, /* LATIN SMALL LETTER G */
+ /* 0x68 */ 0x0068, /* LATIN SMALL LETTER H */
+ /* 0x69 */ 0x0069, /* LATIN SMALL LETTER I */
+ /* 0x6A */ 0x006A, /* LATIN SMALL LETTER J */
+ /* 0x6B */ 0x006B, /* LATIN SMALL LETTER K */
+ /* 0x6C */ 0x006C, /* LATIN SMALL LETTER L */
+ /* 0x6D */ 0x006D, /* LATIN SMALL LETTER M */
+ /* 0x6E */ 0x006E, /* LATIN SMALL LETTER N */
+ /* 0x6F */ 0x006F, /* LATIN SMALL LETTER O */
+ /* 0x70 */ 0x0070, /* LATIN SMALL LETTER P */
+ /* 0x71 */ 0x0071, /* LATIN SMALL LETTER Q */
+ /* 0x72 */ 0x0072, /* LATIN SMALL LETTER R */
+ /* 0x73 */ 0x0073, /* LATIN SMALL LETTER S */
+ /* 0x74 */ 0x0074, /* LATIN SMALL LETTER T */
+ /* 0x75 */ 0x0075, /* LATIN SMALL LETTER U */
+ /* 0x76 */ 0x0076, /* LATIN SMALL LETTER V */
+ /* 0x77 */ 0x0077, /* LATIN SMALL LETTER W */
+ /* 0x78 */ 0x0078, /* LATIN SMALL LETTER X */
+ /* 0x79 */ 0x0079, /* LATIN SMALL LETTER Y */
+ /* 0x7A */ 0x007A, /* LATIN SMALL LETTER Z */
+ /* 0x7B */ 0x00E4, /* LATIN SMALL LETTER A WITH DIAERESIS */
+ /* 0x7C */ 0x00F6, /* LATIN SMALL LETTER O WITH DIAERESIS */
+ /* 0x7D */ 0x00F1, /* LATIN SMALL LETTER N WITH TILDE */
+ /* 0x7E */ 0x00FC, /* LATIN SMALL LETTER U WITH DIAERESIS */
+ /* 0x7F */ 0x00E0 /* LATIN SMALL LETTER A WITH GRAVE */
+};
+
+
+// Convert Unicode big endian to Unicode little endian
+unsigned Ucs2BeToUcs2Le(unsigned short *ucs2bige, unsigned int size)
+{
+ if (!ucs2bige) {
+ return 0;
+ }
+
+ unsigned int length = size;
+ unsigned short *tmp = ucs2bige;
+
+ while (*tmp && length) {
+
+ length--;
+ unsigned char val_high = *tmp >> 8;
+ unsigned char val_low = (unsigned char) * tmp;
+
+ *tmp = val_low << 8 | val_high;
+
+ tmp++;
+ }
+
+ return size - length;
+}
+
+
+
+// Convert Ucs-2 to Utf-8
+unsigned int Ucs2ToUtf8(unsigned short *ucs2, unsigned int ucs2_size,
+ unsigned char *utf8, unsigned int utf8_size)
+{
+ unsigned int length = 0;
+
+ if (!ucs2) {
+ return 0;
+ }
+
+ unsigned short *inbuf = ucs2;
+ unsigned char *outbuf = utf8;
+
+ if (*inbuf == 0xFFFE) {
+ Ucs2BeToUcs2Le(inbuf, ucs2_size);
+ }
+
+ if (!utf8) {
+ unsigned int insize = ucs2_size;
+
+ while (*inbuf && insize) {
+ insize--;
+
+ if (0x0080 > *inbuf) {
+ length++;
+ } else if (0x0800 > *inbuf) {
+ length += 2;
+ } else {
+ length += 3;
+ }
+
+ inbuf++;
+ }
+
+ return length;
+ } else {
+ unsigned int insize = ucs2_size;
+
+ while (*inbuf && insize && length < utf8_size) {
+ insize--;
+
+ if (*inbuf == 0xFFFE) {
+ inbuf++;
+ continue;
+ }
+
+ if (0x0080 > *inbuf) {
+ /* 1 byte UTF-8 Character.*/
+ *outbuf++ = (unsigned char)(*inbuf);
+ length++;
+ } else if (0x0800 > *inbuf) {
+ /*2 bytes UTF-8 Character.*/
+ *outbuf++ = 0xc0 | ((unsigned char)(*inbuf >> 6));
+ *outbuf++ = 0x80 | ((unsigned char)(*inbuf & 0x3F));
+ length += 2;
+ } else {
+ /* 3 bytes UTF-8 Character .*/
+ *outbuf++ = 0xE0 | ((unsigned char)(*inbuf >> 12));
+ *outbuf++ = 0x80 | ((unsigned char)((*inbuf >> 6) & 0x3F));
+ *outbuf++ = 0x80 | ((unsigned char)(*inbuf & 0x3F));
+ length += 3;
+ }
+
+ inbuf++;
+ }
+
+ return length;
+ }
+}
+
+
+// Convert Utf-8 to Ucs-2
+unsigned int Utf8ToUcs2(unsigned char *utf8, unsigned int utf8_size,
+ unsigned short *ucs2, unsigned int ucs2_size)
+{
+ int length = 0;
+ unsigned int insize = utf8_size;
+ unsigned char *inbuf = utf8;
+
+ if (!utf8)
+ return 0;
+
+ if (!ucs2) {
+ while (*inbuf && insize) {
+ unsigned char c = *inbuf;
+ if ((c & 0x80) == 0) {
+ length += 1;
+ insize -= 1;
+ inbuf++;
+ } else if ((c & 0xE0) == 0xC0) {
+ length += 1;
+ insize -= 2;
+ inbuf += 2;
+ } else if ((c & 0xF0) == 0xE0) {
+ length += 1;
+ insize -= 3;
+ inbuf += 3;
+ }
+ }
+
+ return length;
+ } else {
+ unsigned short *outbuf = ucs2;
+ unsigned int outsize = ucs2_size;
+
+ while (*inbuf && insize && length < outsize) {
+ unsigned char c = *inbuf;
+ if ((c & 0x80) == 0) {
+ *outbuf++ = c;
+ inbuf++;
+ length++;
+ insize--;
+ } else if ((c & 0xE0) == 0xC0) {
+ unsigned short val;
+
+ val = (c & 0x3F) << 6;
+ inbuf++;
+ c = *inbuf;
+ val |= (c & 0x3F);
+ inbuf++;
+
+ length++;
+ insize -= 2;
+
+ *outbuf++ = val;
+ } else if ((c & 0xF0) == 0xE0) {
+ unsigned short val;
+
+ val = (c & 0x1F) << 12;
+ inbuf++;
+ c = *inbuf;
+ val |= (c & 0x3F) << 6;
+ inbuf++;
+ c = *inbuf;
+ val |= (c & 0x3F);
+ inbuf++;
+
+ insize -= 3;
+ length++;
+
+ *outbuf++ = val;
+ }
+ }
+
+ return length;
+ }
+
+ return 0;
+}
+
+#if 0 // cov M , has no user
+int unicode_to_utf8(unsigned short *unicode_buf, unsigned char *utf8_buf, int max_utf8_buf_size, int endian)
+{
+ unsigned short *uni_ptr = unicode_buf;
+ unsigned char *utf_ptr = utf8_buf;
+ unsigned short word;
+ unsigned char ch;
+ unsigned int uni_ind = 0, utf_ind = 0, utf_num = 0;
+
+ while (1) {
+ word = *(uni_ptr + uni_ind);
+ uni_ind++;
+
+ if (word == 0x0000) //½áÊø·û
+ break;
+
+ if (endian == 1) { //´ó¶Ë
+ //¸ßµÍλ½»»»
+ ch = (unsigned char)word;
+ word = word >> 8;
+ word += ch << 8;
+ }
+
+ if (word < 0x80) {
+ *(utf_ptr + utf_ind) = word & 0x7F | 0x00;
+ utf_ind++;
+
+ utf_num++;
+ } else if (word < 0x0800) {
+ *(utf_ptr + utf_ind) = (word >> 6) & 0x1F | 0xC0;
+ utf_ind++;
+ *(utf_ptr + utf_ind) = word & 0x3F | 0x80;
+ utf_ind++;
+
+ utf_num++;
+ } else if (word < 0x010000) {
+ *(utf_ptr + utf_ind) = (word >> 12) & 0x0F | 0xE0;
+ utf_ind++;
+ *(utf_ptr + utf_ind) = (word >> 6) & 0x3F | 0x80;
+ utf_ind++;
+ *(utf_ptr + utf_ind) = word & 0x3F | 0x80;
+ utf_ind++;
+
+ utf_num++;
+ } else if (word < 0x110000) {
+ *(utf_ptr + utf_ind) = (word >> 18) & 0x07 | 0xF0;
+ utf_ind++;
+ *(utf_ptr + utf_ind) = (word >> 12) & 0x3F | 0x80;
+ utf_ind++;
+ *(utf_ptr + utf_ind) = (word >> 6) & 0x3F | 0x80;
+ utf_ind++;
+ *(utf_ptr + utf_ind) = word & 0x3F | 0x80;
+ utf_ind++;
+
+ utf_num++;
+ }
+
+ if (utf_num > max_utf8_buf_size - 1) {
+ break;
+ }
+ }
+
+ return utf_num;
+}
+
+#endif
+
+
+/*
+int gbk_to_unicode(unsigned char *gbk_buf, unsigned short *unicode_buf, int max_unicode_buf_size, int endian)
+{
+ unsigned short word;
+ unsigned char *gbk_ptr = gbk_buf;
+ unsigned short *uni_ptr = unicode_buf;
+ unsigned int uni_ind = 0, gbk_ind = 0, uni_num = 0;
+ unsigned char ch;
+ int word_pos;
+
+ if (!gbk_buf || !unicode_buf)
+ return -1;
+
+ while (1) {
+ ch = *(gbk_ptr + gbk_ind);
+
+ if (ch == 0x00)
+ break;
+
+ if (ch > 0x80) {
+ //chinese
+ //word = *p *256 + *(p+1);
+
+ if (endian == 1) { //´ó¶Ë
+ word = *(gbk_ptr + gbk_ind);
+ word <<= 8;
+ gbk_ind++;
+ word += *(gbk_ptr + gbk_ind);
+ gbk_ind++;
+ } else {
+ word = *(gbk_ptr + gbk_ind + 1);
+ word <<= 8;
+ word += *(gbk_ptr + gbk_ind);
+ gbk_ind += 2;
+ }
+
+ //printf("word: 0x%x\n", word);
+
+ word_pos = word - g_gbk_first_code;
+ if (word >= g_gbk_first_code && word <= g_gbk_last_code && (word_pos < g_gbk_to_unicode_buf_size)) {
+ //*p_out = g_gbk_to_unicode_buf[word_pos];
+ //*p_out ++;
+ //n++;
+
+ *(uni_ptr + uni_ind) = g_gbk_to_unicode_buf[word_pos];
+ uni_ind++;
+
+ uni_num++;
+ }
+ } else {
+ //for ASCII
+ //*p_out = (unsigned short)*p;
+ //*p_out ++;
+ //n++;
+
+ gbk_ind++;
+
+ //*(uni_ptr + uni_ind) = g_gbk_to_unicode_buf[word_pos];
+ *(uni_ptr + uni_ind) = ch;
+ uni_ind++;
+
+ uni_num++;
+ }
+
+ if (uni_num > max_unicode_buf_size - 1)
+ break;
+ }
+
+ return uni_num;
+}
+*/
+
+char Char2Num(char ch)
+{
+ if (ch >= '0' && ch <= '9') return (char)(ch - '0');
+ if (ch >= 'a' && ch <= 'f') return (char)(ch - 'a' + 10);
+ if (ch >= 'A' && ch <= 'F') return (char)(ch - 'A' + 10);
+ return '0';
+}
+
+int URLEncode(const char* str, const int strSize, char* result, const int resultSize)
+{
+ int i;
+ int j = 0; /* for result index */
+ char ch;
+
+ if ((str == NULL) || (result == NULL) || (strSize <= 0) || (resultSize <= 0)) {
+ return 0;
+ }
+
+ for (i = 0; (i < strSize) && (j < resultSize); i++) {
+ ch = str[i];
+ if ((ch >= 'A') && (ch <= 'Z')) {
+ result[j++] = ch;
+ } else if ((ch >= 'a') && (ch <= 'z')) {
+ result[j++] = ch;
+ } else if ((ch >= '0') && (ch <= '9')) {
+ result[j++] = ch;
+ } else if (ch == ' ') {
+ result[j++] = '+';
+ } else {
+ if (j + 3 < resultSize) {
+ sprintf(result + j, "%%%02X", (unsigned char)ch);
+ j += 3;
+ //printf("[traffic] URLEncode result = %s \n", result);
+ } else {
+ return 0;
+ }
+ }
+ }
+
+ result[j] = '\0';
+ return j;
+}
+
+
+unsigned char zte_traffic_Low2High(unsigned char x)
+{
+ if (x >= 'a' && x < 'g') {
+ x = (x - 'a') + 'A';
+ }
+
+ return x;
+}
+
+unsigned char zte_traffic_Char2Dec(unsigned char x)
+{
+ unsigned char d = 0;
+
+ if (x >= 'A' && x < 'G') {
+ d = (x - 'A') + 10;
+ } else {
+ d = x - '0';
+ }
+
+ return d;
+}
+
+unsigned char zte_traffic_Char2Byte(unsigned char a, unsigned char b)
+{
+ unsigned char data = 0;
+ unsigned char l = 0, h = 0;
+
+ a = zte_traffic_Low2High(a);
+ b = zte_traffic_Low2High(b);
+ h = zte_traffic_Char2Dec(a);
+ l = zte_traffic_Char2Dec(b);
+
+ data = h * 16 + l;
+
+ return data;
+}
+
+void zte_traffic_Str2Bytes(unsigned char *text, int text_len, unsigned char *data, int data_len)
+{
+ int i = 0;
+
+ while (2 * i + 1 < text_len) {
+ data[i] = zte_traffic_Char2Byte(text[2 * i], text[2 * i + 1]);
+ i ++;
+ }
+}
+
+unsigned long zte_traffic_convert_GSMDefault_to_UCS2
+(
+ const unsigned char *gsmdef,
+ unsigned char *ucs2,
+ unsigned long len
+)
+{
+ unsigned long i = 0;
+ unsigned long j = 0;
+ unsigned long k = 0;
+ unsigned long p = 0;
+ unsigned long s = 0;
+ unsigned long is_find = 0;
+
+ s = sizeof(zte_traffic_GSMDefault_To_UCS2_Table_Ex) / sizeof(zte_traffic_GSMDefault_To_UCS2_Table_Ex[0]);
+ for (i = 0; i < len; i++) {
+ j = gsmdef[i];
+ if (j == 0x1b) {
+ i++;
+ for (p = 0; p < s; p++) {
+ if (zte_traffic_GSMDefault_To_UCS2_Table_Ex[p][0] == gsmdef[i]) {
+ ucs2[k] = zte_traffic_GSMDefault_To_UCS2_Table_Ex[p][1] >> 8;
+ k++;
+ ucs2[k] = (unsigned char)(zte_traffic_GSMDefault_To_UCS2_Table_Ex[p][1]);
+ is_find = 1;
+ break;
+ }
+ }
+ if (!is_find) {
+ printf("zte_traffic: data = %d not find in gsmdefault extension table\n", gsmdef[i]);
+ }
+ } else {
+ ucs2[k] = zte_traffic_GSMDefault_To_UCS2_Table[j] >> 8;
+ k++;
+ ucs2[k] = (unsigned char)(zte_traffic_GSMDefault_To_UCS2_Table[j]);
+ }
+ k++;
+ }
+ ucs2[k] = '\0';
+
+ return k;
+}
+
+
+/* °Ñin_ptrµÄÊý¾ÝÒ»¸ö²ðÁ½¸ö£¬·Ö³É16½øÖÆ£¬´æÈëout_ptr*/
+int zte_traffic_DispatchWtoi(unsigned char *in_ptr, int iLength, unsigned char *out_ptr)
+{
+ int low = 0;
+ int high = 0;
+
+ if (in_ptr == NULL || out_ptr == NULL) {
+ return ZUFI_FAIL;
+ }
+
+ while (iLength > 0) {
+ low = in_ptr[iLength - 1] & 0xf;
+ high = (in_ptr[iLength - 1] & 0xf0) >> 4;
+ out_ptr[2 * iLength - 1] = g_zte_traffic_DigAscMap[low];
+ out_ptr[2 * iLength - 2] = g_zte_traffic_DigAscMap[high];
+ iLength --;
+ }
+ return ZUFI_SUCC;
+}
+
+int zte_traffic_ConvertUcs2(char *data, UINT16 sms_len, char *out_content)
+{
+ char ascii_content [200] = {0};
+ UINT16 len = 0;
+
+ len = zte_traffic_convert_GSMDefault_to_UCS2(
+ (const UINT8*)data,
+ (UINT8*)ascii_content, sms_len);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_ConvertUcs2 len = %d \n", len);
+ (void)zte_traffic_DispatchWtoi((unsigned char*)ascii_content, len, (unsigned char*)out_content);
+ return len;
+}
+
+
+int zte_traffic_string_convert_to_unicode_bytes(const char* pSrc, unsigned short* pDst, int nSrcLength)
+{
+ int i = 0;
+
+ //УÑé²ÎÊý
+ if (pSrc == NULL || pDst == NULL || nSrcLength < 0) {
+ return -1;
+ }
+
+ for (i = 0; i < nSrcLength; i += 4) {
+ // Êä³ö×î¸ß4λ
+ if (*pSrc >= '0' && *pSrc <= '9') {
+ *pDst = (*pSrc - '0') << 12;
+ } else {
+ *pDst = ((toupper(*pSrc) - 'A') + 10) << 12;
+ }
+
+ pSrc++;
+
+
+ if (*pSrc >= '0' && *pSrc <= '9') {
+ *pDst |= (*pSrc - '0') << 8;
+ } else {
+ *pDst |= ((toupper(*pSrc) - 'A') + 10) << 8;
+ }
+
+ pSrc++;
+
+ if (*pSrc >= '0' && *pSrc <= '9') {
+ *pDst |= (*pSrc - '0') << 4;
+ } else {
+ *pDst |= ((toupper(*pSrc) - 'A') + 10) << 4;
+ }
+
+ pSrc++;
+
+ // Êä³öµÍ4λ
+ if (*pSrc >= '0' && *pSrc <= '9') {
+ *pDst |= *pSrc - '0';
+ } else {
+ *pDst |= (toupper(*pSrc) - 'A') + 10;
+ }
+
+ pSrc++;
+ pDst++;
+ }
+
+ // ·µ»ØÄ¿±êÊý¾Ý³¤¶È
+ return nSrcLength / 4;
+}
+
+
+void zte_traffic_convert_unicode_to_utf8(char *strUnicode, int str_len, char *dstUtf8, int dst_len)
+{
+ unsigned short buf_unicode[1000] = {0};
+ char utf8_buf[1024] = {0};
+ int unicode_len = 0;
+
+ //char utf8_buf[1200] = "e5b08ae695ace79a84e58aa8e6849fe59cb0e5b8a6e5aea2e688b7efbc8ce682a8e5a5bdefbc81e682a8e69cace69c88e5a597e9a490e680bbe6b581e9878f3230302e30304defbc8ce688aae6ada2e5bd93e5898de5b7b2e4bdbfe794a8352e39344defbc8ce585b6e4b8ade4b88de58c85e590abe789b9e5ae9ae4bc98e683a0e6b581e9878fe7bb9fe8aea1e38082e69fa5e8afa2e6b581e9878fe8bf9be5baa6e6988ee7bb86e8afb7e59b9ee5a48d313133efbc9be5a682e99c80e69bb4e5a49ae6b581e9878fe58fafe5bc80e9809ae58fa0e58aa0e58c85efbc8ce59b9ee5a48d33333035e5bc80e9809a35e58583e58c8533304d42efbc8ce59b9ee5a48d33333130e5bc80e9809a3130e58583e58c8537304d42efbc8ce59b9ee5a48d33333230e5bc80e9809a3230e58583e58c853135304d42efbc8ce7ab8be58db3e7949fe69588efbc8ce69c88e5ba95e887aae58aa8e585b3e997ade38082e4b8ade59bbde7a7bbe58aa8";
+ if (strUnicode == NULL || dstUtf8 == NULL) return;
+
+ unicode_len = zte_traffic_string_convert_to_unicode_bytes((unsigned char *)strUnicode, buf_unicode, str_len);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_second_get_request_data....len = %d \n", unicode_len);
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_second_get_request_data....buf[0] = %x, buf[1] = %x,buf[2] = %x,buf[3] = %x, \n", buf_unicode[0], buf_unicode[1], buf_unicode[unicode_len - 2], buf_unicode[unicode_len - 1]);
+
+ Ucs2ToUtf8(buf_unicode, unicode_len, utf8_buf, sizeof(utf8_buf));
+ URLEncode(utf8_buf, strlen(utf8_buf), dstUtf8, dst_len);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_second_get_request_data....dstUtf8 = %s \n", dstUtf8);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_traffic_second_get_request_data....dstUtf8 len = %d \n", strlen(dstUtf8));
+}
+
+
+unsigned int zte_traffic_parse_str_by_separator(unsigned char* input,
+ unsigned char* output, int destLen, unsigned char separator)
+{
+ int i, j, k;
+ int srcLen = 0;
+ i = j = k = 0;
+
+ if (NULL == input || NULL == output || destLen == 0 || strlen(input) == 0) {
+ return 0;
+ }
+
+ srcLen = strlen(input) + 1;//which contains the '\0'
+
+ for (i = 0; i < srcLen; i++) {
+ if ('\0' == input[i]) {
+ if (k <= (destLen - 1)) {
+ *(output + destLen * j + k) = '\0';
+ } else {
+ *(output + destLen * j + (destLen - 1)) = '\0';
+ }
+
+ return j + 1;
+ }
+
+ if (separator == input[i]) {
+ if (k <= (destLen - 1)) {
+ *(output + destLen * j + k) = '\0';
+ } else {
+ *(output + destLen * j + (destLen - 1)) = '\0';
+ }
+
+ if ('\0' != input[i + 1]) {
+ k = 0;
+ j++;
+ }
+ } else {
+ if (k < (destLen - 1)) {
+ *(output + destLen * j + k) = input[i];
+ k++;
+ }
+ }
+ }
+
+ return j;
+}
+
+/*
+void zte_traffic_convert_gsm_to_utf8(char *gsm_buf, char *dst_Utf8, int dst_size)
+{
+ char unicode_buf[50] = {0};
+ int len = 0;
+ if (gsm_buf == NULL || dst_Utf8 == NULL) {
+ return;
+ }
+
+ len = zte_traffic_ConvertUcs2(gsm_buf, strlen(gsm_buf), unicode_buf);
+ zte_traffic_convert_unicode_to_utf8(unicode_buf, strlen(unicode_buf), dst_Utf8, dst_size);
+}
+*/
+
diff --git a/ap/app/goahead/interface5.0/wifi/Makefile b/ap/app/goahead/interface5.0/wifi/Makefile
new file mode 100755
index 0000000..1898061
--- /dev/null
+++ b/ap/app/goahead/interface5.0/wifi/Makefile
@@ -0,0 +1,68 @@
+# /*****************************************************************************
+#* °æÈ¨ËùÓÐ (C)2015, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+#*
+#* ÎļþÃû³Æ: Makefile
+#* Îļþ±êʶ: Makefile
+#* ÄÚÈÝÕªÒª: Makefile of ZTE applications
+#* ʹÓ÷½·¨: void
+#*
+#* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
+#* -----------------------------------------------------------------------------
+#* 2015/11/26 V1.0 Create ÇñÏèÓî ´´½¨
+#*
+# ******************************************************************************/
+
+#*******************************************************************************
+# include ZTE application makefile
+#*******************************************************************************
+#ifeq ($(LINUX_TYPE),uClinux)
+include $(zte_app_mak)
+#endif
+
+#*******************************************************************************
+# execute
+#*******************************************************************************
+#EXEC = libwebuiwifi.a
+
+#*******************************************************************************
+# objects
+#*******************************************************************************
+OBJS = zte_web_lan.o zte_web_mgmt_wifi.o zte_web_wlan_station.o zte_web_lan_utils.o
+
+SRC = zte_web_lan.c zte_web_mgmt_wifi.c zte_web_wlan_station.c zte_web_lan_utils.c
+
+#*******************************************************************************
+# include path
+#*******************************************************************************
+
+CFLAGS += -DCONFIG_CHINA_UNICOM -DWEBS -DUEMF -DOS="LINUX" -DLINUX \
+ -I. \
+ -I$(zte_lib_path)/libnvram \
+ -I$(zte_lib_path)/libezxml \
+ -I$(zte_lib_path)/libmxml \
+ -I../../../include \
+ -I../../../wlan \
+ -I$(zte_lib_path)/libsqlite \
+ -I$(zte_lib_path)/libsoft_timer \
+ -I../../../at_server \
+ -I../../server \
+ -I.. \
+ -I../net \
+
+ifeq ($(CONFIG_USE_WEBUI_SECURITY),yes)
+CFLAGS += -DWEBS_SECURITY
+endif
+#*******************************************************************************
+# targets
+#*******************************************************************************
+
+#$(error ===================================>)
+
+all: $(OBJS)
+ @echo "--------------------wifi build-----------------------"
+#$(RANLIB) $@
+%.o: %.c
+ $(CC) $(CFLAGS) $(INCLUDES) -c $< -Wl,--start-group $(LDLIBS) -Wl,--end-group
+
+clean:
+ -rm -f *.elf *.gdb *.o *.a
diff --git a/ap/app/goahead/interface5.0/wifi/zte_web_lan.c b/ap/app/goahead/interface5.0/wifi/zte_web_lan.c
new file mode 100755
index 0000000..f0dd1c3
--- /dev/null
+++ b/ap/app/goahead/interface5.0/wifi/zte_web_lan.c
@@ -0,0 +1,2112 @@
+
+/************************************************************************
+* °æÈ¨ËùÓÐ (C)2010, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º zte_web_lan.c
+* Îļþ±êʶ£º
+* ÄÚÈÝÕªÒª£º
+* ÆäËü˵Ã÷£º
+* µ±Ç°°æ±¾£º V0.1
+* ×÷ Õߣº zyt
+* Íê³ÉÈÕÆÚ£º 2010-11-06
+*
+* Ð޸ļǼ1£º
+* ÐÞ¸ÄÄÚÈÝ£º³õʼ°æ±¾
+************************************************************************/
+
+/**************************************************************************
+* Ð޸ıàºÅ : й¦ÄÜ
+* ÐÞ ¸Ä ÈË : chenjie10092374
+* ÐÞ¸ÄÈÕÆÚ : 2014.6.24
+* ÐÞ¸ÄÄÚÈÝ : Ìí¼ÓÖ§³Öufi monitor¹¦ÄÜ´¦Àí´úÂë
+**************************************************************************/
+#include <ctype.h>
+
+#include "zte_web_interface.h"
+#include "./net/zte_web_net_other.h"
+#include "netotherapi.h"
+
+#define WDS_DISABLE "0"
+#define WDS_ROOTAP "1"
+#define WDS_CLIENT "2"
+#define WDS_REPEATER "3"
+#define WIFI_MAX_STA_NUM 32 //kw 3
+
+
+#define NV_WRITE(nv_name, str, ret) do{ ret = zte_web_write(nv_name, (char *)str);}while(0)
+
+static int zte_wlan_ssid1_basic_set(webs_t wp, unsigned int *wifi_set_flags);
+static int zte_lan_ssid1_security_set(webs_t wp, unsigned int *wifi_set_flags);
+static int zte_wlan_ssid2_basic_set(webs_t wp, unsigned int *wifi_set_flags);
+static int zte_lan_ssid2_security_set(webs_t wp, unsigned int *wifi_set_flags);
+
+static int get_random(unsigned char* buf, size_t len);
+
+
+enum {WIFI_COVERAGE_LEN = 16};
+/**
+ * @brief wifi share mode setting's struct
+ * @param wep_key_index
+ * @param wep_key1_mode
+ * @param wep_key2_mode
+ * @param wep_key3_mode
+ * @param wep_key4_mode
+ * @param wep_key1
+ * @param wep_key2
+ * @param wep_key3
+ * @param wep_key4
+ * @note
+ * @warning
+ */
+typedef struct {
+ uint8 wep_key_index[WF_WPS_KEY_INDEX_LEN];
+ uint8 wep_key1_mode[WF_KEY_MODE_LEN];
+ uint8 wep_key2_mode[WF_KEY_MODE_LEN];
+ uint8 wep_key3_mode[WF_KEY_MODE_LEN];
+ uint8 wep_key4_mode[WF_KEY_MODE_LEN];
+ uint8 wep_key1[WF_WEP_KEY_MAX_LEN];
+ uint8 wep_key2[WF_WEP_KEY_MAX_LEN];
+ uint8 wep_key3[WF_WEP_KEY_MAX_LEN];
+ uint8 wep_key4[WF_WEP_KEY_MAX_LEN];
+} zte_wifi_open_and_share_mode_s_type;
+/*wifi WPA/WPA2 mode setting*/
+typedef struct {
+ uint8 pre_share_key[WF_WPA_KEY_MAX_LEN];
+} zte_wifi_wpa_and_wpa2_mode_s_type;
+
+static char * str2upper(const char * in, char * out)
+{
+ char *p1 = in;
+ char *p2 = out;
+ if (in == NULL || out == NULL) return NULL;
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s] in=%s\n", __FILE__, in);
+
+ while (*p1 != '\0') {
+ //if (isalpha(*p1)) {//cov m
+ if ((*p1) >= 'a' && (*p1) <= 'z') {
+ *p2 = toupper(*p1);
+ } else {
+ *p2 = *p1;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s] UPPER = %c[%d], Lower=%c[%d]\n", __FILE__, *p2, *p2, *p1, *p1);
+ p1++;
+ p2++;
+ }
+
+ *p2 = '\0';
+ return out;
+
+}
+
+static int validate_pin_code(unsigned long code)
+{
+ unsigned long accum = 0;
+ accum += 3 * ((code / 10000000) % 10);
+ accum += 1 * ((code / 1000000) % 10);
+ accum += 3 * ((code / 100000) % 10);
+ accum += 1 * ((code / 10000) % 10);
+ accum += 3 * ((code / 1000) % 10);
+ accum += 1 * ((code / 100) % 10);
+ accum += 3 * ((code / 10) % 10);
+ accum += 1 * ((code / 1) % 10);
+ return (0 == (accum % 10));
+}
+static int zte_Safe_valid_SpecialCharForSSID(char single_data)
+{
+ /*if(single_data == '&') return 0;
+ else if(single_data == '.') return 0;
+ else if(single_data == '`') return 0;
+ else if(single_data == '\\') return 0;
+ else*/
+ return 1;
+}
+
+
+static data_safe_result_type_t zte_Safe_noSpecialCharForSSID(char *str)
+{
+#if 0 //kw 3
+ int i = 0;
+ int len = 0;
+ if (NULL == str) {
+ return 0;
+ }
+
+ len = strlen(str);
+ for (i = 0; i < len; i++) {
+ if (zte_Safe_valid_SpecialCharForSSID(str[i]) != 0) {
+ continue;
+ } else {
+ return 0;
+ }
+ }
+#endif
+ return 1;
+}
+
+void wlan_set_change_ssid_key_status()
+{
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MMI, MSG_CMD_MODIFY_SSID_KEY, 0, NULL, 0);
+}
+
+
+void wifi_work_mode_set_basic()
+{
+ char m_ssid_enable[20] = {0};
+ char system_restore_flg[32] = {0};
+ char MAX_Access_num[16] = {0};
+ char m_MAX_Access_num[16] = {0};
+ char MAX_Station_num[16] = {0};
+
+ char num_buf[12] = {0};
+ char m_num_buf[12] = {0};
+ int max_sta_num = 0;
+ int max_num = 0;
+ int m_max_num = 0;
+ char max_access_bak[16] = {0};
+ char max_station_bak[16] = {0};
+ sc_cfg_get("MAX_Access_num_bbak", max_access_bak, sizeof(max_access_bak));
+ sc_cfg_get("MAX_Station_num_bak", max_station_bak, sizeof(max_station_bak));
+ slog(MISC_PRINT, SLOG_ERR,"MAX_Access_num_bbak:%s,MAX_Station_num_bak:%s\n",max_access_bak,max_station_bak);
+ if(strlen(max_station_bak) != 0 && strcmp(max_station_bak, "0")){
+ sc_cfg_set("MAX_Station_num",max_station_bak);
+ sc_cfg_set("MAX_Station_num_bak","0");
+ }
+ if(strlen(max_access_bak) != 0 && strcmp(max_access_bak, "0")){
+ sc_cfg_set("MAX_Access_num", max_access_bak);
+ }
+
+ //wifi workmode set
+ sc_cfg_get("m_ssid_enable", m_ssid_enable, sizeof(m_ssid_enable));
+ sc_cfg_get("system_restore_flg", system_restore_flg, sizeof(system_restore_flg));
+
+ if (!strcmp(m_ssid_enable, "1")) {
+ sc_cfg_set("AP_STARTMODE", "multi");
+ if (!strcmp(system_restore_flg, "first_restore")) {
+ sc_cfg_set("system_restore_flg", "not_first_restore");
+ slog(MISC_PRINT, SLOG_DEBUG,"is first config access num.....\n");
+
+ sc_cfg_get("MAX_Access_num", MAX_Access_num, sizeof(MAX_Access_num));
+ max_num = atoi(MAX_Access_num);
+ if (max_num > 1 && max_num < 33) {
+ sprintf(num_buf, "%d", max_num / 2);
+ slog(MISC_PRINT, SLOG_DEBUG,"num_buf = %s\n", num_buf);
+ zte_web_write("MAX_Access_num", num_buf);
+ zte_web_write("m_MAX_Access_num", num_buf);
+ }
+ }
+
+ sc_cfg_get("MAX_Station_num", MAX_Station_num, sizeof(MAX_Station_num));
+ sc_cfg_get("MAX_Access_num", MAX_Access_num, sizeof(MAX_Access_num));
+ sc_cfg_get("m_MAX_Access_num", m_MAX_Access_num, sizeof(m_MAX_Access_num));
+
+ zte_web_write("MAX_Access_num_bak", MAX_Access_num);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s],MAX_Access_num_bak=%s\n", __FILE__, MAX_Access_num);
+
+ max_sta_num = atoi(MAX_Station_num);
+ max_num = atoi(MAX_Access_num);
+ m_max_num = atoi(m_MAX_Access_num);
+ if ((max_sta_num < 0 || max_sta_num > WIFI_MAX_STA_NUM) ||
+ (max_num < 0 || max_num > WIFI_MAX_STA_NUM)) { //kw 3
+ slog(MISC_PRINT, SLOG_ERR,"\n error max_sta_num parameter\n");
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s],MAX_Station_num=%s,MAX_Access_num=%s,m_MAX_Access_num=%s\n", __FILE__, MAX_Station_num, MAX_Access_num, m_MAX_Access_num);
+ if (max_num == max_sta_num) {
+ sprintf(m_num_buf, "%d", max_sta_num / 2);
+ zte_web_write("MAX_Access_num", m_num_buf);
+ zte_web_write("m_MAX_Access_num", m_num_buf);
+ } else {
+ if (max_num < max_sta_num) { // ʵ¼ÊÉÏ£¬³ýÁ˵ÈÓÚ×î´óÖµ£¬¾ÍÊÇСÓÚ×î´óÖµ£¬´Ë´¦ÅжÏÎÞÒâÒå
+ m_max_num = max_sta_num - max_num;
+ sprintf(m_num_buf, "%d", m_max_num);
+ zte_web_write("m_MAX_Access_num", m_num_buf);
+ }
+
+ }
+
+ } else if (!strcmp(m_ssid_enable, "0")) {
+ sc_cfg_set("AP_STARTMODE", "standard");
+ sc_cfg_get("MAX_Access_num_bak", MAX_Access_num, sizeof(MAX_Access_num));
+ zte_web_write("MAX_Access_num", MAX_Access_num);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"\n error wifi_work_mode_set parameter\n");
+ return;
+ }
+}
+
+void zte_lan_stop_apsta()
+{
+ zte_web_write("wifi_sta_connection", "0");
+ //zte_web_write("blc_switch", "00");
+ zte_web_write("user_initiate_disconnect", "0"); //Óû§Ö÷¶¯Á¬½Ó״̬£¬Í˳ö¸ÉԤģʽ
+ zte_web_write("manual_d_wifi", "0");
+
+ slog(MISC_PRINT, SLOG_NORMAL,"[zte_lan_stop_apsta]MSG_CMD_WIFI_STATION_CLOSE_OPEN_MSSID\n", 0, NULL);
+
+ //zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_CLOSE_OPEN_MSSID, 0, NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_CLOSE_OPEN_MSSID, 0, NULL, 0);
+}
+
+void zte_wlan_basic_set(webs_t wp)
+{
+ char_t *wifi_on = NULL, *old_wifi_on = NULL;
+ char_t *radio_off = NULL;
+ char_t *wirelessmode = NULL, *old_wirelessmode = NULL;
+ char_t *countrycode = NULL, *old_countrycode = NULL;
+ //char_t *ssid = NULL, *old_ssid = NULL;
+ char_t *broadcastssid = NULL, *old_broadcastssid = NULL ;
+ char_t *channel = NULL, *old_channel = NULL;
+ //char_t *abg_rate = NULL,*old_abg_rate = NULL;
+ //char_t *NoForwarding = NULL,*old_NoForwarding = NULL;
+ char_t *MAX_Access_num = NULL, *old_MAX_Access_num = NULL;
+ char_t *m_ssid_enable = NULL, *old_m_ssid_enable = NULL;
+ //char_t *m_SSID = NULL,*old_m_SSID = NULL;
+ //char_t *m_HideSSID = NULL,*old_m_HideSSID = NULL;
+ //char_t *m_NoForwarding = NULL,*old_m_NoForwarding =NULL;
+ char_t *wifi_11n_cap = NULL, *old_wifi_11n_cap = NULL;
+ //char_t *channel_JP = NULL, *old_channel_JP = NULL;
+ char_t *wifi_band = NULL, *old_wifi_band = NULL;
+
+ //int Access_num = 0;
+ unsigned int wifi_set_flags = 0;
+ char wifi_set_flags_str[NV_ITEM_STRING_LEN_20] = {0};
+ char wifi_sta_connection[8] = {0};
+
+ zte_topsw_state_e_type nv_ret = ZTE_NVIO_DONE;
+ char nv_basic[NVIO_WIFI_MAX_LEN] = {0}; // for nv read and write
+//cov m
+#define NV_READ(nv_name, str, ret) do{ret = zte_web_read(nv_name, nv_basic); str = nv_basic;}while(0)
+ /*lint -e717*/
+ //#define NV_WRITE(nv_name, str, ret) do{ ret = zte_web_write(nv_name, (char *)str);}while(0)
+
+ slog(WIFI_PRINT, SLOG_ERR, "zte_wlan_basic_set enter \n");
+
+ //reset wifi_set_flags
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, "");
+
+ //wifiEnabled or not
+ memset(nv_basic, 0, sizeof(nv_basic));
+ wifi_on = websGetVar(wp, T("wifiEnabled"), NULL);
+ if (wifi_on != NULL) {
+ if (STR_EQUAL(wifi_on, "0")) {
+ slog(MISC_PRINT, SLOG_ERR, T("UFIx User disable WIFI swtich!\n"));
+ } else if (STR_EQUAL(wifi_on, "1")) {
+ slog(MISC_PRINT, SLOG_ERR, T("UFIx User enable WIFI swtich!\n"));
+ }
+ NV_READ("wifiEnabled", old_wifi_on, nv_ret);
+ printf("[%s:%s]old_wifi_on=%s, nv_ret=%d\n", __FILE__, __FUNCTION__, old_wifi_on, nv_ret);
+ //NV_READ("RadioOff", radio_off, nv_ret);
+ //printf("[%s:%s]radio_off=%s, nv_ret=%d",__FILE__, __FUNCTION__, radio_off,nv_ret);
+ if (!STR_EQUAL(wifi_on, old_wifi_on)) { //kw 3
+ //send_to_mc = TRUE;
+ wifi_set_flags |= ZTE_WLAN_ON_OFF_SET;
+ NV_WRITE("wifiEnabled", wifi_on, nv_ret);
+
+#if 0
+ if (STR_EQUAL(wifi_on, "0") && STR_EQUAL(radio_off, "1")) {
+ NV_WRITE("wifiEnabled", wifi_on, nv_ret);
+ NV_WRITE("RadioOff", wifi_on, nv_ret);
+ NV_WRITE("RadioOn", wifi_on, nv_ret);
+
+ } else if (STR_EQUAL(wifi_on, "1")) {
+ NV_WRITE("wifiEnabled", wifi_on, nv_ret);
+ NV_WRITE("RadioOn", wifi_on, nv_ret);
+ }
+#endif
+ }
+ printf("[%s:%s]wifi_on:[%s]\n", __FILE__, __FUNCTION__, wifi_on);
+ }
+
+ //wifiMode
+ memset(nv_basic, 0, sizeof(nv_basic));
+ wirelessmode = websGetVar(wp, T("wifiMode"), NULL);
+ if (wirelessmode != NULL) {
+ slog(MISC_PRINT, SLOG_ERR, T("UFIx User set WIFI advanced settings!\n"));
+ printf("[%s:%s]wirelessmode:%s\n", __FILE__, __FUNCTION__, wirelessmode); /*lint !e26*/
+ NV_READ("WirelessMode", old_wirelessmode, nv_ret);
+ printf("[%s:%s]old_wirelessmode=%s, nv_ret=%d\n", __FILE__, __FUNCTION__, old_wirelessmode, nv_ret); /*lint !e26*/
+ if (!STR_EQUAL(wirelessmode, old_wirelessmode)) { //kw 3
+ wifi_set_flags |= ZTE_WLAN_WIRELESS_MODE_SET;
+ NV_WRITE("WirelessMode", wirelessmode, nv_ret);
+ printf("[%s:%s]wirelessmode is :%s\n", __FILE__, __FUNCTION__, wirelessmode); /*lint !e26*/
+ }
+ }
+
+ /* country code*/
+ memset(nv_basic, 0, sizeof(nv_basic));
+ countrycode = websGetVar(wp, T("countryCode"), NULL);
+ if (countrycode != NULL) {
+#ifdef WEBS_SECURITY
+ zte_web_read("wifi_sta_connection", wifi_sta_connection);
+ if(wifi_sta_connection[0] == '1')
+ {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+#endif
+ NV_READ("CountryCode", old_countrycode, nv_ret);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]old_countrycode=%s, nv_ret=%d\n", __FILE__, __FUNCTION__, old_countrycode, nv_ret); /*lint !e26*/
+ if (!STR_EQUAL(countrycode, old_countrycode)) { //kw 3
+ wifi_set_flags |= ZTE_WLAN_COUNTRY_SET;
+ NV_WRITE("CountryCode", countrycode, nv_ret);
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]countrycode:%s\n", __FILE__, __FUNCTION__, countrycode); /*lint !e26*/
+ }
+
+#if 0 //²»ÊôÓڸ߼¶É䯵²ÎÊý
+ //broadcastSsidEnabled
+ memset(nv_basic, 0, sizeof(nv_basic));
+ broadcastssid = websGetVar(wp, T("broadcastSsidEnabled"), NULL);
+ if (broadcastssid != NULL) {
+ NV_READ("HideSSID", old_broadcastssid, nv_ret);
+ printf("[%s:%s]old_broadcastssid=%s, nv_ret=%d\n", __FILE__, __FUNCTION__, old_broadcastssid, nv_ret); /*lint !e26*/
+ if ((nv_ret == ZTE_NVIO_DONE &&
+ !STR_EQUAL(broadcastssid, old_broadcastssid)) ||
+ (nv_ret != ZTE_NVIO_DONE)) {
+ //send_to_mc = TRUE;
+ wifi_set_flags |= ZTE_WLAN_BROADCAST_SET;
+ NV_WRITE("HideSSID", broadcastssid, nv_ret);
+ }
+ printf("[%s:%s]broadcastssid:%s\n", __FILE__, __FUNCTION__, broadcastssid); /*lint !e26*/
+ }
+#endif
+ //selectedChannel
+ memset(nv_basic, 0, sizeof(nv_basic));
+ channel = websGetVar(wp, T("selectedChannel"), NULL);
+ if (channel != NULL) {
+ NV_READ("Channel", old_channel, nv_ret);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]old_channel=%s, nv_ret=%d\n", __FILE__, __FUNCTION__, old_channel, nv_ret); /*lint !e26*/
+ if (!STR_EQUAL(channel, old_channel)) { //kw 3
+ //send_to_mc = TRUE;
+ wifi_set_flags |= ZTE_WLAN_CHANNEL_SET;
+ NV_WRITE("Channel", channel, nv_ret);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]channel:%s\n", __FILE__, __FUNCTION__, channel); /*lint !e26*/
+ }
+
+ //band setting
+ memset(nv_basic, 0, sizeof(nv_basic));
+ wifi_band = websGetVar(wp, T("wifi_band"), NULL);
+ if (wifi_band != NULL) {
+ NV_READ("wifi_band", old_wifi_band, nv_ret);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]old_wifi_band=%s, nv_ret=%d\n", __FILE__, __FUNCTION__, old_wifi_band, nv_ret); /*lint !e26*/
+ if (!STR_EQUAL(wifi_band, old_wifi_band)) { //kw 3
+ wifi_set_flags |= ZTE_WLAN_WIFI_BAND_SET;
+ NV_WRITE("wifi_band", wifi_band, nv_ret);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]wifi_band:%s\n", __FILE__, __FUNCTION__, wifi_band); /*lint !e26*/
+ }
+
+
+ //set wifi rate
+#if 0
+ memset(nv_basic, 0, sizeof(nv_basic));
+ abg_rate = websGetVar(wp, T("abg_rate"), NULL);
+ if (abg_rate != NULL) {
+ NV_READ("HT_MCS", old_abg_rate, nv_ret);
+ printf("old_abg_rate=%s, nv_ret=%d", old_abg_rate, nv_ret); /*lint !e26*/
+ if ((nv_ret == ZTE_NVIO_DONE &&
+ !STR_EQUAL(abg_rate, old_abg_rate)) ||
+ (nv_ret != ZTE_NVIO_DONE)) {
+ wifi_set_flags |= ZTE_WLAN_DATA_RATE_SET;
+ NV_WRITE("HT_MCS", abg_rate, nv_ret);
+ }
+
+ printf("abg_rate:%s", abg_rate); /*lint !e26*/
+ }
+#endif
+
+#if 0 // not belong to RF parameters
+ //set MAX_Access_num
+ memset(nv_basic, 0, sizeof(nv_basic));
+ MAX_Access_num = websGetVar(wp, T("MAX_Access_num"), NULL);
+ if (MAX_Access_num != NULL) {
+ NV_READ("MAX_Access_num", old_MAX_Access_num, nv_ret);
+ printf("[%s:%s]old_MAX_Access_num=%s, nv_ret=%d\n", __FILE__, __FUNCTION__, old_MAX_Access_num, nv_ret); /*lint !e26*/
+ if ((nv_ret == ZTE_NVIO_DONE &&
+ !STR_EQUAL(MAX_Access_num, old_MAX_Access_num)) ||
+ (nv_ret != ZTE_NVIO_DONE)) {
+ wifi_set_flags |= ZTE_WLAN_MAX_ACCESS_NUM_SET;
+ NV_WRITE("MAX_Access_num", MAX_Access_num, nv_ret);
+ NV_WRITE("MAX_Access_num_user_set", "1", nv_ret);
+ }
+
+ printf("[%s:%s]MAX_Access_num:%s\n", __FILE__, __FUNCTION__, MAX_Access_num); /*lint !e26*/
+ }
+#endif
+ //set m_ssid_enable
+ memset(nv_basic, 0, sizeof(nv_basic));
+ m_ssid_enable = websGetVar(wp, T("m_ssid_enable"), NULL);
+ if (m_ssid_enable != NULL) {
+#if 1
+ NV_READ("m_ssid_enable", old_m_ssid_enable, nv_ret);
+ slog(MISC_PRINT, SLOG_DEBUG,"old_m_ssid_enable=%s, nv_ret=%d\n", old_m_ssid_enable, nv_ret);/*lint !e26*/
+ if (!STR_EQUAL(m_ssid_enable, old_m_ssid_enable)) { //kw 3
+ wifi_set_flags |= ZTE_WLAN_SET_AP_MSSID;
+ NV_WRITE("m_ssid_enable", m_ssid_enable, nv_ret);
+ wlan_set_change_ssid_key_status();//added by dujiajiao
+ wifi_work_mode_set_basic();
+ }
+#else
+ if (!strcmp(m_ssid_enable, "1")) {
+ NV_WRITE("m_ssid_enable", "0", nv_ret);
+ }
+#endif
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]m_ssid_enable:%s\n", __FILE__, __FUNCTION__, m_ssid_enable); /*lint !e26*/
+ }
+
+ //set wifi_11n_cap
+ memset(nv_basic, 0, sizeof(nv_basic));
+ NV_READ("wifi_11n_cap", old_wifi_11n_cap, nv_ret);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]old_wifi_11n_cap=%s, nv_ret=%d\n", __FILE__, __FUNCTION__, old_wifi_11n_cap, nv_ret); /*lint !e26*/
+ wifi_11n_cap = websGetVar(wp, T("wifi_11n_cap"), NULL);
+ if (wifi_11n_cap != NULL) {
+ if (!STR_EQUAL(wifi_11n_cap, old_wifi_11n_cap)) { //kw 3
+ wifi_set_flags |= ZTE_WLAN_WIRELESS_MODE_SET;
+ NV_WRITE("wifi_11n_cap", wifi_11n_cap, nv_ret);
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]wifi_11n_cap:%s\n", __FILE__, __FUNCTION__, wifi_11n_cap); /*lint !e26*/
+ }
+
+ //last, write the wifi_set_flags
+ (void)snprintf(wifi_set_flags_str, sizeof(wifi_set_flags_str) - 1, "%u", wifi_set_flags);
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]wifi_set_flags:[0x%x] to [%s]\n", __FILE__, __FUNCTION__, wifi_set_flags, wifi_set_flags_str); /*lint !e26*/
+
+ if (0 != wifi_set_flags) {
+ unsigned int flags = 0;
+ UCHAR flag_str[8] = {0};
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]send wifi para to wlan-server@basic_set\n", __FILE__, __FUNCTION__); /*lint !e26*/
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]m_ssid_enable=%s,wifi_on=%s\n", __FILE__, __FUNCTION__, m_ssid_enable, wifi_on); /*lint !e26*/
+
+ if (NULL != wifi_on && (wifi_set_flags & ZTE_WLAN_ON_OFF_SET)) {
+//¿ªÆôwifiʱºò£¬Èç¹ûͬʱ¿ªÆôMSSID£¬»¹ÊÇÖ»ÉèÖÿªÆôwifi µÄflags£¬ÒòΪMSSIDµÄnvÒѾÉèÖùýÁË
+
+ if (0 == atoi(wifi_on))
+ flags = WIFI_ADVANCED_CLOSE;
+ else if (m_ssid_enable != NULL && 1 == atoi(m_ssid_enable)) { // ͬʱ¿ªÆômultisssid£¬ÒªÔ¤·Àapsta Ò»²¢¿ªÆôµÄÇé¿ö
+ flags = WIFI_ADVANCED_OPEN_VA01;
+ } else
+ flags = WIFI_ADVANCED_OPEN;
+
+ } else if (wifi_set_flags & ZTE_WLAN_SET_AP_MSSID) { // ÔÚwifi¿ª¹Ø¿ªÆôµÄ״̬Ï£¬¶Ô Multi SSID ½øÐпª¹ØÇл»
+ if (1 == atoi(m_ssid_enable))
+ flags = WIFI_ADVANCED_OPEN_VA1;
+ else
+ flags = WIFI_ADVANCED_CLOSE_MSSID;
+
+ } else { // ÉèÖø߼¶²ÎÊýÉ䯵
+ flags = WIFI_ADVANCED_RF;
+ }
+ snprintf(flag_str,sizeof(flag_str), "%d", flags);
+ zte_web_read("wifi_sta_connection", wifi_sta_connection);
+
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]m_ssid_enable=%s,wifi_on=%s\n", __FILE__, __FUNCTION__, m_ssid_enable, wifi_on); /*lint !e26*/
+
+//when open mssid , need close apsta at same time
+ if ((flags == WIFI_ADVANCED_OPEN_VA1) && atoi(wifi_sta_connection) == 1) {
+ zte_lan_stop_apsta();
+ } else {
+ //if(0 != zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_ADVANCED, strlen(flag_str)+1, flag_str))
+ if (0 != ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_ADVANCED, strlen(flag_str) + 1, flag_str, 0)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ }
+ slog(WIFI_PRINT, SLOG_ERR, "[%s:%s]wifi set cmd done! \n", __FILE__, __FUNCTION__); /*lint !e26*/
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+
+}
+
+void zte_wlan_mac_filter_set(webs_t wp)
+{
+ char_t *ACL_mode = NULL;
+ char_t *old_ACL_mode = NULL;
+ char_t *wifi_mac_black_list = NULL;
+ char_t *wifi_mac_white_list = NULL;
+ char_t *old_wifi_mac_black_list = NULL;
+ char_t *old_wifi_mac_white_list = NULL;
+ char_t *wifi_hostname_black_list = NULL;
+ char_t *wifi_hostname_white_list = NULL;
+ unsigned int wifi_set_flags = 0;
+ char wifi_set_flags_str[NV_ITEM_STRING_LEN_20] = {0};
+ char accesscontrollist0[720] = {0};
+ zte_topsw_state_e_type nv_ret = ZTE_NVIO_DONE;
+ char nv_basic[NVIO_WIFI_MAX_LEN] = {0}; // for nv read and write
+ char nv_mac[720] = {0};
+//cov m
+#define NV_READ(nv_name, str, ret) do{ret = zte_web_read(nv_name, nv_basic); str = nv_basic;}while(0)
+#define NV_READ_MAC(nv_name, str, ret) do{ret = zte_web_read(nv_name, nv_mac); str = nv_mac;}while(0)
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]zte_wlan_mac_filter_set.\n", __FILE__, __FUNCTION__); /*lint !e26*/
+ memset(nv_basic, 0, sizeof(nv_basic));
+ NV_READ("ACL_mode", old_ACL_mode, nv_ret);
+ ACL_mode = websGetVar(wp, T("ACL_mode"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s] ACL_mode =%s,nv_ret = %d old_ACL_mode = %s \n", __FILE__, __FUNCTION__, ACL_mode, nv_ret, old_ACL_mode);
+ if (ACL_mode != NULL) {
+ if (!strcmp(ACL_mode, "2")) {
+ slog(MISC_PRINT, SLOG_ERR, T("UFIx User enable black list!\n"));
+ } else if (!strcmp(ACL_mode, "0")) {
+ slog(MISC_PRINT, SLOG_ERR, T("UFIx User disable black list!\n"));
+ }
+ if (!STR_EQUAL(ACL_mode, old_ACL_mode)) { //kw 3
+ wifi_set_flags |= ZTE_WLAN_ACL_SET;
+ NV_WRITE("ACL_mode", ACL_mode, nv_ret);
+ }
+
+ } else {//klocwork
+ slog(MISC_PRINT, SLOG_ERR,"[%s:%s]ACL_mode:no such para.", __FILE__, __FUNCTION__); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ memset(nv_mac, 0, sizeof(nv_mac));
+ if (!strcmp(ACL_mode, "2")) {
+ char black_list[720] = {0};
+ NV_READ_MAC("wifi_mac_black_list", old_wifi_mac_black_list, nv_ret);
+ wifi_mac_black_list = websGetVar(wp, T("wifi_mac_black_list"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s] wifi_mac_black_list = %s, old_wifi_mac_black_list=%s \n", __FILE__, wifi_mac_black_list, old_wifi_mac_black_list);
+ //cov m
+ if ((wifi_mac_black_list != NULL) && (strlen(wifi_mac_black_list) < sizeof(black_list))) {
+ str2upper(wifi_mac_black_list, black_list);
+ if (!STR_EQUAL(black_list, old_wifi_mac_black_list)) { //kw 3
+ wifi_set_flags |= ZTE_WLAN_ACL_SET;
+ NV_WRITE("wifi_mac_black_list", black_list, nv_ret);
+ }
+
+ }
+ wifi_hostname_black_list = websGetVar(wp, T("wifi_hostname_black_list"), T(""));
+ if (wifi_hostname_black_list != NULL)//klocwork
+ (void)zte_web_write("wifi_hostname_black_list", wifi_hostname_black_list);
+ } else if (!strcmp(ACL_mode, "1")) {
+ char white_list[720] = {0};
+ NV_READ_MAC("wifi_mac_white_list", old_wifi_mac_white_list, nv_ret);
+ wifi_mac_white_list = websGetVar(wp, T("wifi_mac_white_list"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s] wifi_mac_white_list = %s,old_wifi_mac_white_list=%s \n", __FILE__, wifi_mac_white_list, old_wifi_mac_white_list);
+ //cov m
+ if ((wifi_mac_white_list != NULL) && (strlen(wifi_mac_white_list) < sizeof(white_list))) {
+ str2upper(wifi_mac_white_list, white_list);
+ if (!STR_EQUAL(white_list, old_wifi_mac_white_list)) { //kw 3
+ wifi_set_flags |= ZTE_WLAN_ACL_SET;
+ NV_WRITE("wifi_mac_white_list", white_list, nv_ret);
+ }
+
+ }
+ wifi_hostname_white_list = websGetVar(wp, T("wifi_hostname_white_list"), T(""));
+ if (wifi_hostname_white_list != NULL)//klocwork
+ (void)zte_web_write("wifi_hostname_white_list", wifi_hostname_white_list);
+ }
+ if ('\0' == *ACL_mode) {
+ slog(MISC_PRINT, SLOG_ERR,"[%s:%s]ACL_mode:invalid input para.", __FILE__, __FUNCTION__); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //(void)zte_web_write("ACL_mode",ACL_mode);
+ //(void)zte_web_write("wifi_mac_black_list", wifi_mac_black_list);
+
+
+/*
+ if (!strcmp(ACL_mode, "2")) {
+ (void)zte_web_write("wifi_hostname_black_list", wifi_hostname_black_list);
+ } else if (!strcmp(ACL_mode, "1")) {
+ (void)zte_web_write("wifi_hostname_white_list", wifi_hostname_white_list);
+ }
+*/
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s] wifi_mac_black_list=%s ,wifi_mac_white_list=%s, wifi_set_flags=%d\n",
+ __FILE__, wifi_mac_black_list, wifi_mac_white_list, wifi_set_flags);
+
+ if (wifi_set_flags != 0) {
+ (void)snprintf(wifi_set_flags_str, sizeof(wifi_set_flags_str) - 1, "%u", wifi_set_flags);
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_MAC,0,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_MAC, 0, NULL, 0);
+
+ slog(MISC_PRINT, SLOG_NORMAL,"[%s:%s] MSG_CMD_WIFI_MAC send to wlan-server!\n", __FILE__, __FUNCTION__); /*lint !e26*/
+ } else {
+ slog(MISC_PRINT, SLOG_NORMAL,"[%s:%s]do not deal\n", __FILE__, __FUNCTION__);
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+
+}
+
+void zte_wlan_wps_mode_set(webs_t wp)
+
+{
+ slog(MISC_PRINT, SLOG_ERR, T("UFIx User set wps mode!\n"));
+
+ char *wps_mode = NULL;
+ char *WPS_SSID = NULL;
+ char *wps_pin = NULL;
+
+// char pinIsValidate[10] = {0};
+ char auth_mode[NV_ITEM_STRING_LEN_20] = {0};
+ char encrypType[WF_ENCRY_TYPE_LEN] = {0};
+ char wps_state[NV_ITEM_STRING_LEN_50] = {0};
+ int pin_len = 0;
+ unsigned int wifi_set_flags = 0;
+ char wifi_set_flags_str[NV_ITEM_STRING_LEN_20] = {0};
+
+ char *wifi_wps_index = NULL;
+ char wps_msg[16] = {0};
+
+ wps_mode = websGetVar(wp, T("wps_mode"), T(""));
+ WPS_SSID = websGetVar(wp, T("WPS_SSID"), T(""));
+ wifi_wps_index = websGetVar(wp, T("wifi_wps_index"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s] wifi_wps_index = %s\n", __FILE__, __FUNCTION__, wifi_wps_index);
+
+ if (('\0' == *wps_mode) || ('\0' == *WPS_SSID)) {
+ slog(MISC_PRINT, SLOG_ERR,"[%s:%s]zte_lan_wps_set:invalid input para.\n wps_mode is [%s]\n WPS_SSID is [%s]", __FILE__, __FUNCTION__, wps_mode, WPS_SSID); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ (void) zte_web_read(NV_WIFI_WPS_STATE, wps_state);
+ if (0 == strcmp(wps_state, "1")) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_lan_wps_set:invalid operate, wps in processing..");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (0 == strcmp(wps_mode, WPS_MODE_PBC)) {
+ (void)zte_web_write(NV_WIFI_WPS_STATE, "1");
+ (void)zte_web_write(NV_WIFI_WPS_MODE, wps_mode);
+ (void)zte_web_write(NV_WIFI_WPS_SSID, WPS_SSID);
+ } else if (0 == strcmp(wps_mode, WPS_MODE_PIN)) {
+ wps_pin = websGetVar(wp, T("wps_pin"), T(""));
+ //add by liuyingnan for server safe for xss attack start
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(wps_pin)) {
+ slog(MISC_PRINT, SLOG_ERR,"[%s:%s]Get Data is no Safe:wps_pin:%s\n", __FILE__, __FUNCTION__, wps_pin); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //printf(" ---- zte_wlan_wps_mode_set len is %s\n", wps_pin);
+ if (wps_pin == NULL) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ pin_len = strlen(wps_pin);
+ if ((pin_len == 0) || ((pin_len != 4) && (pin_len != 8))) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ int wps_pin_num = atoi(wps_pin);
+ if(wps_pin_num<0 || wps_pin_num> INT_MAX-1)
+ {
+ wps_pin_num = 0;
+ }
+ if ((pin_len == 8) && !validate_pin_code(wps_pin_num)) {
+ zte_write_result_to_web(wp, FAILURE);
+ slog(MISC_PRINT, SLOG_ERR,"%s PIN check failed\n", __FUNCTION__);
+ return;
+ }
+
+
+ //add by liuyingnan for server safe for xss attack end
+ (void)zte_web_write(NV_WIFI_WPS_STATE, "1");
+ (void)zte_web_write(NV_WIFI_WPS_MODE, wps_mode);
+ (void)zte_web_write(NV_WIFI_WPS_SSID, WPS_SSID);
+ (void)zte_web_write(NV_WIFI_WPS_PIN, wps_pin);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[%s][%s]invalid wps_mode[%s].", __FILE__, __FUNCTION__, wps_mode); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ wifi_set_flags |= ZTE_WLAN_WPS_SET;
+
+ //last, write the wifi_set_flags
+ (void)snprintf(wifi_set_flags_str, sizeof(wifi_set_flags_str) - 1, "%u", wifi_set_flags);
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+
+ slog(MISC_PRINT, SLOG_NORMAL,"[%s][%s] send to wlan-server wps cmd\n", __FILE__, __FUNCTION__);
+
+
+ if (wifi_wps_index != NULL) {
+ zte_web_write(NV_WIFI_WPS_INDEX, wifi_wps_index);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s] wifi_wps_index = %s\n", __FILE__, __FUNCTION__, wifi_wps_index);
+ }
+
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_WPS,0,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_WPS, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]wifi set cmd done!", __FILE__, __FUNCTION__); /*lint !e26*/
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+
+
+void zte_wlan_web_ssid1_set(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_DEBUG, T("UFIx User set WIFI SSID settings!\n"));
+
+ unsigned int wifi_set_flags = 0;
+ char wifi_set_flags_str[NV_ITEM_STRING_LEN_20] = {0};
+ zte_topsw_state_e_type ret = ZTE_NVIO_DONE;
+
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, "");
+
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_web_ssid1_set:+++++++++++++++++======\n");
+ if (FALSE == zte_wlan_ssid1_basic_set(wp, &wifi_set_flags)) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_web_ssid1_set: zte_wlan_ssid1_basic_set failure .\n");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (-1 == zte_lan_ssid1_security_set(wp, &wifi_set_flags)) {
+ slog(MISC_PRINT, SLOG_ERR,"call zte_lan_ssid1_security_set failure .\n");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ (void)snprintf(wifi_set_flags_str, sizeof(wifi_set_flags_str) - 1, "%u", wifi_set_flags);
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_web_ssid1_set: wifi_set_flags [%u] to [%s].\n", wifi_set_flags, wifi_set_flags_str); /*lint !e26*/
+
+ if (0 != wifi_set_flags) {
+ slog(MISC_PRINT, SLOG_NORMAL,"send wifi para to wlan-server@ssid1\n");/*lint !e26*/
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_SSID,NULL,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_CFG_AP, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]wifi set cmd done!", __FILE__, __FUNCTION__); /*lint !e26*/
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+
+}
+
+
+
+void zte_wlan_ssid2_set(webs_t wp)
+{
+
+ unsigned int wifi_set_flags = 0;
+ char wifi_set_flags_str[NV_ITEM_STRING_LEN_20] = {0};
+ zte_topsw_state_e_type ret = ZTE_NVIO_DONE;
+
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, "");
+
+ if (FALSE == zte_wlan_ssid2_basic_set(wp, &wifi_set_flags)) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_ssid2_set: zte_wlan_ssid2_basic_set failure .");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (-1 == zte_lan_ssid2_security_set(wp, &wifi_set_flags)) {
+ slog(MISC_PRINT, SLOG_ERR,"call zte_lan_ssid2_security_set fail.\n .");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ (void)snprintf(wifi_set_flags_str, sizeof(wifi_set_flags_str) - 1, "%u", wifi_set_flags);
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_ssid2_set: wifi_set_flags [%u] to [%s].", wifi_set_flags, wifi_set_flags_str);
+
+ if (0 != wifi_set_flags) {
+ slog(MISC_PRINT, SLOG_NORMAL,"send wifi para to wlan-server@ssid2");/*lint !e26*/
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_SSID_M,NULL,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_CFG_AP2, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_DEBUG,"wifi set cmd done!"); /*lint !e26*/
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+
+}
+
+
+
+/**********************************************************************
+* Function: zte_wlan_sleep_set
+* Description: to set the wifi sleep mode
+* Input: http info
+* Output:
+* Return: 0:ok;-1:fail
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/07/11 V1.0 zhouti first version
+**********************************************************************/
+void zte_wlan_sleep_set(webs_t wp)
+{
+ char_t *sleepMode = NULL;
+ //char_t *wifi_mac_black_list = NULL;
+ //char_t *wifi_hostname_black_list = NULL;
+ unsigned int wifi_set_flags = 0;
+ char wifi_set_flags_str[NV_ITEM_STRING_LEN_20] = {0};
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]zte_wlan_sleep_set.", __FILE__, __FUNCTION__); /*lint !e26*/
+ //printf("zhouti zte_wlan_sleep_set------------------------\n");
+ sleepMode = websGetVar(wp, T("sysIdleTimeToSleep"), T(""));
+
+ if (NULL == sleepMode || '\0' == *sleepMode) {
+ slog(MISC_PRINT, SLOG_ERR,"sleepMode:invalid input para.");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //printf("zhouti zte_wlan_sleep_set sleepMode is %s\n", sleepMode);
+ (void)zte_web_write("Sleep_interval", sleepMode);
+ // (void)zte_web_write("wifi_mac_black_list", wifi_mac_black_list);
+ // (void)zte_web_write("wifi_hostname_black_list", wifi_hostname_black_list);
+
+
+ wifi_set_flags |= ZTE_WLAN_SET_AP_SLEEPTIMER;
+
+ (void)snprintf(wifi_set_flags_str, sizeof(wifi_set_flags_str) - 1, "%u", wifi_set_flags);
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+
+ slog(MISC_PRINT, SLOG_NORMAL,"send wifi para to wlan-mac_filter_set@basic_set");/*lint !e26*/
+ //zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_SLEEP, 0, NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_SLEEP, 0, NULL, 0);
+ //printf("wifi set cmd done!");/*lint !e26*/
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+static int check_web_input_wifi(char *str, int len)
+{
+ int i = 0;
+ if (str == NULL || len <= 0 || strlen(str) < len) {
+ return 0;
+ }
+ for (i = 0; i < len; i++) {
+ if (strchr("`$&*\\[];:\'\"<>,",str[i]) || !isprint(str[i])) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
+/**********************************************************************
+* Function: zte_wlan_coverage_set
+* Description: to set the wifi coverage
+* Input: http info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2014/05/27 V1.0 zhouti first version
+**********************************************************************/
+void zte_wlan_coverage_set(webs_t wp)
+{
+ char_t *wifi_coverage = NULL;
+ char_t old_wifi_coverage[WIFI_COVERAGE_LEN + 1] = {0};
+ unsigned int wifi_set_flags = 0;
+ char wifi_set_flags_str[NV_ITEM_STRING_LEN_20] = {0};
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_coverage_set.");
+ //printf("zhouti zte_wlan_coverage_set------------------------\n");
+ wifi_coverage = websGetVar(wp, T(NV_WIFI_COVERAGE), T(""));
+
+ if (NULL == wifi_coverage || '\0' == *wifi_coverage) {
+ slog(MISC_PRINT, SLOG_ERR,"[%s][%s]coverage: invalid input para.", __FILE__, __FUNCTION__);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ (void)zte_web_read(NV_WIFI_COVERAGE, old_wifi_coverage);
+ if (strcmp(wifi_coverage, old_wifi_coverage)) { //kw 3
+ (void)zte_web_write(NV_WIFI_COVERAGE, wifi_coverage);
+
+ wifi_set_flags |= ZTE_WLAN_POWER_SET;
+
+ (void)snprintf(wifi_set_flags_str, sizeof(wifi_set_flags_str) - 1, "%u", wifi_set_flags);
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+
+ slog(MISC_PRINT, SLOG_NORMAL,"send wifi para to wlan-mac_filter_set@basic_set");/*lint !e26*/
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_COVERAGE,0,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_COVERAGE, 0, NULL, 0);
+ //printf("wifi set cmd done!");/*lint !e26*/
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+static int zte_wlan_ssid1_basic_set(webs_t wp, unsigned int *wifi_set_flags)
+{
+
+ char_t *ssid = NULL;
+ char_t *broadcastssid = NULL ;
+ char_t *NoForwarding = NULL ;
+ char_t *MAX_Access_num = NULL;
+ zte_topsw_state_e_type status = ZTE_NVIO_MAX;
+ char nv_tmp[NVIO_WIFI_MAX_LEN] = {0};
+ char_t *wirelessmode = NULL;
+ char_t *countrycode = NULL;
+ char_t *channel = NULL;
+ char_t *wifi_11n_cap = NULL;
+ char_t *wifi_band = NULL;
+ char_t *show_qrcode_flag = NULL;//main ssid show qrcode flag
+
+ char wifi_sta_connection[8] = {0};
+
+ sc_cfg_get("wifi_sta_connection", wifi_sta_connection, sizeof(wifi_sta_connection));
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]wifi_sta_connection=%s\n", __FILE__, __FUNCTION__, wifi_sta_connection);
+
+ //ssid
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ ssid = websGetVar(wp, T("ssid"), NULL);
+#ifdef WEBS_SECURITY
+ if(ssid && !check_web_input_wifi(ssid,strlen(ssid)))
+ {
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]ssid1=%s\n",ssid);
+ return FALSE;
+ }
+#endif
+ if (ssid != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ (void)zte_web_read("SSID1", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]old_ssid=[%s], ssid=[%s]", __FILE__, __FUNCTION__, nv_tmp, ssid); /*lint !e26*/
+ //add by liuyingnan for server safe for xss attack start
+#if 0 //kw 3
+ if (DATA_NO_SAFE == zte_Safe_noSpecialCharForSSID(ssid)) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]Get Data is no Safe:ssid:%s\n", __FILE__, __FUNCTION__, ssid); /*lint !e26*/
+ return FALSE;
+ }
+#endif
+ //add by liuyingnan for server safe for xss attack end
+ if (0 != strcmp(ssid, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_SSID_SET;
+ status = zte_web_write("SSID1", ssid);
+ wlan_set_change_ssid_key_status();
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]zte_wlan_ssid1_basic_set: write nv [SSID1] fail.", __FILE__, __FUNCTION__); /*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+ //broadcastSsidEnabled
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ broadcastssid = websGetVar(wp, T("broadcastSsidEnabled"), NULL);
+
+ if (broadcastssid != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ (void)zte_web_read("HideSSID", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"old_HideSSID=[%s], HideSSID=[%s]", nv_tmp, broadcastssid); /*lint !e26*/
+ if (0 != strcmp(broadcastssid, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_BROADCAST_SET;
+ status = zte_web_write("HideSSID", broadcastssid);
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_ssid1_basic_set: write nv [HideSSID] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+#if 0
+ //set NoForwarding(ap isolated)
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ NoForwarding = websGetVar(wp, T("NoForwarding"), NULL);
+ if (NoForwarding != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ (void)zte_web_read("NoForwarding", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"old_NoForwarding=[%s], NoForwarding=[%s]", nv_tmp, NoForwarding);/*lint !e26*/
+ if (0 != strcmp(NoForwarding, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_AP_ISOLATION_SET;
+ status = zte_web_write("NoForwarding", NoForwarding);
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_ssid1_basic_set: write nv [NoForwarding] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+#endif
+ //set MAX_Access_num
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ MAX_Access_num = websGetVar(wp, T("MAX_Access_num"), NULL);
+ if (MAX_Access_num != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ (void)zte_web_read("MAX_Access_num", nv_tmp);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]old_MAX_Access_num=[%s], MAX_Access_num=[%s]\n", __FILE__, __FUNCTION__, nv_tmp, MAX_Access_num);
+
+ if (0 != strcmp(MAX_Access_num, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_MAX_ACCESS_NUM_SET;
+ zte_web_write("MAX_Access_num", MAX_Access_num); //kw 3
+ zte_web_write("MAX_Access_num_user_set", "1");
+ }
+ }
+ //set show_qrcode_flag
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ show_qrcode_flag = websGetVar(wp, T("show_qrcode_flag"), NULL);
+ if (show_qrcode_flag != NULL) {
+ (void)zte_web_read("show_qrcode_flag", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]ssid1:old_show_qrcode_flag=[%s], show_qrcode_flag=[%s]\n", __FILE__, __FUNCTION__, nv_tmp, show_qrcode_flag);
+
+ if (0 != strcmp(show_qrcode_flag, nv_tmp)) {
+ status = zte_web_write("show_qrcode_flag", show_qrcode_flag);
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_ssid1_basic_set: write nv [show_qrcode_flag] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+
+
+#if 0
+ //wifiMode
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ wirelessmode = websGetVar(wp, T("wifiMode"), NULL);
+ if (wirelessmode != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ printf("wirelessmode:%s", wirelessmode); /*lint !e26*/
+ (void)zte_web_read("WirelessMode", nv_tmp);
+ printf("[%s][%s]old_WirelessMode=[%s], wirelessmode=[%s]", __FILE__, __FUNCTION__, nv_tmp, wirelessmode); /*lint !e26*/
+ if (0 != strcmp(wirelessmode, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_WIRELESS_MODE_SET;
+ status = zte_web_write("WirelessMode", wirelessmode);
+ if (ZTE_NVIO_DONE != status) {
+ printf("zte_wlan_ssid1_basic_set: write nv [WirelessMode] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+ /* country code*/
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ countrycode = websGetVar(wp, T("countryCode"), NULL);
+ if (countrycode != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ (void)zte_web_read("CountryCode", nv_tmp);
+ printf("[%s][%s]old_countrycode=%s, countrycode = %s", __FILE__, __FUNCTION__, nv_tmp, countrycode); /*lint !e26*/
+ if (0 != strcmp(countrycode, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_COUNTRY_SET;
+ status = zte_web_write("CountryCode", countrycode);
+ if (ZTE_NVIO_DONE != status) {
+ printf("[%s][%s]zte_wlan_ssid1_basic_set: write nv [CountryCode] fail.", __FILE__, __FUNCTION__); /*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+ //selectedChannel
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ channel = websGetVar(wp, T("selectedChannel"), NULL);
+ if (channel != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ (void)zte_web_read("Channel", nv_tmp);
+ printf("[%s][%s]old_channel=%s, channel = %s", __FILE__, __FUNCTION__, nv_tmp, channel); /*lint !e26*/
+ if (0 != strcmp(channel, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_CHANNEL_SET;
+ status = zte_web_write("Channel", channel);
+ if (ZTE_NVIO_DONE != status) {
+ printf("zte_wlan_ssid1_basic_set: write nv [Channel] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+ //band setting
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ wifi_band = websGetVar(wp, T("wifi_band"), NULL);
+ if (wifi_band != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ (void)zte_web_read("wifi_band", nv_tmp);
+ printf("[%s][%s]old_wifi_band=%s, wifi_band = %s", __FILE__, __FUNCTION__, nv_tmp, wifi_band); /*lint !e26*/
+ if (0 != strcmp(wifi_band, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_WIFI_BAND_SET;
+ status = zte_web_write("wifi_band", channel);
+ if (ZTE_NVIO_DONE != status) {
+ printf("zte_wlan_ssid1_basic_set: write nv [wifi_band] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+ //set wifi_11n_cap
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ wifi_11n_cap = websGetVar(wp, T("wifi_11n_cap"), NULL);
+ if (wifi_11n_cap != NULL && !(wp->flags & WEBS_XML_CLIENT_REQUEST)) {
+ (void)zte_web_read("wifi_11n_cap", nv_tmp);
+ printf("[%s][%s]old_wifi_11n_cap=%s, wifi_11n_cap=%s", __FILE__, __FUNCTION__, nv_tmp, wifi_11n_cap); /*lint !e26*/
+ if (0 != strcmp(wifi_11n_cap, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_WIRELESS_MODE_SET;
+ status = zte_web_write("wifi_11n_cap", wifi_11n_cap);
+ if (ZTE_NVIO_DONE != status) {
+ printf("zte_wlan_ssid1_basic_set: write nv [wifi_11n_cap] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+#endif
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_ssid1_basic_set: wifi basic setup success.");/*lint !e26*/
+ return TRUE;
+
+}
+
+static int zte_wlan_ssid2_basic_set(webs_t wp, unsigned int *wifi_set_flags)
+{
+ char_t *ssid = NULL;
+ char_t *broadcastssid = NULL ;
+ char_t *NoForwarding = NULL ;
+ char_t *MAX_Access_num = NULL;
+ char_t *show_qrcode_flag = NULL;//guest ssid show qrcode flag
+ zte_topsw_state_e_type status = ZTE_NVIO_MAX;
+ char nv_tmp[NVIO_WIFI_MAX_LEN] = {0};
+
+ if ((NULL == wp) || (NULL == wifi_set_flags)) {
+ return FALSE;
+ }
+
+ //ssid
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ ssid = websGetVar(wp, T("m_SSID"), NULL);
+#ifdef WEBS_SECURITY
+ if(ssid && !check_web_input_wifi(ssid,strlen(ssid)))
+ {
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]ssid2=%s\n",ssid);
+ return FALSE;
+ }
+#endif
+ if (ssid != NULL) {
+ //add by liuyingnan for server safe for xss attack start
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(ssid)) {
+ slog(MISC_PRINT, SLOG_DEBUG,"Get Data is no Safe:ssid:%s\n", ssid); /*lint !e26*/
+ return FALSE;
+ }
+ //add by liuyingnan for server safe for xss attack end
+ (void)zte_web_read("m_SSID", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"old_m_SSID=[%s], m_SSID=[%s]", nv_tmp, ssid); /*lint !e26*/
+ if (0 != strcmp(ssid, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_SET_AP_MSSID;
+ status = zte_web_write("m_SSID", ssid);
+ wlan_set_change_ssid_key_status();//added by dujiajiao
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_ssid2_basic_set: write nv [m_SSID] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+ //broadcastSsidEnabled
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ broadcastssid = websGetVar(wp, T("m_HideSSID"), NULL);
+ if (broadcastssid != NULL) {
+ (void)zte_web_read("m_HideSSID", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"old_m_HideSSID=[%s], m_HideSSID=[%s]", nv_tmp, broadcastssid); /*lint !e26*/
+ if (0 != strcmp(broadcastssid, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_SET_AP_MSSID;
+ status = zte_web_write("m_HideSSID", broadcastssid);
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_ssid2_basic_set: write nv [m_HideSSID] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+
+ //set NoForwarding
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ NoForwarding = websGetVar(wp, T("m_NoForwarding"), NULL);
+ if (NoForwarding != NULL) {
+ (void)zte_web_read("m_NoForwarding", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"old_m_NoForwarding=[%s], m_NoForwarding=[%s]", nv_tmp, NoForwarding);/*lint !e26*/
+ if (0 != strcmp(NoForwarding, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_SET_AP_MSSID;
+ status = zte_web_write("m_NoForwarding", NoForwarding);
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_ssid1_basic_set: write nv [m_NoForwarding] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+ //set MAX_Access_num
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ MAX_Access_num = websGetVar(wp, T("m_MAX_Access_num"), NULL);
+ if (MAX_Access_num != NULL) {
+ (void)zte_web_read("m_MAX_Access_num", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"old_m_MAX_Access_num=[%s], m_MAX_Access_num=[%s]", nv_tmp, MAX_Access_num);/*lint !e26*/
+ if (0 != strcmp(MAX_Access_num, nv_tmp)) {
+ *wifi_set_flags |= ZTE_WLAN_SET_AP_MSSID;
+ status = zte_web_write("m_MAX_Access_num", MAX_Access_num);
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_ssid2_basic_set: write nv [MAX_Access_num] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+ //set show_qrcode_flag
+ memset(nv_tmp, 0, sizeof(nv_tmp));
+ show_qrcode_flag = websGetVar(wp, T("m_show_qrcode_flag"), NULL);
+ if (show_qrcode_flag != NULL) {
+ (void)zte_web_read("m_show_qrcode_flag", nv_tmp);
+ slog(MISC_PRINT, SLOG_DEBUG,"ssid2: old_show_qrcode_flag=[%s], show_qrcode_flag=[%s]", nv_tmp, show_qrcode_flag);/*lint !e26*/
+ if (0 != strcmp(show_qrcode_flag, nv_tmp)) {
+ status = zte_web_write("m_show_qrcode_flag", show_qrcode_flag);
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_ssid2_basic_set: write nv [show_qrcode_flag] fail.");/*lint !e26*/
+ return FALSE;
+ }
+ }
+ }
+
+
+
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wlan_ssid2_basic_set: wifi basic setup success.");/*lint !e26*/
+ return TRUE;
+
+}
+
+static int zte_lan_ssid1_security_set(webs_t wp, unsigned int *wifi_set_flags)
+{
+#define KEY_INDEX_MAX 5
+
+ char_t *security_mode = NULL;
+ char *encryp_type = NULL;
+ int i = 0;
+ char_t *pass_phrase_str = NULL;
+ //add by liuyingnan for Server safe start
+ int pass_phrase_str_decode_length = 0;
+ char_t *pass_phrase_str_decode = NULL;
+#ifdef WEBS_SECURITY
+ char_t *pass_phrase_b64_encode = NULL;
+#endif
+ char_t zte_pass_phrase_str[WIFI_PSW_DEFAULT_LENGTH] = {0};
+ int zte_pass_phrase_len = 0;
+ //add by liuyingnan for Server safe end
+
+ char_t *DefaultKeyID = NULL;
+ char_t * KeyType[KEY_INDEX_MAX];
+ char_t * KeyStr[KEY_INDEX_MAX];
+
+ char_t *cipher_str = NULL;
+ char_t wpa_encry_type[WF_ENCRY_TYPE_LEN] = {0};
+
+ zte_topsw_state_e_type nv_ret = ZTE_NVIO_DONE; /*lint -e550*/
+
+ uint8 nv_au_mode[WF_AU_MODE_LEN] = {0};
+ uint8 nv_ecry_type[WF_ENCRY_TYPE_LEN] = {0};
+ char_t psw[NV_ITEM_VALUE_DEFAULT_STRING_LEN] = {0};
+ //char nv_basic[NVIO_WIFI_MAX_LEN]={0}; // for nv read and write
+
+ /*lint -e717*/
+#define SECURITY_NV_WRITE(nv_name, str, ret) do{ ret = zte_web_write(nv_name, (char *)str);}while(0)
+
+ memset(KeyType, 0, sizeof(KeyType)); //set 0
+ memset(KeyStr, 0, sizeof(KeyStr)); //set 0
+
+ if ((NULL == wp) || (NULL == wifi_set_flags)) {
+ slog(MISC_PRINT, SLOG_ERR,"[%s][%s]input para is null.\n", __FILE__, __FUNCTION__); /*lint !e26*/
+ return -1;
+ }
+
+ security_mode = websGetVar(wp, T("security_mode"), NULL);
+ if (security_mode != NULL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]security_mode = [%s]", __FILE__, __FUNCTION__, security_mode); /*lint !e26*/
+
+ encryp_type = websGetVar(wp, T("security_shared_mode"), NULL);
+ if (NULL == encryp_type) {
+ slog(MISC_PRINT, SLOG_ERR,"encryp_type == NULL");/*lint !e26*/
+ return -1;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]encryp_type = [%s]", __FILE__, __FUNCTION__, encryp_type); /*lint !e26*/
+
+ if (STR_EQUAL(security_mode, WF_AU_OPEN) || STR_EQUAL(security_mode, WF_AU_SHARE)) {
+ if ((STR_EQUAL(security_mode, WF_AU_OPEN) && STR_EQUAL(encryp_type, WF_ENCRY_WEP)) ||
+ (STR_EQUAL(security_mode, WF_AU_SHARE))) { //&&STR_EQUAL(wifi_encry_type, WF_AU_OPEN)) )
+ zte_wifi_open_and_share_mode_s_type nv_open_and_share_s;
+ memset(&nv_open_and_share_s, 0, sizeof(zte_wifi_open_and_share_mode_s_type));
+
+ //read nv
+ (void)zte_web_read("AuthMode", nv_au_mode);
+ (void)zte_web_read("EncrypType", nv_ecry_type);
+ (void)zte_web_read("DefaultKeyID", nv_open_and_share_s.wep_key_index);
+ (void)zte_web_read("Key1Str1", nv_open_and_share_s.wep_key1);
+ (void)zte_web_read("Key2Str1", nv_open_and_share_s.wep_key2);
+ (void)zte_web_read("Key3Str1", nv_open_and_share_s.wep_key3);
+ (void)zte_web_read("Key4Str1", nv_open_and_share_s.wep_key4);
+ (void)zte_web_read("Key1Type", nv_open_and_share_s.wep_key1_mode);
+ (void)zte_web_read("Key2Type", nv_open_and_share_s.wep_key2_mode);
+ (void)zte_web_read("Key3Type", nv_open_and_share_s.wep_key3_mode);
+ (void)zte_web_read("Key4Type", nv_open_and_share_s.wep_key4_mode);
+
+ DefaultKeyID = websGetVar(wp, T("wep_default_key"), "");
+ KeyStr[1] = websGetVar(wp, T("wep_key_1"), "");
+ KeyStr[2] = websGetVar(wp, T("wep_key_2"), "");
+ KeyStr[3] = websGetVar(wp, T("wep_key_3"), "");
+ KeyStr[4] = websGetVar(wp, T("wep_key_4"), "");
+ KeyType[1] = websGetVar(wp, T("WEP1Select"), "");
+ KeyType[2] = websGetVar(wp, T("WEP2Select"), "");
+ KeyType[3] = websGetVar(wp, T("WEP3Select"), "");
+ KeyType[4] = websGetVar(wp, T("WEP4Select"), "");
+
+ //when the wifi setting has changed,then set them
+ if (STR_EQUAL(security_mode, nv_au_mode) && STR_EQUAL(encryp_type, nv_ecry_type) \
+ && STR_EQUAL(DefaultKeyID, nv_open_and_share_s.wep_key_index) \
+ && STR_EQUAL(KeyStr[1], nv_open_and_share_s.wep_key1) && STR_EQUAL(KeyStr[2], nv_open_and_share_s.wep_key2) && STR_EQUAL(KeyStr[3], nv_open_and_share_s.wep_key3) && STR_EQUAL(KeyStr[4], nv_open_and_share_s.wep_key4) \
+ && STR_EQUAL(KeyType[1], nv_open_and_share_s.wep_key1_mode) && STR_EQUAL(KeyType[2], nv_open_and_share_s.wep_key2_mode) && STR_EQUAL(KeyType[3], nv_open_and_share_s.wep_key3_mode) && STR_EQUAL(KeyType[4], nv_open_and_share_s.wep_key4_mode)) {
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]wifi:[%s][%s] not changed.\n", __FILE__, __FUNCTION__, security_mode, encryp_type); /*lint !e26*/
+ } else {
+ SECURITY_NV_WRITE("AuthMode", security_mode, nv_ret);
+ SECURITY_NV_WRITE("EncrypType", encryp_type, nv_ret);
+
+ SECURITY_NV_WRITE("DefaultKeyID", DefaultKeyID, nv_ret);
+
+ SECURITY_NV_WRITE("Key1Str1", KeyStr[1], nv_ret);
+ SECURITY_NV_WRITE("Key2Str1", KeyStr[2], nv_ret);
+ SECURITY_NV_WRITE("Key3Str1", KeyStr[3], nv_ret);
+ SECURITY_NV_WRITE("Key4Str1", KeyStr[4], nv_ret);
+
+ SECURITY_NV_WRITE("Key1Type", KeyType[1], nv_ret);
+ SECURITY_NV_WRITE("Key2Type", KeyType[2], nv_ret);
+ SECURITY_NV_WRITE("Key3Type", KeyType[3], nv_ret);
+ SECURITY_NV_WRITE("Key4Type", KeyType[4], nv_ret);
+
+ *wifi_set_flags |= ZTE_WLAN_BASIC_SECURITY_SET;
+ wlan_set_change_ssid_key_status();
+ }
+ } else if (STR_EQUAL(security_mode, WF_AU_OPEN) && STR_EQUAL(encryp_type, WF_ENCRY_NONE)) {
+ (void)zte_web_read("AuthMode",nv_au_mode);
+ (void)zte_web_read("EncrypType", nv_ecry_type);
+
+ if (STR_EQUAL(security_mode, nv_au_mode) && STR_EQUAL(encryp_type, nv_ecry_type)) {
+ printf("[%s][%s]wifi:[%s][%s] not changed.\n", __FILE__, __FUNCTION__, security_mode, encryp_type); /*lint !e26*/
+ } else {
+ SECURITY_NV_WRITE("AuthMode", security_mode, nv_ret);
+ SECURITY_NV_WRITE("EncrypType", encryp_type, nv_ret);
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_ENCODE, "", nv_ret);
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS, "", nv_ret);
+ SECURITY_NV_WRITE("Key1Str1", "", nv_ret);
+ SECURITY_NV_WRITE("Key2Str1", "", nv_ret);
+ SECURITY_NV_WRITE("Key3Str1", "", nv_ret);
+ SECURITY_NV_WRITE("Key4Str1", "", nv_ret);
+ *wifi_set_flags |= ZTE_WLAN_BASIC_SECURITY_SET;
+ wlan_set_change_ssid_key_status();
+ }
+ } else {
+ //wifi_au_mode or encrype invalid
+ slog(MISC_PRINT, SLOG_ERR,"[%s][%s]wifi:[%s][%s] is invalid.\n", __FILE__, __FUNCTION__, security_mode, encryp_type); /*lint !e26*/
+ return -1;
+ }
+ } else if (STR_EQUAL(security_mode, WF_AU_WPA) || STR_EQUAL(security_mode, WF_AU_WPA2) ||
+ STR_EQUAL(security_mode, WF_AU_WPA_WPA2) || STR_EQUAL(security_mode, WF_AU_WPA3) || STR_EQUAL(security_mode, WF_AU_WPA2_WPA3)) {
+ zte_wifi_wpa_and_wpa2_mode_s_type nv_wpa_and_wpa2;
+ memset(&nv_wpa_and_wpa2, 0, sizeof(zte_wifi_wpa_and_wpa2_mode_s_type));
+
+ pass_phrase_str = websGetVar(wp, T("passphrase"), "");
+ int j = 0;
+ for (i = 0; i < strlen(pass_phrase_str) && j < NV_ITEM_VALUE_DEFAULT_STRING_LEN; i++) {
+ if (pass_phrase_str[i] != '\r' && pass_phrase_str[i] != '\n') {
+ psw[j] = pass_phrase_str[i];
+ j++;
+ }
+ }
+ pass_phrase_str = psw;
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ cipher_str = websGetVar(wp, T("cipher"), "");
+ } else {
+#ifndef CONFIG_CHINA_UNICOM
+ if (STR_EQUAL(security_mode, WF_AU_WPA_WPA2)) {
+ cipher_str = websGetVar(wp, T("cipher_str"), "");
+ } else
+#endif
+ {
+ cipher_str = websGetVar(wp, T("cipher"), "");
+ }
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]pass_phrase_str = %s", __FILE__, __FUNCTION__, pass_phrase_str); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]cipher_str = %s", __FILE__, __FUNCTION__, cipher_str); /*lint !e26*/
+ //add by liuyingnan for server safe for xss attack start
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(pass_phrase_str)) {
+ slog(MISC_PRINT, SLOG_ERR,"Get Data is no Safe:ssid:%s\n", pass_phrase_str); /*lint !e26*/
+ return -1;
+ }
+ //add by liuyingnan for server safe for xss attack end
+
+ switch (cipher_str[0]) {
+ case '0':
+ strncpy(wpa_encry_type, WF_ENCRY_TKIP, sizeof(wpa_encry_type) - 1);
+ break;
+ case '1':
+ strncpy(wpa_encry_type, WF_ENCRY_AES, sizeof(wpa_encry_type) - 1);
+ break;
+ case '2':
+ strncpy(wpa_encry_type, WF_ENCRY_TKIP_AES, sizeof(wpa_encry_type) - 1);
+ break;
+ default:
+ slog(MISC_PRINT, SLOG_ERR,"unvalid encry type [%c]", encryp_type[0], 0, 0);
+ return -1;
+ }
+
+ (void)zte_web_read("AuthMode", nv_au_mode);
+ (void)zte_web_read("EncrypType", nv_ecry_type);
+ (void)zte_web_read(NV_WIFI_WPA_PASS, nv_wpa_and_wpa2.pre_share_key);
+
+ if (STR_EQUAL(security_mode, nv_au_mode) && STR_EQUAL(wpa_encry_type, nv_ecry_type) && STR_EQUAL(pass_phrase_str, nv_wpa_and_wpa2.pre_share_key)) {
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]wifi:[%s][%s] not changed.\n", __FILE__, __FUNCTION__, security_mode, wpa_encry_type); /*lint !e26*/
+ } else {
+ SECURITY_NV_WRITE("AuthMode", security_mode, nv_ret);
+ SECURITY_NV_WRITE("EncrypType", wpa_encry_type, nv_ret);
+#ifndef CONFIG_CHINA_UNICOM
+ if (STR_EQUAL(security_mode, WF_AU_WPA_WPA2)) {
+#endif
+ SECURITY_NV_WRITE("cipher_str", cipher_str, nv_ret);
+#ifndef CONFIG_CHINA_UNICOM
+ }
+#endif
+ //add by liuyingnan for Server safe start
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]pass_phrase_str:%s.\n", __FILE__, __FUNCTION__, pass_phrase_str); /*lint !e26*/
+#ifdef WEBS_SECURITY
+ pass_phrase_str_decode = js_aes_decode(pass_phrase_str, strlen(pass_phrase_str), (unsigned int*)&pass_phrase_str_decode_length);
+#else
+ pass_phrase_str_decode = (char*)zte_base64_decode((const unsigned char *)pass_phrase_str, strlen(pass_phrase_str), (unsigned int*)&pass_phrase_str_decode_length);
+#endif
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s][%s]login2 -> zte_password:%s.\n", __FILE__, __FUNCTION__, pass_phrase_str_decode); /*lint !e26*/
+
+ if (NULL == pass_phrase_str_decode) {
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_str_decode: psw is empty.\n");/*lint !e26*/
+ free(pass_phrase_str_decode);
+ return -1;
+ }
+ zte_pass_phrase_len = (pass_phrase_str_decode_length < sizeof(zte_pass_phrase_str) ? pass_phrase_str_decode_length : sizeof(zte_pass_phrase_str) - 1);
+ snprintf(zte_pass_phrase_str,zte_pass_phrase_len+1,"%s",pass_phrase_str_decode);
+ //strncpy(zte_pass_phrase_str, pass_phrase_str_decode, zte_pass_phrase_len);
+ free(pass_phrase_str_decode);
+ slog(MISC_PRINT, SLOG_DEBUG,"login3 -> zte_psw_admin:%s.\n", zte_pass_phrase_str); //cov m
+#ifdef WEBS_SECURITY
+ if(zte_pass_phrase_str && !check_web_input_wifi(zte_pass_phrase_str,strlen(zte_pass_phrase_str)))
+ {
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]wifipass1=%s\n",zte_pass_phrase_str);
+ return -1;
+ }
+ pass_phrase_b64_encode = zte_base64_encode(zte_pass_phrase_str, strlen(zte_pass_phrase_str));
+ if (NULL == pass_phrase_b64_encode) {
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_b64_encode: psw is NULL.\n");/*lint !e26*/
+ return -1;
+ }
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_b64_encode, nv_ret);
+ free(pass_phrase_b64_encode);
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS, zte_pass_phrase_str, nv_ret);
+ SECURITY_NV_WRITE("WPAPSK1_enaes", pass_phrase_str, nv_ret);
+#else
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_str, nv_ret);
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS, zte_pass_phrase_str, nv_ret);
+#endif
+ //add by liuyingnan for Server safe end
+ //SECURITY_NV_WRITE(NV_WIFI_WPA_PASS, pass_phrase_str, nv_ret);
+
+ *wifi_set_flags |= ZTE_WLAN_BASIC_SECURITY_SET;
+ wlan_set_change_ssid_key_status();
+ }
+ } else {
+ // other security mode is invalid
+ slog(MISC_PRINT, SLOG_ERR,"ERROR:security mode is invalid", 0, 0, 0);/*lint !e26*/
+ return -1;
+ }
+ } else {
+ //security_mode is NULL
+ slog(MISC_PRINT, SLOG_ERR,"ERROR:security_mode is NULL ", 0, 0, 0);/*lint !e26*/
+ return -1;
+ }
+
+ return 0;
+
+}
+
+/**********************************************************************
+* Function: zte_lan_ssid2_security_set
+* Description: to set the wifi security paras for SSID2
+* Input: http info
+* Output:
+* Return: 0:ok;-1:fail
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/07/11 V1.0 chenyi first version
+**********************************************************************/
+/*lint -e{818,830}*/
+static int zte_lan_ssid2_security_set(webs_t wp, unsigned int *wifi_set_flags) /*lint !e533*/
+{
+#define KEY_INDEX_MAX 5
+
+ char_t *security_mode = NULL;
+ char *encryp_type = NULL;
+
+ char_t *pass_phrase_str = NULL;
+ //add by liuyingnan for Server safe start
+ int pass_phrase_str_decode_length = 0;
+ char_t *pass_phrase_str_decode = NULL;
+#ifdef WEBS_SECURITY
+ char_t *pass_phrase_b64_encode = NULL;
+#endif
+ char_t zte_pass_phrase_str[WIFI_PSW_DEFAULT_LENGTH] = {0};
+ int zte_pass_phrase_len = 0;
+ //add by liuyingnan for Server safe end
+
+ char_t *DefaultKeyID = NULL;
+ char_t * KeyType[KEY_INDEX_MAX];
+ char_t * KeyStr[KEY_INDEX_MAX];
+
+ char_t *cipher_str = NULL;
+ char_t wpa_encry_type[WF_ENCRY_TYPE_LEN] = {0};
+
+ zte_topsw_state_e_type nv_ret = ZTE_NVIO_DONE; /*lint -e550*/
+
+ uint8 nv_au_mode[WF_AU_MODE_LEN] = {0};
+ uint8 nv_ecry_type[WF_ENCRY_TYPE_LEN] = {0};
+
+ //char nv_basic[NVIO_WIFI_MAX_LEN]={0}; // for nv read and write
+
+ /*lint -e717*/
+#define SECURITY_NV_WRITE(nv_name, str, ret) do{ ret = zte_web_write(nv_name, (char *)str);}while(0)
+
+ memset(KeyType, 0, sizeof(KeyType)); //set 0
+ memset(KeyStr, 0, sizeof(KeyStr)); //set 0
+
+ if ((NULL == wp) || (NULL == wifi_set_flags)) {
+ slog(MISC_PRINT, SLOG_ERR,"input para is null.\n");/*lint !e26*/
+ return -1;
+ }
+
+ security_mode = websGetVar(wp, T("m_AuthMode"), NULL);
+ if (security_mode != NULL) {
+ slog(MISC_PRINT, SLOG_DEBUG,"security_mode = [%s]", security_mode);/*lint !e26*/
+
+ encryp_type = websGetVar(wp, T("m_EncrypType"), NULL);
+ if (NULL == encryp_type) {
+ slog(MISC_PRINT, SLOG_DEBUG,"encryp_type == NULL", 0, 0, 0);/*lint !e26*/
+ return -1;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"encryp_type = [%s]", encryp_type); /*lint !e26*/
+
+ if (STR_EQUAL(security_mode, WF_AU_OPEN) || STR_EQUAL(security_mode, WF_AU_SHARE)) {
+ if ((STR_EQUAL(security_mode, WF_AU_OPEN) && STR_EQUAL(encryp_type, WF_ENCRY_WEP)) ||
+ (STR_EQUAL(security_mode, WF_AU_SHARE))) { //&&STR_EQUAL(wifi_encry_type, WF_AU_OPEN)) )
+ zte_wifi_open_and_share_mode_s_type nv_open_and_share_s;
+ memset(&nv_open_and_share_s, 0, sizeof(zte_wifi_open_and_share_mode_s_type));
+
+ //read nv
+ (void)zte_web_read("m_AuthMode", nv_au_mode);
+ (void)zte_web_read("m_EncrypType", nv_ecry_type);
+ (void)zte_web_read("m_DefaultKeyID", nv_open_and_share_s.wep_key_index);
+ (void)zte_web_read("m_Key1Str1", nv_open_and_share_s.wep_key1);
+ (void)zte_web_read("m_Key2Str1", nv_open_and_share_s.wep_key2);
+ (void)zte_web_read("m_Key3Str1", nv_open_and_share_s.wep_key3);
+ (void)zte_web_read("m_Key4Str1", nv_open_and_share_s.wep_key4);
+ (void)zte_web_read("m_Key1Type", nv_open_and_share_s.wep_key1_mode);
+ (void)zte_web_read("m_Key2Type", nv_open_and_share_s.wep_key2_mode);
+ (void)zte_web_read("m_Key3Type", nv_open_and_share_s.wep_key3_mode);
+ (void)zte_web_read("m_Key4Type", nv_open_and_share_s.wep_key4_mode);
+
+ DefaultKeyID = websGetVar(wp, T("m_DefaultKeyID"), "");
+ KeyStr[1] = websGetVar(wp, T("m_Key1Str1"), "");
+ KeyStr[2] = websGetVar(wp, T("m_Key2Str1"), "");
+ KeyStr[3] = websGetVar(wp, T("m_Key3Str1"), "");
+ KeyStr[4] = websGetVar(wp, T("m_Key4Str1"), "");
+ KeyType[1] = websGetVar(wp, T("m_Key1Type"), "");
+ KeyType[2] = websGetVar(wp, T("m_Key2Type"), "");
+ KeyType[3] = websGetVar(wp, T("m_Key3Type"), "");
+ KeyType[4] = websGetVar(wp, T("m_Key4Type"), "");
+
+ //when the wifi setting has changed,then set them
+ if (STR_EQUAL(security_mode, nv_au_mode) && STR_EQUAL(encryp_type, nv_ecry_type) \
+ && STR_EQUAL(DefaultKeyID, nv_open_and_share_s.wep_key_index) \
+ && STR_EQUAL(KeyStr[1], nv_open_and_share_s.wep_key1) && STR_EQUAL(KeyStr[2], nv_open_and_share_s.wep_key2) && STR_EQUAL(KeyStr[3], nv_open_and_share_s.wep_key3) && STR_EQUAL(KeyStr[4], nv_open_and_share_s.wep_key4) \
+ && STR_EQUAL(KeyType[1], nv_open_and_share_s.wep_key1_mode) && STR_EQUAL(KeyType[2], nv_open_and_share_s.wep_key2_mode) && STR_EQUAL(KeyType[3], nv_open_and_share_s.wep_key3_mode) && STR_EQUAL(KeyType[4], nv_open_and_share_s.wep_key4_mode)) {
+
+ printf("wifi:[%s][%s] not changed.\n", security_mode, encryp_type); /*lint !e26*/
+ } else {
+ SECURITY_NV_WRITE("m_AuthMode", security_mode, nv_ret);
+ SECURITY_NV_WRITE("m_EncrypType", encryp_type, nv_ret);
+
+ SECURITY_NV_WRITE("m_DefaultKeyID", DefaultKeyID, nv_ret);
+
+ SECURITY_NV_WRITE("m_Key1Str1", KeyStr[1], nv_ret);
+ SECURITY_NV_WRITE("m_Key2Str1", KeyStr[2], nv_ret);
+ SECURITY_NV_WRITE("m_Key3Str1", KeyStr[3], nv_ret);
+ SECURITY_NV_WRITE("m_Key4Str1", KeyStr[4], nv_ret);
+
+ SECURITY_NV_WRITE("m_Key1Type", KeyType[1], nv_ret);
+ SECURITY_NV_WRITE("m_Key2Type", KeyType[2], nv_ret);
+ SECURITY_NV_WRITE("m_Key3Type", KeyType[3], nv_ret);
+ SECURITY_NV_WRITE("m_Key4Type", KeyType[4], nv_ret);
+
+ *wifi_set_flags |= ZTE_WLAN_SET_AP_MSSID;
+ wlan_set_change_ssid_key_status(); //added by dujiajiao
+ }
+ } else if (STR_EQUAL(security_mode, WF_AU_OPEN) && STR_EQUAL(encryp_type, WF_ENCRY_NONE)) {
+ (void)zte_web_read("m_AuthMode", nv_au_mode);
+ (void)zte_web_read("m_EncrypType", nv_ecry_type);
+
+ if (STR_EQUAL(security_mode, nv_au_mode) && STR_EQUAL(encryp_type, nv_ecry_type)) {
+ slog(MISC_PRINT, SLOG_NORMAL,"wifi:[%s][%s] not changed.\n", security_mode, encryp_type); /*lint !e26*/
+ } else {
+ SECURITY_NV_WRITE("m_AuthMode", security_mode, nv_ret);
+ SECURITY_NV_WRITE("m_EncrypType", encryp_type, nv_ret);
+ /* added by dujiajiao, in open&no encrypt condition, there is no password */
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_M_ENCODE, "", nv_ret);
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_M, "", nv_ret);
+ SECURITY_NV_WRITE("m_Key1Str1", "", nv_ret);
+ SECURITY_NV_WRITE("m_Key2Str1", "", nv_ret);
+ SECURITY_NV_WRITE("m_Key3Str1", "", nv_ret);
+ SECURITY_NV_WRITE("m_Key4Str1", "", nv_ret);
+ /*added by dujiajiao end */
+ *wifi_set_flags |= ZTE_WLAN_SET_AP_MSSID;
+ wlan_set_change_ssid_key_status(); //added by dujiajiao
+ }
+ } else {
+ //wifi_au_mode or encrype invalid
+ slog(MISC_PRINT, SLOG_ERR,"wifi:[%s][%s] is invalid.\n", security_mode, encryp_type); /*lint !e26*/
+ return -1;
+ }
+ } else if (STR_EQUAL(security_mode, WF_AU_WPA) || STR_EQUAL(security_mode, WF_AU_WPA2) ||
+ STR_EQUAL(security_mode, WF_AU_WPA_WPA2) || STR_EQUAL(security_mode, WF_AU_WPA3) || STR_EQUAL(security_mode, WF_AU_WPA2_WPA3)) {
+ zte_wifi_wpa_and_wpa2_mode_s_type nv_wpa_and_wpa2;
+ memset(&nv_wpa_and_wpa2, 0, sizeof(zte_wifi_wpa_and_wpa2_mode_s_type));
+
+ pass_phrase_str = websGetVar(wp, T(NV_WIFI_WPA_PASS_M), "");
+ cipher_str = websGetVar(wp, T("cipher"), "");
+
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_str = %s", pass_phrase_str); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG,"cipher_str = %s", cipher_str); /*lint !e26*/
+
+ //add by liuyingnan for server safe for xss attack start
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(pass_phrase_str)) {
+ printf("Get Data is no Safe:ssid:%s\n", pass_phrase_str); /*lint !e26*/
+ return -1;
+ }
+ //add by liuyingnan for server safe for xss attack end
+
+ switch (cipher_str[0]) {
+ case '0':
+ strncpy(wpa_encry_type, WF_ENCRY_TKIP, sizeof(wpa_encry_type) - 1);
+ break;
+ case '1':
+ strncpy(wpa_encry_type, WF_ENCRY_AES, sizeof(wpa_encry_type) - 1);
+ break;
+ case '2':
+ strncpy(wpa_encry_type, WF_ENCRY_TKIP_AES, sizeof(wpa_encry_type) - 1);
+ break;
+ default:
+ printf("unvalid encry type [%c]", encryp_type[0]);/*lint !e26*/
+ return -1;
+ }
+
+ (void)zte_web_read("m_AuthMode", nv_au_mode);
+ (void)zte_web_read("m_EncrypType", nv_ecry_type);
+ (void)zte_web_read(NV_WIFI_WPA_PASS_M, nv_wpa_and_wpa2.pre_share_key);
+
+ if (STR_EQUAL(security_mode, nv_au_mode) && STR_EQUAL(wpa_encry_type, nv_ecry_type) && STR_EQUAL(pass_phrase_str, nv_wpa_and_wpa2.pre_share_key)) {
+
+ slog(MISC_PRINT, SLOG_NORMAL,"wifi:[%s][%s] not changed.\n", security_mode, wpa_encry_type); /*lint !e26*/
+ } else {
+ SECURITY_NV_WRITE("m_AuthMode", security_mode, nv_ret);
+ SECURITY_NV_WRITE("m_EncrypType", wpa_encry_type, nv_ret);
+ //add by liuyingnan for Server safe start
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_str:%s.\n", pass_phrase_str); /*lint !e26*/
+#ifdef WEBS_SECURITY
+ pass_phrase_str_decode = js_aes_decode(pass_phrase_str, strlen(pass_phrase_str), (unsigned int)&pass_phrase_str_decode_length);
+#else
+ pass_phrase_str_decode = (char*)zte_base64_decode((const unsigned char *)pass_phrase_str, strlen(pass_phrase_str), (unsigned int)&pass_phrase_str_decode_length);
+#endif
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_str_decode:%s.\n", pass_phrase_str_decode); /*lint !e26*/
+
+ if (NULL == pass_phrase_str_decode) {
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_str_decode: psw is empty.\n");/*lint !e26*/
+ free(pass_phrase_str_decode);
+ return -1;
+ }
+ zte_pass_phrase_len = (pass_phrase_str_decode_length < sizeof(zte_pass_phrase_str) ? pass_phrase_str_decode_length : sizeof(zte_pass_phrase_str) - 1);
+ snprintf(zte_pass_phrase_str,zte_pass_phrase_len+1,"%s",pass_phrase_str_decode);
+ //strncpy(zte_pass_phrase_str, pass_phrase_str_decode, zte_pass_phrase_len);
+ free(pass_phrase_str_decode);
+ slog(MISC_PRINT, SLOG_DEBUG,"login3 -> zte_pass_phrase_str:%s.\n", zte_pass_phrase_str); //cov m
+#ifdef WEBS_SECURITY
+ if(zte_pass_phrase_str && !check_web_input_wifi(zte_pass_phrase_str,strlen(zte_pass_phrase_str)))
+ {
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]wifipass2=%s\n",zte_pass_phrase_str);
+ return -1;
+ }
+ pass_phrase_b64_encode = zte_base64_encode(zte_pass_phrase_str, strlen(zte_pass_phrase_str));
+ if (NULL == pass_phrase_b64_encode) {
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_b64_encode: psw is NULL.\n");/*lint !e26*/
+ return -1;
+ }
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_M_ENCODE, pass_phrase_b64_encode, nv_ret);
+ free(pass_phrase_b64_encode);
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_M, zte_pass_phrase_str, nv_ret);
+ SECURITY_NV_WRITE("m_WPAPSK1_enaes", pass_phrase_str, nv_ret);
+#else
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_M_ENCODE, pass_phrase_str, nv_ret);
+ SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_M, zte_pass_phrase_str, nv_ret);
+#endif
+ //add by liuyingnan for Server safe end
+ //SECURITY_NV_WRITE(NV_WIFI_WPA_PASS_M, pass_phrase_str, nv_ret);
+
+ *wifi_set_flags |= ZTE_WLAN_SET_AP_MSSID;
+ wlan_set_change_ssid_key_status(); //added by dujiajiao
+ }
+ } else {
+ // other security mode is invalid
+ slog(MISC_PRINT, SLOG_ERR,"ERROR:security mode is invalid");/*lint !e26*/
+ return -1;
+ }
+ } else {
+ //security_mode is NULL
+ slog(MISC_PRINT, SLOG_ERR,"ERROR:security_mode is NULL ");/*lint !e26*/
+ return -1;
+ }
+
+ return 0;
+
+}
+
+void zte_wlan_set_tsw(webs_t wp)
+{
+ char * openEnable = NULL;
+ char * closeEnable = NULL;
+ char * openTime = NULL;
+ char * closeTime = NULL;
+ char old_open_time[16] = {0};
+ char old_close_time[16] = {0};
+ char old_open_enable[16] = {0};
+ char tsw_sleep_time_hour[16] = {0};
+ char tsw_sleep_time_min[16] = {0};
+ char tsw_wake_time_hour[16] = {0};
+ char tsw_wake_time_min[16] = {0};
+ char *tmp = NULL;
+ int tsw_change_flag = 0;
+ sc_cfg_get("openEnable", old_open_enable, sizeof(old_open_enable));
+
+ sc_cfg_get("openTime", old_open_time, sizeof(old_open_time));
+
+ sc_cfg_get("closeTime", old_close_time, sizeof(old_close_time));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s]old_open_enable=%s,old_open_time=%s,old_close_time=%s\n", __FUNCTION__, old_open_enable, old_open_time, old_close_time);
+ openEnable = websGetVar(wp, T("openEnable"), T(""));
+ closeEnable = websGetVar(wp, T("closeEnable"), T(""));
+ openTime = websGetVar(wp, T("openTime"), T(""));
+ closeTime = websGetVar(wp, T("closeTime"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s]openEnable=%s,closeEnable=%s,openTime=%s,closeTime=%s\n", __FUNCTION__, openEnable, closeEnable, openTime, closeTime);
+
+ //check the param: openEnable & closeEnable
+ if (NULL == openEnable || '\0' == *openEnable || NULL == closeEnable || '\0' == *closeEnable) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_set_tsw: **open/close**invalid input para.\n");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //if swtich is open , then check the param: openTime & closeTime
+ if (strcmp(openEnable, "1") == 0) {
+ if (NULL == openTime || '\0' == *openTime || NULL == closeTime || '\0' == *closeTime) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_wlan_set_tsw: **open**invalid input para:openTime /closeTime.\n");/*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ }
+ sc_cfg_set("openEnable", openEnable);
+ sc_cfg_set("closeEnable", closeEnable);
+
+ //send msg to wlan-server to close timing sleep wake up
+ if (strcmp(openEnable, "0") == 0 && strcmp(old_open_enable, "1") == 0) {
+ tsw_change_flag = 1;
+ slog(MISC_PRINT, SLOG_NORMAL,"send to wlan-server : MSG_CMD_WIFI_TSW_CLOSE\n");
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_TSW_CLOSE,0,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_TSW_CLOSE, 0, NULL, 0);
+
+ }
+ // 1.if current openEnable is 1, and old_open_enable is 0, then send msg to wlan-server to setup tsw
+ // 2. if current openEnable is 1, and openTime is changed or closeTime changed, then send msg to wlan-server to setup tsw
+ else if ((strcmp(openEnable, "1") == 0 && strcmp(old_open_enable, "0") == 0) || \
+ ((strcmp(openEnable, "1") == 0) && (strcmp(openTime, old_open_time) != 0 || strcmp(closeTime, old_close_time) != 0))) {
+ tsw_change_flag = 1;
+
+ sc_cfg_set("openTime", openTime);
+ sc_cfg_set("closeTime", closeTime);
+ snprintf(tsw_wake_time_hour, 3, "%s", openTime);
+ snprintf(tsw_wake_time_min, 3, "%s", openTime + 3);
+ snprintf(tsw_sleep_time_hour, 3, "%s", closeTime);
+ snprintf(tsw_sleep_time_min, 3, "%s", closeTime + 3);
+ slog(MISC_PRINT, SLOG_DEBUG,"tsw_wake_time_hour:%s,tsw_wake_time_min:%s\n", tsw_wake_time_hour, tsw_wake_time_min);
+ slog(MISC_PRINT, SLOG_DEBUG,"tsw_sleep_time_hour:%s,tsw_sleep_time_min:%s\n", tsw_sleep_time_hour, tsw_sleep_time_min);
+ sc_cfg_set("tsw_wake_time_hour", tsw_wake_time_hour);
+
+ sc_cfg_set("tsw_wake_time_min", tsw_wake_time_min);
+ sc_cfg_set("tsw_sleep_time_hour", tsw_sleep_time_hour);
+
+ sc_cfg_set("tsw_sleep_time_min", tsw_sleep_time_min);
+
+ slog(MISC_PRINT, SLOG_NORMAL,"send msg to wlan-server : MSG_CMD_WIFI_TSW_SET\n ");
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_TSW_SET,0,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_TSW_SET, 0, NULL, 0);
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+static void zte_get_cur_user_mac(struct list_head *Dhcp_info_list)
+{
+ struct in_addr addr;
+ char ipaddress[16] = {0};
+ char client_mac_addr[18] = {0};
+ char old_client_mac_addr[18] = {0};
+ DHCPOFFERADDR_LIST_t * p_dhcp_info = NULL;
+
+ sc_cfg_get("client_mac_address", old_client_mac_addr, sizeof(old_client_mac_addr));
+ sc_cfg_get(NV_USER_IP_ADDR, ipaddress, sizeof(ipaddress));
+ list_for_each_entry(p_dhcp_info, Dhcp_info_list, list) {
+ addr.s_addr = p_dhcp_info->dhcp_info.ip;
+ if ((strcmp(ipaddress, "") != 0) && (strcmp(inet_ntoa(addr), "")) && (!strcmp(ipaddress, inet_ntoa(addr)))) {
+ snprintf(client_mac_addr, 18, "%02X:%02X:%02X:%02X:%02X:%02X", p_dhcp_info->dhcp_info.mac[0], p_dhcp_info->dhcp_info.mac[1], p_dhcp_info->dhcp_info.mac[2], p_dhcp_info->dhcp_info.mac[3], p_dhcp_info->dhcp_info.mac[4], p_dhcp_info->dhcp_info.mac[5]);
+ if (strcmp(client_mac_addr, old_client_mac_addr)) {
+ sc_cfg_set("client_mac_address", client_mac_addr);
+ break;
+ }
+ }
+ }
+}
+
+static DHCPOFFERADDR_LIST_t *find_match_sta(struct list_head *dhcp_info_list, RT_802_11_MAC_ENTRY * pEntry)
+{
+ DHCPOFFERADDR_LIST_t * p_dhcp_info = NULL;
+
+ list_for_each_entry(p_dhcp_info, dhcp_info_list, list) {
+ // printf("[%s] p_dhcp_info:%d\n", __FUNCTION__, p_dhcp_info);
+
+
+ if ((p_dhcp_info->dhcp_info.mac[0] == pEntry->Addr[0]) && (p_dhcp_info->dhcp_info.mac[1] == pEntry->Addr[1]) &&
+ (p_dhcp_info->dhcp_info.mac[2] == pEntry->Addr[2]) && (p_dhcp_info->dhcp_info.mac[3] == pEntry->Addr[3]) &&
+ (p_dhcp_info->dhcp_info.mac[4] == pEntry->Addr[4]) && (p_dhcp_info->dhcp_info.mac[5] == pEntry->Addr[5])) {
+
+ return p_dhcp_info;
+
+ }
+ }
+
+
+ return NULL;
+
+}
+
+//»ñÈ¡wifi lan¿ÚÐÅÏ¢: wifi·Ö¿ªÔÒò£¬ÁÚ¾ÓÁбíºÍlease¶¼ÎÞ·¨Çø·ÖËÊÇwifi£¬Ö»ÓÐwifiоƬ֪µÀ
+void zte_wlan_get_station_list(webs_t wp)
+{
+ int i = 0;
+ int result = 0;
+
+ BOOL first = TRUE;
+ BOOL match = FALSE;
+
+ struct in_addr ipAddr = {0};
+ RT_802_11_MAC_TABLE staList = {0};
+ DHCPOFFERADDR_LIST_t * p_dhcp_info = NULL;
+
+ struct list_head dhcp_info_list;
+ INIT_LIST_HEAD(&dhcp_info_list);
+
+ zte_get_wifi_sta_list(&staList);
+ if (staList.Num > MAX_NUMBER_OF_MAC) {//kw 2,3
+ slog(MISC_PRINT, SLOG_ERR, "sta_count err, Num=%d\n", staList.Num);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s]staList.Num:%d\n", __FUNCTION__, staList.Num);
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s]sta_list->ConnectedTime:%d\n", __FUNCTION__, staList.Entry[0].ConnectedTime);
+ if (0 == staList.Num) {
+ sc_cfg_set("client_mac_address", ""); //added by dujiajiao 2016-2-24
+ }
+
+ result = zte_get_mac_list_from_lease(&dhcp_info_list);
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"%s\":["), CMD_WIFI_STATION_LIST);
+
+ /*
+ if(-1 == result || -2 == result || -3 == result)
+ {
+ (void)websWrite(wp, T("]}"));
+ safe_free(dhcp_info_list);
+ return;
+ }
+ */
+
+ if (0 == result) {
+ zte_get_cur_user_mac(&dhcp_info_list);//added by dujiajiao 2016-2-24
+ }
+
+
+ for (i = 0; i < staList.Num; i++) {
+
+ if (first == FALSE) {
+ (void)websWrite(wp, T(","));
+ } else {
+ first = FALSE;
+ }
+
+ if (staList.Entry[i].ConnectedTime) {
+ (void)websWrite(wp, T("{\"%s\":%ld,"), WIFI_STATION_CONNECTTIME, staList.Entry[i].ConnectedTime);
+ } else {
+ (void)websWrite(wp, T("{\"%s\":\"--\","), WIFI_STATION_CONNECTTIME);
+ }
+
+ /*do not use macro, the SSID_index = 0 in broadcom*/
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s]SSID_index:%d\n", __FUNCTION__, staList.Entry[i].SSID_index);
+
+ if (staList.Entry[i].SSID_index) {
+ (void)websWrite(wp, T("\"%s\":\"%d\","), WIFI_SSID_INDEX, staList.Entry[i].SSID_index);
+ }
+
+ (void)websWrite(wp, T("\"%s\":\"wifi\","), WIFI_STATION_DEVTYPE);
+
+
+ (void)websWrite(wp, T("\"%s\":\"%02X:%02X:%02X:%02X:%02X:%02X\","), WIFI_STATION_MAC, \
+ staList.Entry[i].Addr[0], staList.Entry[i].Addr[1], staList.Entry[i].Addr[2], staList.Entry[i].Addr[3], staList.Entry[i].Addr[4], staList.Entry[i].Addr[5]);
+
+ if ((p_dhcp_info = find_match_sta(&dhcp_info_list, &staList.Entry[i])) != NULL) {
+
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s] dhcp_info.mac= %02X %02X %02X %02X %02X %02X \n", __FUNCTION__, \
+ p_dhcp_info->dhcp_info.mac[0], p_dhcp_info->dhcp_info.mac[1], p_dhcp_info->dhcp_info.mac[2], \
+ p_dhcp_info->dhcp_info.mac[3], p_dhcp_info->dhcp_info.mac[4], p_dhcp_info->dhcp_info.mac[5]);
+
+ if (p_dhcp_info->dhcp_info.ip != NULL) {
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s]dhcp_info_ip:%d\n", __FUNCTION__, p_dhcp_info->dhcp_info.ip);
+
+ }
+
+ ipAddr.s_addr = p_dhcp_info->dhcp_info.ip;
+
+ if (strlen(p_dhcp_info->dhcp_info.host_name) > 0) { //kw 3 ??
+ (void)websWrite(wp, T("\"%s\":\"%s\","), WIFI_STATION_HOSTNAME, p_dhcp_info->dhcp_info.host_name);
+ } else {
+ (void)websWrite(wp, T("\"%s\":\"--\","), WIFI_STATION_HOSTNAME);
+ }
+
+ if (inet_ntoa(ipAddr)) {
+ (void)websWrite(wp, T("\"%s\":\"%s\","), WIFI_STATION_IPADDR, inet_ntoa(ipAddr));
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s]dhcp_info_ip-inet_ntoa:%s\n", __FUNCTION__, inet_ntoa(ipAddr));
+ } else {
+ (void)websWrite(wp, T("\"%s\":\"--\","), WIFI_STATION_IPADDR);
+ }
+
+ if (zte_is_static_dhcp_ip(inet_ntoa(ipAddr))) {
+ //(void)websWrite(wp,T("\"%s\":-1,"),WIFI_STATION_VALIDTIME);
+ (void)websWrite(wp, T("\"%s\":\"STATIC\"}"), WIFI_STATION_IPTYPE);
+ } else {
+ //(void)websWrite(wp,T("\"%s\":%ld,"),WIFI_STATION_VALIDTIME, dhcpInfo.expires);
+ (void)websWrite(wp, T("\"%s\":\"DHCP\"}"), WIFI_STATION_IPTYPE);
+ }
+ match = FALSE;
+ } else {
+//1. dchp not give an IP
+//2. customer set a static ip
+ slog(MISC_PRINT, SLOG_DEBUG,"[%s:%s]do not match ++++++++ \n", __FILE__, __FUNCTION__);
+
+ (void)websWrite(wp, T("\"%s\":\"--\","), WIFI_STATION_HOSTNAME);
+ (void)websWrite(wp, T("\"%s\":\"--\","), WIFI_STATION_IPADDR);
+ (void)websWrite(wp, T("\"%s\":\"--\"}"), WIFI_STATION_IPTYPE);
+ }
+
+ }
+
+ (void)websWrite(wp, T("]}"));
+
+ free_dhcp_list(&dhcp_info_list);
+}
+
+
+static unsigned int wps_pin_checksum(unsigned long pin)
+{
+ unsigned long int accum = 0;
+ while (pin) {
+ accum += 3 * (pin % 10);
+ pin /= 10;
+ accum += pin % 10;
+ pin /= 10;
+ }
+
+ return (10 - accum % 10) % 10;
+}
+
+int os_get_time(struct os_time *t)
+{
+ int res = 0;
+ struct timeval tv;
+ res = gettimeofday(&tv, NULL);
+ t->sec = tv.tv_sec;
+ t->usec = tv.tv_usec;
+ return res;
+}
+static int get_random(unsigned char* buf, size_t len)
+{
+ FILE* f;
+ size_t rc;
+
+ f = fopen("/dev/urandom", "rb");
+ if (f == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"Could not open /dev/urandom.\n");
+ return -1;
+ }
+
+ rc = fread(buf, 1, len, f);
+ //kw 3
+ fclose(f);
+
+ //printf("rc is %d, buf is %s\n", rc, buf);
+ return rc != len ? -1 : 0;
+}
+
+int random_get_bytes(void* buf, size_t len)
+{
+ int ret;
+ unsigned char* bytes = buf;
+
+ ret = get_random(buf, len);
+ return ret;
+}
+
+static int wps_generate_pin(void)
+{
+ unsigned int val = 0;
+
+ /*Generate seven random digits for the PIN*/
+ if (random_get_bytes((unsigned char *) &val, sizeof(val)) < 0) {
+ struct os_time now;
+ os_get_time(&now);
+ val = random() ^ now.sec ^ now.usec;
+ } else {//klocwork
+ if (val > 0xFFFFFFF0) {
+ struct os_time now;
+ os_get_time(&now);
+ val = random() ^ now.sec ^ now.usec;
+ }
+ }
+ val %= 10000000;
+ //printf("val is %ld\n", val);
+ /*Append checksum digit*/
+ return val * 10 + wps_pin_checksum(val);
+}
+
+void zte_wlan_get_wps_pin(webs_t wp)
+{
+ unsigned long pincode = 0;
+ char pin[9] = {0};
+
+ pincode = wps_generate_pin();
+ snprintf(pin,sizeof(pin), "%08d", pincode);
+
+ (void)zte_web_write(NV_WIFI_WPS_AP_PIN, pin);
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, NV_WIFI_WPS_AP_PIN, pin, 0);
+ zte_rest_cmd_write_foot(wp);
+}
+
+void zte_wlan_get_wps_defpin(webs_t wp)
+{
+ //unsigned long defpincode = 0;
+ char pin[9] = {0};
+ (void)zte_web_read(NV_WIFI_WPS_DEF_PIN, pin);
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, NV_WIFI_WPS_DEF_PIN, pin, 0);
+ zte_rest_cmd_write_foot(wp);
+}
+
+
diff --git a/ap/app/goahead/interface5.0/wifi/zte_web_lan_utils.c b/ap/app/goahead/interface5.0/wifi/zte_web_lan_utils.c
new file mode 100755
index 0000000..a5884a8
--- /dev/null
+++ b/ap/app/goahead/interface5.0/wifi/zte_web_lan_utils.c
@@ -0,0 +1,310 @@
+/* vi: set sw=4 ts=4 sts=4: */
+/*
+ * wireless.c -- Wireless Settings
+ *
+ * Copyright (c) Ralink Technology Corporation All Rights Reserved.
+ *
+ * $Id: wireless.c,v 1.99.2.4 2008-10-17 10:49:17 winfred Exp $
+ */
+
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <net/route.h>
+//#include "../../autoconf.h"
+#ifdef CONFIG_DEFAULTS_KERNEL_2_6_21
+#include <linux/types.h>
+#include <linux/socket.h>
+#endif
+//#include <linux/wireless.h>
+#include <string.h>
+#include <dirent.h>
+//#include "nvram.h"
+#include "webs.h"
+#include "zte_web_lan_utils.h"
+//#include "zte_web_lan_oid.h"
+//#include "linux/autoconf.h"
+#include <sys/time.h>
+#include <signal.h>
+#include "zte_web_interface.h"
+
+/*
+ * nanosleep(2) don't depend on signal SIGALRM and could cooperate with
+ * other SIGALRM-related functions(ex. setitimer(2))
+ */
+unsigned int Sleep(unsigned int secs)
+{
+ int rc = 0;
+ struct timespec ts, remain;/*lint !e1080 !e565 */
+ ts.tv_sec = secs;/*lint !e115 !e1013 !e63 */
+ ts.tv_nsec = 0;/*lint !e115 !e1013 !e63 */
+sleep_again:
+ rc = nanosleep(&ts, &remain);
+ if (rc == -1 && errno == EINTR) {
+ ts.tv_sec = remain.tv_sec;/*lint !e115 !e1013 !e63 */
+ ts.tv_nsec = remain.tv_nsec;/*lint !e115 !e1013 !e63 */
+ goto sleep_again;
+ }
+ return 0;
+}
+
+int setTimer(int microsec, void ((*sigroutine)(int)))
+{
+ struct itimerval value, ovalue;
+ signal(SIGALRM, sigroutine);
+ value.it_value.tv_sec = 0;
+ value.it_value.tv_usec = microsec;
+ value.it_interval.tv_sec = 0;
+ value.it_interval.tv_usec = microsec;
+ return setitimer(ITIMER_REAL, &value, &ovalue);
+}
+void stopTimer(void)
+{
+ struct itimerval value, ovalue;
+ value.it_value.tv_sec = 0;
+ value.it_value.tv_usec = 0;
+ value.it_interval.tv_sec = 0;
+ value.it_interval.tv_usec = 0;
+ setitimer(ITIMER_REAL, &value, &ovalue);
+}
+
+/*
+ * argument: [IN] index -- the index array of deleted items(begin from 0)
+ * [IN] count -- deleted itmes count.
+ * [IN/OUT] value -- original string/return string
+ * [IN] delimit -- delimitor
+ */
+int deleteNthValueMulti(int index[], int count, char *value, char delimit)
+{
+ char *begin = NULL;
+ char *end = NULL;
+ int i = 0;
+ int j = 0;
+ int need_check_flag = 0;
+ char *buf = strdup(value);
+ if (buf == NULL)
+ return -1;
+ *(buf+strlen(value)) = 0;
+ begin = buf;
+ end = strchr(begin, delimit);
+ while (end) {
+ if (i == index[j]) {
+ memset(begin, 0, end - begin);
+ if (index[j] == 0) {
+ need_check_flag = 1;
+ }
+ j++;
+ if (j >= count) {
+ break;
+ }
+ }
+ begin = end;
+ end = strchr(begin + 1, delimit);
+ i++;
+ }
+ if (!end && index[j] == i) {
+ memset(begin, 0, strlen(begin));
+ }
+ if (need_check_flag) {
+ for (i = 0; i < strlen(value); i++) {
+ if (buf[i] == '\0') {
+ continue;
+ }
+ if (buf[i] == ';') {
+ buf[i] = '\0';
+ }
+ break;
+ }
+ }
+ for (i = 0, j = 0; i < strlen(value); i++) {
+ if (buf[i] != '\0') {
+ value[j++] = buf[i];
+ }
+ }
+ value[j] = '\0';
+ free(buf);
+ return 0;
+}
+
+/*
+ * substitution of getNthValue which dosen't destroy the original value
+ */
+int getNthValueSafe(int index, char *value, char delimit, char *result, int len)
+{
+ int i = 0;
+ int result_len = 0;
+ char *begin = NULL;
+ char *end = NULL;
+ if (!value || !result || !len) {
+ return -1;
+ }
+ begin = value;
+ end = strchr(begin, delimit);
+ while (i < index && end) {
+ begin = end + 1;
+ end = strchr(begin, delimit);
+ i++;
+ }
+ if (!end) {
+ if (i == index) {
+ end = begin + strlen(begin);
+ result_len = (len - 1) < (end - begin) ? (len - 1) : (end - begin);
+ } else {
+ return -1;
+ }
+ } else {
+ result_len = (len - 1) < (end - begin) ? (len - 1) : (end - begin);
+ }
+ memcpy(result, begin, result_len);
+ *(result + result_len) = '\0';
+ return 0;
+}
+
+/*
+ * arguments: ifname - interface name
+ * if_addr - a 18-byte buffer to store mac address
+ * description: fetch mac address according to given interface name
+ */
+int getIfMac(char *ifname, char *if_hw)
+{
+ struct ifreq ifr;
+ char *ptr = NULL;
+ int skfd = 0;
+ memset(&ifr, 0, sizeof(struct ifreq));
+ if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"getIfMac: open socket error");
+ return -1;
+ }
+ strncpy(ifr.ifr_name, ifname, IF_NAMESIZE-1);
+ if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0) {
+ close(skfd);
+ return -1;
+ }
+ ptr = (char *) & (ifr.ifr_addr.sa_data); /*lint !e545*/
+ sprintf(if_hw, "%02X:%02X:%02X:%02X:%02X:%02X", (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377));
+ close(skfd);
+ return 0;
+}
+
+/*
+ * arguments: ifname - interface name
+ * if_addr - a 16-byte buffer to store ip address
+ * description: fetch ip address, netmask associated to given interface name
+ */
+int getIfIp(char *ifname, char *if_addr)
+{
+ struct ifreq ifr;
+ int skfd = 0;
+ memset(&ifr, 0, sizeof(struct ifreq));
+ if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ slog(MISC_PRINT, SLOG_DEBUG,"getIfIp: open socket error");
+ return -1;
+ }
+ strncpy(ifr.ifr_name, ifname, IF_NAMESIZE-1);
+ if (ioctl(skfd, SIOCGIFADDR, &ifr) < 0) {
+ close(skfd);
+ return -1;
+ }
+ strcpy(if_addr, inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
+ close(skfd);
+ return 0;
+}
+
+/*
+ * arguments: index - index of the Nth value (starts from 0)
+ * old_values - un-parsed values
+ * new_value - new value to be replaced
+ * description: parse values delimited by semicolon,
+ * replace the Nth value with new_value,
+ * and return the result
+ * WARNING: return the internal static string -> use it carefully
+ */
+char *setNthValue(int index, char *old_values, char *new_value)
+{
+ int i = 0;
+ char *p = NULL;
+ char *q = NULL;
+ static char ret[2048] = {0};
+ char buf[8][256] = {0};
+ memset(ret, 0, 2048);
+ for (i = 0; i < 8; i++) {
+ memset(buf[i], 0, 256);
+ }
+ for (i = 0, p = old_values, q = strchr(p, ';');
+ i < 8 && q != NULL;
+ i++, p = q + 1, q = strchr(p, ';')) {
+ //strncpy(buf[i], p, q - p);
+ if (q - p < sizeof(buf[i]))
+ snprintf(buf[i],q-p+1,"%s",p);
+ else
+ snprintf(buf[i],sizeof(buf[i]),"%s",p);
+ }
+ if (i < 8) { //kw 3
+ //strcpy(buf[i], p); //the last one
+ if (strlen(p) < sizeof(buf[i]))
+ snprintf(buf[i],strlen(p)+1,"%s",p);
+ else
+ snprintf(buf[i],sizeof(buf[i]),"%s",p);
+ }
+ strncpy(buf[index], new_value, 255);//cov
+ index = (i > index) ? i : index;
+ strncat(ret, buf[0],sizeof(ret)-strlen(ret)-1);
+ for (i = 1; i <= index; i++) {
+ //strncat(ret, ";", 2);
+ //strncat(ret, buf[i], 256);
+ snprintf(ret+strlen(ret),sizeof(ret)-strlen(ret),";%s",buf[i]);//cov
+ }
+ p = ret;
+ return p;
+}
+
+/*
+ * description: return LAN interface name
+ */
+char* getLanIfName(void)
+{
+ char mode[128] = {0};
+ static char *if_name = "br0";
+ char num_s[64] = {0};
+
+ sc_cfg_get("OperationMode", &mode, sizeof(mode));
+
+ if (strcmp(mode, "") == 0) {
+ return if_name;
+ }
+ if (!strncmp(mode, "0", 2)) { /*lint !e530*/
+ if_name = "br0";
+ } else if (!strncmp(mode, "1", 2)) {
+#if defined CONFIG_RAETH_ROUTER || defined CONFIG_MAC_TO_MAC_MODE || defined CONFIG_RT_3052_ESW
+ if_name = "br0";
+#elif defined CONFIG_ICPLUS_PHY && CONFIG_RT2860V2_AP_MBSS
+ sc_cfg_get("BssidNum", &num_s, sizeof(num_s));
+
+ if (atoi(num_s) > 1) { // multiple ssid
+ if_name = "br0";
+ } else {
+ if_name = "ra0";
+ }
+#else
+ if_name = "ra0";
+#endif
+ } else if (!strncmp(mode, "2", 2)) {
+ if_name = "eth2";
+ } else if (!strncmp(mode, "3", 2)) {
+ if_name = "br0";
+ }
+ return if_name;
+}/*lint !e529*/
+
+/*
+ * concatenate a string with an integer
+ * ex: racat("SSID", 1) will return "SSID1"
+ */
+char *racat(char *s, int i)
+{
+ static char str[32] = {0};
+ snprintf(str, 32, "%s%1d", s, i);
+ return str;
+}
+
diff --git a/ap/app/goahead/interface5.0/wifi/zte_web_lan_utils.h b/ap/app/goahead/interface5.0/wifi/zte_web_lan_utils.h
new file mode 100755
index 0000000..d4a1620
--- /dev/null
+++ b/ap/app/goahead/interface5.0/wifi/zte_web_lan_utils.h
@@ -0,0 +1,275 @@
+/*
+ * zte_web_wireless_utils.h -- Wireless Configuration Header
+ *
+ * Copyright (c) ZTE Corporation All Rights Reserved.
+ *
+ * $Id: zte_web_wireless_utils.h,v 0.1 2010-12-15 $
+ * Authors : ZHAOYONG - zhao.yong3@zte.com.cn>
+ */
+#ifndef __WIRELESS__H__
+#define __WIRELESS__H__
+#include <stdlib.h>
+//#include <stdint.h>
+#include <sys/ioctl.h>
+#include <arpa/inet.h>
+//#include <net/if.h>
+//#include <net/route.h>
+
+#ifdef CONFIG_DEFAULTS_KERNEL_2_6_21
+#include <linux/types.h>
+#include <linux/socket.h>
+#endif
+//#include <linux/wireless.h>
+//#include <net/if.h>
+#include <string.h>
+#include <dirent.h>
+//#include "nvram.h"
+#include "webs.h"
+//#include "zte_web_lan_oid.h"
+//#include "linux/autoconf.h"
+#include "zte_web_interface.h"
+#include <sys/socket.h>
+#include <asm/types.h>
+#include <sys/time.h>
+#include <time.h>
+#include <signal.h>
+#include <ctype.h>
+
+#define RT2860_NVRAM 0
+#define RTINIC_NVRAM 1
+#define RT2561_NVRAM 2
+#define RTDEV_NVRAM 1
+#define CERT_NVRAM 2
+#define WAPI_NVRAM 3
+#define PACKED __attribute__ ((packed))
+#define USHORT unsigned short
+#define UCHAR unsigned char
+#define WPS_AP_TIMEOUT_SECS 120000 // 120 seconds
+#define WPS_AP_CATCH_CONFIGURED_TIMER 100 // 0.1 sec
+#define WIFIPIN 8
+#define LFW(x, y) do{ \
+ if(! ( x = websGetVar(wp, T(#y), T("")))) \
+ return; \
+ }while(0)
+
+#define LFWi(x, y) do{ \
+ char_t *x##_str; \
+ if(! ( x##_str = websGetVar(wp, T(#y), T("")))) \
+ return; \
+ x = atoi(x##_str); \
+ }while(0)
+
+#define LFF(result, nvram, x, n) \
+ do{ char tmp[128]; \
+ char strx[512]; \
+ sc_cfg_get(#x,strx,sizeof(strx)); \
+ strcpy(strx,x); \
+ if(!x) \
+ tmp[0] = '\0'; \
+ else{ \
+ if( getNthValueSafe(n, x, ';', tmp, 128) != -1){\
+ gstrncat(result, tmp, 4096); \
+ } \
+ }gstrncat(result, "\r", 4096); \
+ }while(0)
+
+#define cprintf(fmt, args...) do { \
+ FILE *fp = fopen("/dev/console", "w"); \
+ if (fp) { \
+ fprintf(fp, fmt, ## args); \
+ fclose(fp); \
+ } \
+} while (0)
+
+#define PBC_WPS_34 34
+#define RALINK_GPIO_REG_IRQ 0x0A
+
+#if 0
+#ifdef CONFIG_RT2860V2_AP_WAPI
+#define MAX_NUMBER_OF_MAC 96
+#else
+#define MAX_NUMBER_OF_MAC 32 // if MAX_MBSSID_NUM is 8, this value can't be larger than 211
+#endif
+
+typedef union _MACHTTRANSMIT_SETTING {
+ struct {
+ unsigned short MCS: 7; // MCS
+ unsigned short BW: 1; //channel bandwidth 20MHz or 40 MHz
+ unsigned short ShortGI: 1;
+ unsigned short STBC: 2; //SPACE
+ unsigned short eTxBF: 1;
+ unsigned short rsv: 1;
+ unsigned short iTxBF: 1;
+ unsigned short MODE: 2; // Use definition MODE_xxx.
+ } field;
+ unsigned short word;
+} MACHTTRANSMIT_SETTING;
+
+typedef struct _RT_802_11_MAC_ENTRY {
+#ifdef CONFIG_RT2860V2_AP_V24_DATA_STRUCTURE
+ unsigned char ApIdx;
+#endif
+ unsigned char Addr[6];
+ unsigned char Aid;
+ unsigned char Psm; // 0:PWR_ACTIVE, 1:PWR_SAVE
+ unsigned char MimoPs; // 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled
+ char AvgRssi0;
+ char AvgRssi1;
+ char AvgRssi2;
+ unsigned int ConnectedTime;
+ MACHTTRANSMIT_SETTING TxRate;
+ unsigned int LastRxRate;
+ int StreamSnr[3];
+ int SoundingRespSnr[3];
+} RT_802_11_MAC_ENTRY;
+
+typedef struct _RT_802_11_MAC_TABLE {
+ unsigned long Num;
+ RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC]; //MAX_LEN_OF_MAC_TABLE = 32
+} RT_802_11_MAC_TABLE;
+
+/*add by myc for wifi_client_show 2012-04-19 begin*/
+
+typedef struct _DHCPOFFERADDR {
+ unsigned long expires;
+ unsigned long ip;
+ unsigned char mac[6];
+ unsigned char host_name[20];
+ unsigned char pad[2];
+} DHCPOFFERADDR;
+
+#endif
+
+typedef struct PACKED _WSC_CONFIGURED_VALUE {
+ USHORT WscConfigured; // 1 un-configured; 2 configured
+ UCHAR WscSsid[32 + 1];
+ USHORT WscAuthMode; // mandatory, 0x01: open, 0x02: wpa-psk, 0x04: shared, 0x08:wpa, 0x10: wpa2, 0x
+ USHORT WscEncrypType; // 0x01: none, 0x02: wep, 0x04: tkip, 0x08: aes
+ UCHAR DefaultKeyIdx;
+ UCHAR WscWPAKey[64 + 1];
+} WSC_CONFIGURED_VALUE;
+
+typedef struct {
+ unsigned int irq; //request irq pin number
+ pid_t pid; //process id to notify
+} ralink_gpio_reg_info;
+
+typedef struct PACKED _NDIS80211SSID {
+ unsigned int SsidLength; // length of SSID field below, in bytes;
+ // this can be zero.
+ unsigned char Ssid[32]; // SSID information field
+} NDIS80211SSID;
+
+typedef struct _WSC_CREDENTIAL {
+ NDIS80211SSID SSID; // mandatory
+ USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa-psk2
+ USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes
+ UCHAR Key[64]; // mandatory, Maximum 64 byte
+ USHORT KeyLength;
+ UCHAR MacAddr[6]; // mandatory, AP MAC address
+ UCHAR KeyIndex; // optional, default is 1
+ UCHAR Rsvd[3]; // Make alignment
+} WSC_CREDENTIAL, *PWSC_CREDENTIAL;
+
+typedef struct _WSC_PROFILE {
+#ifndef UINT
+#define UINT unsigned long
+#endif
+ UINT ProfileCnt;
+ UINT ApplyProfileIdx; // add by johnli, fix WPS test plan 5.1.1
+ WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles
+} WSC_PROFILE, *PWSC_PROFILE;
+
+typedef struct _ADVANCED_SETTINGS {
+ char_t *bg_protection;
+ char_t *beacon;
+ char_t *dtim;
+ char_t *fragment;
+ char_t *rts;
+ char_t *tx_power;
+ char_t *short_preamble;
+ char_t *short_slot;
+ char_t *tx_burst;
+ char_t *pkt_aggregate;
+ char_t *ieee_80211h;
+ char_t *wmm_capable;
+ char_t *apsd_capable;
+ char_t *dls_capable;
+ char_t *countrycode;
+ char_t *m2u_enable;
+} ADVANCED_SETTINGS;
+
+
+
+//typedef struct _DHCPOFFERADDR {
+// uint8_t hostname[16];
+// uint8_t chaddr[16];
+// uint32_t yiaddr; /* network order */
+// uint32_t expires; /* host order */
+//} DHCPOFFERADDR;
+
+
+/*add by myc for wifi_client_show 2012-04-19 end */
+
+extern void formDefineWireless_Advanced(void);
+extern void formDefineWireless_Basic(void);
+extern void formDefineWireless_Stainfo(void);
+extern void formDefineWireless_Security(void);
+extern void formDefineWireless(void);
+extern void restart8021XDaemon(int nvram);
+extern void updateFlash8021x(int nvram);
+extern void Security(int nvram, webs_t wp, char_t *path, char_t *query);
+extern void confWPAGeneral(int nvram, webs_t wp, int mbssid);
+extern void confWEP(int nvram, webs_t wp, int mbssid);
+extern void conf8021x(int nvram, webs_t wp, int mbssid);
+extern void getSecurity(int nvram, webs_t wp, char_t *path, char_t *query);
+extern void DeleteAccessPolicyList(int nvram, webs_t wp, char_t *path, char_t *query);
+extern void restart_wlan(void);
+extern char *racat(char *s, int i);
+extern char* getLanIfName(void);
+extern char *setNthValue(int index, char *old_values, char *new_value);
+extern int getIfIp(char *ifname, char *if_addr);
+extern int deleteNthValueMulti(int index[], int count, char *value, char delimit);
+extern int getNthValueSafe(int index, char *value, char delimit, char *result, int len);
+extern int getIfMac(char *ifname, char *if_hw);
+extern int getIfIp(char *ifname, char *if_addr);
+extern char *setNthValue(int index, char *old_values, char *new_value);
+extern char *getLanIfName(void);
+extern char *racat(char *s, int i);
+extern int setTimer(int microsec, void ((*sigroutine)(int)));
+extern void stopTimer(void);
+extern int wlan_timeout_deal(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlan11aChannels(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlan11bChannels(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlan11gChannels(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlanChannel(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlanCurrentMac(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlanWdsEncType(int eid, webs_t wp, int argc, char_t **argv);
+extern int deleteNthValueMulti(int index[], int count, char *value, char delimit); /* for Access Policy list deletion*/
+extern void DeleteAccessPolicyList(int nvram, webs_t wp, char_t *path, char_t *query);
+extern void revise_mbss_value(int old_num, int new_num);
+extern void restart8021XDaemon(int nvram);
+extern void restart_wlan(void);
+extern void updateFlash8021x(int nvram);
+extern void STFs(int nvram, int index, char *flash_key, char *value);
+extern int AccessPolicyHandle(webs_t wp, int mbssid);
+extern int getDLSBuilt(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlanM2UBuilt(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlanStaInfo(int eid, webs_t wp, int argc, char_t **argv);
+extern int getWlanStaInfo_ap2(int eid, webs_t wp, int argc, char_t **argv);
+extern void wirelessGetSecurity(webs_t wp, char_t *path, char_t *query);
+inline void clearRadiusSetting(int nvram, int mbssid);
+extern void APSecurity(webs_t wp, char_t *path, char_t *query);
+extern void APDeleteAccessPolicyList(webs_t wp, char_t *path, char_t *query);
+extern void WPSRestart(void);
+extern void formDefineWPS(void);
+extern void wps_register(void);
+extern void wirelessadvanced_getwebpara(webs_t wp, ADVANCED_SETTINGS *advanced_setting_inside);
+extern void wirelessadvanced_setnv(ADVANCED_SETTINGS *advanced_setting_inside, int ssid_num_inside, int wlan_mode_inside);
+extern void WPSSingleTriggerHandler(int signo);
+/*extern void LFW(webs_t wp,char_t *x,char *y);
+extern void LFF(char_t *result,int nvram,char_t *x,int n);
+extern void LFWi(webs_t wp,int *intvalue,char *webname);*/
+
+#endif
+
diff --git a/ap/app/goahead/interface5.0/wifi/zte_web_mgmt_wifi.c b/ap/app/goahead/interface5.0/wifi/zte_web_mgmt_wifi.c
new file mode 100755
index 0000000..6677f54
--- /dev/null
+++ b/ap/app/goahead/interface5.0/wifi/zte_web_mgmt_wifi.c
@@ -0,0 +1,431 @@
+#include "zte_web_mgmt_wifi.h"
+#include "zte_web_interface.h"
+
+void deal_quick_setup_wifi_basic_mgmt(webs_t wp)
+{
+ char *ssid_name = NULL;
+ char *ssid_broadcast = NULL;
+
+ ssid_name = websGetVar(wp, "SSID_name", T(""));
+ ssid_broadcast = websGetVar(wp, "SSID_Broadcast", T(""));
+
+ sc_cfg_set("SSID1", ssid_name);
+ wlan_set_change_ssid_key_status();
+ sc_cfg_set("HideSSID", ssid_broadcast);
+}
+
+void deal_quick_setup_wifi_basic_mgmt_1(webs_t wp)
+{
+ char *ssid_name = NULL;
+ char *ssid_broadcast = NULL;
+
+ ssid_name = websGetVar(wp, "ssid", T(""));
+ ssid_broadcast = websGetVar(wp, "broadcastSsidEnabled", T(""));
+
+ sc_cfg_set("SSID1", ssid_name);
+
+ wlan_set_change_ssid_key_status();
+
+ sc_cfg_set("HideSSID", ssid_broadcast);
+}
+
+void deal_quick_setup_wifi_security_mgmt(webs_t wp)
+{
+ char *security_mode = NULL;
+ char *shared_mode = NULL;
+ char *pass_phrase_str = NULL;
+ char_t *cipher_str = NULL;
+ uint8 wpa_encry_type[WF_ENCRY_TYPE_LEN] = {0};
+ int pass_phrase_str_decode_length = 0;
+ char *pass_phrase_str_decode = NULL;
+#ifdef WEBS_SECURITY
+ char *pass_phrase_b64_encode = NULL;
+#endif
+ char zte_pass_phrase_str[WIFI_PSW_DEFAULT_LENGTH] = {0};
+ char wifi_cur_state[WIFI_STATUS_LEN] = {0};
+ unsigned int wifi_set_flags = 0;
+ char wifi_set_flags_str[NV_ITEM_STRING_LEN_20] = {0};
+
+ security_mode = websGetVar(wp, "Encryption_Mode_hid", T("")); /* OPEN | SHARED | WPSPASK... */
+ if (0 == strcmp("SHARED", security_mode) ||
+ 0 == strcmp("WEPAUTO", security_mode)) {
+ sc_cfg_set("EncrypType", "WEP");
+ //sc_cfg_set("DefaultKeyID", "1");
+ //sc_cfg_set("Key1Type", websGetVar(wp, "WEP1Select", T("")));
+ //sc_cfg_set("Key1Str1", websGetVar(wp, "Network_Key_1", T("")));
+ sc_cfg_set("DefaultKeyID", websGetVar(wp, "wep_default_key", T("")));
+ sc_cfg_set("Key1Type", websGetVar(wp, "WEP1Select", T("")));
+ sc_cfg_set("Key1Str1", websGetVar(wp, "wep_key_1", T("")));
+ sc_cfg_set("Key2Type", websGetVar(wp, "WEP2Select", T("")));
+ sc_cfg_set("Key2Str1", websGetVar(wp, "wep_key_2", T("")));
+ sc_cfg_set("Key3Type", websGetVar(wp, "WEP3Select", T("")));
+ sc_cfg_set("Key3Str1", websGetVar(wp, "wep_key_3", T("")));
+ sc_cfg_set("Key4Type", websGetVar(wp, "WEP4Select", T("")));
+ sc_cfg_set("Key4Str1", websGetVar(wp, "wep_key_4", T("")));
+ wlan_set_change_ssid_key_status();
+ } else if (0 == strcmp(WF_AU_OPEN, security_mode)) {
+ shared_mode = websGetVar(wp, "security_shared_mode", T(""));
+ if (0 == strcmp("NONE", shared_mode)) { /* OPEN-NONE */
+ sc_cfg_set("EncrypType", "NONE");
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, "");
+ sc_cfg_set(NV_WIFI_WPA_PASS, "");
+ sc_cfg_set("Key1Str1", "");
+ sc_cfg_set("Key2Str1", "");
+ sc_cfg_set("Key3Str1", "");
+ sc_cfg_set("Key4Str1", "");
+ wlan_set_change_ssid_key_status();
+ } else {
+ sc_cfg_set("EncrypType", "WEP");
+ //sc_cfg_set("DefaultKeyID", "1");
+ //sc_cfg_set("Key1Type", websGetVar(wp, "WEP1Select", T("")));
+ //sc_cfg_set("Key1Str1", websGetVar(wp, "Network_Key_1", T("")));
+ sc_cfg_set("DefaultKeyID", websGetVar(wp, "wep_default_key", T("")));
+ sc_cfg_set("Key1Type", websGetVar(wp, "WEP1Select", T("")));
+ sc_cfg_set("Key1Str1", websGetVar(wp, "wep_key_1", T("")));
+ sc_cfg_set("Key2Type", websGetVar(wp, "WEP2Select", T("")));
+ sc_cfg_set("Key2Str1", websGetVar(wp, "wep_key_2", T("")));
+ sc_cfg_set("Key3Type", websGetVar(wp, "WEP3Select", T("")));
+ sc_cfg_set("Key3Str1", websGetVar(wp, "wep_key_3", T("")));
+ sc_cfg_set("Key4Type", websGetVar(wp, "WEP4Select", T("")));
+ sc_cfg_set("Key4Str1", websGetVar(wp, "wep_key_4", T("")));
+ wlan_set_change_ssid_key_status();
+ }
+ } else if (0 == strcmp("WPAPSK", security_mode) ||
+ 0 == strcmp("WPA2PSK", security_mode) ||
+ 0 == strcmp("WPAPSKWPA2PSK", security_mode) ||
+ 0 == strcmp("WPA3Personal", security_mode) ||
+ 0 == strcmp("WPA2WPA3", security_mode)) {
+#ifndef CONFIG_CHINA_UNICOM
+ if (STR_EQUAL(security_mode, WF_AU_WPA_WPA2)) {
+ cipher_str = websGetVar(wp, T("cipher_str"), T(""));
+ } else
+#endif
+ {
+ cipher_str = websGetVar(wp, T("WPA_ENCRYPTION_hid"), T(""));
+ }
+ switch (cipher_str[0]) {
+ case '0':
+ strncpy(wpa_encry_type, WF_ENCRY_TKIP, sizeof(wpa_encry_type) - 1);
+ break;
+ case '1':
+ strncpy(wpa_encry_type, WF_ENCRY_AES, sizeof(wpa_encry_type) - 1);
+ break;
+ case '2':
+ strncpy(wpa_encry_type, WF_ENCRY_TKIP_AES, sizeof(wpa_encry_type) - 1);
+ break;
+ default:
+ return;
+ }
+ sc_cfg_set("EncrypType", wpa_encry_type);
+
+#ifndef CONFIG_CHINA_UNICOM
+ if (0 == strcmp("WPAPSKWPA2PSK", security_mode)) {
+#endif
+ sc_cfg_set("cipher_str", cipher_str);
+
+#ifndef CONFIG_CHINA_UNICOM
+ }
+#endif
+ sc_cfg_set("RekeyMethod", "TIME");
+ sc_cfg_set("RekeyInterval", websGetVar(wp, "Key_Rotation_Interval_hid", T("")));
+ // sc_cfg_set("DefaultKeyID", "2");
+
+ pass_phrase_str = websGetVar(wp, T("WPA_PreShared_Key"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "pass_phrase_str:%s.\n", pass_phrase_str); /*lint !e26*/
+#ifdef WEBS_SECURITY
+ pass_phrase_str_decode = js_aes_decode(pass_phrase_str, strlen(pass_phrase_str), &pass_phrase_str_decode_length);
+#else
+ pass_phrase_str_decode = zte_base64_decode((const unsigned char *)pass_phrase_str, strlen(pass_phrase_str), &pass_phrase_str_decode_length);
+#endif
+ slog(MISC_PRINT, SLOG_DEBUG, "login2 -> zte_password:%s.\n", pass_phrase_str_decode); /*lint !e26*/
+
+ if (NULL == pass_phrase_str_decode) {
+ slog(MISC_PRINT, SLOG_DEBUG, "pass_phrase_str_decode: psw is empty.\n"); /*lint !e26*/
+ free(pass_phrase_str_decode);
+ return;
+ }
+ //strncpy(zte_pass_phrase_str, pass_phrase_str_decode, pass_phrase_str_decode_length);
+ if(pass_phrase_str_decode_length >= sizeof(zte_pass_phrase_str))
+ snprintf(zte_pass_phrase_str,sizeof(zte_pass_phrase_str),"%s",pass_phrase_str_decode);
+ else
+ snprintf(zte_pass_phrase_str,pass_phrase_str_decode_length+1,"%s",pass_phrase_str_decode);
+ free(pass_phrase_str_decode);
+ slog(MISC_PRINT, SLOG_DEBUG, "login3 -> zte_psw_admin:%s.\n", zte_pass_phrase_str); //cov m
+
+#ifdef WEBS_SECURITY
+ pass_phrase_b64_encode = zte_base64_encode(zte_pass_phrase_str, strlen(zte_pass_phrase_str));
+ if (NULL == pass_phrase_b64_encode) {
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_b64_encode: psw is NULL.\n");/*lint !e26*/
+ return;
+ }
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_b64_encode);
+ free(pass_phrase_b64_encode);
+ sc_cfg_set(NV_WIFI_WPA_PASS, zte_pass_phrase_str);
+ sc_cfg_set("WPAPSK1_enaes", pass_phrase_str);
+#else
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_str);
+ sc_cfg_set(NV_WIFI_WPA_PASS, zte_pass_phrase_str);
+#endif
+ wlan_set_change_ssid_key_status();
+ } else if (0 == strcmp("WAPISK", security_mode)) {
+ sc_cfg_set("RekeyMethod", "TIME");
+ sc_cfg_set("RekeyInterval", websGetVar(wp, "Key_Rotation_Interval_hid", T("")));
+ sc_cfg_set("wapiType", "2");
+ pass_phrase_str = websGetVar(wp, T("WPA_PreShared_Key"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "pass_phrase_str:%s.\n", pass_phrase_str); /*lint !e26*/
+#ifdef WEBS_SECURITY
+ pass_phrase_str_decode = js_aes_decode(pass_phrase_str, strlen(pass_phrase_str), &pass_phrase_str_decode_length);
+#else
+ pass_phrase_str_decode = zte_base64_decode((const unsigned char *)pass_phrase_str, strlen(pass_phrase_str), &pass_phrase_str_decode_length);
+#endif
+ slog(MISC_PRINT, SLOG_DEBUG, "login2 -> zte_password:%s.\n", pass_phrase_str_decode); /*lint !e26*/
+
+ if (NULL == pass_phrase_str_decode) {
+ slog(MISC_PRINT, SLOG_DEBUG, "pass_phrase_str_decode: psw is empty.\n"); /*lint !e26*/
+ free(pass_phrase_str_decode);
+ return;
+ }
+ //strncpy(zte_pass_phrase_str, pass_phrase_str_decode, pass_phrase_str_decode_length);
+ if(pass_phrase_str_decode_length >= sizeof(zte_pass_phrase_str))
+ snprintf(zte_pass_phrase_str,sizeof(zte_pass_phrase_str),"%s",pass_phrase_str_decode);
+ else
+ snprintf(zte_pass_phrase_str,pass_phrase_str_decode_length+1,"%s",pass_phrase_str_decode);
+ free(pass_phrase_str_decode);
+ slog(MISC_PRINT, SLOG_DEBUG, "login3 -> zte_psw_admin:%s.\n", zte_pass_phrase_str); /*lint !e26*/
+
+#ifdef WEBS_SECURITY
+ pass_phrase_b64_encode = zte_base64_encode(zte_pass_phrase_str, strlen(zte_pass_phrase_str));
+ if (NULL == pass_phrase_b64_encode) {
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_b64_encode: psw is NULL.\n");/*lint !e26*/
+ return;
+ }
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_b64_encode);
+ free(pass_phrase_b64_encode);
+ sc_cfg_set(NV_WIFI_WPA_PASS, zte_pass_phrase_str);
+ sc_cfg_set("WPAPSK1_enaes", pass_phrase_str);
+#else
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_str);
+ sc_cfg_set(NV_WIFI_WPA_PASS, zte_pass_phrase_str);
+#endif
+ wlan_set_change_ssid_key_status();
+ } else {
+ return;
+ }
+
+ sc_cfg_set("AuthMode", security_mode);
+ //sc_cfg_set("IEEE8021X", "0");
+
+ /*TBD:notify wifi module to make parameters go into effect*/
+ //(void)snprintf(wifi_set_flags_str,sizeof(wifi_set_flags_str)-1,"%u",wifi_set_flags);
+ //(void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+ //slog(MISC_PRINT,SLOG_DEBUG,"zte_wlan_ssid1_set: wifi_set_flags [%u] to [%s].", wifi_set_flags,wifi_set_flags_str);/*lint !e26*/
+ //printf(" deal_quick_setup_wifi_security------------------------- 11111\n");
+
+ sc_cfg_get("wifi_cur_state", wifi_cur_state, sizeof(wifi_cur_state));
+ printf("[%s]wifi_cur_state is %s\n", __FUNCTION__, wifi_cur_state);
+ if (strcmp(wifi_cur_state, WIFI_OPENED) != 0) {
+ printf("[%s]wifi_cur_state is 0, wifi is off, don't send msg to wlan-server\n", __FUNCTION__);
+ return;
+ }
+
+ wifi_set_flags = ZTE_WLAN_SSID_SET|ZTE_WLAN_BROADCAST_SET|ZTE_WLAN_BASIC_SECURITY_SET;
+ (void)snprintf(wifi_set_flags_str, sizeof(wifi_set_flags_str) - 1, "%u", wifi_set_flags);
+ (void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+
+ slog(MISC_PRINT, SLOG_NORMAL, "send wifi para to wlan-server@ssid1"); /*lint !e26*/
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_SSID,NULL,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_CFG_AP, 0, NULL, 0);
+
+ slog(MISC_PRINT, SLOG_DEBUG, "wifi set cmd done!"); /*lint !e26*/
+
+ return;
+}
+
+
+void deal_quick_setup_wifi_security_mgmt_1(webs_t wp)
+{
+ char *security_mode = NULL;
+ char *shared_mode = NULL;
+ char *pass_phrase_str = NULL;
+ char_t *cipher_str = NULL;
+ uint8 wpa_encry_type[WF_ENCRY_TYPE_LEN] = {0};
+ int pass_phrase_str_decode_length = 0;
+ char *pass_phrase_str_decode = NULL;
+#ifdef WEBS_SECURITY
+ char *pass_phrase_b64_encode = NULL;
+#endif
+ char zte_pass_phrase_str[WIFI_PSW_DEFAULT_LENGTH] = {0};
+ char wifi_cur_state[WIFI_STATUS_LEN] = {0};
+ security_mode = websGetVar(wp, "security_mode", T("")); /* OPEN | SHARED | WPSPASK... */
+ if (0 == strcmp("SHARED", security_mode) ||
+ 0 == strcmp("WEPAUTO", security_mode)) {
+ sc_cfg_set("EncrypType", "WEP");
+ //sc_cfg_set("DefaultKeyID", "1");
+ //sc_cfg_set("Key1Type", websGetVar(wp, "WEP1Select", T("")));
+ //sc_cfg_set("Key1Str1", websGetVar(wp, "Network_Key_1", T("")));
+ sc_cfg_set("DefaultKeyID", websGetVar(wp, "wep_default_key", T("")));
+ sc_cfg_set("Key1Type", websGetVar(wp, "WEP1Select", T("")));
+ sc_cfg_set("Key1Str1", websGetVar(wp, "wep_key_1", T("")));
+ sc_cfg_set("Key2Type", websGetVar(wp, "WEP2Select", T("")));
+ sc_cfg_set("Key2Str1", websGetVar(wp, "wep_key_2", T("")));
+ sc_cfg_set("Key3Type", websGetVar(wp, "WEP3Select", T("")));
+ sc_cfg_set("Key3Str1", websGetVar(wp, "wep_key_3", T("")));
+ sc_cfg_set("Key4Type", websGetVar(wp, "WEP4Select", T("")));
+ sc_cfg_set("Key4Str1", websGetVar(wp, "wep_key_4", T("")));
+ wlan_set_change_ssid_key_status();
+ } else if (0 == strcmp(WF_AU_OPEN, security_mode)) {
+ shared_mode = websGetVar(wp, "security_shared_mode", T(""));
+ if (0 == strcmp("NONE", shared_mode)) { /* OPEN-NONE */
+ sc_cfg_set("EncrypType", "NONE");
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, "");
+ sc_cfg_set(NV_WIFI_WPA_PASS, "");
+ sc_cfg_set("Key1Str1", "");
+ sc_cfg_set("Key2Str1", "");
+ sc_cfg_set("Key3Str1", "");
+ sc_cfg_set("Key4Str1", "");
+ wlan_set_change_ssid_key_status();
+ } else {
+ sc_cfg_set("EncrypType", "WEP");
+ //sc_cfg_set("DefaultKeyID", "1");
+ //sc_cfg_set("Key1Type", websGetVar(wp, "WEP1Select", T("")));
+ //sc_cfg_set("Key1Str1", websGetVar(wp, "Network_Key_1", T("")));
+ sc_cfg_set("DefaultKeyID", websGetVar(wp, "wep_default_key", T("")));
+ sc_cfg_set("Key1Type", websGetVar(wp, "WEP1Select", T("")));
+ sc_cfg_set("Key1Str1", websGetVar(wp, "wep_key_1", T("")));
+ sc_cfg_set("Key2Type", websGetVar(wp, "WEP2Select", T("")));
+ sc_cfg_set("Key2Str1", websGetVar(wp, "wep_key_2", T("")));
+ sc_cfg_set("Key3Type", websGetVar(wp, "WEP3Select", T("")));
+ sc_cfg_set("Key3Str1", websGetVar(wp, "wep_key_3", T("")));
+ sc_cfg_set("Key4Type", websGetVar(wp, "WEP4Select", T("")));
+ sc_cfg_set("Key4Str1", websGetVar(wp, "wep_key_4", T("")));
+ wlan_set_change_ssid_key_status();
+ }
+ } else if (0 == strcmp("WPAPSK", security_mode) ||
+ 0 == strcmp("WPA2PSK", security_mode) ||
+ 0 == strcmp("WPAPSKWPA2PSK", security_mode) ||
+ 0 == strcmp("WPA3Personal", security_mode) ||
+ 0 == strcmp("WPA2WPA3", security_mode)) {
+ cipher_str = websGetVar(wp, T("cipher"), T(""));
+ switch (cipher_str[0]) {
+ case '0':
+ strncpy(wpa_encry_type, WF_ENCRY_TKIP, sizeof(wpa_encry_type) - 1);
+ break;
+ case '1':
+ strncpy(wpa_encry_type, WF_ENCRY_AES, sizeof(wpa_encry_type) - 1);
+ break;
+ case '2':
+ strncpy(wpa_encry_type, WF_ENCRY_TKIP_AES, sizeof(wpa_encry_type) - 1);
+ break;
+ default:
+ return;
+ }
+ sc_cfg_set("EncrypType", wpa_encry_type);
+
+#ifndef CONFIG_CHINA_UNICOM
+ if (0 == strcmp("WPAPSKWPA2PSK", security_mode)) {
+#endif
+ sc_cfg_set("cipher_str", cipher_str);
+
+#ifndef CONFIG_CHINA_UNICOM
+ }
+#endif
+ sc_cfg_set("RekeyMethod", "TIME");
+ sc_cfg_set("RekeyInterval", websGetVar(wp, "Key_Rotation_Interval_hid", T("")));
+ // sc_cfg_set("DefaultKeyID", "2");
+
+ pass_phrase_str = websGetVar(wp, T("passphrase"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "pass_phrase_str:%s.\n", pass_phrase_str); /*lint !e26*/
+ pass_phrase_str_decode = zte_base64_decode((const unsigned char *)pass_phrase_str, strlen(pass_phrase_str), &pass_phrase_str_decode_length);
+ slog(MISC_PRINT, SLOG_DEBUG, "login2 -> zte_password:%s.\n", pass_phrase_str_decode); /*lint !e26*/
+
+ if (NULL == pass_phrase_str_decode) {
+ slog(MISC_PRINT, SLOG_DEBUG, "pass_phrase_str_decode: psw is empty.\n"); /*lint !e26*/
+ free(pass_phrase_str_decode);
+ return;
+ }
+ //strncpy(zte_pass_phrase_str, pass_phrase_str_decode, pass_phrase_str_decode_length);
+ if(pass_phrase_str_decode_length >= sizeof(zte_pass_phrase_str))
+ snprintf(zte_pass_phrase_str,sizeof(zte_pass_phrase_str),"%s",pass_phrase_str_decode);
+ else
+ snprintf(zte_pass_phrase_str,pass_phrase_str_decode_length+1,"%s",pass_phrase_str_decode);
+ free(pass_phrase_str_decode);
+ slog(MISC_PRINT, SLOG_DEBUG, "login3 -> zte_psw_admin:%s.\n", zte_pass_phrase_str); //cov m
+
+#ifdef WEBS_SECURITY
+ pass_phrase_b64_encode = zte_base64_encode(zte_pass_phrase_str, strlen(zte_pass_phrase_str));
+ if (NULL == pass_phrase_b64_encode) {
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_b64_encode: psw is NULL.\n");/*lint !e26*/
+ return;
+ }
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_b64_encode);
+ free(pass_phrase_b64_encode);
+#else
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_str);
+#endif
+ sc_cfg_set(NV_WIFI_WPA_PASS, zte_pass_phrase_str);
+ wlan_set_change_ssid_key_status();
+ } else if (0 == strcmp("WAPISK", security_mode)) {
+ sc_cfg_set("RekeyMethod", "TIME");
+ sc_cfg_set("RekeyInterval", websGetVar(wp, "Key_Rotation_Interval_hid", T("")));
+ sc_cfg_set("wapiType", "2");
+ pass_phrase_str = websGetVar(wp, T("passphrase"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "pass_phrase_str:%s.\n", pass_phrase_str); /*lint !e26*/
+ pass_phrase_str_decode = zte_base64_decode((const unsigned char *)pass_phrase_str, strlen(pass_phrase_str), &pass_phrase_str_decode_length);
+ slog(MISC_PRINT, SLOG_DEBUG, "login2 -> zte_password:%s.\n", pass_phrase_str_decode); /*lint !e26*/
+
+ if (NULL == pass_phrase_str_decode) {
+ slog(MISC_PRINT, SLOG_DEBUG, "pass_phrase_str_decode: psw is empty.\n"); /*lint !e26*/
+ free(pass_phrase_str_decode);
+ return;
+ }
+ //strncpy(zte_pass_phrase_str, pass_phrase_str_decode, pass_phrase_str_decode_length);
+ if(pass_phrase_str_decode_length >= sizeof(zte_pass_phrase_str))
+ snprintf(zte_pass_phrase_str,sizeof(zte_pass_phrase_str),"%s",pass_phrase_str_decode);
+ else
+ snprintf(zte_pass_phrase_str,pass_phrase_str_decode_length+1,"%s",pass_phrase_str_decode);
+ free(pass_phrase_str_decode);
+ slog(MISC_PRINT, SLOG_DEBUG, "login3 -> zte_psw_admin:%s.\n", zte_pass_phrase_str); /*lint !e26*/
+
+#ifdef WEBS_SECURITY
+ pass_phrase_b64_encode = zte_base64_encode(zte_pass_phrase_str, strlen(zte_pass_phrase_str));
+ if (NULL == pass_phrase_b64_encode) {
+ slog(MISC_PRINT, SLOG_DEBUG,"pass_phrase_b64_encode: psw is NULL.\n");/*lint !e26*/
+ return;
+ }
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_b64_encode);
+ free(pass_phrase_b64_encode);
+#else
+ sc_cfg_set(NV_WIFI_WPA_PASS_ENCODE, pass_phrase_str);
+#endif
+ sc_cfg_set(NV_WIFI_WPA_PASS, zte_pass_phrase_str);
+ wlan_set_change_ssid_key_status();
+ } else {
+ return;
+ }
+
+ sc_cfg_set("AuthMode", security_mode);
+ //sc_cfg_set("IEEE8021X", "0");
+
+ /*TBD:notify wifi module to make parameters go into effect*/
+ //(void)snprintf(wifi_set_flags_str,sizeof(wifi_set_flags_str)-1,"%u",wifi_set_flags);
+ //(void)zte_web_write(WIFI_NV_ITEM_WIFI_SET_FLAGS, wifi_set_flags_str);
+ //slog(MISC_PRINT,SLOG_DEBUG,"zte_wlan_ssid1_set: wifi_set_flags [%u] to [%s].", wifi_set_flags,wifi_set_flags_str);/*lint !e26*/
+ //printf(" deal_quick_setup_wifi_security------------------------- 11111\n");
+
+ sc_cfg_get("wifi_cur_state", wifi_cur_state, sizeof(wifi_cur_state));
+ if (strcmp(wifi_cur_state, WIFI_OPENED) != 0) {
+ slog(MISC_PRINT, SLOG_NORMAL,"[%s]wifi_cur_state is 0, wifi is off, don't send msg to wlan-server\n", __FUNCTION__);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_NORMAL, "send wifi para to wlan-server@ssid1"); /*lint !e26*/
+ //zte_send_message(MODULE_ID_WIFI,MSG_CMD_WIFI_SSID,NULL,NULL);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_CFG_AP, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "wifi set cmd done!"); /*lint !e26*/
+
+ return;
+}
+
+void deal_quick_setup_wps_mgmt(webs_t wp)
+{
+ return;
+}
diff --git a/ap/app/goahead/interface5.0/wifi/zte_web_mgmt_wifi.h b/ap/app/goahead/interface5.0/wifi/zte_web_mgmt_wifi.h
new file mode 100644
index 0000000..3427a76
--- /dev/null
+++ b/ap/app/goahead/interface5.0/wifi/zte_web_mgmt_wifi.h
@@ -0,0 +1,15 @@
+#ifndef ZTE_WEB_MGMT_WIFI_H
+#define ZTE_WEB_MGMT_WIFI_H
+
+#include "webs.h"
+
+extern void deal_quick_setup_wifi_basic_mgmt(webs_t wp);
+extern void deal_quick_setup_wifi_security_mgmt(webs_t wp);
+extern void deal_quick_setup_wps_mgmt(webs_t wp);
+
+//start:for MF910W
+extern void deal_quick_setup_wifi_basic_mgmt_1(webs_t wp);
+extern void deal_quick_setup_wifi_security_mgmt(webs_t wp);
+//end:for MF910W
+
+#endif
diff --git a/ap/app/goahead/interface5.0/wifi/zte_web_wlan_station.c b/ap/app/goahead/interface5.0/wifi/zte_web_wlan_station.c
new file mode 100755
index 0000000..63b8dd0
--- /dev/null
+++ b/ap/app/goahead/interface5.0/wifi/zte_web_wlan_station.c
@@ -0,0 +1,1367 @@
+
+/************************************************************************
+* °æÈ¨ËùÓÐ (C)2015, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º zte_web_wlan_station.c
+* Îļþ±êʶ£º
+* ÄÚÈÝÕªÒª£º
+* ÆäËü˵Ã÷£º
+* µ±Ç°°æ±¾£º V0.1
+* ×÷ Õߣº XUJIAN
+* Íê³ÉÈÕÆÚ£º 2015-03-09
+*
+* Ð޸ļǼ1£º
+* ÐÞ¸ÄÄÚÈÝ£º³õʼ°æ±¾
+************************************************************************/
+#include "zte_web_interface.h"
+
+
+#define WEB_WLAN_STATION_MODE_WIFI_PREF "wifi_pref"
+#define WEB_WLAN_STATION_MODE_DIAL_PREF "dial_pref"
+#define WEB_WLAN_STATION_CONNECTION_LEN 1
+#define WEB_WLAN_STATION_MODE_LEN 10
+
+#define WEB_WLAN_STATION_IP_STATUS_CONNECT "connect"
+#define WEB_WLAN_STATION_IP_STATUS_DISCONNECT "disconnect"
+#define WEB_WLAN_STATION_IP_STATUS_CONNECTING "connecting"
+#define WIFI_STATION_IP_STATUS_DHCPING "dhcping"
+#define WEB_WLAN_STATION_IP_STATUS_LEN 15
+
+#define WEB_WLAN_STATION_SPOT_ADD "add"
+#define WEB_WLAN_STATION_SPOT_MODIFY "modify"
+#define WEB_WLAN_STATION_SPOT_DEL "delete"
+#define WEB_WLAN_STATION_SPOT_NUM_LEN 8
+#define WEB_WLAN_STATION_SPOT_LIST_MAX 10
+#define WEB_WLAN_STATION_PROFILE_NV_NAME_LEN 20
+#define WEB_WLAN_STATION_SPOT_LEN 256
+#define WEB_WLAN_STATION_SPOT_PROFILE_NAME_LEN 30
+#define WEB_WLAN_STATION_SPOT_KEY_ID_LEN 10
+#define WEB_WLAN_STATION_SPOT_PASSWORD_LEN 128
+
+#define WEB_WLAN_STATION_SSID_LEN 128
+#define WEB_WLAN_STATION_ACTION_LEN 32
+
+#define WIFI_STATION_SPOT_LEN 256
+#define WIFI_STATION_SPOT_LIST_NUM 10
+#define WIFI_STATION_SPOT_PROFILE_NAME_LEN 30
+#define WIFI_STATION_SPOT_PASSWORD_LEN 128
+#define WIFI_STATION_SPOT_KEY_ID_LEN 10
+#define WIFI_STATION_PROFILE_NV_NAME_LEN 20
+#define WIFI_STATION_MAC_LEN 20
+#define WIFI_STATION_SSID_LEN 128
+#define WIFI_STATION_AUTH_MODE_LEN 20
+#define WIFI_STATION_ENCRYPT_TYPE_LEN 20
+#define WIFI_STATION_AP_MAC_LEN 18
+
+#define WEB_WLAN_STATION_AUTH_MODE_SHARED "SHARED"
+#define WEB_WLAN_STATION_AUTH_MODE_WPAPSK_WPA2PSK "WPAPSKWPA2PSK"
+#define WEB_WLAN_STATION_AUTH_MODE_WPAPSK "WPAPSK"
+#define WEB_WLAN_STATION_AUTH_MODE_WPA2PSK "WPA2PSK"
+#define WEB_WLAN_STATION_AUTH_MODE_WPAEAP_WPA2EAP "WPAEAPWPA2EAP"
+#define WEB_WLAN_STATION_AUTH_MODE_WPAEAP "WPAEAP"
+#define WEB_WLAN_STATION_AUTH_MODE_WPA2EAP "WPA2EAP"
+#define WEB_WLAN_STATION_AUTH_MODE_EAP_SIM_AKA "EAP-SIM/AKA"
+#define WEB_WLAN_STATION_AUTH_MODE_WPA2_WPA3 "WPA2WPA3"
+#define WEB_WLAN_STATION_AUTH_MODE_WPA3 "WPA3Personal"
+
+#define WEB_WLAN_STATION_ENCRYPT_TYPE_TKIP_CCMP "TKIPCCMP"
+#define WEB_WLAN_STATION_ENCRYPT_TYPE_CCMP "CCMP"
+#define WEB_WLAN_STATION_ENCRYPT_TYPE_TKIP "TKIP"
+#define WEB_WLAN_STATION_ENCRYPT_TYPE_NONE "NONE"
+#define WEB_WLAN_STATION_ENCRYPT_TYPE_WEP "WEP"
+
+#define safe_free(x) do { if(x) {free(x); x=NULL;} } while(0)
+#define wf_log(fmt, args...) \
+ do {slog(WIFI_PRINT,SLOG_ERR, "[wlan][%s-%d]: " fmt"\n", __FUNCTION__, __LINE__, ## args);} while (0)
+
+extern void zte_write_result_to_web(webs_t wp, char_t *result);
+//extern LONG zte_send_message(USHORT target_id,USHORT Msg_cmd,USHORT us_DataLen,UCHAR *pData);
+typedef enum web_wifi_profile_content {
+ WEB_WLAN_STATION_CONTENT_UNDEFINED,
+ WEB_WLAN_STATION_PROFILE_NAME,
+ WEB_WLAN_STATION_FROM_PROVIDER,
+ WEB_WLAN_STATION_CONNECT_STATUS,
+ WEB_WLAN_STATION_SIGNAL,
+ WEB_WLAN_STATION_SSID,
+ WEB_WLAN_STATION_AUTH_MODE,
+ WEB_WLAN_STATION_ENCRYPT_TYPE,
+ WEB_WLAN_STATION_PASSWORD,
+ WEB_WLAN_STATION_KEY_ID,
+ WEB_WLAN_STATION_MAC
+} web_wifi_profile_content_t;
+
+typedef struct update_spot_info {
+ char spot[WEB_WLAN_STATION_SPOT_LEN];
+ char action[WEB_WLAN_STATION_ACTION_LEN];
+} updateinfo_t;
+
+typedef struct web_spot {
+ char profile_name[WIFI_STATION_SPOT_PROFILE_NAME_LEN];
+ short from_provider;//0:·ÇÔËÓªÉÌ£¬1:ÔËÓªÉÌ
+ short connect_status;
+ short signal;
+ char ssid[WIFI_STATION_SSID_LEN];
+ char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
+ char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
+ char password[WIFI_STATION_SPOT_PASSWORD_LEN];
+ short keyID;
+ char mac[WIFI_STATION_MAC_LEN];
+} web_spot_t;
+
+static web_spot_t * g_spot_list[WEB_WLAN_STATION_SPOT_LIST_MAX] = {NULL};
+
+static int get_spot_num(char_t* spot_num)
+{
+ int num = -1;
+
+ if (spot_num == NULL) {
+ return num;
+ }
+
+ if (strcmp(spot_num, "0") == 0) {
+ num = 0;
+ } else if (strcmp(spot_num, "1") == 0) {
+ num = 1;
+ } else if (strcmp(spot_num, "2") == 0) {
+ num = 2;
+ } else if (strcmp(spot_num, "3") == 0) {
+ num = 3;
+ } else if (strcmp(spot_num, "4") == 0) {
+ num = 4;
+ } else if (strcmp(spot_num, "5") == 0) {
+ num = 5;
+ } else if (strcmp(spot_num, "6") == 0) {
+ num = 6;
+ } else if (strcmp(spot_num, "7") == 0) {
+ num = 7;
+ } else if (strcmp(spot_num, "8") == 0) {
+ num = 8;
+ } else if (strcmp(spot_num, "9") == 0) {
+ num = 9;
+ } else if (strcmp(spot_num, "10") == 0) {
+ num = 10;
+ } else {
+ }
+
+ return num;
+}
+
+static BOOL check_profile_name(char_t* profile_name)
+{
+ int profile_name_len = 0;
+
+ if (profile_name == NULL) {
+ return FALSE;
+ }
+
+ profile_name_len = strlen(profile_name);
+
+ if (profile_name_len > 0 && profile_name_len < WEB_WLAN_STATION_SPOT_PROFILE_NAME_LEN) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+
+}
+
+static BOOL check_keyID(char_t* keyID)
+{
+ int keyID_len = 0;
+
+ if (keyID == NULL) {
+ return FALSE;
+ }
+
+ keyID_len = strlen(keyID);
+
+ if (keyID_len > 0 && keyID_len < WEB_WLAN_STATION_SPOT_KEY_ID_LEN) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+
+}
+
+static BOOL check_password(char_t* password)
+{
+ int password_len = 0;
+
+ if (password == NULL) {
+ return FALSE;
+ }
+
+ password_len = strlen(password);
+
+ if (password_len >= 0 && password_len < WEB_WLAN_STATION_SPOT_PASSWORD_LEN) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+
+}
+
+static BOOL check_encrypt_type(char_t* encrypt_type)
+{
+ if (encrypt_type == NULL) {
+ return FALSE;
+ }
+
+ if (strcmp(encrypt_type, WEB_WLAN_STATION_ENCRYPT_TYPE_TKIP_CCMP) == 0
+ || strcmp(encrypt_type, WEB_WLAN_STATION_ENCRYPT_TYPE_CCMP) == 0
+ || strcmp(encrypt_type, WEB_WLAN_STATION_ENCRYPT_TYPE_TKIP) == 0
+ || strcmp(encrypt_type, WEB_WLAN_STATION_ENCRYPT_TYPE_WEP) == 0
+ || strcmp(encrypt_type, WEB_WLAN_STATION_ENCRYPT_TYPE_NONE) == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+
+}
+
+static BOOL check_auth_mode(char_t* auth_mode)
+{
+ if (auth_mode == NULL) {
+ return FALSE;
+ }
+
+ if (strcmp(auth_mode, WF_AU_OPEN) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_SHARED) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_WPAPSK_WPA2PSK) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_WPAPSK) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_WPA2PSK) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_WPAEAP_WPA2EAP) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_WPAEAP) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_WPA2EAP) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_EAP_SIM_AKA) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_WPA2_WPA3) == 0
+ || strcmp(auth_mode, WEB_WLAN_STATION_AUTH_MODE_WPA3) == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+
+}
+
+static BOOL check_signal(char_t* signal)
+{
+ if (signal == NULL) {
+ return FALSE;
+ }
+
+ if (strcmp(signal, "0") == 0
+ || strcmp(signal, "1") == 0
+ || strcmp(signal, "2") == 0
+ || strcmp(signal, "3") == 0
+ || strcmp(signal, "4") == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+
+}
+
+static BOOL check_mac(char_t * mac)
+{
+ int mac_len = 0;
+ if (mac == NULL) {
+ return FALSE;
+ }
+ mac_len = strlen(mac) + 1;
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s] mac=%s,mac_len=%d\n", __FILE__, mac, mac_len);
+ if (mac_len == WIFI_STATION_AP_MAC_LEN) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+static BOOL check_ssid(char_t* ssid)
+{
+ int ssid_len = 0;
+
+ if (ssid == NULL) {
+ return FALSE;
+ }
+
+ ssid_len = strlen(ssid);
+
+ if (ssid_len > 0 && ssid_len < WEB_WLAN_STATION_SSID_LEN) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+static BOOL check_zero_one_str(char_t* str)
+{
+ if (str == NULL) {
+ return FALSE;
+ }
+
+ if (strcmp(str, "0") == 0
+ || strcmp(str, "1") == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+static web_spot_t* parse_spot_string(char *spot_string)
+{
+ web_spot_t *spot = NULL;
+ char *splited_string = NULL;
+ char *save = NULL;
+ const char *delimiter = ",";
+ web_wifi_profile_content_t wifi_profile_content = WEB_WLAN_STATION_CONTENT_UNDEFINED;
+ char spot_string_tmp[256] = {0};
+
+ if (spot_string == NULL) {
+ return NULL;
+ }
+
+ strncpy(spot_string_tmp, spot_string, sizeof(spot_string_tmp)-1);
+
+ spot = safe_malloc(sizeof(web_spot_t), FALSE);
+ if (spot == NULL) {
+ return NULL;
+ }
+
+ //·Ö¸î×Ö·û´®£¬´æ´¢µ½½á¹¹Ìå
+ splited_string = strtok_r(spot_string_tmp, delimiter, &save);
+ while (splited_string) {
+ wifi_profile_content++;
+ switch (wifi_profile_content) {
+ case WEB_WLAN_STATION_PROFILE_NAME:
+ strncpy(spot->profile_name, splited_string, sizeof(spot->profile_name)-1);
+ break;
+ case WEB_WLAN_STATION_FROM_PROVIDER:
+ spot->from_provider = atoi(splited_string);
+ break;
+ case WEB_WLAN_STATION_CONNECT_STATUS:
+ spot->connect_status = atoi(splited_string);
+ break;
+ case WEB_WLAN_STATION_SIGNAL:
+ spot->signal = atoi(splited_string);
+ break;
+ case WEB_WLAN_STATION_SSID:
+ strncpy(spot->ssid, splited_string, sizeof(spot->ssid)-1);
+ break;
+ case WEB_WLAN_STATION_AUTH_MODE:
+ strncpy(spot->auth_mode, splited_string, sizeof(spot->auth_mode)-1);
+ break;
+ case WEB_WLAN_STATION_ENCRYPT_TYPE:
+ strncpy(spot->encrypt_type, splited_string, sizeof(spot->encrypt_type)-1);
+ break;
+ case WEB_WLAN_STATION_PASSWORD:
+ strncpy(spot->password, splited_string, sizeof(spot->password)-1);
+ break;
+ case WEB_WLAN_STATION_KEY_ID:
+ spot->keyID = atoi(splited_string);
+ break;
+ case WEB_WLAN_STATION_MAC:
+ strncpy(spot->mac, splited_string, sizeof(spot->mac)-1);
+ break;
+ default:
+ break;
+ }
+
+ splited_string = strtok_r(NULL, delimiter, &save);
+ }
+
+ if (wifi_profile_content != WEB_WLAN_STATION_MAC) {
+ safe_free(spot);
+ return NULL;
+ }
+
+ return spot;
+
+}
+
+
+
+static BOOL check_wifi_profile(char_t* wifi_profile)
+{
+ web_wifi_profile_content_t wifi_profile_content = WEB_WLAN_STATION_CONTENT_UNDEFINED;
+ char_t *splited_string = NULL;
+ char_t *save = NULL;
+ char_t *delimiter = ",";
+ char_t wifi_profile_temp[WEB_WLAN_STATION_SPOT_LEN] = {0};
+
+ if (wifi_profile == NULL) {
+ return FALSE;
+ }
+
+ strncpy(wifi_profile_temp, wifi_profile, sizeof(wifi_profile_temp)-1);
+
+ //·Ö¸î×Ö·û´®
+ splited_string = strtok_r(wifi_profile_temp, delimiter, &save);
+ while (splited_string) {
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]profile split=%s\n", __FILE__, splited_string);
+ wifi_profile_content++;
+ switch (wifi_profile_content) {
+ case WEB_WLAN_STATION_PROFILE_NAME://profile_name
+ if (check_profile_name(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_FROM_PROVIDER://from_provider
+ if (check_zero_one_str(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_CONNECT_STATUS://connect_status
+ if (check_zero_one_str(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_SIGNAL://signal
+ if (check_signal(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_SSID://ssid
+ if (check_ssid(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_AUTH_MODE://auth_mode
+ if (check_auth_mode(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_ENCRYPT_TYPE://encrypt_type
+ if (check_encrypt_type(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_PASSWORD://password
+ if (check_password(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_KEY_ID://keyID
+ if (check_keyID(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ case WEB_WLAN_STATION_MAC://mac
+ if (check_mac(splited_string) == FALSE) {
+ return FALSE;
+ }
+ break;
+ default:
+ return FALSE;
+ }
+
+ splited_string = strtok_r(NULL, delimiter, &save);
+ }
+
+ if (wifi_profile_content == WEB_WLAN_STATION_MAC) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+
+}
+
+static BOOL check_set_value(char_t* wifi_sta_connection)
+{
+ if (wifi_sta_connection == NULL) {
+ return FALSE;
+ }
+
+ if (check_zero_one_str(wifi_sta_connection) == FALSE) {
+ return FALSE;
+ }
+ /***
+ if(strcmp(ap_station_mode, WEB_WLAN_STATION_MODE_WIFI_PREF) == 0
+ || strcmp(ap_station_mode, WEB_WLAN_STATION_MODE_DIAL_PREF) == 0)
+ {
+ }
+ else
+ {
+ return FALSE;
+ }
+ *****/
+ return TRUE;
+
+}
+
+static BOOL check_spot_value(char_t* action, char_t* wifi_profile_num, char_t* old_wifi_profile_num, char_t* wifi_update_profile, char_t** wifi_profile)
+{
+ int spot_num_new = -1;
+ int spot_num_old = -1;
+ int temp = -5;
+ int i = 0;
+ int j = 0;
+ char_t profile_name_tmp1[WEB_WLAN_STATION_SPOT_PROFILE_NAME_LEN] = {0};
+ char_t profile_name_tmp2[WEB_WLAN_STATION_SPOT_PROFILE_NAME_LEN] = {0};
+
+ if (action == NULL || wifi_profile_num == NULL || old_wifi_profile_num == NULL
+ || wifi_update_profile == NULL || wifi_profile == NULL) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]para is null\n", __FILE__);
+ return FALSE;
+ }
+
+ spot_num_new = get_spot_num(wifi_profile_num);
+ spot_num_old = get_spot_num(old_wifi_profile_num);
+ temp = spot_num_new - spot_num_old;
+
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]spot_num_new=%d\n", __FILE__, spot_num_new);
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]spot_num_old=%d\n", __FILE__, spot_num_old);
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]temp=%d\n", __FILE__, temp);
+
+ //¼ì²éwifi_profile
+ for (i = 0; i < spot_num_new; i++) {
+ //¼ì²éµ¥¸öwifi_profile±¾ÉíµÄºÏ·¨ÐÔ
+ if (check_wifi_profile(wifi_profile[i]) == FALSE) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]wifi_profile[%d]=%s wrong\n", __FILE__, i, wifi_profile[i]);
+
+ return FALSE;
+ }
+
+ }
+#if 0
+ //¼ì²éwifi_update_profile±¾ÉíµÄºÏ·¨ÐÔ
+ if (check_wifi_profile(wifi_update_profile) == FALSE) {
+ wf_log("[%s]wifi_update_profile wrong\n", __FILE__);
+ return FALSE;
+ }
+#endif
+ //¼ì²éaction
+
+ if (strcmp(action, WEB_WLAN_STATION_SPOT_ADD) == 0) {
+ //¼ì²éwifi_profile_num
+ if (spot_num_new > 0 && temp == 1) { //kw 3
+ } else {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]wifi_profile_num add wrong\n", __FILE__);
+ return FALSE;
+ }
+ } else if (strcmp(action, WEB_WLAN_STATION_SPOT_MODIFY) == 0) {
+ //¼ì²éwifi_profile_num
+ if (spot_num_new > 0 && temp == 0) { //kw 3
+ } else {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]wifi_profile_num modify wrong\n", __FILE__);
+
+ return FALSE;
+ }
+ } else if (strcmp(action, WEB_WLAN_STATION_SPOT_DEL) == 0) {
+ //¼ì²éwifi_profile_num
+ if (spot_num_new >= 0 && temp == -1) { //kw 3
+ } else {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]wifi_profile_num del wrong\n", __FILE__);
+
+ return FALSE;
+ }
+ } else {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]wifi_profile_num action wrong\n", __FILE__);
+
+ return FALSE;
+ }
+
+ //È·±£ÐµÄÈȵãÁбíÖеÄprofile nameµÄΨһÐÔ
+ for (i = 0; i < spot_num_new - 1; i++) {
+ for (j = i + 1; j < spot_num_new; j++) {
+ sscanf(wifi_profile[i], "%29[^,]", profile_name_tmp1);
+ sscanf(wifi_profile[j], "%29[^,]", profile_name_tmp2);
+ if (strcmp(profile_name_tmp1, profile_name_tmp2) == 0) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]wifi_profile_num profile name wrong\n", __FILE__);
+
+ return FALSE;
+ }
+ }
+ }
+
+
+ //TODO Ôݲ»¿¼ÂǼì²é¾ÉµÄÓëеÄwifi_profileµÄ±È½ÏµÄºÏ·¨ÐÔ
+
+ return TRUE;
+
+}
+
+static BOOL check_connect_value(char_t* ssid, char_t* auth_mode, char_t* encrypt_type, char_t* keyID, char_t* profile, char_t* wep_key, char_t* wpa_psk1)
+{
+ if (ssid == NULL || auth_mode == NULL || wep_key == NULL || wpa_psk1 == NULL
+ || encrypt_type == NULL || keyID == NULL || profile == NULL) {
+ return FALSE;
+ }
+
+ if (check_ssid(ssid) == FALSE) {
+ return FALSE;
+ }
+
+ if (check_auth_mode(auth_mode) == FALSE) {
+ return FALSE;
+ }
+
+ if (check_encrypt_type(encrypt_type) == FALSE) {
+ return FALSE;
+ }
+
+ if (check_keyID(keyID) == FALSE) {
+ return FALSE;
+ }
+
+ if (check_profile_name(profile) == FALSE) {
+ return FALSE;
+ }
+
+ if (check_password(wep_key) == FALSE) {
+ return FALSE;
+ }
+
+ if (check_password(wpa_psk1) == FALSE) {
+ return FALSE;
+ }
+
+ return TRUE;
+
+}
+
+/**********************************************************************
+* Function: sort_spot
+* Description: sort spot by requirement
+* Input: g_spot_list
+* Output: sort the spot, save in g_spot_list
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2015/03/09 V1.0 xujian first version
+**********************************************************************/
+void insert_to_spot_list(int priority, web_spot_t * spot)
+{
+ int i = 0, j = 0;
+
+
+
+ //1. provider ap place the first
+ //2. last connected ap place the second
+ if (1 == priority || 2 == priority) {
+
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+ if (g_spot_list[i] == NULL) {
+ g_spot_list[i] = spot;
+ return;
+ } else {
+ if (1 == g_spot_list[i]->from_provider) {
+ continue;
+ } else {
+
+ //½«ÓàÏÂÈȵãÈ«²¿ºóÒÆÒ»¸öλÖ㬿ճöµ±Ç°iµÄλÖÃ
+ for (j = WEB_WLAN_STATION_SPOT_LIST_MAX - 2; j >= i; j--) { // ¼Ù¶¨×îºóÒ»¸ö¿Ï¶¨Êǿյ쬲»¿ÉÄÜ10¸öÂúÁË£¬»¹ÔÚÌí¼ÓÈȵ㣬֮ǰÒѾÅжϴíÎó·µ»ØÁË
+ if (g_spot_list[j] == NULL)continue;
+ else {
+ g_spot_list[j + 1] = g_spot_list[j];
+ }
+ }
+
+ g_spot_list[i] = spot;
+ return;
+ }
+ }
+ }
+ }
+
+
+ //3. other ap stay
+ if (3 == priority) {
+
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+
+ if (g_spot_list[i] != NULL)continue;
+
+ g_spot_list[i] = spot;
+ return;
+
+ }
+ }
+
+}
+
+void resort_spot_list(int priority, char * profile_name)
+{
+
+ int i = 0, j = 0;
+ char_t wifi_profile_nv_name[WEB_WLAN_STATION_PROFILE_NV_NAME_LEN] = {0};
+ char spot_string[256] = {0};
+
+ int index = 0;
+ web_spot_t * spot = NULL;
+
+
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+ if (g_spot_list[i] != NULL) {
+ if (strcmp(g_spot_list[i]->profile_name, profile_name) == 0) {
+ index = i;
+ spot = g_spot_list[i];
+ break;
+ }
+ }
+
+ }
+
+ if (index == 0) return;
+
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+ if (1 == g_spot_list[i]->from_provider) {
+ continue;
+ } else {
+ //move other spot
+ for (j = index; j > i; j--) { // ¼Ù¶¨×îºóÒ»¸ö¿Ï¶¨Êǿյ쬲»¿ÉÄÜ10¸öÂúÁË£¬»¹ÔÚÌí¼ÓÈȵ㣬֮ǰÒѾÅжϴíÎó·µ»ØÁË
+ if (g_spot_list[j] == NULL)continue;
+ else {
+ g_spot_list[j] = g_spot_list[j - 1]; //j must greater than 0
+ }
+ }
+
+ g_spot_list[i] = spot;
+ break;
+ }
+ }
+
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+ if (i == 0) {
+ safe_strcpy(wifi_profile_nv_name, "wifi_profile", WEB_WLAN_STATION_PROFILE_NV_NAME_LEN);
+ } else {
+ memset(wifi_profile_nv_name, 0, WEB_WLAN_STATION_PROFILE_NV_NAME_LEN);
+ snprintf(wifi_profile_nv_name, WEB_WLAN_STATION_PROFILE_NV_NAME_LEN, "wifi_profile%d", i);
+ }
+
+
+ memset(spot_string, 0, sizeof(spot_string));
+ if (g_spot_list[i] != NULL) {
+ snprintf(spot_string, WIFI_STATION_SPOT_LEN, "%s,%d,%d,%d,%s,%s,%s,%s,%d", g_spot_list[i]->profile_name,
+ g_spot_list[i]->from_provider, g_spot_list[i]->connect_status, g_spot_list[i]->signal,
+ g_spot_list[i]->ssid, g_spot_list[i]->auth_mode, g_spot_list[i]->encrypt_type,
+ g_spot_list[i]->password, g_spot_list[i]->keyID);
+ }
+
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]wifi_profile_nv_name=%s, spot_string=%s\n", __FILE__, wifi_profile_nv_name, spot_string);
+
+ zte_web_write(wifi_profile_nv_name, spot_string);
+ }
+
+
+
+
+}
+
+
+/**********************************************************************
+* Function: zte_wlan_station_set
+* Description: to set the wifi station func
+* Input: http info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2015/03/09 V1.0 xujian first version
+**********************************************************************/
+void zte_wlan_station_set(webs_t wp)
+{
+ char_t *wifi_sta_connection = NULL;
+ //char_t *ap_station_mode = NULL;
+ char_t old_wifi_sta_connection[WEB_WLAN_STATION_CONNECTION_LEN + 1] = {0};
+ long lRet = 0;
+
+ char MAX_Access_num_bak[16] = {0};
+ char m_ssid_enable[16] = {0};
+ wifi_sta_connection = websGetVar(wp, T("wifi_sta_connection"), T(""));
+ //ap_station_mode = websGetVar(wp, T("ap_station_mode"), T(""));
+
+
+ //²ÎÊýºÏ·¨ÐÔ¼ì²é
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]zte_wlan_station_set !\n", __FILE__);
+ if (check_set_value(wifi_sta_connection) == FALSE) {
+ zte_write_result_to_web(wp, FAILURE);
+
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]parameter wrong!\n", __FILE__);
+ return;
+ }
+
+ //¶Á¾ÉÖµ
+ (void)zte_web_read("wifi_sta_connection", old_wifi_sta_connection);
+
+
+ //дNV
+ (void)zte_web_write("wifi_sta_connection", wifi_sta_connection);
+ if (strcmp(wifi_sta_connection, "1") == 0) { // »¥³â±£»¤
+ (void)zte_web_read("m_ssid_enable", m_ssid_enable);
+
+ if (!strcmp(m_ssid_enable, "1")) { //if multi ssid is open, recovery the max access nv
+ zte_web_read("MAX_Access_num_bak", MAX_Access_num_bak);
+ zte_web_write("MAX_Access_num", MAX_Access_num_bak);
+ zte_web_write("m_ssid_enable", "0");
+ wlan_set_change_ssid_key_status();//added by dujiajiao, for the switch between apsta and mssid
+ }
+ }
+ //(void)zte_web_write("ap_station_mode", ap_station_mode);
+
+ if (strcmp(wifi_sta_connection, "0") == 0) { //¹¦ÄܹرÕ
+
+ //ÉèÖõÄÖµºÍÔÏȵÄÒ»Ö£¬ÔòÖ±½Ó»Ø¸´³É¹¦
+ if (strcmp(wifi_sta_connection, old_wifi_sta_connection) == 0) {
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+ }
+ //else{
+ //zte_web_write("RadioOff", "0"); // set ap radio off
+ //}
+
+
+ //TODO ×Ü¿ØÄ£¿é¿ØÖÆ--Èç¹ûWIFIÊÇÁ¬½ÓÈȵã״̬£¬Ôò¶Ï¿ªÈȵãÁ¬½Ó,ÔÙ×ßMODEM×Ô¶¯ÖØÁ¬Á÷³Ì
+ zte_web_write("user_initiate_disconnect", "0"); //Óû§Ö÷¶¯Á¬½Ó״̬£¬Í˳ö¸ÉԤģʽ
+ zte_web_write("manual_d_wifi", "0");
+
+
+ //lRet=zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_CLOSE, 0, NULL);
+ lRet = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_CLOSE, 0, NULL, 0);
+ if (lRet != 0) {
+ //zte_web_write("RadioOff", "1");
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]zte_wlan_station_set MSG_CMD_WIFI_STATION_CLOSE failed\n", __FILE__);
+ } else {
+
+ slog(WIFI_PRINT, SLOG_NORMAL,"[%s]zte_wlan_station_set MSG_CMD_WIFI_STATION_CLOSE!\n", __FILE__);
+ }
+
+ } else if (strcmp(wifi_sta_connection, "1") == 0) { //¹¦ÄÜ¿ªÆô
+
+ if (strcmp(wifi_sta_connection, old_wifi_sta_connection) == 0) {
+ // apsta ûÓпªÆô¶¯×÷£¬²»ÐèÒªÉèÖÃRadioOff
+
+ zte_web_write("user_initiate_disconnect", "0"); //Óû§Ö÷¶¯Á¬½Ó״̬£¬Í˳ö¸ÉԤģʽ
+ zte_web_write("manual_d_wifi", "0");
+ /************
+ if(strcmp(ap_station_mode, WEB_WLAN_STATION_MODE_WIFI_PREF) == 0)
+ {
+ // zte_send_message(MODULE_ID_BLC_RCV, MSG_CMD_BLC_SET_WIFISTATION_PRE, 0, NULL);
+ wf_log("[%s]zte_wlan_station_set WIFISTATION_PRE!\n",__FILE__);
+ }
+ else if(strcmp(ap_station_mode, WEB_WLAN_STATION_MODE_DIAL_PREF) == 0)
+ {
+ //zte_send_message(MODULE_ID_BLC_RCV, MSG_CMD_BLC_SET_MODEM_PRE, 0, NULL);
+ wf_log("[%s]zte_wlan_station_set MODEM_PRE!\n",__FILE__);
+ }
+ **********/
+
+ } else {
+ //zte_web_write("RadioOff", "0"); // set ap radio off
+
+ zte_web_write("user_initiate_disconnect", "0"); //Óû§Ö÷¶¯Á¬½Ó״̬£¬Í˳ö¸ÉԤģʽ
+ zte_web_write("manual_d_wifi", "0");
+
+ //lRet=zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_OPEN, 0, NULL);
+ lRet = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_OPEN, 0, NULL, 0);
+ if (lRet != 0) {
+ //zte_web_write("RadioOff", "1");
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]zte_wlan_station_set MSG_CMD_WIFI_STATION_OPEN failed\n", __FILE__);
+ } else {
+
+ slog(WIFI_PRINT, SLOG_NORMAL,"[%s]zte_wlan_station_set MSG_CMD_WIFI_STATION_OPEN!\n", __FILE__);
+ }
+
+ }
+ }
+ slog(WIFI_PRINT, SLOG_DEBUG,"zte_wlan_station_set SUCCESS!\n");//cov m
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*
+ µ±É¾³ýµÄÈȵã Óë Á¬½Ó¹ýµÄÈȵã ÊÇͬһ¸öÈȵãµÄʱºò£¬ÐèÒª½«
+
+ EX_SSID1µÈ ÖØÖÃΪ¿Õ£¬²»È»Ï´λáÈ¥Á¬½ÓÕâ¸ö²»´æÔÚµÄÈȵ㣬
+
+ 1¡¢Èç¹ûɾ³ýºóÖØÐÂÌí¼Ó£¬½ö½öÊÇprofile name²»Í¬£¬ÈÔÈ»»áÁ¬½ÓÉϵ«ÊÇÎÞ·¨½«wifi_profile µÄ״̬λÖÃΪ 1£¬ÒòΪprofileÒѾ²»ÏàµÈÁË
+
+ 2¡¢Èç¹ûÊÇɾ³ýºó£¬¸ÃÈȵãʵ¼ÊÈÔÈ»´æÔÚ£¬Èç¹ûwlanstation²»×ö profile_numΪ0µÄ±£»¤£¬Ôò»¹ÊÇ»áÁ¬½ÓÉÏ£¬µ¼ÖÂ״̬´íÂÒ
+
+ ËùÒÔÇå¿ÕÕâЩnvÖµÊÇÓбØÒªµÄ
+
+*/
+void zte_wlan_reset_EX_ap(void)
+{
+
+ zte_web_write("EX_SSID1", "");
+ zte_web_write("EX_AuthMode", "");
+ zte_web_write("EX_EncrypType", "");
+ zte_web_write("EX_DefaultKeyID", "");
+ zte_web_write("EX_WEPKEY", "");
+ zte_web_write("EX_WPAPSK1", "");
+ zte_web_write("EX_wifi_profile", "");
+ zte_web_write("EX_mac", "");
+}
+
+/**********************************************************************
+* Function: zte_wlan_station_spot_profile_update
+* Description: to update the wifi spot profile
+* Input: http info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2015/03/09 V1.0 xujian first version
+**********************************************************************/
+void zte_wlan_station_spot_profile_update(webs_t wp)
+{
+ char_t *action = NULL;
+ char_t *wifi_profile_num = NULL;
+ char_t old_wifi_profile_num[WEB_WLAN_STATION_SPOT_NUM_LEN + 1] = {0};
+ char_t *wifi_update_profile = NULL;
+ char_t *wifi_profile[WEB_WLAN_STATION_SPOT_LIST_MAX] = {NULL};
+ char_t sta_ip_status[WEB_WLAN_STATION_IP_STATUS_LEN + 1] = {0};
+ char_t wifi_sta_connection[WEB_WLAN_STATION_CONNECTION_LEN + 1] = {0};
+ char_t wifi_profile_nv_name[WEB_WLAN_STATION_PROFILE_NV_NAME_LEN] = {0};
+ updateinfo_t info = {0};
+
+ char_t current_profile[WEB_WLAN_STATION_SPOT_PROFILE_NAME_LEN] = {0};
+ char spot_string[WEB_WLAN_STATION_SPOT_LEN] = {0};
+
+ char wifi_profile_string[WEB_WLAN_STATION_SPOT_LEN] = {0};
+ web_spot_t * web_wifi_profile = NULL;
+ web_spot_t * nv_wifi_profile = NULL;
+
+ web_spot_t * tmp_wifi_profile = NULL;
+
+ web_spot_t * web_spot = NULL;
+ web_spot_t * update_spot = NULL;
+ int i = 0;
+
+ int current_profile_flag = -1; //sorted num of wifi_profile(nv) in web ui
+
+ slog(WIFI_PRINT, SLOG_NORMAL,"[%s]update spot profile\n", __FILE__);
+
+ //Èç¹ûWIFIÊÇÕýÔÚÁ¬½ÓÈȵã״̬£¬Ôò²»ÔÊÐíÐÞ¸ÄÈȵãÐÅÏ¢
+ (void)zte_web_read("sta_ip_status", sta_ip_status);
+ if (strcmp(sta_ip_status, WEB_WLAN_STATION_IP_STATUS_CONNECTING) == 0 ||
+ strcmp(sta_ip_status, WIFI_STATION_IP_STATUS_DHCPING) == 0) {
+ //zte_write_result_to_web(wp,FAILURE);
+ zte_write_result_to_web(wp, PROCESSING);
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]update spot profile,connecting so failed\n", __FILE__);
+
+ return;
+ }
+
+ //¹¦Äܹرգ¬Ôò·µ»Ø´íÎó
+ (void)zte_web_read("wifi_sta_connection", wifi_sta_connection);
+ if (strcmp(wifi_sta_connection, "1") != 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]update spot profile,wifi sta no open so failed\n", __FILE__);
+
+ return;
+ }
+
+ action = websGetVar(wp, T("action"), T(""));
+ wifi_profile_num = websGetVar(wp, T("wifi_profile_num"), T(""));
+ wifi_update_profile = websGetVar(wp, T("wifi_update_profile"), T(""));
+
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]update spot profile,wifi_profile_num=%s\n", __FILE__, wifi_profile_num);
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]update spot profile,wifi_update_profile=%s\n", __FILE__, wifi_update_profile);
+
+ zte_web_read("EX_wifi_profile", current_profile);
+
+ if (strcmp(action, WEB_WLAN_STATION_SPOT_DEL) == 0) {
+
+ if (strncmp(current_profile, wifi_update_profile, 20) == 0) {
+
+//webui´æÔÚË¢ÐÂÎÊÌ⣬»áÓмä϶ ¿ÉÒÔ±»É¾³ý£¬ÐèÒªÔö¼Ó´Ë±£»¤£¬Á¬½Ó״̬µÄÈȵ㣬²»ÔÊÐí±»É¾³ý
+ if (strcmp(sta_ip_status, WEB_WLAN_STATION_IP_STATUS_CONNECT) == 0) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]do not allow del connected profile=%s,[%s]\n", __FILE__, wifi_update_profile, current_profile);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ } else {
+//Èç¹ûɾ³ýÁË֮ǰÁ¬½Ó¹ýµÄÈȵ㣬ÐèÒªÇå¿ÕEX_SSID1µÈnvÖµ
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]reset EX_SSID1 EX_wifi_profile=[%s]\n", __FILE__, current_profile);
+ zte_wlan_reset_EX_ap();
+ }
+ }
+ }
+ if (strcmp(action, WEB_WLAN_STATION_SPOT_MODIFY) == 0) {
+ sc_cfg_get("wifi_profile", wifi_profile_string, sizeof(wifi_profile_string));
+ if (strcmp(wifi_profile_string, "") == 0) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]error!nv:wifi_profile=%s\n", __FILE__, wifi_profile_string);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ nv_wifi_profile = parse_spot_string(wifi_profile_string);
+ if (NULL == nv_wifi_profile) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]error!nv_wifi_profile=null\n", __FILE__);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ }
+
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+ if (i == 0) {
+ safe_strcpy(wifi_profile_nv_name, "wifi_profile", WEB_WLAN_STATION_PROFILE_NV_NAME_LEN);
+ } else {
+ memset(wifi_profile_nv_name, 0, WEB_WLAN_STATION_PROFILE_NV_NAME_LEN);
+ snprintf(wifi_profile_nv_name, WEB_WLAN_STATION_PROFILE_NV_NAME_LEN, "wifi_profile%d", i);
+ }
+
+ //»ñÈ¡WEB²ÎÊýÖµ
+ wifi_profile[i] = websGetVar(wp, wifi_profile_nv_name, T(""));
+
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]update spot profile,wifi_profile[%d]=%s\n", __FILE__, i, wifi_profile[i]);
+#if 0
+ if (strcmp(action, WEB_WLAN_STATION_SPOT_MODIFY) == 0) {
+ tmp_wifi_profile = parse_spot_string(wifi_profile[i]);
+ //kw 3
+ if ((NULL != tmp_wifi_profile) && (NULL != nv_wifi_profile) && (strcmp(nv_wifi_profile->profile_name, tmp_wifi_profile->profile_name) == 0)) {
+ current_profile_flag = i;
+ web_wifi_profile = tmp_wifi_profile;
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]current_profile_flag=%d\n", __FILE__, i);
+ } else {
+ safe_free(tmp_wifi_profile);//cov
+ }
+ }
+#endif
+ }
+ //kw 3
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+ if (strcmp(action, WEB_WLAN_STATION_SPOT_MODIFY) == 0) {
+ tmp_wifi_profile = parse_spot_string(wifi_profile[i]);
+ if ((NULL != tmp_wifi_profile) && (NULL != nv_wifi_profile) && (strcmp(nv_wifi_profile->profile_name, tmp_wifi_profile->profile_name) == 0)) {
+ current_profile_flag = i;
+ web_wifi_profile = tmp_wifi_profile;
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]current_profile_flag=%d\n", __FILE__, i);
+ break;
+ } else {
+ safe_free(tmp_wifi_profile);//cov
+ }
+ }
+ }
+
+ if (strcmp(action, WEB_WLAN_STATION_SPOT_MODIFY) == 0) {
+ if (current_profile_flag <= -1) { //kw 3
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]error!current_profile_flag=%d\n", __FILE__, current_profile_flag);
+ zte_write_result_to_web(wp, FAILURE);
+ goto end;
+ }
+ if (web_wifi_profile->connect_status != nv_wifi_profile->connect_status) {
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]error!web_wifi_profile->connect_status=%d,nv_wifi_profile->connect_status=%d\n", __FILE__,
+ web_wifi_profile->connect_status, nv_wifi_profile->connect_status);
+ zte_write_result_to_web(wp, PROCESSING);
+ goto end;
+ }
+ }
+ //¶Á¾ÉÖµ
+ (void)zte_web_read("wifi_profile_num", old_wifi_profile_num);
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]update spot profile, old_wifi_profile_num=%s\n", __FILE__, old_wifi_profile_num);
+
+ //²ÎÊýºÏ·¨ÐÔ¼ì²é
+ if (check_spot_value(action, wifi_profile_num, old_wifi_profile_num, wifi_update_profile, wifi_profile) == FALSE) {
+ zte_write_result_to_web(wp, FAILURE);
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]update spot profile,para wrong so failed\n", __FILE__);
+ goto end;
+ }
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]update spot profile, action=%s\n", __FILE__, action);
+
+
+
+ //ÏÈÊÍ·Å֮ǰ´æ´¢µÄÈȵãÁбíÄÚ´æ
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+ safe_free(g_spot_list[i]);
+ }
+
+//½«Èȵã½âÎöµ½ ½á¹¹ÌåÀïÃæ£¬·½±ãÅÅÐòʹÓÃ
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+
+ web_spot = parse_spot_string(wifi_profile[i]);
+
+ if (NULL == web_spot)break;
+
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]web_spot->ssid=%s\n", __FILE__, web_spot->ssid);
+
+ if (web_spot->from_provider == 1) // ÔËÓªÉÌÈȵãÌí¼ÓÔÚµÚһλ
+ insert_to_spot_list(1, web_spot);
+ else if (strcmp(current_profile, web_spot->profile_name) == 0) // Èç¹ûÊǵ±Ç°Á´½ÓµÄÈȵ㣬ÔòÐèÒªÅÅÔÚÔËÓªÉ̺óÃæ
+ insert_to_spot_list(2, web_spot);
+ else
+ insert_to_spot_list(3, web_spot); //ÆÕͨÈȵ㣬°´Ë³ÐòÍùºóÅÅ
+
+ }
+
+//½«¸üÐÂÈÈµã½øÐзֽ⣬´æµ½ÏàÓ¦½á¹¹ÌåÖÐ
+ update_spot = parse_spot_string(wifi_update_profile);
+ if (update_spot != NULL) {
+ char *ptr = NULL;
+ size_t key_len = 0;
+
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]update_spot->ssid=%s\n", __FILE__, update_spot->ssid);
+ //ÅжÏwep³¤¶ÈÊÇ·ñΪ5¡¢13¡¢16
+ ptr = strstr (update_spot->encrypt_type, "WEP");
+ if (ptr) {
+ key_len = strnlen(update_spot->password,WIFI_STATION_SPOT_PASSWORD_LEN);
+ if (key_len != 5 && key_len != 13 && key_len != 16) { //ascii
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]error!wep key len invalid\n", __FILE__);
+ zte_write_result_to_web(wp, FAILURE);
+ safe_free(update_spot);
+ goto end;
+ }
+ }
+
+ }
+
+//µ±±à¼Ê±ºò£¬ÐèÒª²é¿´ÊÇ·ñÐèÒª¸üÐÂEX AP Ïà¹ØÄÚÈÝ
+ if (update_spot != NULL && strcmp(action, WEB_WLAN_STATION_SPOT_MODIFY) == 0) {
+ if (strcmp(current_profile, update_spot->profile_name) == 0) {
+ char keyid[8] = {0};
+ sprintf(keyid, "%d", update_spot->keyID);
+ zte_web_write("EX_SSID1", update_spot->ssid);
+ zte_web_write("EX_AuthMode", update_spot->auth_mode);
+ zte_web_write("EX_EncrypType", update_spot->encrypt_type);
+ zte_web_write("EX_DefaultKeyID", keyid);
+ zte_web_write("EX_WPAPSK1", update_spot->password);
+ zte_web_write("EX_WEPKEY", update_spot->password);
+ zte_web_write("EX_mac", update_spot->mac);
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]reset EX_SSID1=%s ,EX_AuthMode=%s ,EX_EncrypType=%s ,EX_DefaultKeyID =%d ,EX_WPAPSK1=EX_WEPKEY=[%s]=\n",
+ __FILE__, update_spot->ssid, update_spot->auth_mode, update_spot->encrypt_type, update_spot->keyID, update_spot->password);
+ }
+ }
+//²é¿´ÊÇ·ñÖØ¸´Ìí¼ÓÏàͬSSID
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+ if (g_spot_list[i] != NULL && update_spot != NULL) {
+ if (strcmp(g_spot_list[i]->profile_name, update_spot->profile_name) != 0 &&
+ strcmp(g_spot_list[i]->ssid, update_spot->ssid) == 0 &&
+ strcmp(action, WEB_WLAN_STATION_SPOT_ADD) == 0) {
+ safe_free(update_spot);
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]not allow add the same SSID¡¡spot\n", __FUNCTION__);
+ zte_write_result_to_web(wp, EXIST);
+ goto end;
+
+ } else if (
+ strcmp(g_spot_list[i]->profile_name, update_spot->profile_name) != 0 &&
+ strcmp(g_spot_list[i]->ssid, update_spot->ssid) == 0 &&
+ strcmp(action, WEB_WLAN_STATION_SPOT_MODIFY) == 0) {
+ safe_free(update_spot);
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]not allow modify to the existed SSID from spot list!\n", __FUNCTION__);
+ zte_write_result_to_web(wp, EXIST);
+ goto end;
+ }
+ }
+ }
+ safe_free(update_spot);
+
+
+
+
+ //×îºó½«¸üеÄnvÖµ ±£´æ дÈë
+ (void)zte_web_write("wifi_profile_num", wifi_profile_num);
+
+ for (i = 0; i < WEB_WLAN_STATION_SPOT_LIST_MAX; i++) {
+
+ if (i == 0) {
+ safe_strcpy(wifi_profile_nv_name, "wifi_profile", WEB_WLAN_STATION_PROFILE_NV_NAME_LEN);
+ } else {
+ memset(wifi_profile_nv_name, 0, WEB_WLAN_STATION_PROFILE_NV_NAME_LEN);
+ snprintf(wifi_profile_nv_name, WEB_WLAN_STATION_PROFILE_NV_NAME_LEN, "wifi_profile%d", i);
+ }
+ memset(spot_string, 0, sizeof(spot_string));
+ if (g_spot_list[i] != NULL) {
+ snprintf(spot_string, WIFI_STATION_SPOT_LEN, "%s,%d,%d,%d,%s,%s,%s,%s,%d,%s", g_spot_list[i]->profile_name,
+ g_spot_list[i]->from_provider, g_spot_list[i]->connect_status, g_spot_list[i]->signal,
+ g_spot_list[i]->ssid, g_spot_list[i]->auth_mode, g_spot_list[i]->encrypt_type,
+ g_spot_list[i]->password, g_spot_list[i]->keyID, g_spot_list[i]->mac);
+ }
+
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]wifi_profile_nv_name=%s, spot_string=%s\n", __FILE__, wifi_profile_nv_name, spot_string);
+ (void)zte_web_write(wifi_profile_nv_name, spot_string);
+ }
+
+ strncpy(info.action, action,sizeof(info.action)-1);
+ strncpy(info.spot, wifi_update_profile, sizeof(info.spot)-1);
+ slog(WIFI_PRINT, SLOG_NORMAL,"[%s]xujian send MSG_CMD_WIFI_STATION_SPOT_UPDATE start action =%s \n", __FILE__, info.action);
+ //zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_SPOT_UPDATE, sizeof(info),(UCHAR*)info);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_SPOT_UPDATE, sizeof(updateinfo_t), (UCHAR*)&info, 0);
+ slog(WIFI_PRINT, SLOG_DEBUG,"[%s]xujian send MSG_CMD_WIFI_STATION_SPOT_UPDATE end\n", __FILE__);
+
+ zte_write_result_to_web(wp, SUCCESS);
+
+end:
+ safe_free(nv_wifi_profile);
+ safe_free(tmp_wifi_profile);
+}
+
+/**********************************************************************
+* Function: zte_wlan_station_connect
+* Description: to connect the wifi spot
+* Input: http info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2015/03/09 V1.0 xujian first version
+**********************************************************************/
+void zte_wlan_station_connect(webs_t wp)
+{
+ char_t *EX_SSID1 = NULL;
+ char_t *EX_AuthMode = NULL;
+ char_t *EX_EncrypType = NULL;
+ char_t *EX_DefaultKeyID = NULL;
+ char_t *EX_WEPKEY = NULL;
+ char_t *EX_WPAPSK1 = NULL;
+ char_t *EX_wifi_profile = NULL;
+ char_t *EX_mac = NULL;
+ char_t sta_ip_status[WEB_WLAN_STATION_IP_STATUS_LEN + 1] = {0};
+ char_t wifi_sta_connection[WEB_WLAN_STATION_CONNECTION_LEN + 1] = {0};
+ char wifi_cur_state[8] = {0};
+
+ long ret = 0;
+
+ EX_SSID1 = websGetVar(wp, T("EX_SSID1"), T(""));
+ EX_AuthMode = websGetVar(wp, T("EX_AuthMode"), T(""));
+ EX_EncrypType = websGetVar(wp, T("EX_EncrypType"), T(""));
+ EX_DefaultKeyID = websGetVar(wp, T("EX_DefaultKeyID"), T(""));
+ EX_WEPKEY = websGetVar(wp, T("EX_WEPKEY"), T(""));
+ EX_WPAPSK1 = websGetVar(wp, T("EX_WPAPSK1"), T(""));
+ EX_wifi_profile = websGetVar(wp, T("EX_wifi_profile"), T(""));
+ EX_mac = websGetVar(wp, T("EX_mac"), T(""));
+ slog(WIFI_PRINT, SLOG_NORMAL,"-----zte_wlan_station_connect-----EX_AuthMode is %s\n", EX_AuthMode);
+ //²ÎÊýºÏ·¨ÐÔ¼ì²é
+ if (check_connect_value(EX_SSID1, EX_AuthMode, EX_EncrypType, EX_DefaultKeyID, EX_wifi_profile, EX_WEPKEY, EX_WPAPSK1) == FALSE) {
+ zte_write_result_to_web(wp, FAILURE);
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]connect para check failed\n", __FILE__);
+
+ return;
+ }
+
+ //Èç¹ûWIFIÊÇÕýÔÚÁ¬½ÓÈȵã״̬,Ôò·µ»Ø´íÎó
+ (void)zte_web_read("sta_ip_status", sta_ip_status);
+ (void)zte_web_read("wifi_cur_state", wifi_cur_state);
+ if (strcmp(sta_ip_status, WEB_WLAN_STATION_IP_STATUS_CONNECTING) == 0 ||
+ strcmp(sta_ip_status, WIFI_STATION_IP_STATUS_DHCPING) == 0) {
+ //zte_write_result_to_web(wp,FAILURE);
+ zte_write_result_to_web(wp, PROCESSING);
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]sta_ip_status connecting so failed\n", __FILE__);
+
+ return;
+ }
+
+ //¹¦Äܹرգ¬Ôò·µ»Ø´íÎó
+ (void)zte_web_read("wifi_sta_connection", wifi_sta_connection);
+ if (strcmp(wifi_cur_state, WIFI_CLOSED) == 0 || strcmp(wifi_sta_connection, "1") != 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]apsta closed , so failed\n", __FILE__);
+ return;
+ }
+
+ //дNV
+ (void)zte_web_write("EX_SSID1", EX_SSID1);
+ (void)zte_web_write("EX_AuthMode", EX_AuthMode);
+ (void)zte_web_write("EX_EncrypType", EX_EncrypType);
+ (void)zte_web_write("EX_DefaultKeyID", EX_DefaultKeyID);
+ (void)zte_web_write("EX_WEPKEY", EX_WEPKEY);
+ (void)zte_web_write("EX_WPAPSK1", EX_WPAPSK1);
+ (void)zte_web_write("EX_wifi_profile", EX_wifi_profile);
+ (void)zte_web_write("EX_mac", EX_mac);
+
+
+ // resort_spot_list(2,EX_wifi_profile);
+
+ //дÕýÔÚÁ¬½Ó״̬
+// (void)zte_web_write("sta_ip_status", WEB_WLAN_STATION_IP_STATUS_CONNECTING);
+
+ zte_web_write("manual_d_wifi", "0");
+
+ //ret=zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_CONNECT, 0, NULL);
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_CONNECT, 0, NULL, 0);
+ if (ret != 0) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]send MSG_CMD_WIFI_STATION_CONNECT failed\n", __FILE__);
+ } else {
+ slog(WIFI_PRINT, SLOG_NORMAL,"[%s]send MSG_CMD_WIFI_STATION_CONNECT success\n", __FILE__);
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/**********************************************************************
+* Function: zte_wlan_station_disconnect
+* Description: to disconnect the wifi spot
+* Input: http info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2015/03/09 V1.0 xujian first version
+**********************************************************************/
+void zte_wlan_station_disconnect(webs_t wp)
+{
+ char_t wifi_sta_connection[WEB_WLAN_STATION_CONNECTION_LEN + 1] = {0};
+ char_t sta_ip_status[WEB_WLAN_STATION_IP_STATUS_LEN + 1] = {0};
+ long ret = 0;
+ //¹¦Äܹرգ¬Ôò·µ»Ø´íÎó
+ (void)zte_web_read("wifi_sta_connection", wifi_sta_connection);
+ if (strcmp(wifi_sta_connection, "1") != 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+
+ //Èç¹ûWIFIÊÇÕýÔÚÁ¬½ÓÈȵã״̬,Ôò·µ»Ø´íÎó
+ (void)zte_web_read("sta_ip_status", sta_ip_status);
+ if (strcmp(sta_ip_status, WEB_WLAN_STATION_IP_STATUS_CONNECTING) == 0 ||
+ strcmp(sta_ip_status, WIFI_STATION_IP_STATUS_DHCPING) == 0) {
+ //zte_write_result_to_web(wp,FAILURE);
+ zte_write_result_to_web(wp, PROCESSING);
+ return;
+ }
+
+ zte_web_write("manual_d_wifi", "1");
+ //zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_DISCONNECT, 0, NULL);
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_DISCONNECT, 0, NULL, 0); //kw 3
+ if (ret != 0) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]send MSG_CMD_WIFI_STATION_DISCONNECT failed\n", __FILE__);
+ } else {
+ slog(WIFI_PRINT, SLOG_NORMAL,"[%s]send MSG_CMD_WIFI_STATION_DISCONNECT success\n", __FILE__);
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/**********************************************************************
+* Function: zte_wlan_station_refresh
+* Description: to scan the wifi spot
+* Input: http info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2015/03/09 V1.0 xujian first version
+**********************************************************************/
+void zte_wlan_station_refresh(webs_t wp)
+{
+ char_t wifi_sta_connection[WEB_WLAN_STATION_CONNECTION_LEN + 1] = {0};
+ char_t sta_ip_status[WEB_WLAN_STATION_IP_STATUS_LEN + 1] = {0};
+ long ret = 0;
+ //¹¦Äܹرգ¬Ôò·µ»Ø´íÎó
+ (void)zte_web_read("wifi_sta_connection", wifi_sta_connection);
+ if (strcmp(wifi_sta_connection, "1") != 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //Èç¹ûWIFIÊÇÕýÔÚÁ¬½ÓÈȵã״̬,Ôò·µ»Ø´íÎó
+ (void)zte_web_read("sta_ip_status", sta_ip_status);
+ if (strcmp(sta_ip_status, WEB_WLAN_STATION_IP_STATUS_CONNECTING) == 0 ||
+ strcmp(sta_ip_status, WIFI_STATION_IP_STATUS_DHCPING) == 0) {
+ //zte_write_result_to_web(wp,FAILURE);
+ zte_write_result_to_web(wp, PROCESSING);
+ return;
+ }
+
+ (void)zte_web_write(NV_WIFI_SCAN_FINISH, "0");
+
+ //zte_send_message(MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_SCAN, 0, NULL);
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_WIFI, MSG_CMD_WIFI_STATION_SCAN, 0, NULL, 0);
+ if (ret != 0) {
+ slog(WIFI_PRINT, SLOG_ERR,"[%s]send MSG_CMD_WIFI_STATION_SCAN failed\n", __FILE__);
+ } else {
+ slog(WIFI_PRINT, SLOG_NORMAL,"[%s]send MSG_CMD_WIFI_STATION_SCAN success\n", __FILE__);
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+
+}
diff --git a/ap/app/goahead/interface5.0/zte_web_cell_broadcast.c b/ap/app/goahead/interface5.0/zte_web_cell_broadcast.c
new file mode 100644
index 0000000..e360cbb
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_cell_broadcast.c
@@ -0,0 +1,105 @@
+/***********************************************************************************
+ * Description: define handle function for CELL BROADCAST module
+ * Modify Date Version Author Modification
+ * 2013/01/08 V1.0 chenyi create
+ ***********************************************************************************/
+#include "message.h"
+#include "zte_web_cell_broadcast.h"
+#include "zte_web_interface.h"
+//#include "../../sms_pbm/libzte_wms.h"
+
+#define ZTE_CBM_DELETE_COUNT_MAX 100
+#define CBM_MSG_ID_LEN 11
+#define CBM_SEPARATOR_CHARACTER ';'
+
+static void zte_web_feed_back_cb_msg_empty(webs_t wp);
+
+/******************************************************
+* Function: parseStrBySeparator()
+* Description: separate the string by a specific character
+* Input:
+* Output:
+* Return: -1--->failed, 0--->successful
+* Others:
+* Modify Date Version Author Modification
+* 2010/10/27 V1.0 huangmin create
+2012/06/20 v2.0 chenyi modify
+*******************************************************/
+static unsigned int parseStrBySeparator
+(
+ unsigned char* input,
+ unsigned char* output,
+ int destLen,
+ unsigned char separator
+)
+{
+ int i, j, k;
+ int srcLen = 0;
+ i = j = k = 0;
+
+ if (NULL == input || NULL == output || destLen == 0 || strlen(input) == 0) {
+ slog(MISC_PRINT, SLOG_DEBUG, "parseStrBySemicolon: param is null!\n");
+ return 0;
+ }
+
+ srcLen = strlen(input) + 1;//which contains the '\0'
+
+ for (i = 0; i < srcLen; i++) {
+ if ('\0' == input[i]) {
+ if (k <= (destLen - 1)) {
+ *(output + destLen * j + k) = '\0';
+ } else {
+ *(output + destLen * j + (destLen - 1)) = '\0';
+ }
+
+ return j + 1;
+ }
+
+ if (separator == input[i]) {
+ if (k <= (destLen - 1)) {
+ *(output + destLen * j + k) = '\0';
+ } else {
+ *(output + destLen * j + (destLen - 1)) = '\0';
+ }
+
+ if ('\0' != input[i + 1]) {
+ k = 0;
+ j++;
+ }
+ } else {
+ if (k < (destLen - 1)) {
+ *(output + destLen * j + k) = input[i];
+ k++;
+ }
+ }
+ }
+
+ return j;
+}
+
+
+
+
+
+
+/**********************************************************************
+* Function: zte_web_feed_back_cb_msg_empty
+* Description: to write empty cb msg to web
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2013/01/08 V1.0 chenyi first version
+**********************************************************************/
+static void zte_web_feed_back_cb_msg_empty(webs_t wp)
+{
+ if (NULL == wp) {
+ return;
+ }
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"%s\":[]}"), CB_MSG);
+}
+
diff --git a/ap/app/goahead/interface5.0/zte_web_cell_broadcast.h b/ap/app/goahead/interface5.0/zte_web_cell_broadcast.h
new file mode 100644
index 0000000..f479b46
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_cell_broadcast.h
@@ -0,0 +1,22 @@
+/******************************************************
+* Description: constants, interface for cell broadcast module
+* Modify Date Version Author Modification
+* 2013/01.08 V1.0 chenyi create
+*******************************************************/
+
+#ifndef _ZTE_WEB_CELL_BROADCAST_H
+#define _ZTE_WEB_CELL_BROADCAST_H
+
+/********************************Constant************************/
+#define CB_MSG "cb_msg"
+
+#define CB_READ_RECORD_MAX_NUM 10
+
+#define CB_MSG_ID "id"
+#define CB_MSG_CHANNEL "channel"
+#define CB_MSG_CONTENT "content"
+
+/****************************************************************/
+#endif
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_cjson.c b/ap/app/goahead/interface5.0/zte_web_cjson.c
new file mode 100755
index 0000000..0653a8a
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_cjson.c
@@ -0,0 +1,980 @@
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+#include <float.h>
+#include <limits.h>
+#include <ctype.h>
+#include "zte_web_cjson.h"
+
+
+static const char *parse_value(cJSON *item, const char *value);
+static char *print_value(cJSON *item, int depth, int fmt);
+static const char *parse_array(cJSON *item, const char *value);
+static char *print_array(cJSON *item, int depth, int fmt);
+static const char *parse_object(cJSON *item, const char *value);
+static char *print_object(cJSON *item, int depth, int fmt);
+
+static const char *ep;
+
+static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+
+const char *cJSON_GetErrorPtr(void)
+{
+ return ep;
+}
+
+static int cJSON_strcasecmp(const char *s1, const char *s2)
+{
+ if (!s1) return (s1 == s2) ? 0 : 1;
+ if (!s2) return 1;
+ for (; tolower(*s1) == tolower(*s2); ++s1, ++s2) if (*s1 == 0) return 0;
+ return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
+}
+
+static void *(*cJSON_malloc)(size_t sz) = malloc;
+static void (*cJSON_free)(void *ptr) = free;
+
+static const char *skip(const char *in)
+{
+ while (in && *in && (unsigned char)*in <= 32) in++;
+ return in;
+}
+
+static char* cJSON_strdup(const char* str)
+{
+ size_t len;
+ char* str_cpy;
+
+ len = strlen(str) + 1;
+ if (!(str_cpy = (char*)cJSON_malloc(len))) return 0;
+ memcpy(str_cpy, str, len);
+ return str_cpy;
+}
+
+void cJSON_InitHooks(cJSON_Hooks* hooks)
+{
+ if (!hooks) { /*hooks reset*/
+ cJSON_malloc = malloc;
+ cJSON_free = free;
+ return;
+ }
+
+ cJSON_malloc = (hooks->malloc_fn) ? hooks->malloc_fn : malloc;
+ cJSON_free = (hooks->free_fn) ? hooks->free_fn : free;
+}
+
+static cJSON *cJSON_New_Item(void)
+{
+ cJSON* inode = (cJSON*)cJSON_malloc(sizeof(cJSON));
+ if (inode) memset(inode, 0, sizeof(cJSON));
+ return inode;
+}
+
+void cJSON_Delete(cJSON *c)
+{
+ cJSON *next_node;
+ while (c) {
+ next_node = c->next;
+ if (!(c->type & cJSON_IsReference) && c->child) cJSON_Delete(c->child);
+ if (!(c->type & cJSON_IsReference) && c->valuestring) cJSON_free(c->valuestring);
+ if (c->string) cJSON_free(c->string);
+ cJSON_free(c);
+ c = next_node;
+ }
+}
+
+static const char *parse_number(cJSON *item, const char *num)
+{
+ int subscale = 0, signsubscale = 1;
+
+ double inum = 0, sign = 1, scale = 0;
+
+ if (*num == '-') sign = -1, num++;
+ if (*num == '0') num++;
+ if (*num >= '1' && *num <= '9') do inum = (inum * 10.0) + (*num++ -'0');
+ while (*num >= '0' && *num <= '9');
+ if (*num == '.' && num[1] >= '0' && num[1] <= '9') {
+ num++;
+ do inum = (inum * 10.0) + (*num++ -'0'), scale--;
+ while (*num >= '0' && *num <= '9');
+ }
+ if (*num == 'e' || *num == 'E') {
+ num++;
+ if (*num == '+') num++;
+ else if (*num == '-') signsubscale = -1, num++;
+ while (*num >= '0' && *num <= '9') subscale = (subscale * 10) + (*num++ - '0');
+ }
+
+ inum = sign * inum * pow(10.0, (scale + subscale * signsubscale));
+
+ item->valuedouble = inum;
+ item->valueint = (int)inum;
+ item->type = cJSON_Number;
+ return num;
+}
+
+static char *print_number(cJSON *item)
+{
+ double d = item->valuedouble;
+
+ char *str;
+
+ if (fabs(((double)item->valueint) - d) <= DBL_EPSILON && d <= INT_MAX && d >= INT_MIN) {
+ str = (char*)cJSON_malloc(21); /* 2^64+1 can be represented in 21 chars. */
+ if (str) sprintf(str, "%d", item->valueint);
+ } else {
+ str = (char*)cJSON_malloc(64);
+ if (str) {
+ if (fabs(floor(d) - d) <= DBL_EPSILON && fabs(d) < 1.0e60)sprintf(str, "%.0f", d);
+ else if (fabs(d) < 1.0e-6 || fabs(d) > 1.0e9) sprintf(str, "%e", d);
+ else sprintf(str, "%f", d);
+ }
+ }
+ return str;
+}
+
+static unsigned parse_hex4(const char *str)
+{
+ unsigned hex = 0;
+ if (*str >= '0' && *str <= '9')
+ hex += (*str) - '0';
+ else if (*str >= 'A' && *str <= 'F')
+ hex += 10 + (*str) - 'A';
+ else if (*str >= 'a' && *str <= 'f')
+ hex += 10 + (*str) - 'a';
+ else
+ return 0;
+ hex = hex << 4;
+ str++;
+ if (*str >= '0' && *str <= '9')
+ hex += (*str) - '0';
+ else if (*str >= 'A' && *str <= 'F')
+ hex += 10 + (*str) - 'A';
+ else if (*str >= 'a' && *str <= 'f')
+ hex += 10 + (*str) - 'a';
+ else
+ return 0;
+ hex = hex << 4;
+ str++;
+ if (*str >= '0' && *str <= '9')
+ hex += (*str) - '0';
+ else if (*str >= 'A' && *str <= 'F')
+ hex += 10 + (*str) - 'A';
+ else if (*str >= 'a' && *str <= 'f')
+ hex += 10 + (*str) - 'a';
+ else
+ return 0;
+ hex = hex << 4;
+ str++;
+ if (*str >= '0' && *str <= '9')
+ hex += (*str) - '0';
+ else if (*str >= 'A' && *str <= 'F')
+ hex += 10 + (*str) - 'A';
+ else if (*str >= 'a' && *str <= 'f')
+ hex += 10 + (*str) - 'a';
+ else
+ return 0;
+ return hex;
+}
+
+static const char *parse_string(cJSON *item, const char *str)
+{
+ const char *pstr = str + 1;
+ char *pstr2;
+ char *out;
+ int len = 0;
+ unsigned uc, uc2;
+ if (*str != '\"') {
+ ep = str; /* not a string! */
+ return 0;
+ }
+
+ while (*pstr != '\"' && *pstr && ++len) if (*pstr++ == '\\') pstr++; /* Skip escaped quotes. */
+
+ out = (char*)cJSON_malloc(len + 1); /* This is how long we need for the string, roughly. */
+ if (!out) return 0;
+
+ pstr = str + 1;
+ pstr2 = out;
+ while (*pstr != '\"' && *pstr) {
+ if (*pstr != '\\') *pstr2++ = *pstr++;
+ else {
+ pstr++;
+ switch (*pstr) {
+ case 'b':
+ *pstr2++ = '\b';
+ break;
+ case 'f':
+ *pstr2++ = '\f';
+ break;
+ case 'n':
+ *pstr2++ = '\n';
+ break;
+ case 'r':
+ *pstr2++ = '\r';
+ break;
+ case 't':
+ *pstr2++ = '\t';
+ break;
+ case 'u':
+ uc = parse_hex4(pstr + 1);
+ pstr += 4;
+
+ if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0)
+ break;
+
+ if (uc >= 0xD800 && uc <= 0xDBFF) {
+ if (pstr[1] != '\\' || pstr[2] != 'u')
+ break;
+ uc2 = parse_hex4(pstr + 3);
+ pstr += 6;
+ if (uc2 < 0xDC00 || uc2 > 0xDFFF)
+ break;
+ uc = 0x10000 + (((uc & 0x3FF) << 10) | (uc2 & 0x3FF));
+ }
+
+ len = 4;
+ if (uc < 0x80) len = 1;
+ else if (uc < 0x800) len = 2;
+ else if (uc < 0x10000) len = 3;
+ pstr2 += len;
+
+ switch (len) {
+ case 4:
+ *--pstr2 = ((uc | 0x80) & 0xBF);
+ uc >>= 6;
+ case 3:
+ *--pstr2 = ((uc | 0x80) & 0xBF);
+ uc >>= 6;
+ case 2:
+ *--pstr2 = ((uc | 0x80) & 0xBF);
+ uc >>= 6;
+ case 1:
+ *--pstr2 = (uc | firstByteMark[len]);
+ }
+ pstr2 += len;
+ break;
+ default:
+ *pstr2++ = *pstr;
+ break;
+ }
+ pstr++;
+ }
+ }
+ *pstr2 = 0;
+ if (*pstr == '\"') pstr++;
+ item->valuestring = out;
+ item->type = cJSON_String;
+ return pstr;
+}
+
+static char *print_string_ptr(const char *str)
+{
+ const char *pstr;
+ char *pstr2, *out;
+ int len = 0;
+ unsigned char token;
+
+ if (!str) return cJSON_strdup("");
+ pstr = str;
+ while ((token = *pstr) && ++len) {
+ if (strchr("\"\\\b\f\n\r\t", token)) len++;
+ else if (token < 32) len += 5;
+ pstr++;
+ }
+
+ out = (char*)cJSON_malloc(len + 3);
+ if (!out) return 0;
+
+ pstr2 = out;
+ pstr = str;
+ *pstr2++ = '\"';
+ while (*pstr) {
+ if ((unsigned char)*pstr > 31 && *pstr != '\"' && *pstr != '\\') *pstr2++ = *pstr++;
+ else {
+ *pstr2++ = '\\';
+ switch (token = *pstr++) {
+ case '\\':
+ *pstr2++ = '\\';
+ break;
+ case '\"':
+ *pstr2++ = '\"';
+ break;
+ case '\b':
+ *pstr2++ = 'b';
+ break;
+ case '\f':
+ *pstr2++ = 'f';
+ break;
+ case '\n':
+ *pstr2++ = 'n';
+ break;
+ case '\r':
+ *pstr2++ = 'r';
+ break;
+ case '\t':
+ *pstr2++ = 't';
+ break;
+ default:
+ sprintf(pstr2, "u%04x", token);
+ pstr2 += 5;
+ break;
+ }
+ }
+ }
+ *pstr2++ = '\"';
+ *pstr2++ = 0;
+ return out;
+}
+
+static char *print_string(cJSON *item)
+{
+ return print_string_ptr(item->valuestring);
+}
+
+cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int require_null_terminated)
+{
+ const char *str_end = 0;
+ cJSON *c = cJSON_New_Item();
+ ep = 0;
+ if (!c)
+ return 0;
+
+ str_end = parse_value(c, skip(value));
+ if (!str_end) {
+ cJSON_Delete(c);
+ return 0;
+ }
+
+ if (require_null_terminated) {
+ str_end = skip(str_end);
+ if (*str_end) {
+ cJSON_Delete(c);
+ ep = str_end;
+ return 0;
+ }
+ }
+ if (return_parse_end) *return_parse_end = str_end;
+ return c;
+}
+
+cJSON *cJSON_Parse(const char *value)
+{
+ return cJSON_ParseWithOpts(value, 0, 0);
+}
+char *cJSON_Print(cJSON *item)
+{
+ return print_value(item, 0, 1);
+}
+char *cJSON_PrintUnformatted(cJSON *item)
+{
+ return print_value(item, 0, 0);
+}
+
+static const char *parse_value(cJSON *item, const char *value)
+{
+ if (!value)
+ return 0;
+ if (!strncmp(value, "null", 4)) {
+ item->type = cJSON_NULL;
+ return value + 4;
+ }
+ if (!strncmp(value, "false", 5)) {
+ item->type = cJSON_False;
+ return value + 5;
+ }
+ if (!strncmp(value, "true", 4)) {
+ item->type = cJSON_True;
+ item->valueint = 1;
+ return value + 4;
+ }
+ if (*value == '\"') {
+ return parse_string(item, value);
+ }
+ if (*value == '-' || (*value >= '0' && *value <= '9')) {
+ return parse_number(item, value);
+ }
+ if (*value == '[') {
+ return parse_array(item, value);
+ }
+ if (*value == '{') {
+ return parse_object(item, value);
+ }
+
+ ep = value;
+ return 0;
+}
+
+static char *print_value(cJSON *item, int depth, int fmt)
+{
+ char *item_value = 0;
+ if (!item)
+ return 0;
+ switch ((item->type) & 255) {
+ case cJSON_NULL:
+ item_value = cJSON_strdup("null");
+ break;
+ case cJSON_False:
+ item_value = cJSON_strdup("false");
+ break;
+ case cJSON_True:
+ item_value = cJSON_strdup("true");
+ break;
+ case cJSON_Number:
+ item_value = print_number(item);
+ break;
+ case cJSON_String:
+ item_value = print_string(item);
+ break;
+ case cJSON_Array:
+ item_value = print_array(item, depth, fmt);
+ break;
+ case cJSON_Object:
+ item_value = print_object(item, depth, fmt);
+ break;
+ }
+ return item_value;
+}
+
+
+static const char *parse_array(cJSON *item, const char *value)
+{
+ cJSON *child;
+ if (*value != '[') {
+ ep = value;
+ return 0;
+ }
+
+ item->type = cJSON_Array;
+ value = skip(value + 1);
+ if (*value == ']') return value + 1;
+
+ item->child = child = cJSON_New_Item();
+ if (!item->child) return 0;
+ value = skip(parse_value(child, skip(value)));
+ if (!value) return 0;
+
+ while (*value == ',') {
+ cJSON *new_item;
+ if (!(new_item = cJSON_New_Item()))
+ return 0;
+ child->next = new_item;
+ new_item->prev = child;
+ child = new_item;
+ value = skip(parse_value(child, skip(value + 1)));
+ if (!value)
+ return 0;
+ }
+
+ if (*value == ']')
+ return value + 1;
+ ep = value;
+ return 0;
+}
+
+static char *print_array(cJSON *item, int depth, int fmt)
+{
+ char *oitem = 0, *pstr, *ret;
+ char **entries;
+ int len = 5;
+ int numentries = 0, i = 0, fail = 0;
+ cJSON *child = item->child;
+
+ while (child) numentries++, child = child->next;
+
+ if (!numentries) {
+ oitem = (char*)cJSON_malloc(3);
+ if (oitem)
+ strcpy(oitem, "[]");
+ return oitem;
+ }
+
+ entries = (char**)cJSON_malloc(numentries * sizeof(char*));
+ if (!entries) return 0;
+ memset(entries, 0, numentries * sizeof(char*));
+
+ child = item->child;
+ while (child && !fail) {
+ ret = print_value(child, depth + 1, fmt);
+ entries[i++] = ret;
+ if (ret) len += strlen(ret) + 2 + (fmt ? 1 : 0);
+ else fail = 1;
+ child = child->next;
+ }
+
+
+ if (!fail)
+ oitem = (char*)cJSON_malloc(len);
+
+ if (!oitem)
+ fail = 1;
+
+
+ if (fail) {
+ for (i = 0; i < numentries; i++) if (entries[i]) cJSON_free(entries[i]);
+ cJSON_free(entries);
+ return 0;
+ }
+
+
+ *oitem = '[';
+ pstr = oitem + 1;
+ *pstr = 0;
+ for (i = 0; i < numentries; i++) {
+ strcpy(pstr, entries[i]);
+ pstr += strlen(entries[i]);
+ if (i != numentries - 1) {
+ *pstr++ = ',';
+ if (fmt)*pstr++ = ' ';
+ *pstr = 0;
+ }
+ cJSON_free(entries[i]);
+ }
+ cJSON_free(entries);
+ *pstr++ = ']';
+ *pstr++ = 0;
+ return oitem;
+}
+
+static const char *parse_object(cJSON *item, const char *value)
+{
+ cJSON *child;
+ if (*value != '{') {
+ ep = value;
+ return 0;
+ }
+
+ item->type = cJSON_Object;
+ value = skip(value + 1);
+ if (*value == '}') return value + 1;
+
+ item->child = child = cJSON_New_Item();
+ if (!item->child) return 0;
+ value = skip(parse_string(child, skip(value)));
+ if (!value) return 0;
+ child->string = child->valuestring;
+ child->valuestring = 0;
+ if (*value != ':') {
+ ep = value;
+ return 0;
+ }
+ value = skip(parse_value(child, skip(value + 1)));
+ if (!value) return 0;
+
+ while (*value == ',') {
+ cJSON *new_item;
+ if (!(new_item = cJSON_New_Item())) return 0;
+ child->next = new_item;
+ new_item->prev = child;
+ child = new_item;
+ value = skip(parse_string(child, skip(value + 1)));
+ if (!value) return 0;
+ child->string = child->valuestring;
+ child->valuestring = 0;
+ if (*value != ':') {
+ ep = value;
+ return 0;
+ }
+ value = skip(parse_value(child, skip(value + 1)));
+ if (!value) return 0;
+ }
+
+ if (*value == '}') return value + 1;
+ ep = value;
+ return 0;
+}
+
+static char *print_object(cJSON *item, int depth, int fmt)
+{
+ char *oitem = 0, *pstr, *ret, *str;
+ char **entries = 0, **names = 0;
+ int len = 7, i = 0, j;
+ int numentries = 0, fail = 0;
+ cJSON *child = item->child;
+
+ while (child) numentries++, child = child->next;
+
+ if (!numentries) {
+ oitem = (char*)cJSON_malloc(fmt ? depth + 4 : 3);
+ if (!oitem) return 0;
+ pstr = oitem;
+ *pstr++ = '{';
+ if (fmt) {
+ *pstr++ = '\n';
+ for (i = 0; i < depth - 1; i++) *pstr++ = '\t';
+ }
+ *pstr++ = '}';
+ *pstr++ = 0;
+ return oitem;
+ }
+
+ entries = (char**)cJSON_malloc(numentries * sizeof(char*));
+ if (!entries)
+ return 0;
+ names = (char**)cJSON_malloc(numentries * sizeof(char*));
+ if (!names) {
+ cJSON_free(entries);
+ return 0;
+ }
+ memset(entries, 0, sizeof(char*)*numentries);
+ memset(names, 0, sizeof(char*)*numentries);
+
+
+ child = item->child;
+ depth++;
+ if (fmt) len += depth;
+ while (child) {
+ names[i] = str = print_string_ptr(child->string);
+ entries[i++] = ret = print_value(child, depth, fmt);
+ if (str && ret)
+ len += strlen(ret) + strlen(str) + 2 + (fmt ? 2 + depth : 0);
+ else
+ fail = 1;
+ child = child->next;
+ }
+
+
+ if (!fail) oitem = (char*)cJSON_malloc(len);
+ if (!oitem) fail = 1;
+
+
+ if (fail) {
+ for (i = 0; i < numentries; i++) {
+ if (names[i]) cJSON_free(names[i]);
+ if (entries[i]) cJSON_free(entries[i]);
+ }
+ cJSON_free(names);
+ cJSON_free(entries);
+ return 0;
+ }
+
+
+ *oitem = '{';
+ pstr = oitem + 1;
+ if (fmt)*pstr++ = '\n';
+ *pstr = 0;
+ for (i = 0; i < numentries; i++) {
+ if (fmt) for (j = 0; j < depth; j++) *pstr++ = '\t';
+ strcpy(pstr, names[i]);
+ pstr += strlen(names[i]);
+ *pstr++ = ':';
+ if (fmt) *pstr++ = '\t';
+ strcpy(pstr, entries[i]);
+ pstr += strlen(entries[i]);
+ if (i != numentries - 1) *pstr++ = ',';
+ if (fmt) *pstr++ = '\n';
+ *pstr = 0;
+ cJSON_free(names[i]);
+ cJSON_free(entries[i]);
+ }
+
+ cJSON_free(names);
+ cJSON_free(entries);
+ if (fmt) for (i = 0; i < depth - 1; i++) *pstr++ = '\t';
+ *pstr++ = '}';
+ *pstr++ = 0;
+ return oitem;
+}
+
+int cJSON_GetArraySize(cJSON *array)
+{
+ int i = 0;
+ cJSON *citem = array->child;
+
+ while (citem)i++, citem = citem->next;
+ return i;
+}
+cJSON *cJSON_GetArrayItem(cJSON *array, int item)
+{
+ cJSON *citem = array->child;
+ while (citem && item > 0) item--, citem = citem->next;
+ return citem;
+}
+cJSON *cJSON_GetObjectItem(cJSON *object, const char *string)
+{
+ cJSON *citem = object->child;
+ while (citem && cJSON_strcasecmp(citem->string, string)) citem = citem->next;
+ return citem;
+}
+
+static void suffix_object(cJSON *prev, cJSON *item)
+{
+ prev->next = item;
+ item->prev = prev;
+}
+
+static cJSON *create_reference(cJSON *item)
+{
+ cJSON *refer = cJSON_New_Item();
+ if (!refer)
+ return 0;
+ memcpy(refer, item, sizeof(cJSON));
+ refer->string = 0;
+ refer->type |= cJSON_IsReference;
+ refer->next = refer->prev = 0;
+ return refer;
+}
+
+void cJSON_AddItemToArray(cJSON *array, cJSON *item)
+{
+ cJSON *citem = array->child;
+ if (!item)
+ return;
+ if (!citem) {
+ array->child = item;
+ } else {
+ while (citem && citem->next) citem = citem->next;
+ suffix_object(citem, item);
+ }
+}
+void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item)
+{
+ if (!item)
+ return;
+ if (item->string) cJSON_free(item->string);
+ item->string = cJSON_strdup(string);
+ cJSON_AddItemToArray(object, item);
+}
+void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item)
+{
+ cJSON_AddItemToArray(array, create_reference(item));
+}
+void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item)
+{
+ cJSON_AddItemToObject(object, string, create_reference(item));
+}
+
+cJSON *cJSON_DetachItemFromArray(cJSON *array, int which)
+{
+ cJSON *citem = array->child;
+ while (citem && which > 0) citem = citem->next, which--;
+ if (!citem)
+ return 0;
+ if (citem->prev) citem->prev->next = citem->next;
+ if (citem->next) citem->next->prev = citem->prev;
+ if (citem == array->child) array->child = citem->next;
+ citem->prev = citem->next = 0;
+ return citem;
+}
+void cJSON_DeleteItemFromArray(cJSON *array, int which)
+{
+ cJSON_Delete(cJSON_DetachItemFromArray(array, which));
+}
+cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string)
+{
+ int i = 0;
+ cJSON *citem = object->child;
+ while (citem && cJSON_strcasecmp(citem->string, string)) i++, citem = citem->next;
+ if (citem)
+ return cJSON_DetachItemFromArray(object, i);
+ return 0;
+}
+void cJSON_DeleteItemFromObject(cJSON *object, const char *string)
+{
+ cJSON_Delete(cJSON_DetachItemFromObject(object, string));
+}
+
+void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem)
+{
+ cJSON *citem = array->child;
+ while (citem && which > 0) citem = citem->next, which--;
+ if (!citem)
+ return;
+ newitem->next = citem->next;
+ newitem->prev = citem->prev;
+ if (newitem->next) newitem->next->prev = newitem;
+ if (citem == array->child) array->child = newitem;
+ else newitem->prev->next = newitem;
+ citem->next = citem->prev = 0;
+ cJSON_Delete(citem);
+}
+void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem)
+{
+ int i = 0;
+ cJSON *citem = object->child;
+ while (citem && cJSON_strcasecmp(citem->string, string))i++, citem = citem->next;
+ if (citem) {
+ newitem->string = cJSON_strdup(string);
+ cJSON_ReplaceItemInArray(object, i, newitem);
+ }
+}
+
+cJSON *cJSON_CreateNull(void)
+{
+ cJSON *item = cJSON_New_Item();
+ if (item)item->type = cJSON_NULL;
+ return item;
+}
+cJSON *cJSON_CreateTrue(void)
+{
+ cJSON *item = cJSON_New_Item();
+ if (item)item->type = cJSON_True;
+ return item;
+}
+cJSON *cJSON_CreateFalse(void)
+{
+ cJSON *item = cJSON_New_Item();
+ if (item)item->type = cJSON_False;
+ return item;
+}
+cJSON *cJSON_CreateBool(int b)
+{
+ cJSON *item = cJSON_New_Item();
+ if (item)item->type = b ? cJSON_True : cJSON_False;
+ return item;
+}
+cJSON *cJSON_CreateNumber(double num)
+{
+ cJSON *item = cJSON_New_Item();
+ if (item) {
+ item->type = cJSON_Number;
+ item->valuedouble = num;
+ item->valueint = (int)num;
+ }
+ return item;
+}
+cJSON *cJSON_CreateString(const char *string)
+{
+ cJSON *item = cJSON_New_Item();
+ if (item) {
+ item->type = cJSON_String;
+ item->valuestring = cJSON_strdup(string);
+ }
+ return item;
+}
+cJSON *cJSON_CreateArray(void)
+{
+ cJSON *item = cJSON_New_Item();
+ if (item)item->type = cJSON_Array;
+ return item;
+}
+cJSON *cJSON_CreateObject(void)
+{
+ cJSON *item = cJSON_New_Item();
+ if (item)item->type = cJSON_Object;
+ return item;
+}
+
+cJSON *cJSON_CreateIntArray(const int *numbers, int count)
+{
+ int i;
+ cJSON *n = 0, *p = 0, *a = cJSON_CreateArray();
+ for (i = 0; a && i < count; i++) {
+ n = cJSON_CreateNumber(numbers[i]);
+ if (!i)a->child = n;
+ else suffix_object(p, n);
+ p = n;
+ }
+ return a;
+}
+cJSON *cJSON_CreateFloatArray(const float *numbers, int count)
+{
+ int i;
+ cJSON *n = 0, *p = 0, *a = cJSON_CreateArray();
+ for (i = 0; a && i < count; i++) {
+ n = cJSON_CreateNumber(numbers[i]);
+ if (!i)a->child = n;
+ else suffix_object(p, n);
+ p = n;
+ }
+ return a;
+}
+cJSON *cJSON_CreateDoubleArray(const double *numbers, int count)
+{
+ int i;
+ cJSON *n = 0, *p = 0, *a = cJSON_CreateArray();
+ for (i = 0; a && i < count; i++) {
+ n = cJSON_CreateNumber(numbers[i]);
+ if (!i)a->child = n;
+ else suffix_object(p, n);
+ p = n;
+ }
+ return a;
+}
+cJSON *cJSON_CreateStringArray(const char **strings, int count)
+{
+ int i;
+ cJSON *n = 0, *p = 0, *a = cJSON_CreateArray();
+ for (i = 0; a && i < count; i++) {
+ n = cJSON_CreateString(strings[i]);
+ if (!i)a->child = n;
+ else suffix_object(p, n);
+ p = n;
+ }
+ return a;
+}
+
+cJSON *cJSON_Duplicate(cJSON *item, int recurse)
+{
+ cJSON *newitem, *cptr, *nptr = 0, *newchild;
+
+ if (!item)
+ return 0;
+
+ newitem = cJSON_New_Item();
+ if (!newitem)
+ return 0;
+
+ newitem->type = item->type & (~cJSON_IsReference), newitem->valueint = item->valueint, newitem->valuedouble = item->valuedouble;
+ if (item->valuestring) {
+ newitem->valuestring = cJSON_strdup(item->valuestring);
+ if (!newitem->valuestring) {
+ cJSON_Delete(newitem);
+ return 0;
+ }
+ }
+ if (item->string) {
+ newitem->string = cJSON_strdup(item->string);
+ if (!newitem->string) {
+ cJSON_Delete(newitem);
+ return 0;
+ }
+ }
+
+ if (!recurse)
+ return newitem;
+
+ cptr = item->child;
+ while (cptr) {
+ newchild = cJSON_Duplicate(cptr, 1);
+ if (!newchild) {
+ cJSON_Delete(newitem);
+ return 0;
+ }
+ if (nptr) {
+ nptr->next = newchild, newchild->prev = nptr;
+ nptr = newchild;
+ } else {
+ newitem->child = newchild;
+ nptr = newchild;
+ }
+ cptr = cptr->next;
+ }
+ return newitem;
+}
+
+void cJSON_Minify(char *json)
+{
+ char *cpr_str = json;
+ while (*json) {
+ if (*json == ' ') json++;
+ else if (*json == '\t') json++;
+ else if (*json == '\r') json++;
+ else if (*json == '\n') json++;
+ else if (*json == '/' && json[1] == '/') while (*json && *json != '\n') json++;
+ else if (*json == '/' && json[1] == '*') {
+ while (*json && !(*json == '*' && json[1] == '/')) json++;
+ json += 2;
+ } else if (*json == '\"') {
+ *cpr_str++ = *json++;
+ while (*json && *json != '\"') {
+ if (*json == '\\') *cpr_str++ = *json++;
+ *cpr_str++ = *json++;
+ }
+ *cpr_str++ = *json++;
+ } else *cpr_str++ = *json++;
+ }
+ *cpr_str = 0;
+}
diff --git a/ap/app/goahead/interface5.0/zte_web_cjson.h b/ap/app/goahead/interface5.0/zte_web_cjson.h
new file mode 100755
index 0000000..4a86aba
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_cjson.h
@@ -0,0 +1,99 @@
+#ifndef cJSON__h
+#define cJSON__h
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#define cJSON_False 0
+#define cJSON_True 1
+#define cJSON_NULL 2
+#define cJSON_Number 3
+#define cJSON_String 4
+#define cJSON_Array 5
+#define cJSON_Object 6
+
+#define cJSON_IsReference 256
+
+typedef struct cJSON_Hooks {
+ void *(*malloc_fn)(size_t sz);
+ void (*free_fn)(void *ptr);
+} cJSON_Hooks;
+
+typedef struct cJSON {
+ struct cJSON *next, *prev;
+ struct cJSON *child;
+
+ int type;
+
+ char *valuestring;
+ int valueint;
+ double valuedouble;
+
+ char *string;
+} cJSON;
+
+
+extern void cJSON_InitHooks(cJSON_Hooks* hooks);
+
+extern cJSON *cJSON_Parse(const char *value);
+extern char *cJSON_Print(cJSON *item);
+extern char *cJSON_PrintUnformatted(cJSON *item);
+
+extern int cJSON_GetArraySize(cJSON *array);
+extern cJSON *cJSON_GetArrayItem(cJSON *array, int item);
+extern cJSON *cJSON_GetObjectItem(cJSON *object, const char *string);
+
+extern const char *cJSON_GetErrorPtr(void);
+
+extern cJSON *cJSON_CreateNull(void);
+extern cJSON *cJSON_CreateTrue(void);
+extern cJSON *cJSON_CreateFalse(void);
+extern cJSON *cJSON_CreateBool(int b);
+extern cJSON *cJSON_CreateNumber(double num);
+extern cJSON *cJSON_CreateString(const char *string);
+extern cJSON *cJSON_CreateArray(void);
+extern cJSON *cJSON_CreateObject(void);
+
+extern cJSON *cJSON_CreateIntArray(const int *numbers, int count);
+extern cJSON *cJSON_CreateFloatArray(const float *numbers, int count);
+extern cJSON *cJSON_CreateDoubleArray(const double *numbers, int count);
+extern cJSON *cJSON_CreateStringArray(const char **strings, int count);
+
+extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
+extern void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
+extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
+extern void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
+
+extern void cJSON_Delete(cJSON *c);
+
+extern cJSON *cJSON_DetachItemFromArray(cJSON *array, int which);
+extern void cJSON_DeleteItemFromArray(cJSON *array, int which);
+extern cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string);
+extern void cJSON_DeleteItemFromObject(cJSON *object, const char *string);
+
+extern void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
+extern void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem);
+
+extern cJSON *cJSON_Duplicate(cJSON *item, int recurse);
+extern cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int require_null_terminated);
+
+extern void cJSON_Minify(char *json);
+
+#define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
+
+#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
+#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
+#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
+#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
+#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
+#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ap/app/goahead/interface5.0/zte_web_get_fw_para.c b/ap/app/goahead/interface5.0/zte_web_get_fw_para.c
new file mode 100755
index 0000000..47df969
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_get_fw_para.c
@@ -0,0 +1,891 @@
+/**************************************************************************
+*
+* Copyright (c) 2013 ZTE Corporation.
+*
+***************************************************************************
+* 模 块 名 :
+* 文 件 名 :
+* 相关文件 :
+* 实现功能 :
+* 作 者 :
+* 版 本 :
+* 完成日期 :
+* 其它说明 :
+**************************************************************************/
+
+#include <stdlib.h>
+#include "zte_web_interface.h"
+#include "zte_web_get_fw_para.h"
+#include "./wifi/zte_web_lan_utils.h"
+#include <linux/wireless.h>
+#include <sys/ioctl.h>
+/*Added for get dhcp lease info, 20121018 begin*/
+#define MAX_MAC_ADDR_LEN 20
+#define MAX_IP_ADDR_LEN 20
+#define MAX_HOSET_NAME_LEN 256
+#define MAX_DHCP_CLIENT_ID_LEN 765
+/*Added for get dhcp lease info, 20121018 end*/
+
+#ifndef IFNAMSIZ
+#define IFNAMSIZ 16
+#endif
+/***********************************************/
+/*Struct Definition*/
+/***********************************************/
+typedef struct web_cmd_nologin_get_struct {
+ char cmd[64];
+} web_cmd_nologin_get_s_type;
+
+static const unsigned char base64_table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+
+web_cmd_nologin_get_s_type web_cmd_get_nologin_data_new[] = {
+ NV_MODEM_MAIN_STATE,
+ NV_PUKNUMBER,
+ NV_PINNUMBER,
+ NV_PIN_STATUS,
+ STR_SDCARD_MODE_OPT,
+ NV_SD_CARD_STATE,
+ NV_HTTPSHARE_STATUS,
+ NV_HTTPSHARE_WR_AUTH,
+ NV_HTTPSHARE_FILE,
+ NV_LANGUAGE,
+ NV_OPMS_WAN_MODE,
+ NV_LOGINFO,
+ "ppp_status",
+ "sim_imsi",
+ "broadcast_data",
+ NV_LOGIN_LOCK_TIME,
+ "psw_fail_num_str",
+ "imei",
+#ifdef WEBS_SECURITY
+ "rnum_js",
+#endif
+ "inner_version",
+ NV_CR_VERSION,
+ "network_type",
+ "signalbar",
+ "wifi_cur_state"
+ "realtime_tx_thrpt",
+ "realtime_rx_thrpt",
+ "station_mac",
+ "battery_pers",
+ "battery_charging",
+ "EX_SSID1",
+ "sta_ip_status",
+ "wifi_profile",
+ "wifi_profile1",
+ "wifi_profile2",
+ "wifi_profile3",
+ "wifi_profile4",
+ "wifi_profile5",
+ "wifi_profile6",
+ "wifi_profile7",
+ "wifi_profile8",
+ "wifi_profile9",
+ "wifi_profile_num",
+ NV_BLC_WAN_MODE,
+ "blc_wan_auto_mode",
+ "sta_count",
+ "m_sta_count"
+};
+
+static void zte_get_nv_value(webs_t wp, const char_t *nv_name);
+static void zte_reset_nv_value(webs_t wp, const char_t *nv_name);
+extern void zte_get_login_status_value(webs_t wp, char *login_status);
+extern void zte_rest_result_write(webs_t wp, char_t *result);
+
+void web_feedback_header(webs_t wp)
+{
+ websWrite(wp, T("HTTP/1.1 200 OK\n"));
+ websWrite(wp, T("Server: %s\r\n"), WEBS_NAME);
+#ifdef WEBINSPECT_FIX
+ websWrite(wp, T("X-Frame-Options: SAMEORIGIN\n"));
+#endif
+ websWrite(wp, T("Pragma: no-cache\n"));
+ websWrite(wp, T("Cache-control: no-cache\n"));
+ websWrite(wp, T("Content-Type: text/html\n"));
+#ifdef WEBS_SECURITY
+ websWrite(wp, T("Expires: 0\n"));
+ char cook_token[COOKIE_SESSION_SIZE+1] = {0};
+ (void)zte_web_read(NV_WEB_TOKEN, cook_token);
+ if(strlen(cook_token) == 0)
+ {
+ web_make_salt_base64(cook_token, sizeof(cook_token));
+ if (websSSLIsOpen())
+ websWrite(wp, T("Set-Cookie: token=%s; secure; HttpOnly; SameSite=Lax;\n"),cook_token);
+ else
+ websWrite(wp, T("Set-Cookie: token=%s; HttpOnly; SameSite=Lax;\n"),cook_token);
+ (void)zte_web_write(NV_WEB_TOKEN, cook_token);
+ }
+#endif
+ websWrite(wp, T("\n"));
+}
+
+
+/* AT */
+typedef struct {
+ char_t srcCmd[NVIO_DEFAULT_LEN];
+ char_t dstCmd[NVIO_DEFAULT_LEN];
+} T_WEB_CONVERT_CMD_TAB;
+
+/******************************************************
+* Function: zte_web_get_para_xml(webs_t wp, char_t *nv_name)
+* Description: read the nv from nvconfig and write to page
+* Input: wp:http request info;nv_name: the name for nv item
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/08/15 V1.0 liuyingnan create
+*******************************************************/
+void zte_web_get_para_xml(webs_t wp, char_t *nv_name)
+{
+ char_t nv_value[NVIO_MAX_LEN] = {0};
+ char_t *flag = NULL;
+ char_t convert_nv_name[NVIO_DEFAULT_LEN] = {0};
+ int result = 0;
+
+ if ((NULL == wp) || (NULL == nv_name) || ((*nv_name) == '\0')) {
+ return;
+ }
+
+ flag = websGetVar(wp, T("flag"), T(""));
+
+ if (0 == strcmp(nv_name, NV_LOGINFO)) {
+ zte_get_login_status_value(wp, nv_value);
+ } else {
+ sc_cfg_get(nv_name, &nv_value, sizeof(nv_value));
+ }
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, nv_name, nv_value, 0);
+ zte_rest_cmd_write_foot(wp);
+
+ if (0 == strcmp(flag, "0")) {
+ sc_cfg_set(nv_name, "");
+ }
+}
+
+void zte_web_get_para_nologin(webs_t wp, char_t *nv_name)
+{
+ char_t nv_value[NVIO_MAX_LEN] = {0};
+ char_t *flag = NULL;
+ unsigned int max_cmd_index = (unsigned int)(sizeof(web_cmd_get_nologin_data_new) / sizeof(web_cmd_nologin_get_s_type));
+ int cmd_index = 0;
+ int black_list_result = 0;
+
+ if ((NULL == wp) || (NULL == nv_name) || ((*nv_name) == '\0')) {
+ return;
+ }
+
+ flag = websGetVar(wp, T("flag"), T(""));
+ for (cmd_index = 0; cmd_index < max_cmd_index; cmd_index++) {
+ if (0 == strcmp(web_cmd_get_nologin_data_new[cmd_index].cmd, nv_name)) {
+ black_list_result = 1;
+ break;
+ }
+ }
+
+ sc_cfg_get(nv_name, &nv_value, sizeof(nv_value));
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ if (black_list_result == 1) {
+ black_list_result = 0;
+ if (0 == strcmp(nv_name, NV_LOGINFO)) {
+ zte_get_login_status_value(wp, nv_value);
+ }
+ zte_rest_cmd_write(wp, nv_name, nv_value, 0);
+ } else {
+ zte_rest_cmd_write(wp, nv_name, "", 0);
+ }
+ zte_rest_cmd_write_foot(wp);
+
+ if (0 == strcmp(flag, "0")) {
+ sc_cfg_set(nv_name, "");
+ }
+
+ //save the nvconfig info from memory to flash
+}
+
+/******************************************************
+* Function: zte_write_result_to_web
+* Description: feedback the info to web
+* Input: http request info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/08/09 V1.0 liuyingnan modife
+*******************************************************/
+void zte_write_result_to_web(webs_t wp, char_t *result)
+{
+ if ((NULL == wp) || (NULL == result)) {
+ return;
+ }
+ //save the nvconfig info from memory to flash
+ //sc_cfg_save();
+
+ web_feedback_header(wp);
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ zte_rest_result_write(wp, result);
+ } else {
+ websWrite(wp, T("{\"result\":\"%s\"}"), result);
+ }
+}
+
+/******************************************************
+* Function: zte_get_request_process
+* Description: the only entry for handle multiple data for get request
+* Input: wp:http request info;cmd:get request command
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/01/17 V1.0 chenyi create
+*******************************************************/
+void zte_get_request_process(webs_t wp, const char_t *cmd)
+{
+ char_t nv_name[NV_ITEM_STRING_LEN_50] = {0}; //for generic nv name
+ int i = 0, j = 0;
+ int count = 0;
+ int flag = -1;
+
+ web_feedback_header(wp);
+
+ if ((NULL == cmd) || ('\0' == *cmd)) {
+ websWrite(wp, T(""));
+ return;
+ }
+
+ websWrite(wp, T("{")); //content head
+
+ for (; cmd[i] != '\0';) {
+ if (cmd[i] != ',') {
+ if (j < (NV_ITEM_STRING_LEN_50 - 1)) {
+ nv_name[j] = cmd[i];
+ }
+ i++;
+ j++;
+ flag = 0;
+ } else {
+ zte_get_nv_value(wp, nv_name);
+ websWrite(wp, T(",")); //field separator
+ count ++;
+ j = 0;
+ i++;
+ flag = 1;
+ zte_reset_nv_value(wp, nv_name);
+ memset(nv_name, 0, sizeof(nv_name)); //reset
+ }
+ }
+
+ if (0 == flag) {
+ //for only one field or last field
+ count ++;
+ zte_get_nv_value(wp, nv_name);
+ zte_reset_nv_value(wp, nv_name);
+ }
+
+ websWrite(wp, T("}")); //content tail
+}
+
+/******************************************************
+* Function: zte_get_request_process_xml
+* Description: the only entry for handle multiple data for get request
+* Input: wp:http request info;cmd:get request command
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/12/04 V1.0 liuyingnan create
+*******************************************************/
+void zte_get_request_process_xml(webs_t wp, const char_t *cmd)
+{
+ char_t nv_name[NV_ITEM_STRING_LEN_50] = {0}; //for generic nv name
+ int i = 0, j = 0;
+ int count = 0;
+ int flag = -1;
+
+ web_feedback_header(wp);
+
+ if ((NULL == cmd) || ('\0' == *cmd)) {
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, "empty", "", 0);
+ zte_rest_cmd_write_foot(wp);
+ } else {
+ websWrite(wp, T(""));
+ }
+ return;
+ }
+
+ zte_rest_cmd_write_head(wp);
+
+ for (; cmd[i] != '\0';) {
+ if (cmd[i] != ',') {
+ if (j < (NV_ITEM_STRING_LEN_50 - 1)) {
+ nv_name[j] = cmd[i];
+ }
+ i++;
+ j++;
+ flag = 0;
+ } else {
+ //sc_cfg_set("url_goform_get", nv_name);
+ zte_get_nv_value(wp, nv_name);
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST)
+ {}
+ else {
+ websWrite(wp, T(",")); //field separator
+ }
+ count ++;
+ j = 0;
+ i++;
+ flag = 1;
+ zte_reset_nv_value(wp, nv_name);
+ memset(nv_name, 0, sizeof(nv_name)); //reset
+ }
+ }
+
+ if (0 == flag) {
+ //for only one field or last field
+ count ++;
+ zte_get_nv_value(wp, nv_name);
+ zte_reset_nv_value(wp, nv_name);
+ }
+
+ zte_rest_cmd_write_foot(wp);
+}
+
+void zte_get_request_process_nologin(webs_t wp, const char_t *cmd)
+{
+ char_t nv_name[NV_ITEM_STRING_LEN_50] = {0}; //for generic nv name
+ int i = 0, j = 0;
+ int count = 0;
+ int flag = -1;
+
+ //add by liuyingnan for server safe start
+ unsigned int max_cmd_index = (unsigned int)(sizeof(web_cmd_get_nologin_data_new) / sizeof(web_cmd_nologin_get_s_type));
+ int cmd_index = 0;
+ int black_list_result = 0;
+ //add by liuyingnan for server safe end
+
+ web_feedback_header(wp);
+
+ if ((NULL == cmd) || ('\0' == *cmd)) {
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, "empty", "", 0);
+ zte_rest_cmd_write_foot(wp);
+ } else {
+ websWrite(wp, T(""));
+ }
+ return;
+ }
+
+ zte_rest_cmd_write_head(wp);
+
+ for (; cmd[i] != '\0';) {
+ if (cmd[i] != ',') {
+ if (j < (NV_ITEM_STRING_LEN_50 - 1)) {
+ nv_name[j] = cmd[i];
+ }
+ i++;
+ j++;
+ flag = 0;
+ } else {
+ //sc_cfg_set("url_goform_get", nv_name);
+ //add by liuyingnan for server safe start
+ for (cmd_index = 0; cmd_index < max_cmd_index; cmd_index++) {
+ if (0 == strcmp(web_cmd_get_nologin_data_new[cmd_index].cmd, nv_name)) {
+ black_list_result = 1;
+ break;
+ }
+ }
+ if (black_list_result == 1) {
+ black_list_result = 0;
+ zte_get_nv_value(wp, nv_name);
+ } else {
+ zte_rest_cmd_write(wp, nv_name, "", 0);
+ }
+ //add by liuyingnan for server safe end
+ //zte_get_nv_value(wp,nv_name);
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST)
+ {}
+ else {
+ websWrite(wp, T(",")); //field separator
+ }
+ count ++;
+ j = 0;
+ i++;
+ flag = 1;
+ zte_reset_nv_value(wp, nv_name);
+ memset(nv_name, 0, sizeof(nv_name)); //reset
+ }
+ }
+
+ if (0 == flag) {
+ //for only one field or last field
+ count ++;
+ zte_get_nv_value(wp, nv_name);
+ zte_reset_nv_value(wp, nv_name);
+ }
+
+ zte_rest_cmd_write_foot(wp);
+}
+
+
+/******************************************************
+* Function: zte_get_nv_value
+* Description: to read the specific nv (nv_name)
+* Input: wp:http request info;nv_name:general nv name
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/01/17 V1.0 chenyi create
+*******************************************************/
+static void zte_get_nv_value(webs_t wp, const char_t *nv_name)
+{
+ char_t nv_value[NVIO_MAX_LEN] = {0};
+
+ //add by liuyingnan for server safe start
+ unsigned int max_cmd_index = (unsigned int)(sizeof(web_cmd_get_nologin_data_new) / sizeof(web_cmd_nologin_get_s_type));
+ int cmd_index = 0;
+ int black_list_result = 0;
+ char login_info[NV_ITEM_STRING_LEN_20] = {0};
+ zte_get_login_status_value(wp, login_info);
+ int flag = 0;
+ char_t convert_nv_name[NVIO_DEFAULT_LEN] = {0};
+
+ if ((NULL == nv_name) || ('\0' == *nv_name)) {
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ zte_rest_cmd_write(wp, "empty", "", 0);
+ } else {
+ zte_rest_cmd_write(wp, "", "", 0);
+ }
+ return;
+ }
+
+ for (cmd_index = 0; cmd_index < max_cmd_index; cmd_index++) {
+ if (0 == strcmp(web_cmd_get_nologin_data_new[cmd_index].cmd, nv_name)) {
+ black_list_result = 1;
+ break;
+ }
+ }
+
+ if (0 != strcmp("ok", login_info)) {
+ if (black_list_result != 1) {
+ zte_rest_cmd_write(wp, nv_name, "", 0);
+ return;
+ }
+ }
+
+ sc_cfg_get(nv_name, &nv_value, sizeof(nv_value));
+
+ if ((0 != strcmp(nv_value, "")) && (0 != strcmp(nv_name, NV_LOGINFO))) {
+ zte_rest_cmd_write(wp, nv_name, nv_value, 0);
+ } else {
+ if (0 == strcmp(nv_name, NV_LOGINFO)) {
+ memset(nv_value, 0, sizeof(nv_value));
+ zte_get_login_status_value(wp, nv_value);
+ zte_rest_cmd_write(wp, nv_name, nv_value, 0);
+ } else if (0 == strcmp(nv_name, NV_SD_CARD_STATE)) {
+ websWrite(wp, T("\"sd_card_state\":\"%s\""), T("1"));
+ } else if (0 == strcmp(nv_name, NV_SMS_UNREAD_NUM)) {
+ zte_get_sms_unread_num(wp);
+ } else if (0 == strcmp(nv_name, NV_LOGIN_LOCK_TIME)) {
+ zte_get_login_lock_time(wp);
+ } else {
+ zte_rest_cmd_write(wp, nv_name, "", 0);
+ }
+ }
+}
+
+/******************************************************
+* Function: zte_reset_nv_value
+* Description: to reset the specific nv (nv_name)
+* Input: wp:http request info;nv_name:general nv name
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/01/17 V1.0 chenyi create
+*******************************************************/
+static void zte_reset_nv_value(webs_t wp, const char_t *nv_name)
+{
+ char_t reset_nv_name[NV_ITEM_STRING_LEN_50 + 10] = {0};
+ char_t *flag = NULL;
+
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_DEBUG, "wp is null.\n"); /*lint !e26*/
+ return;
+ }
+
+ if ((NULL == nv_name) || ('\0' == *nv_name)) {
+ return;
+ }
+
+ strncpy(reset_nv_name, nv_name, NV_ITEM_STRING_LEN_50);
+ strcat(reset_nv_name, "_flag");
+
+ flag = websGetVar(wp, (char_t *)reset_nv_name, T(""));
+
+ if (0 == strcmp(flag, "0")) {
+ sc_cfg_set((char *)nv_name, "");
+ }
+}
+
+/******************************************************
+* Function: zte_lan_user_mac_get
+* Description: get current user mac address for black list
+* Input: http request info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2011/07/02 V1.0 qiuzhenhui create
+*******************************************************/
+void zte_lan_user_mac_get(webs_t wp)
+{
+ char_t user_releasetime[NV_ITEM_STRING_LEN_20] = {0};
+ char_t user_macaddr[NV_ITEM_STRING_LEN_20] = {0};
+ char_t user_ipaddr[40] = {0};
+ char_t user_hostname[NV_ITEM_STRING_LEN_200] = {0};
+ char_t user_ipv6macaddr[NV_ITEM_STRING_LEN_64] = {0};
+ char_t *ip_address = NULL;
+ int match_flag = FALSE;
+ FILE *fp = NULL;
+
+ ip_address = websGetRequestIpaddr(wp);
+#if 0 // kw 3
+ if (NULL == ip_address) {
+ zte_write_result_to_web(wp, FAILURE);
+ return ;
+ }
+#endif
+
+ fp = fopen("/usr/zte/zte_conf/config/dnsmasq.leases", "r");
+ if (fp == NULL) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ while (!feof(fp)) {
+ (void)fscanf(fp, "%20s %20s %40s %200s %64s\n", user_releasetime, user_macaddr, user_ipaddr, user_hostname, user_ipv6macaddr);
+
+ if (0 == strncmp(ip_address, user_ipaddr, sizeof(user_ipaddr))) {
+ match_flag = TRUE;
+ break;
+ }
+ }
+
+ fclose(fp);
+
+ if (match_flag == TRUE) {
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, "user_mac_addr", user_macaddr, 0);
+ zte_rest_cmd_write_foot(wp);
+ } else {
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, "user_mac_addr", "error", 0);
+ zte_rest_cmd_write_foot(wp);
+ }
+
+}
+
+/******************************************************
+* Function: zte_get_device_mode
+* Description: get current device mode
+* Input: http request info
+* Output: device_mode
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/05/10 V1.0 qiuzhenhui create
+*******************************************************/
+void zte_get_device_mode(webs_t wp)
+{
+
+ FILE *fp = NULL;
+ char buffer[NVIO_MAX_LEN] = {0};
+ char device_mode[NVIO_MAX_LEN] = {0};
+
+ fp = popen("cat /sys/class/android_usb/android0/debug_enable", "r");
+ if (NULL == fp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_get_device_mode: get read fp failed."); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return ;
+ }
+ (void)fgets(buffer, sizeof(buffer), fp);
+ (void)sscanf(buffer, "%s", device_mode);
+ (void)pclose(fp);
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, "device_mode", device_mode, 0);
+ zte_rest_cmd_write_foot(wp);
+}
+
+/**********************************************************************
+* Function: zte_get_login_status_value
+* Description: to get webui login status
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/17 V1.0 chenyi first version
+* 2012/10/18 V2.0 huangmin modify
+**********************************************************************/
+void zte_get_login_status_value(webs_t wp, char *login_status)
+{
+
+ char loginfo[NV_ITEM_STRING_LEN_20] = {0};
+ char_t nv_ipaddr[40] = {0};
+ zte_topsw_state_e_type status = ZTE_NVIO_MAX;
+ char_t *ip_address = NULL;
+ char buf[NV_ITEM_STRING_LEN_10] = {0};
+ char cook_id[COOKIE_SESSION_SIZE+1] = {0};
+
+ if (NULL == login_status) {
+ slog(MISC_PRINT, SLOG_DEBUG, "login_status is null.\n");
+ return;
+ }
+ status = zte_web_read(NV_LOGINFO, loginfo);
+ if (ZTE_NVIO_DONE != status) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_get_loginfo: read the nv [loginfo] fail.");
+ return ;
+ }
+ //get request ip addr
+ ip_address = websGetRequestIpaddr(wp);
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH wp->ipaddr ipaddr is array, it's address can not be NULL
+ if (NULL == ip_address) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_get_loginfo: ip_address is null.");
+ return ;
+ }
+#endif
+ (void)zte_web_read(NV_USER_IP_ADDR, nv_ipaddr);
+ (void)zte_web_read(NV_COOKIE_ID, cook_id);
+ sc_cfg_get(NV_DATA_CARD, buf, sizeof(buf));
+ if (((0 == strncmp(loginfo, "ok", NV_ITEM_STRING_LEN_20))
+#ifdef WEBS_SECURITY
+ && wp->cookie && strlen(wp->cookie) > strlen(cook_id)
+ && strstr(wp->cookie, cook_id)
+#endif
+ && (0 == strncmp(ip_address, nv_ipaddr, sizeof(nv_ipaddr))))
+ || (0 == strncmp(&buf, "1", sizeof(buf)))) {
+ strncpy(login_status, "ok", NV_ITEM_STRING_LEN_20);
+ } else {
+ strncpy(login_status, "", NV_ITEM_STRING_LEN_20);
+ //slog(MISC_PRINT, SLOG_DEBUG,"zte_get_login loginfo:%s,ip:%s,nv:%s,cookie:%s,nv:%s,buf:%s!\n",loginfo,ip_address,nv_ipaddr,wp->cookie,cook_id,buf);
+ }
+}
+/******************************************************
+* Function: zte_get_login_lock_time
+* Description: get current login lock time
+* Input: http request info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2011/06/16 V1.0 qiuzhenhui create
+*******************************************************/
+void zte_get_login_lock_time(webs_t wp)
+{
+ char last_record_time[LOGIN_RECORD_TIME] = {0};
+ int last_record_time_num = 0;
+ int curr_record_time_num = 0;
+ int lock_time = 0;
+ int last_lock_time = 0;
+ (void)zte_web_read(NV_LAST_LOGIN_TIME, last_record_time);
+ last_record_time_num = atoi(last_record_time);
+ if(last_record_time_num < 0 || last_record_time_num > INT_MAX-1) // kw 3
+ {
+ last_record_time_num = 0;
+ }
+
+ curr_record_time_num = zte_web_getCurrentTime();
+ lock_time = curr_record_time_num - last_record_time_num;
+ last_lock_time = LOGIN_FAIL_LOCK_TIME - lock_time;
+
+ if (last_lock_time >= 0) {
+ (void)websWrite(wp, T("\"login_lock_time\":\"%d\""), last_lock_time);
+ } else {
+ (void)websWrite(wp, T("\"login_lock_time\":\"-1\""));
+ }
+}
+
+/******************************************************
+* Function: zte_get_connection_mode(webs_t wp)
+* Description: get connection mode
+* Input: http request info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2011/11/15 V1.0 chenyi create
+*******************************************************/
+void zte_get_connection_mode(webs_t wp)
+{
+ char_t connection_mode[NV_ITEM_STRING_LEN_20] = {0};
+ char_t auto_conn_when_roaming[NV_ITEM_STRING_LEN_10] = {0};
+
+ (void)zte_web_read(NV_DIAL_MODE, connection_mode);
+ (void)zte_web_read(NV_ROAM_SETTING_OPTION, auto_conn_when_roaming);
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, "connectionMode", connection_mode, 1);
+ zte_rest_cmd_write(wp, "autoConnectWhenRoaming", auto_conn_when_roaming, 0);
+ zte_rest_cmd_write_foot(wp);
+}
+
+int zte_web_getCurrentTime()
+{
+ time_t sys_time = 0;
+ int currentTime = (int)(time(&sys_time));
+ return currentTime;
+}
+
+/**
+ * base64_decode - Base64 decode
+ * @src: Data to be decoded
+ * @len: Length of the data to be decoded
+ * @out_len: Pointer to output length variable
+ * Returns: Allocated buffer of out_len bytes of decoded data,
+ * or %NULL on failure
+ *
+ * Caller is responsible for freeing the returned buffer.
+ */
+unsigned char * zte_base64_decode(const unsigned char *src, size_t len,
+ size_t *out_len)
+{
+ unsigned char dtable[256], *out, *pos, in[4], block[4], tmp;
+ size_t i, count, olen;
+
+ memset(dtable, 0x80, 256);
+ for (i = 0; i < sizeof(base64_table) - 1; i++)
+ dtable[base64_table[i]] = (unsigned char) i;
+ dtable['='] = 0;
+
+ count = 0;
+ for (i = 0; i < len; i++) {
+ if (dtable[src[i]] != 0x80)
+ count++;
+ }
+
+ if (count == 0 || count % 4)
+ return NULL;
+
+ olen = count / 4 * 3;
+ pos = out = malloc(olen);
+ if (out == NULL)
+ return NULL;
+ memset(pos, 0, olen);
+
+ count = 0;
+ for (i = 0; i < len; i++) {
+ tmp = dtable[src[i]];
+ if (tmp == 0x80)
+ continue;
+
+ in[count] = src[i];
+ block[count] = tmp;
+ count++;
+ if (count == 4) {
+ *pos++ = (block[0] << 2) | (block[1] >> 4);
+ *pos++ = (block[1] << 4) | (block[2] >> 2);
+ *pos++ = (block[2] << 6) | block[3];
+ count = 0;
+ }
+ }
+
+ if (pos > out) {
+ if (in[2] == '=')
+ pos -= 2;
+ else if (in[3] == '=')
+ pos--;
+ }
+
+ *out_len = pos - out;
+ return out;
+}
+#ifdef WEBS_SECURITY
+char *zte_base64_encode(const char *data, int data_len)
+{
+ int prepare = 0;
+ int ret_len;
+ int temp = 0;
+ char *ret = NULL;
+ char *f = NULL;
+ int tmp = 0;
+ char changed[4];
+ int i = 0;
+ const char base[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+ if(data == NULL)
+ {
+ return NULL;
+ }
+ if(data_len == 0)
+ {
+ return NULL;
+ }
+ ret_len = data_len / 3;
+ temp = data_len % 3;
+ if (temp > 0)
+ {
+ ret_len += 1;
+ }
+ ret_len = ret_len*4 + 1;
+ ret = (char *)malloc(ret_len);
+
+ if (ret == NULL)
+ {
+ printf("No enough memory.\n");
+ return NULL;
+ }
+ memset(ret, 0, ret_len);
+ f = ret;
+ while (tmp < data_len)
+ {
+ temp = 0;
+ prepare = 0;
+ memset(changed, '\0', 4);
+ while (temp < 3)
+ {
+ //printf("tmp = %d\n", tmp);
+ if (tmp >= data_len)
+ {
+ break;
+ }
+ prepare = ((prepare << 8) | (data[tmp] & 0xFF));
+ tmp++;
+ temp++;
+ }
+ prepare = (prepare<<((3-temp)*8));
+ //printf("before for : temp = %d, prepare = %d\n", temp, prepare);
+ for (i = 0; i < 4 ;i++ )
+ {
+ if (temp < i)
+ {
+ changed[i] = 0x40;
+ }
+ else
+ {
+ changed[i] = (prepare>>((3-i)*6)) & 0x3F;
+ }
+ *f = base[changed[i]];
+ //printf("%.2X", changed[i]);
+ f++;
+ }
+ }
+ *f = '\0';
+ return ret;
+}
+#endif
diff --git a/ap/app/goahead/interface5.0/zte_web_get_fw_para.h b/ap/app/goahead/interface5.0/zte_web_get_fw_para.h
new file mode 100755
index 0000000..7f70df6
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_get_fw_para.h
@@ -0,0 +1,38 @@
+
+
+
+#define cprintf(fmt, args...) do { \
+ FILE *fp = fopen("/dev/console", "w"); \
+ if (fp) { \
+ fprintf(fp, fmt, ## args); \
+ fclose(fp); \
+ } \
+} while (0)
+extern void web_feedback_header(webs_t wp);
+extern void zte_write_result_to_web(webs_t wp, char_t *result);
+extern void zte_get_connection_mode(webs_t wp);
+extern void zte_get_pbm_data(webs_t wp);
+extern void zte_get_pbm_data_total(webs_t wp);
+extern void zte_get_pbm_parameter_info(webs_t wp);
+extern void zte_get_sms_data(webs_t wp);
+extern void zte_get_sms_data_total(webs_t wp);
+extern void zte_get_sms_parameter_info(webs_t wp);
+extern void zte_get_sms_cmd_status_info(webs_t wp);
+extern void zte_get_sms_capacity_info(webs_t wp);
+extern int zte_get_sms_remain_capacity();
+extern void zte_get_sms_status_rpt_data(webs_t wp);
+extern void zte_get_sms_unread_count(webs_t wp);
+extern void zte_get_boradcast_data(webs_t wp);
+extern void zte_get_device_mode(webs_t wp);
+extern void zte_lan_user_mac_get(webs_t wp);
+
+extern void zte_get_ussd_data_info(webs_t wp);
+
+extern void zte_web_get_para_xml(webs_t wp, char_t *nv_name);
+extern void zte_web_get_para_nologin(webs_t wp, char_t *nv_name);
+extern void zte_get_request_process_xml(webs_t wp, const char_t *cmd);
+extern void zte_get_request_process_nologin(webs_t wp, const char_t *cmd);
+
+extern void zte_get_fota_settings(webs_t wp);
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_httpshare.c b/ap/app/goahead/interface5.0/zte_web_httpshare.c
new file mode 100644
index 0000000..e77e0db
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_httpshare.c
@@ -0,0 +1,2690 @@
+#include "zte_web_interface.h"
+#include "zte_web_httpshare.h"
+#include "../server/webs.h"
+#include "sqlite3.h"
+#include <sys/wait.h>
+#include "cfg_api.h"
+
+USER_COMMON_INFOR pp_header;
+
+static char file_buf_memory[FILE_BUFFER_LEN] = {0};
+static char *file_buf_memory_ptr = NULL;
+static int tcard_file_size = 0;
+static BOOL file_end = FALSE;
+char download_file[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1] = {0};
+
+void zte_httpshare_check_upload_file();
+
+static char* neutralize(char *path);
+
+int zte_httpshare_call_system(char * cmd)
+{
+ if (NULL == cmd) {
+ slog(MISC_PRINT,SLOG_DEBUG,"[httpshare]zte_httpshare_call_system: NULL-------------------------------\n");
+ return -1;
+ }
+ slog(MISC_PRINT,SLOG_NORMAL,"[httpshare]zte_httpshare_call_system: [%s] \n", cmd);
+#if 0
+ return system(cmd);
+#else
+ return zxic_system(cmd);
+#endif
+}
+
+static int zte_httpshare_call_system_echo(char * cmd)
+{
+ if (NULL == cmd) {
+ slog(MISC_PRINT,SLOG_DEBUG,"[httpshare]zte_httpshare_call_system_echo: NULL-------------------------------\n");
+ return -1;
+ }
+ slog(MISC_PRINT,SLOG_NORMAL,"[httpshare]zte_httpshare_call_system_echo: [%s] \n", cmd);
+
+ return soft_system(cmd);
+}
+
+
+int zte_system(char *cmd[])
+{
+ pid_t pid;
+ int status;
+ pid_t ret;
+ char *newenviron[] = { NULL };
+
+ // cmd array's size is unknown
+// slog(MISC_PRINT,SLOG_NORMAL,"[httpshare]zte_httpshare_call_zte_system: [%s %s %s] \n", cmd[0],cmd[1],cmd[2]);
+
+ pid = fork();
+ if (pid == -1) {
+ return -1;
+ } else if (pid == 0) {
+ /*child process */
+ execve(cmd[0], cmd, newenviron);
+ /* for kw
+ if (execve(cmd[0], cmd, newenviron) == -1)
+ _exit(127);*/
+ } else {
+ /*father process */
+ while ((ret = waitpid(pid, &status, 0)) == -1) {
+ if (errno != EINTR)
+ break;
+ }
+
+ if (ret != -1 && WIFEXITED(status))
+ return WEXITSTATUS(status);
+ }
+
+ return -1;
+}
+
+zte_httpshare_db_result_e_type zte_httpshare_db_open(sqlite3**db)
+{
+ sqlite3* tmp_db;
+ int rc = 0;
+
+ if (NULL == db) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_db_open:invalide inputs.\n");
+ return ZTE_HTTPSHARE_DB_ERROR_INVAILD_PTR;
+ }
+
+ rc = sqlite3_open(ZTE_HTTPSHARE_DB_PATH, &tmp_db);
+
+ if (rc) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_db_open:can not open db,sqlite3_errmsg:%s\n", sqlite3_errmsg(tmp_db));
+ (void)sqlite3_close(tmp_db);
+ return ZTE_HTTPSHARE_DB_ERROR_NOT_OPEN_DB;
+ }
+ *db = tmp_db;
+ return ZTE_HTTPSHARE_DB_OK;
+}
+
+zte_httpshare_db_result_e_type zte_httpshare_db_close(sqlite3*db)
+{
+ int rc = 0;
+
+ if (NULL == db) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_db_close:invalide inputs.\n");
+ return ZTE_HTTPSHARE_DB_ERROR_INVAILD_PTR;
+ }
+ rc = sqlite3_close(db);
+ if (rc) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_db_close:can not close db.\n");
+ return ZTE_HTTPSHARE_DB_ERROR;
+ }
+ return ZTE_HTTPSHARE_DB_OK;
+}
+zte_httpshare_db_result_e_type zte_httpshare_db_exec_sql(const char *sql, sqlite3_callback callback, void *fvarg)
+{
+ sqlite3* db;
+ int rc = 0;
+
+ if (NULL == sql) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_db_exec_sql:invalide inputs.\n");
+ return ZTE_HTTPSHARE_DB_ERROR_INVAILD_PTR;
+ }
+ if (0 != zte_httpshare_db_open(&db)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_db_exec_sql:open httpshare.db failed.\n");
+ return ZTE_HTTPSHARE_DB_ERROR_NOT_OPEN_DB;
+ }
+ rc = sqlite3_exec(db, sql, callback, fvarg, NULL);
+
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]zte_httpshare_db_exec_sql:%s rc=%d\n", sql, rc);
+ if (rc) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_db_exec_sql:can not exec sql,sqlite3_errmsg:%s.\n", sqlite3_errmsg(db));
+ (void)zte_httpshare_db_close(db);
+ return ZTE_HTTPSHARE_DB_ERROR;
+ }
+ (void)zte_httpshare_db_close(db);
+
+ return ZTE_HTTPSHARE_DB_OK;
+}
+
+
+int zte_insert_download_file(char *path)
+{
+ memset(download_file, 0, sizeof(download_file));
+ strncpy(download_file, path, sizeof(download_file)-1);
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]download_file->%s\n", download_file);
+ return 1;
+}
+
+int zte_del_download_file()
+{
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]del download_file->%s\n", download_file);
+ memset(download_file, 0, sizeof(download_file));
+ return 1;
+}
+
+
+int zte_check_download_file(char *path)//0: ²»´æÔڼǼ 1:¼Ç¼´æÔÚ
+{
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_check_download_file:path->%s\n", path);
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_check_download_file:download_file->%s\n", download_file);
+
+ if (!strncmp(path, download_file, strlen(path))) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_check_download_file:find used file->%s\n", path);
+ return 1;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_check_download_file:not find file->%s\n", path);
+ return 0;
+ }
+}
+
+int zte_check_downloading_file()//0: ²»´æÔڼǼ 1:¼Ç¼´æÔÚ
+{
+ slog(MISC_PRINT, SLOG_DEBUG,"[zyl]strlen(download_file)->%d\n", strlen(download_file));
+ return strlen(download_file);
+}
+
+void zte_change_rootpath_time()
+{
+ struct utimbuf times = {0};
+ utime(SD_CARD_PATH, ×); //timesΪ¿Õʱ£¬utime ½«·ÃÎÊʱ¼äºÍÐÞ¸Äʱ¼äÉèÖÃΪµ±Ç°Ê±¼ä
+ return;
+}
+
+void zte_init_user_list()
+{
+ memset(&pp_header, 0, sizeof(USER_COMMON_INFOR));
+ memset(&download_file, 0, sizeof(download_file));
+}
+
+int zte_del_file(char *path)
+{
+ //char *cmd = NULL;
+
+ if (!path) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_del_file null\n");
+ return 0;
+ }
+ /*
+ cmd = (char *)malloc(strlen(path) + 10);
+ //char cmd[4*ZTE_HTTPSHARE_FILE_NAME_MAX_LEN+1] = {0};
+ if (NULL == cmd) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_del_file malloc error!\n");
+ return 0;
+ }
+ snprintf(cmd, strlen(path) + 10, "rm -rf \"%s\"", path);
+
+ zte_httpshare_call_system(cmd);
+ */
+ char *cmd[] = { "/bin/rm", "-rf", path, NULL };
+ zte_system(cmd);
+ if (access(path, F_OK) == 0) {
+ if(remove(path) < 0){
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]remove file %s fail!\n", path);
+ return 0;
+ }
+ if (access(path, F_OK) == 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]delfile %s fail!\n", path);
+ //free(cmd);
+ return 0;
+ }
+ }
+ //free(cmd);
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]delfile %s OK!\n", path);
+ return 1;
+
+}
+
+int zte_umount_dev()
+{
+ char cmd[ZTE_HTTPSHARE_DEFAULT_LEN] = {0};
+ char sd_path[20] = {0};
+ char *mount_path = "/bin/umount";
+
+ sc_cfg_get ("cur_tcard_blk", sd_path, sizeof(sd_path));
+ if (strlen(sd_path) != 0) {
+ snprintf(cmd, sizeof(cmd), "%s %s", mount_path, sd_path);
+ }
+ else {
+ snprintf(cmd, sizeof(cmd), "%s %s", mount_path, USB_DEV_SDCARD_PATH);
+ }
+ zte_httpshare_call_system(cmd);
+
+ memset(cmd, 0, sizeof(cmd));
+ snprintf(cmd, sizeof(cmd), "%s %s", mount_path, USB_DEV_SDCARD_PATH_BACK);
+ zte_httpshare_call_system(cmd);
+
+ memset(cmd, 0, sizeof(cmd));
+ snprintf(cmd, sizeof(cmd), "%s %s", mount_path, SD_CARD_PATH);
+ zte_httpshare_call_system(cmd);
+
+ return 0;
+}
+
+/*¶ÁдÎļþÏà¹Ø²Ù×÷begin*/
+static int filelength(FILE *fp)
+{
+ int num;
+ fseek(fp,0,SEEK_END);
+ num=ftell(fp);
+ fseek(fp,0,SEEK_SET);
+ return num;
+}
+
+static int readfile(char *path, char* buf, unsigned len)
+{
+ FILE *fp;
+ unsigned int length;
+ size_t read_len = 0;
+
+ if((fp=fopen(path,"r"))==NULL)
+ {
+ slog(USBCFGMNG_PRINT,SLOG_ERR, "[usbCfgMng] open file %s error.\n",path);
+ return -1;
+ }
+ length=filelength(fp);
+ length = length > len? len: length;
+ //ch=(char *)malloc(length+1);
+ read_len = fread(buf,length,1,fp);
+ if(read_len != 1)
+ {
+ slog(USBCFGMNG_PRINT,SLOG_ERR, "read len:%d.\n",read_len);
+ }
+
+ fclose(fp);
+ *(buf+length)='\0';
+ return (int)length;
+}
+int zte_get_cdrom()
+{
+ char cdrom0[8] = {0};
+ char cdrom1[8] = {0};
+ int rtv = 0;
+ int cdrom_state0 = -1;
+ int cdrom_state1 = -1;
+ rtv = readfile("/sys/devices/platform/zx29_hsotg.0/gadget/lun0/cdrom", cdrom0, 8);
+ cdrom_state0 = atoi(cdrom0);
+ rtv = readfile("/sys/devices/platform/zx29_hsotg.0/gadget/lun1/cdrom", cdrom1, 8);
+ cdrom_state1 = atoi(cdrom1);
+ if(cdrom_state0 == 0) //lun0ΪuÅÌ
+ {
+ return 0;
+ }
+
+ if(cdrom_state1 == 0) //lun1ΪuÅÌ
+ {
+ return 1;
+ }
+
+ return -1;
+
+}
+
+void zte_mount_usb()
+{
+ int cdrom = -1;
+ cdrom = zte_get_cdrom();
+
+ if(cdrom == 0)
+ {
+ zte_umount_dev();
+ zte_httpshare_call_system_echo("/bin/echo /dev/mmcblk0 > /sys/devices/platform/zx29_hsotg.0/gadget/lun0/file");
+ }
+ else if(cdrom == 1)
+ {
+ zte_umount_dev();
+ zte_httpshare_call_system_echo("/bin/echo /dev/mmcblk0 > /sys/devices/platform/zx29_hsotg.0/gadget/lun1/file");
+ }
+}
+
+
+
+int zte_httpshare_mount_sd()
+{
+ char *cmd[] = { "/bin/mount", "-t", "vfat",USB_DEV_SDCARD_PATH,SD_CARD_PATH, NULL };
+ char *cmd1[] = { "/bin/mount", "-t", "vfat",USB_DEV_SDCARD_PATH_BACK,SD_CARD_PATH, NULL };
+
+ char sd_path[20] = {0};
+ int i = 0;
+
+ zte_umount_dev();
+//ÂÖѯ·ÖÇø1-10
+ for (i = 1; i <= 10; i++) {
+ memset(sd_path, 0, sizeof(sd_path));
+ snprintf(sd_path, sizeof(sd_path), "/dev/mmcblk0p%d", i);
+ cmd[3] = sd_path;
+ if (0 == zte_system(cmd)) {
+ sc_cfg_set("cur_tcard_blk", sd_path);
+ sleep(2);
+ return 1;
+ }
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_mount_sd %s error!\n", sd_path);
+ }
+
+ if (0 != zte_system(cmd1)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_mount_sd %s error!\n", USB_DEV_SDCARD_PATH_BACK);
+ return 0;
+ }
+ sleep(2);
+ return 1;
+}
+
+int zte_mount_httpshare()
+{
+ char cmd[ZTE_HTTPSHARE_DEFAULT_LEN] = {0};
+
+ int cdrom = -1;
+
+ cdrom = zte_get_cdrom();
+ slog(MISC_PRINT, SLOG_ERR,"zte_mount_httpshare:cdrom=%d\n",cdrom);
+ if(cdrom == 0)
+ {
+ memset(cmd, 0, sizeof(cmd));
+ zte_httpshare_call_system_echo("/bin/echo NULL > /sys/devices/platform/zx29_hsotg.0/gadget/lun0/file");
+ if (-1 == access(SD_CARD_PATH, F_OK)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_mount_httpshare mmc2 no exist!\n");
+ if(mkdir(SD_CARD_PATH, 0777) < 0)
+ {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]mkdir(%s) fail!\n", SD_CARD_PATH);
+ }
+ return zte_httpshare_mount_sd();
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_mount_httpshare %s exist\n", SD_CARD_PATH);
+ return zte_httpshare_mount_sd();
+ }
+ }
+ else if(cdrom == 1)
+ {
+ memset(cmd, 0, sizeof(cmd));
+ zte_httpshare_call_system_echo("/bin/echo NULL > /sys/devices/platform/zx29_hsotg.0/gadget/lun1/file");
+ if (-1 == access(SD_CARD_PATH, F_OK)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_mount_httpshare mmc2 no exist!\n");
+ if(mkdir(SD_CARD_PATH, 0777) < 0){
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]mkdir fail %s exist\n", SD_CARD_PATH);
+ }
+ return zte_httpshare_mount_sd();
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_mount_httpshare %s exist\n", SD_CARD_PATH);
+ return zte_httpshare_mount_sd();
+ }
+ }
+ else
+ return 0;
+
+}
+
+
+void zte_write_auth_to_web(webs_t wp)
+{
+
+ if ((NULL == wp)) {
+ return;
+ }
+ char HTTP_SHARE_WR_AUTH[10] = {0};
+ char HTTP_SHARE_FILE[1024] = {0};
+
+ (void)zte_web_read(NV_HTTPSHARE_WR_AUTH, HTTP_SHARE_WR_AUTH);
+ (void)zte_web_read(NV_HTTPSHARE_FILE, HTTP_SHARE_FILE);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_write_auth_to_web: value is [%s]\n", HTTP_SHARE_WR_AUTH);
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_write_auth_to_web: value is [%s]\n", HTTP_SHARE_FILE);
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"HTTP_SHARE_WR_AUTH\":\"%s\",\"HTTP_SHARE_FILE\":\"%s\"}"),
+ HTTP_SHARE_WR_AUTH, HTTP_SHARE_FILE);
+}
+void zte_write_tcard_name_to_web(webs_t wp)
+{
+ if ((NULL == wp)) {
+ return;
+ }
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"sd_card_name\":\"%s\"}"), "MicroSD Card");
+}
+
+
+void write_sd_card_total_size(uint32 total_size)
+{
+ char sd_card_total_size[NV_ITEM_VALUE_STRING_LEN] = {0};
+
+ snprintf(sd_card_total_size, sizeof(sd_card_total_size), "%lu", total_size);
+ (void)zte_web_write("sd_card_total_size", sd_card_total_size);
+}
+
+void write_sd_card_avi_space_to_nv(uint32 free_size)
+{
+ char sd_card_avi_space[NV_ITEM_VALUE_STRING_LEN] = {0};
+ snprintf(sd_card_avi_space, sizeof(sd_card_avi_space), "%lu", free_size);
+ (void)zte_web_write("sd_card_avi_space", sd_card_avi_space);
+}
+
+
+void get_used_space_size()
+{
+
+ struct statvfs file_stat;
+ uint32 total_size = 0;
+ uint32 b_used = 0 ;
+ if (zte_check_file_exist(SD_CARD_PATH)) {
+ (void)statvfs(SD_CARD_PATH, &file_stat);
+ total_size = file_stat.f_blocks * (file_stat.f_bsize / 512) / 64;
+ b_used = file_stat.f_bfree * (file_stat.f_bsize / 512) / 64;
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]get_used_space_size dirsize = %ld, %ld\n", total_size, b_used);
+ if (total_size / 1024 / 1024 > 32) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]get_used_space_size total size abnormal >1024G !!!!\n");
+ total_size = total_size / 1024;
+ }
+ if (b_used / 1024 / 1024 > 32) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]get_used_space_size b_used size abnormal >1024G !!!!\n");
+ b_used = b_used / 1024;
+ }
+ if (total_size < b_used) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]get_used_space_size sdcard size abnormal : total_size<b_used !!!!\n");
+ }
+ write_sd_card_total_size(total_size);
+ write_sd_card_avi_space_to_nv(b_used);
+ }
+
+}
+
+
+
+void zte_write_space_info_to_web(webs_t wp)
+{
+ if ((NULL == wp)) {
+ return;
+ }
+ char sd_card_total_size[NV_ITEM_VALUE_STRING_LEN] = {0};
+ char sd_card_avi_space[NV_ITEM_VALUE_STRING_LEN] = {0};
+
+ (void)zte_web_read("sd_card_total_size", sd_card_total_size);
+ (void)zte_web_read("sd_card_avi_space", sd_card_avi_space);
+
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"sd_card_total_size\":\"%s\",\"sd_card_avi_space\":\"%s\"}"),
+ sd_card_total_size, sd_card_avi_space);
+}
+
+
+/**** *****/
+//check whether the dir exist or not
+zte_httpshare_return_e_type zte_httpshare_check_and_creat_dir(char *path)
+{
+ if (!path) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_check_and_creat_dir: check dir path null.\n");
+ return ZTE_HTTPSHARE_FAILURE;
+ }
+ if (-1 == access(path, F_OK)) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_httpshare_check_and_creat_dir:%s does not exist,socreate it.\n", ZTE_HTTPSHARE_DB_DIR);
+ if (-1 == mkdir(path, 0777)) { /*lint !e1055*/
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_check_and_creat_dir:failed to create db dir.\n");
+ return ZTE_HTTPSHARE_FAILURE;
+ }
+ }
+ return ZTE_HTTPSHARE_SUCCESS;
+}
+
+zte_httpshare_db_result_e_type zte_httpshare_create_table()
+{
+ zte_httpshare_db_result_e_type result = ZTE_HTTPSHARE_DB_OK;
+
+ //create httpshare table
+ result = zte_httpshare_db_exec_sql(ZTE_CREATE_TABLE_HTTPSHARE_SQL, NULL, NULL);
+
+ if (ZTE_HTTPSHARE_DB_OK != result) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_create_table:create httpshare table result is %d\n", result);
+ return result;
+ }
+ return result;
+}
+
+//based path,check the file wether in Tcard
+int zte_check_file_exist(char * path)
+{
+
+ if (!path) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_check_file_exist:file path null.\n");
+ return 0;
+ }
+
+ if (-1 == access(path, F_OK)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_check_file_exist path=%s (file not exist)\n", path);
+ return 0;
+
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_check_file_exist path=%s (file exist)\n", path);
+ return 1;
+ }
+}
+
+
+int zte_check_sdcard_exist()
+{
+ int ret = 0;
+
+ FILE *fd = NULL;
+
+ char size_sd[ZTE_HTTPSHARE_LEN_12] = {0};
+
+ //system("echo /dev/mmcblk0>/proc/proc_sd/file");
+
+ if(access("/sys/kernel/debug/mmc1/present", R_OK) != 0)
+ {
+ slog(MISC_PRINT, SLOG_ERR, "[httpshare] zte_check_sdcard_exist file not exist!\n");
+ return ret;
+ }
+
+ //fd = popen("cat /proc/proc_sd/size","r");
+ fd = popen("cat /sys/kernel/debug/mmc1/present", "r");
+ //printf("[httpshare]zte_check_sdcard_exist cat /sys/kernel/debug/mmc1/present\n");
+
+ if (fd == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_check_sdcard_exist popen file = NULL\n");
+ return ret;
+ }
+ if (!feof(fd) && fgets(size_sd, sizeof(size_sd), fd) != NULL) {
+ ret = atoi(size_sd);
+ }
+
+ pclose(fd);
+
+ //printf("[httpshare]zte_check_sdcard_exist :get size data = %d\n",ret);
+
+ return ret;
+}
+
+
+// Get current mode from nv
+zte_httpshare_current_mode_type zte_httpshare_get_current_mode()
+{
+ char nv_item[ZTE_HTTPSHARE_DEFAULT_LEN] = {0};
+ (void)zte_web_read(STR_SDCARD_MODE_OPT, nv_item);
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]sdcard_mode_option:%s\n", nv_item);
+
+ if (0 == strcmp("1", nv_item)) {
+ return ZTE_HTTPSHARE_HTTPSHARE;
+ } else {
+ return ZTE_HTTPSHARE_USB;
+ }
+
+}
+int zte_httpshare_change_current_mode(zte_httpshare_current_mode_type mode)
+{
+ char cmd[ZTE_HTTPSHARE_DEFAULT_LEN] = {0};
+ int cdrom = -1;
+
+ if (ZTE_HTTPSHARE_HTTPSHARE == mode) {
+ if (!zte_mount_httpshare()) { //½«dev½Úµã¹ÒÔØÎª/mnt/jffs2/mmc2
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]change to %d mode faile\n", mode);
+ (void)zte_web_write(STR_SDCARD_MODE_OPT, "0");
+
+ cdrom = zte_get_cdrom();
+ slog(MISC_PRINT, SLOG_ERR,"zte_mount_httpshare:cdrom=%d\n",cdrom);
+ if(cdrom == 0)
+ zte_httpshare_call_system_echo("/bin/echo dev/mmcblk0 > /sys/devices/platform/zx29_hsotg.0/gadget/lun0/file");
+ else if(cdrom == 1)
+ zte_httpshare_call_system_echo("/bin/echo dev/mmcblk0 > /sys/devices/platform/zx29_hsotg.0/gadget/lun1/file");
+ return ZTE_CHANGE_MODE_ERROR;
+ }
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]change to %d mode suc.\n", mode);
+ (void)zte_web_write(STR_SDCARD_MODE_OPT, "1");
+ } else {
+ zte_httpshare_check_upload_file();
+
+ zte_mount_usb();
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]change to %d mode suc.\n", mode);
+
+ (void)zte_web_write(STR_SDCARD_MODE_OPT, "0");
+ }
+ return ZTE_CHANGE_MODE_OK;
+
+}
+
+int zte_init_sdcard_mode()
+{
+ if (zte_check_sdcard_exist() > 0) {
+ (void)zte_web_write(NV_SD_CARD_STATE, "1");
+
+ if (ZTE_HTTPSHARE_USB == zte_httpshare_get_current_mode()) {
+ return zte_httpshare_change_current_mode(ZTE_HTTPSHARE_USB);
+ } else {
+ return zte_httpshare_change_current_mode(ZTE_HTTPSHARE_HTTPSHARE);
+ }
+ } else {
+ (void)zte_web_write(NV_SD_CARD_STATE, "0");
+ zte_del_file(SD_CARD_PATH);
+ return ZTE_CHANGE_MODE_ERROR;
+ }
+}
+
+void zte_httpshare_init()
+{
+
+ //zte_init_user_list(&pp_header); //creat user nod
+ zte_init_user_list();
+ (void)zte_del_file(ZTE_HTTPSHARE_DB_PATH);
+
+ if (ZTE_HTTPSHARE_SUCCESS != zte_httpshare_check_and_creat_dir(ZTE_HTTPSHARE_DB_DIR)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_init:zte_httpshare_check_and_creat_dir ZTE_HTTPSHARE_DB_DIR fail!\n");
+ return;
+ }
+ if (ZTE_HTTPSHARE_DB_OK != zte_httpshare_create_table()) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_init:zte_httpshare_create_table fail!\n");
+ return;
+ }
+
+ zte_init_sdcard_mode();
+}
+
+
+int sd_card_isExist()
+{
+ char sdcard_state[ZTE_HTTPSHARE_DEFAULT_LEN] = {0};
+ (void)zte_web_read(NV_SD_CARD_STATE, sdcard_state);
+ if (0 == strcmp("0", sdcard_state)) {
+ printf("[httpshare]sd_card_isExist:sdcard no exist.\n");
+ return 0;
+ } else if (0 == strcmp("1", sdcard_state)) {
+ return 1;
+ } else {
+ printf("[httpshare]sd_card_isExist:sdcard state error.\n");
+ return 0;
+ }
+
+}
+
+boolean zte_httpshare_check_patch_inlegal(const char *path_source)
+{
+ char *token = NULL;
+
+ if (0 == strncmp(path_source, HTTPSHARE_PATH_INLEGAL, 8)) {
+ if (path_source[8] == '/' || path_source[8] == '\0') {
+ return TRUE;
+ }
+ }
+
+ if ((token = strchr(path_source, 39)) != NULL) { // 39 means '
+ while (*token++ == 32); // 32 means (space)
+
+ switch (*token) {
+ case 59: // 59 means ;
+ case 124: // 124 means |
+ return TRUE;
+ case 38: // 38 means &
+ if (*(++token) == 38)
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ }
+
+ return FALSE;
+}
+
+int zte_httpshare_db_id_cb(void *fvarg, int line, char **zresult, char **lname)
+{
+ if (1 > line) {
+ printf("[httpshare]zte_httpshare_db_id_cb:record no data.\n");
+ return -1;
+ }
+ *(int*)fvarg = atoi(zresult[0]);
+
+ return 0;
+}
+
+int zte_httpshare_check_record(char *ip)
+{
+ if (!ip) {
+ printf("[httpshare]zte_httpshare_check_record:para null.\n");
+ return -1;
+ }
+
+ int id = 0;
+ zte_httpshare_db_result_e_type result = ZTE_HTTPSHARE_DB_OK;
+
+ char sql[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 40] = {0};
+
+ snprintf(sql, sizeof(sql), "select id from %s where ip = '%s' ", ZTE_HTTPSHARE_DB_NAME, ip);
+
+ result = zte_httpshare_db_exec_sql(sql, zte_httpshare_db_id_cb, &id);
+ (void)sleep(2);
+ if (ZTE_HTTPSHARE_DB_OK != result) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_check_record:result %d\n", result);
+ }
+
+ return id;
+
+}
+
+
+zte_httpshare_db_result_e_type zte_httpshare_update_record(char *ip, char *path)
+{
+
+ if ((!ip) || (!path)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_update_record:para null.\n");
+ return ZTE_HTTPSHARE_DB_ERROR;
+ }
+
+ zte_httpshare_db_result_e_type result = ZTE_HTTPSHARE_DB_OK;
+
+ char sql[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 40] = {0};
+ snprintf(sql, sizeof(sql), "update %s set path =\"%s\" where ip = \"%s\" ", ZTE_HTTPSHARE_DB_NAME, path, ip);
+
+ result = zte_httpshare_db_exec_sql(sql, NULL, NULL);
+ if (ZTE_HTTPSHARE_DB_OK != result) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_update_record:update record result %d\n", result);
+ return result;
+ }
+
+ return result;
+}
+
+int zte_httpshare_getpath_cb(void *fvarg, int line, char **zresult, char **lname)
+{
+ if (1 > line) return -1;
+ memcpy(fvarg, zresult[0], strlen(zresult[0]));
+ return 0;
+}
+
+zte_httpshare_db_result_e_type zte_httpshare_get_record(char *ip, char *path)
+{
+ if ((!ip) || (!path)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_get_record:para null.\n");
+ return ZTE_HTTPSHARE_DB_ERROR;
+ }
+ zte_httpshare_db_result_e_type result = ZTE_HTTPSHARE_DB_OK;
+
+ char sql[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 40] = {0};
+ snprintf(sql, sizeof(sql), "select path from %s where ip = '%s' ", ZTE_HTTPSHARE_DB_NAME, ip);
+
+ result = zte_httpshare_db_exec_sql(sql, zte_httpshare_getpath_cb, path);
+ (void)sleep(1);
+ if (ZTE_HTTPSHARE_DB_OK != result) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_get_record:update record result %d\n", result);
+ return result;
+ }
+
+ return result;
+}
+
+
+zte_httpshare_db_result_e_type zte_httpshare_insert_path_to_db(char * ip, char *path)
+{
+
+ if ((!ip) || (!path)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_insert_path_to_db:para null.\n");
+ return ZTE_HTTPSHARE_DB_ERROR;
+ }
+
+ zte_httpshare_db_result_e_type result = ZTE_HTTPSHARE_DB_OK;
+
+ char sql[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 40] = {0};
+ snprintf(sql, sizeof(sql), "insert into %s (ip,path) values (\"%s\",\"%s\")", ZTE_HTTPSHARE_DB_NAME, ip, path);
+
+ result = zte_httpshare_db_exec_sql(sql, NULL, NULL);
+
+ if (ZTE_HTTPSHARE_DB_OK != result) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_insert_path_to_db:result %d\n", result);
+ return result;
+ }
+ return result;
+
+}
+
+
+void zte_change_file_time(char *path_source, char*new_time)
+{
+ char *ptr = NULL;
+ int i = 0;
+ struct utimbuf times;
+ if ((!new_time) || (!path_source)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_change_file_time src==NULL\n");
+
+ return;
+ }
+
+ if ((!strlen(path_source)) || (!strlen(new_time))) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_change_file_time src==empty\n");
+
+ return;
+ }
+
+ if (0 == atoi(new_time)) {
+ times.modtime = 1378807200; //1378807200 2013-09-10 10:00:00
+ times.actime = 1378807200; //1631268000 2021-09-10 10:00:00
+ } else {
+ times.modtime = atoi(new_time);
+ times.actime = atoi(new_time);
+ }
+ utime(path_source, ×);
+
+ ptr = path_source + strlen(path_source) - 1;
+ for (i = strlen(path_source); i > 0; i--) {
+ if (*ptr == '/')
+ break;
+ ptr--;
+ }
+ *ptr = '\0';
+ utime(path_source, ×);
+
+ return;
+}
+static void zte_write_file_record_pro(webs_t wp)
+{
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"result\":"));
+ (void)websWrite(wp, T("{\"fileInfo\":["));
+
+}
+
+/*
+struct dirent
+{
+ long d_ino; // inode number Ë÷Òý½ÚµãºÅ
+ off_t d_off; // offset to this dirent ÔÚĿ¼ÎļþÖÐµÄÆ«ÒÆ
+ unsigned short d_reclen; // length of this d_name ÎļþÃû³¤
+ unsigned char d_type; // the type of d_name ÎļþÀàÐÍ
+ char d_name [NAME_MAX+1]; /* file name (null-terminated) ÎļþÃû£¬×256×Ö·û
+}
+*/
+
+int zte_write_filerecord_alphasort(webs_t wp, char*path)
+{
+ struct dirent **namelist;
+ int n = 0;
+ int file_count = 0;
+ n = scandir(path, &namelist, 0, alphasort);
+ zte_write_file_record_pro(wp);
+ if (n < 3) {
+ (void)websWrite(wp, T("],\"totalRecord\":\"%d\"}}"), file_count);
+ if (n <= 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_write_filerecord_alphasort: scandir n=%d.\n", n);
+ free(namelist);
+ return 1;
+ }
+ while (n--) {
+
+ free(namelist[n]);
+ }
+ free(namelist);
+ return 1;
+ }
+ char *file_path = NULL;
+ file_path = (char*)malloc(ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1);
+ if (!file_path) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_write_filerecord_alphasort, malloc error!\n");
+ (void)websWrite(wp, T("],\"totalRecord\":\"%d\"}}"), file_count);
+ while (n--) {
+ slog(MISC_PRINT, SLOG_DEBUG,"namelist[%d]:%s\n", n, namelist[n]->d_name);
+ free(namelist[n]);
+ }
+ free(namelist);
+ return 1;
+ }
+ int i = 0;
+ zte_file_record_s_type record_ptr;
+ struct stat fileinfo;
+ for (i = 0; i < n; i++) {
+ if (!strcmp(namelist[i]->d_name, ".") || !strcmp(namelist[i]->d_name, "..")) {
+ continue;
+ }
+ memset(file_path, 0, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1);
+ snprintf(file_path, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1, "%s/%s", path, namelist[i]->d_name);
+
+ errno = 0;
+ if (stat(file_path, &fileinfo) < 0) {
+ //printf("[httpshare]zte_write_filerecord_alphasort stat < 0\n");
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_write_filerecord_alphasort stat : %s[%s]\n", strerror(errno),file_path);
+ continue;
+ }
+ file_count++;
+ memset(&record_ptr, 0, sizeof(record_ptr));
+ snprintf(record_ptr.fileName, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1, "%s", namelist[i]->d_name);
+ snprintf(record_ptr.lastUpdateTime, ZTE_HTTPSHARE_DEFAULT_LEN, "%lu", fileinfo.st_mtime);
+ if (S_ISDIR(fileinfo.st_mode)) {
+ snprintf(record_ptr.attribute, ZTE_HTTPSHARE_DEFAULT_LEN, "%s", ZTE_FOLDER_STR);
+ } else {
+ snprintf(record_ptr.attribute, ZTE_HTTPSHARE_DEFAULT_LEN, "%s", ZTE_FILE_STR);
+ record_ptr.size = fileinfo.st_size;
+ }
+
+ if (file_count == 1) {
+ (void)websWrite(wp, T("{\"fileName\":\"%s\",\"attribute\":\"%s\",\"size\":\"%u\",\"lastUpdateTime\":\"%s\"}"),
+ record_ptr.fileName, record_ptr.attribute, record_ptr.size, record_ptr.lastUpdateTime);
+ } else {
+ (void)websWrite(wp, T(",{\"fileName\":\"%s\",\"attribute\":\"%s\",\"size\":\"%u\",\"lastUpdateTime\":\"%s\"}"),
+ record_ptr.fileName, record_ptr.attribute, record_ptr.size, record_ptr.lastUpdateTime);
+ }
+ }
+ (void)websWrite(wp, T("],\"totalRecord\":\"%d\"}}"), file_count);
+ free(file_path);
+ file_path = NULL;
+ while (n--) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_write_filerecord_alphasort:namelist[%d]->%s\n", n, namelist[n]->d_name);
+ free(namelist[n]);
+ }
+ free(namelist);
+ namelist = NULL;
+ return 0;
+
+}
+
+
+int zte_write_filerecord_alphasort_page(webs_t wp, char*path, int page_index)
+{
+ struct dirent **namelist;
+ int n = 0;
+ int file_count = 0;
+
+ int i = 0;
+ zte_file_record_s_type record_ptr;
+ struct stat fileinfo;
+ char *file_path = NULL;
+ int begin_index = (page_index - 1) * ZTE_HTTPSHARE_MAX_NUM_SHOW_RECORD;
+ int end_index = page_index * ZTE_HTTPSHARE_MAX_NUM_SHOW_RECORD - 1;
+
+ n = scandir(path, &namelist, 0, alphasort);
+
+ zte_write_file_record_pro(wp);
+ if (n < 3) {
+ (void)websWrite(wp, T("],\"totalRecord\":\"%d\"}}"), file_count);
+
+ if (n <= 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_write_filerecord_alphasort_page scandir n=%d.\n", n);
+ free(namelist);
+ return 1;
+ }
+ while (n--) {
+ //printf("%s\n",namelist[n]->d_name);
+ free(namelist[n]);
+ }
+ free(namelist);
+ return 1;
+ }
+ file_path = (char*)malloc(ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1);
+ if (!file_path) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_write_filerecord_alphasort_page:list file memory fail!\n");
+ (void)websWrite(wp, T("],\"totalRecord\":\"%d\"}}"), file_count);
+ while (n--) free(namelist[n]);
+ free(namelist);
+ return 1;
+ }
+
+ for (i = 0; i < n; i++) {
+ if (!strcmp(namelist[i]->d_name, ".") || !strcmp(namelist[i]->d_name, "..")) {
+ if (i <= begin_index) {
+ begin_index += 1;
+ end_index += 1;
+ } else {
+ end_index += 1;
+ }
+ continue;
+ }
+
+ if ((i < begin_index))continue;
+
+ if (i > end_index)break;
+
+ memset(file_path, 0, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1);
+ snprintf(file_path, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1, "%s/%s", path, namelist[i]->d_name);
+ if (stat(file_path, &fileinfo) < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_write_filerecord_alphasort_page stat %s[%s]\n", strerror(errno),file_path);
+ continue;
+ }
+
+ file_count++;
+ memset(&record_ptr, 0, sizeof(record_ptr));
+ snprintf(record_ptr.fileName, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1, "%s", namelist[i]->d_name);
+ snprintf(record_ptr.lastUpdateTime, ZTE_HTTPSHARE_DEFAULT_LEN, "%lu", fileinfo.st_mtime);
+ if (S_ISDIR(fileinfo.st_mode)) {
+ snprintf(record_ptr.attribute, ZTE_HTTPSHARE_DEFAULT_LEN, "%s", ZTE_FOLDER_STR);
+ } else {
+ snprintf(record_ptr.attribute, ZTE_HTTPSHARE_DEFAULT_LEN, "%s", ZTE_FILE_STR);
+ record_ptr.size = fileinfo.st_size;
+ }
+ if (file_count == 1) {
+ (void)websWrite(wp, T("{\"fileName\":\"%s\",\"attribute\":\"%s\",\"size\":\"%u\",\"lastUpdateTime\":\"%s\"}"),
+ record_ptr.fileName, record_ptr.attribute, record_ptr.size, record_ptr.lastUpdateTime);
+ } else {
+ (void)websWrite(wp, T(",{\"fileName\":\"%s\",\"attribute\":\"%s\",\"size\":\"%u\",\"lastUpdateTime\":\"%s\"}"),
+ record_ptr.fileName, record_ptr.attribute, record_ptr.size, record_ptr.lastUpdateTime);
+ }
+ }
+ (void)websWrite(wp, T("],\"totalRecord\":\"%d\"}}"), n - 2);
+ free(file_path);
+ file_path = NULL;
+ while (n--) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_write_filerecord_alphasort_page:namelist[%d]->%s\n", n, namelist[n]->d_name);
+ free(namelist[n]);
+ }
+ free(namelist);
+ namelist = NULL;
+ return 0;
+}
+
+
+
+// creat a new document
+int zte_create_document(char* path)
+{
+ if (!path) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_create_document:path is null\n");
+ return 0;
+ }
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]zte_create_document:create new folder->%s\n", path);
+
+ if (-1 == mkdir(path, 0777)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_create_documentcreate new folder->%s failed\n", path);
+
+ return 0;
+ }
+ (void)zte_httpshare_call_system("/bin/sync");
+
+ return 1;
+
+}
+
+
+int zte_del_multi_file_record(char* path, char* path1) //0ʧ°Ü£¬1 ³É¹¦£¬2ÓÐÏÂÔØ¼Ç¼
+{
+ int del_res = 1;
+ char *p = path1;
+ int i = 0;
+ char *absolute_path = NULL;
+ char *name = NULL;
+ absolute_path = (char*)malloc(ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1);
+ if (!absolute_path) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_del_multi_file_record:multi del abusolute path malloc fail.\n");
+ return 0;
+ }
+ name = (char*)malloc(strlen(path1) + 1);
+ if (!name) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_del_multi_file_record:multi del name malloc fail.\n");
+ free(absolute_path);
+ absolute_path = NULL;
+ return 0;
+ }
+
+ memset(absolute_path, 0, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1);
+ memset(name, 0, strlen(path1) + 1);
+
+ for (p = path1; *p != '\0'; p++) {
+ if (*p != '*') {
+ name[i] = *p;
+ i++;
+ } else {
+ //·¾¶Ãû³Æ³¤¶È<4096 ; ÎļþÃû³¤¶È<255
+ if ((strlen(name) > 255) || ((strlen(name) + strlen(path)) > 4095)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_del_multi_file_record:filename/path too long\n");
+
+ free(name);
+ free(absolute_path);
+ name = absolute_path = NULL;
+ return 0;
+ }
+
+ snprintf(absolute_path, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1, "%s/%s", path, name);
+
+// added by fenglei for security begin 20141029
+ if (zte_httpshare_check_patch_inlegal(absolute_path)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_del_multi_file_record:check del path is legal or not %s\n", absolute_path);
+ free(name);
+ free(absolute_path);
+ name = absolute_path = NULL;
+ return 0;
+ }
+// added by fenglei for security end 20141029
+ int check_result = -1;
+ if (0 == (check_result = zte_check_download_file(absolute_path))) { //ÎÞÏÂÔØ¼Ç¼
+ (void)zte_del_file(absolute_path);
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_del_multi_file_record:check result->%d.\n", check_result);
+
+ if (access(absolute_path, F_OK) == 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_del_multi_file_record:del file fail.\n");
+ if (0 == check_result) { //²»´æÔڼǼ£¬É¾³ýʧ°Ü£¬·µ»ØÊ§°Ü
+ del_res = 0;
+ } else {
+ del_res = 2; //´æÔڼǼ£¬É¾³ýʧ°Ü£¬·µ»Øprocessing
+ }
+ free(name);
+ free(absolute_path);
+ name = absolute_path = NULL;
+ return del_res;
+ } else {
+ zte_httpshare_call_system("/bin/sync"); //remove file from sdcard on time
+ }
+ memset(absolute_path, 0, ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1);
+ memset(name, 0, strlen(path1) + 1);
+ i = 0;
+ }
+ }
+
+ free(name);
+ free(absolute_path);
+ name = absolute_path = NULL;
+ return del_res;
+}
+
+
+
+/*******************
+
+ GOFORM ÒµÎñÏà¹Ø start
+
+ *******************/
+
+
+void zte_httpShare_auth_get(webs_t wp)
+{
+ int status = 0;
+ status = sd_card_isExist();
+
+ if (0 == status) {
+ zte_write_result_to_web(wp, NO_SDCARD);
+ return;
+ }
+ zte_write_auth_to_web(wp);
+}
+
+void zte_httpShare_getcard_name(webs_t wp)
+{
+ int status = 0;
+ status = sd_card_isExist();
+ if (0 == status) {
+ zte_write_result_to_web(wp, NO_SDCARD);
+ return;
+ }
+ zte_write_tcard_name_to_web(wp);
+
+}
+void zte_httpShare_getcard_value(webs_t wp)
+{
+ if (!sd_card_isExist()) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_getcard_value no sdcard.\n");
+ zte_write_result_to_web(wp, NO_SDCARD);
+ return;
+ }
+ get_used_space_size();
+
+ zte_write_space_info_to_web(wp);
+}
+
+
+int zte_httpShare_chage_to_mode(webs_t wp, char* mode)
+{
+ int set_mode = -1;
+ if (!strcmp("http_share_mode", mode)) {
+ set_mode = ZTE_HTTPSHARE_HTTPSHARE;
+ } else {
+ set_mode = ZTE_HTTPSHARE_USB;
+ }
+ if (set_mode == zte_httpshare_get_current_mode()) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ if (zte_httpshare_change_current_mode(set_mode)) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ zte_write_result_to_web(wp, FAILURE);
+ }
+ }
+ return 1;
+}
+
+
+
+/**********************************************************************
+* Function: zte_httpShare_modeset
+* Description:
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/12 V1.0
+**********************************************************************/
+void zte_httpShare_modeset(webs_t wp)
+{
+ char *mode = websGetVar(wp, "mode_set", T(""));
+
+ //printf("[httpshare]zte_httpShare_modeset:set to mode->%s\n", mode);
+
+ if (!sd_card_isExist()) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_modeset:no sdcard.\n");
+ zte_write_result_to_web(wp, NO_SDCARD);
+ return;
+ }
+ //printf("[httpshare]zte_httpShare_modeset:sdcard exist.\n");
+ if ((0 != strcmp("http_share_mode", mode)) && (0 != strcmp("usb_mode", mode))) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (zte_check_downloading_file() > 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]downloading file,try later.\n");
+ zte_write_result_to_web(wp, PROCESSING);
+ return;
+ }
+ zte_httpShare_chage_to_mode(wp, mode);
+
+ return;
+}
+
+
+/**********************************************************************
+* Function: zte_httpShare_enterFold
+* Description:
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/12 V1.0
+**********************************************************************/
+void zte_httpShare_enterFold(webs_t wp)
+{
+ char *path_source = NULL;
+ char *path_web_tmp = websGetVar(wp, "path_SD_CARD", T(""));
+
+ int path_source_len = 0;
+
+ char *path_web = neutralize(path_web_tmp);
+ if(path_web == NULL){
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_enterFold fail %s.\n", path_web_tmp);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ path_source_len = strlen(path_web) + 30;
+
+// path_source = (char *)malloc(strlen(path_web)+5);
+ path_source = (char *)malloc(path_source_len); //²âÊÔ:SD_CARD_PATH_PR=/mnt/jffs2
+
+ if (!path_source) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_enterFold malloc fail\n");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ int page_index = 0;
+ char* index_page = websGetVar(wp, "indexPage", T(""));
+
+ page_index = atoi(index_page);
+ if(page_index < 0 || page_index > INT_MAX-1)
+ {
+ page_index = 1;
+ }
+
+
+ char * ip = websGetRequestIpaddr(wp);
+ memset(path_source, 0, path_source_len);
+ snprintf(path_source, path_source_len, "%s%s", SD_CARD_PATH_PR, path_web);
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_httpShare_enterFold: path->%s, page_index->%d, ip->%s.\n", path_source, page_index, ip);
+
+ if (!sd_card_isExist()) {
+ zte_write_result_to_web(wp, NO_SDCARD);
+ goto end;
+ }
+
+ if (!zte_check_file_exist(path_source)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_enterFold path inexist\n");
+ zte_write_result_to_web(wp, FAILURE);
+ goto end;
+ //return;
+ }
+//added by fenglei for security begin 20141029
+ if (zte_httpshare_check_patch_inlegal(path_source)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_enterFold path %s inlegal\n", path_source);
+ zte_write_result_to_web(wp, FAILURE);
+ goto end;
+ }
+ //added by fenglei for security end 20141029
+ if (zte_httpshare_check_record(ip)) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]db have record \n");
+ (void)zte_httpshare_update_record(ip, path_source);
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]it is a new user update httpshare db \n");
+ (void)zte_httpshare_insert_path_to_db(ip, path_source);
+ }
+
+ zte_httpshare_check_upload_file();
+
+ if ('\0' == (*index_page)) { //ÎļþСÓÚ10¸ö£¬ÔÚÒ»Ò³ÖÐÏÔʾ
+ (void)zte_write_filerecord_alphasort(wp, path_source);
+ } else { //Îļþ½Ï¶à£¬·ÖÒ³ÏÔʾ£¬Ã¿Ò³×î¶à10¸ö
+ (void)zte_write_filerecord_alphasort_page(wp, path_source, page_index);
+ }
+
+end:
+ free(path_source);
+ path_source = NULL;
+ return;
+}
+
+
+/**********************************************************************
+* Function: zte_httpShare_new
+* Description:
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/12 V1.0
+**********************************************************************/
+
+void zte_httpShare_new(webs_t wp)
+{
+
+ int new_ret = 0;
+ char *path_web_tmp = websGetVar(wp, "path_SD_CARD", T(""));
+ char *new_time = websGetVar(wp, ZTE_HTTPSHARE_TIME, T(""));
+ char *path_source = NULL;
+ char *path_web = neutralize(path_web_tmp);
+ if(path_web == NULL){
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_new fail %s.\n", path_web_tmp);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ int path_source_len = strlen(path_web) + 30;
+
+// path_source = (char *)malloc(strlen(path_web)+5);
+ path_source = (char *)malloc(path_source_len);
+
+ if (!path_source) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_httpShare_new malloc fail\n");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ memset(path_source, 0, path_source_len);
+ snprintf(path_source, path_source_len, "%s%s", SD_CARD_PATH_PR, path_web);
+ if (!sd_card_isExist()) {
+ zte_write_result_to_web(wp, NO_SDCARD);
+ goto end;
+ }
+ //added by fenglei for security begin 20141029
+ if (zte_httpshare_check_patch_inlegal(path_source) ||
+ zte_httpshare_check_patch_inlegal(new_time)) {
+ zte_write_result_to_web(wp, FAILURE);
+ goto end;
+ }
+ //added by fenglei for security end 20141029
+ if (zte_check_file_exist(path_source)) {
+ zte_write_result_to_web(wp, EXIST);
+ goto end;
+ }
+ new_ret = zte_create_document(path_source);
+
+ if (!new_ret) {
+ zte_write_result_to_web(wp, FAILURE);
+ } else {
+ zte_change_file_time(path_source, new_time);
+ zte_httpshare_call_system("/bin/sync");
+ zte_write_result_to_web(wp, SUCCESS);
+ }
+
+end:
+ free(path_source);
+ path_source = NULL;
+ return;
+
+}
+
+
+
+
+/**********************************************************************
+* Function: zte_httpShare_del
+* Description:
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/12 V1.0
+**********************************************************************/
+
+void zte_httpShare_del(webs_t wp)
+{
+ char *root_web_tmp = websGetVar(wp, "path_SD_CARD", T(""));
+ char *del_path = websGetVar(wp, "name_SD_CARD", T(""));
+ char *root_path = NULL;
+
+ char *root_web = neutralize(root_web_tmp);
+ if(root_web == NULL){
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_del fail %s.\n", root_web_tmp);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ int root_path_len = strlen(root_web) + 30;
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_httpShare_del:dele_path->%s, name->%s.\n", root_web, del_path);
+
+// root_path = (char *)malloc(strlen(root_web)+5);
+ root_path = (char *)malloc(root_path_len);
+ if (!root_path) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_del malloc fail.\n");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ memset(root_path, 0, root_path_len);
+ snprintf(root_path, root_path_len, "%s%s", SD_CARD_PATH_PR, root_web);
+ if (!sd_card_isExist()) {
+ zte_write_result_to_web(wp, NO_SDCARD);
+ goto end;
+ }
+//added by fenglei for security begin 20141029
+ if (zte_httpshare_check_patch_inlegal(del_path)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_del path is inlegal %s\n", del_path);
+ zte_write_result_to_web(wp, FAILURE);
+ goto end;
+ }
+//added by fenglei for security end 20141029
+ switch (zte_del_multi_file_record(root_path, del_path)) {
+ case 0://ʧ°Ü
+ zte_write_result_to_web(wp, FAILURE);
+ break;
+ case 1://³É¹¦
+ zte_write_result_to_web(wp, SUCCESS);
+ break;
+ case 2://ÓÐÏÂÔØ¼Ç¼
+ zte_write_result_to_web(wp, PROCESSING);
+ break;
+ default:
+ break;
+ }
+
+end:
+ free(root_path);
+ root_path = NULL;
+ return;
+}
+
+
+/**********************************************************************
+* Function: zte_httpShare_auth_set
+* Description:
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/12 V1.0
+**********************************************************************/
+
+void zte_httpShare_auth_set(webs_t wp)
+{
+ char *rw_auth = websGetVar(wp, "HTTP_SHARE_WR_AUTH", T(""));
+ char *file_name = websGetVar(wp, "HTTP_SHARE_FILE", T(""));
+ char *httpshare_status = websGetVar(wp, NV_HTTPSHARE_STATUS, T(""));
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_httpShare_auth_set:HTTP_SHARE_STATUS->%s, HTTP_SHARE_WR_AUTH->%s, HTTP_SHARE_FILE->%s\n", httpshare_status, rw_auth, file_name);
+
+ if (!strcmp(httpshare_status, "Disabled")) {
+ (void)zte_web_write(NV_HTTPSHARE_STATUS, httpshare_status);
+ } else {
+ (void)zte_web_write(NV_HTTPSHARE_WR_AUTH, rw_auth);
+ (void)zte_web_write(NV_HTTPSHARE_FILE, file_name);
+ (void)zte_web_write(NV_HTTPSHARE_STATUS, httpshare_status);
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+}
+
+
+/**********************************************************************
+* Function: zte_httpShare_rename
+* Description:
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/12 V1.0
+**********************************************************************/
+
+void zte_httpShare_rename(webs_t wp)
+{
+
+ char *old_file_name = NULL;
+ char *new_file_name = NULL;
+ char *old_file_web_tmp = websGetVar(wp, "OLD_NAME_SD_CARD", T(""));
+ char *new_file_web_tmp = websGetVar(wp, "NEW_NAME_SD_CARD", T(""));
+
+ char *old_file_web = neutralize(old_file_web_tmp);
+ char *new_file_web = neutralize(new_file_web_tmp);
+
+ int check_result = -1;
+ int fd = -1;
+
+ if(old_file_web == NULL || new_file_web == NULL){
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_rename fail %s %s.\n", old_file_web_tmp, new_file_web_tmp);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_httpShare_rename:old name->%s\n", old_file_web);
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_httpShare_rename:new name->%s\n", new_file_web);
+// old_file_name= (char *)malloc(strlen(old_file_web)+5);
+ old_file_name = (char *)malloc(strlen(old_file_web) + 30);
+
+ if (!old_file_name) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_rename malloc fail\n");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ new_file_name = (char *)malloc(strlen(new_file_web) + 30);
+ if (!new_file_name) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_rename malloc fail\n");
+ zte_write_result_to_web(wp, FAILURE);
+ goto end2;
+ }
+ memset(old_file_name, 0, strlen(old_file_web) + 30);
+ memset(new_file_name, 0, strlen(new_file_web) + 30);
+ snprintf(old_file_name, strlen(old_file_web) + 30, "%s%s", SD_CARD_PATH_PR, old_file_web);
+ snprintf(new_file_name, strlen(new_file_web) + 30, "%s%s", SD_CARD_PATH_PR, new_file_web);
+//added by fenglei for security begin 20141029
+ if (zte_httpshare_check_patch_inlegal(old_file_name) ||
+ zte_httpshare_check_patch_inlegal(new_file_name)) {
+ zte_write_result_to_web(wp, FAILURE);
+ goto end;
+ }
+ if (access(old_file_name, F_OK) != 0) {
+ zte_write_result_to_web(wp, NOEXIST);
+ goto end;
+ }
+
+
+ if ((check_result = zte_check_download_file(old_file_name))) { //ÎÞÏÂÔØ¼Ç¼
+ zte_write_result_to_web(wp, PROCESSING);
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_rename:path is using\n");
+ goto end;
+ }
+//added by fenglei for security end 20141029
+ fd = rename(old_file_name, new_file_name);
+
+ if (fd < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_rename:rename fail fd->%d\n", fd);
+ zte_write_result_to_web(wp, FAILURE);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_rename:rename success, fd->%d\n", fd);
+ zte_httpshare_call_system("/bin/sync"); //write new file from momeroy to sdcard on time
+ zte_write_result_to_web(wp, SUCCESS);
+ }
+
+end:
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_httpShare_rename:end2\n");
+ free(new_file_name);
+ new_file_name = NULL;
+
+end2:
+ free(old_file_name);
+ old_file_name = NULL;
+
+ return;
+}
+
+
+/**********************************************************************
+* Function: zte_httpShare_enterFold
+* Description:
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/12 V1.0
+**********************************************************************/
+
+void zte_httpShare_check_file(webs_t wp)
+{
+ char *path_web_tmp = websGetVar(wp, "path_SD_CARD", T(""));
+ char *path_source = NULL;
+ char *path_web = neutralize(path_web_tmp);
+ if(path_web == NULL){
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_check_file fail %s.\n", path_web_tmp);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ int path_source_len = strlen(path_web) + 30;
+
+ if (!sd_card_isExist()) {
+ zte_write_result_to_web(wp, NO_SDCARD);
+ return;
+ }
+ path_source = (char *)malloc(path_source_len);
+ if (!path_source) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpShare_check_file malloc fail\n");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ memset(path_source, 0, path_source_len);
+ snprintf(path_source, path_source_len, "%s%s", SD_CARD_PATH_PR, path_web);
+
+ if (zte_check_file_exist(path_source)) {
+ zte_write_result_to_web(wp, EXIST); //ÎļþÒÑ´æÔÚ
+ } else { //Îļþ²»´æÔÚ
+ if (zte_check_downloading_file() > 0) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]downloading file,try later.\n");
+ zte_write_result_to_web(wp, PROCESSING);
+ } else {
+ zte_write_result_to_web(wp, NOEXIST);
+ }
+ }
+
+ free(path_source);
+ path_source = NULL;
+
+ return;
+}
+
+
+#if 0
+USER_COMMON_INFOR* zte_user_list_insert()
+{
+ USER_COMMON_INFOR* ptr = NULL;
+ USER_COMMON_INFOR* index_ptr = NULL;
+ index_ptr = &pp_header;
+
+ if (!ptr) {
+ ptr = (USER_COMMON_INFOR*)malloc(sizeof(USER_COMMON_INFOR));
+ }
+
+ if (!ptr) {
+ printf("[httpshare]creat user node fail.\n");
+
+ return NULL;
+ } else {
+ while ((index_ptr->next) != NULL) {
+ index_ptr = index_ptr->next;
+ }
+ index_ptr->next = ptr;
+ ptr->next = NULL;
+ pp_header.cnt++;
+ return ptr;
+ }
+}
+
+
+
+USER_COMMON_INFOR* zte_get_new_user(webs_t wp)
+{
+
+ USER_COMMON_INFOR* pp_current = NULL;
+ pp_current = zte_user_list_insert();
+
+ if (NULL != pp_current) {
+ printf("[httpshare]creat new user node.\n");
+ memset(pp_current, 0, sizeof(USER_COMMON_INFOR));
+ return pp_current;
+ } else {
+ printf("[httpshare]creat new user node faile.\n");
+ return NULL;
+ }
+}
+
+
+
+USER_COMMON_INFOR* zte_get_user_position(webs_t wp)
+{
+ USER_COMMON_INFOR *pp_current = NULL;
+ pp_current = pp_header.next;
+
+ a_assert(pp_current->address);
+ a_assert(websGetRequestIpaddr(wp));
+
+ while ((pp_current != NULL) && (pp_current->address != NULL) && (websGetRequestIpaddr(wp) != NULL)) {
+ if ((0 == strcmp((char *)websGetRequestIpaddr(wp), (char *)pp_current->address)) && (pp_current->requst_sid == (void*)websGetSid(wp))) {
+ return pp_current;
+ } else {
+ pp_current = pp_current->next;
+ }
+ }
+ return NULL;
+}
+
+USER_COMMON_INFOR* zte_process_user_auth(webs_t wp)
+{
+
+ USER_COMMON_INFOR* ptr = NULL;
+ ptr = zte_get_user_position(wp);
+ if (NULL == ptr) {
+ ptr = zte_get_new_user(wp);
+ return ptr;
+ } else {
+ return ptr;
+ }
+}
+#endif
+int zte_malloc_cgi_buff()
+{
+ file_buf_memory_ptr = file_buf_memory;
+ return 1;
+}
+
+int zte_path_check(webs_t wp)//¼ì²éÉÏ´«ÎļþURLÊÇ·ñºÏ·¨
+{
+ char path_temp[ZTE_HTTPSHARE_FILE_NAME_MAX_LEN] = {0};
+ char *ptr = NULL;
+
+ if (wp->url == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_path_check error1\n");
+ return 0;
+ }
+
+ if (strlen(wp->url) == 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_path_check error2\n");
+ return 0;
+ }
+ snprintf(path_temp, ZTE_HTTPSHARE_FILE_NAME_MAX_LEN, "%s", wp->url);
+
+ ptr = strstr(path_temp, "/cgi-bin/httpshare");
+ ptr += strlen("/cgi-bin/httpshare")+1;//ptrÖ¸ÏòÃû³ÆÊ××Öĸ
+
+ if (strstr(ptr, "/") != NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_path_check error\n");
+ return 0;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_path_check upload name:%s\n", ptr);
+ return 1;
+}
+
+
+/**³õʼ»¯ÉÏ´«ÎļþÐÅÏ¢**/
+void zte_init_up_infor(USER_COMMON_INFOR*pp_co_info)
+{
+
+ memset(pp_co_info->infor.file_tail_pool, 0, ZTE_PARSE_CGI_TAIL_LEN);
+ pp_co_info->infor.file_head = ZTE_CGI_PARSE_FILE_HEAD_BEGIN;
+ pp_co_info->infor.file_tail = ZTE_CGI_PARSE_FILE_TAIL_BEGIN;
+ pp_co_info->infor.file_tail_pool_len = 0;
+ pp_co_info->infor.file_head_len = 0;
+ pp_co_info->infor.file_tail_len = 0;
+ pp_co_info->infor.data_no = ZTE_CGI_WRITE_THE_FIRST_DATA;
+ pp_co_info->infor.file_tail_addres = ZTE_CGI_PARSE_FILE_TAIL_ADD_BEGIN;
+ pp_co_info->infor.file_raw_size = 0;
+}
+
+/****³õʼ»¯Óû§ÐÅÏ¢*****/
+int zte_init_user_infor(USER_COMMON_INFOR* pp_co_info, webs_t wp)
+{
+ pp_co_info->requst_sid = websGetSid(wp);
+ pp_co_info->card_full = 0;
+ memset(pp_co_info->address, 0, ZTE_IP_ADDRESS_LENGTH);
+ memset(pp_co_info->UnixYMDTime, 0, ZTE_IP_ADDRESS_LENGTH);
+ memset(pp_co_info->file_name, 0, ZTE_HTTPSHARE_FILE_NAME_MAX_LEN);
+ memset(pp_co_info->path, 0, ZTE_HTTPSHARE_FILE_NAME_MAX_LEN);
+ memcpy((void*)pp_co_info->address, (void*)websGetRequestIpaddr(wp), ZTE_IP_ADDRESS_LENGTH);
+ (void)zte_httpshare_get_record(pp_co_info->address, pp_co_info->path);
+ zte_init_up_infor(pp_co_info);
+ return 1;
+}
+
+int zte_reset_cgi_state(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_reset_cgi_state.\n");
+#if 0 // kw 3
+ if (!zte_malloc_cgi_buff()) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]malloc failed.\n");
+ return 0;
+ }
+#else
+ zte_malloc_cgi_buff();
+#endif
+ if (!zte_path_check(wp)) {
+ return 0;
+ }
+ zte_init_user_infor(&pp_header, wp);
+ file_end = FALSE;
+ memset(file_buf_memory, 0, FILE_BUFFER_LEN);
+ return 1;
+}
+
+uint32 zte_get_sd_free_size(uint32 b_free)
+{
+ struct statvfs file_stat;
+ (void)statvfs(SD_CARD_PATH, &file_stat);
+ b_free = (file_stat.f_bfree) * (file_stat.f_bsize / 512) / 8;
+ return b_free;
+}
+
+int zte_str_index(char* s, char* t) //text filename=
+{
+ int i = 0;
+ int j = 0;
+ int strindex = 0;
+ int stateindex = 0;
+ if (NULL == s || NULL == t) {
+ return -1;
+ }
+ int len = strlen(t);
+ stateindex = strlen(s) - strlen(t);
+ while ((strindex <= stateindex) && (j < len)) {
+ if (s[i] == t[j]) {
+ i = i + 1;
+ j = j + 1;
+ } else {
+ i = i - j + 1;
+ strindex = i;
+ j = 0;
+ }
+ }
+ if (j == len) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare] file name index->%d.\n", i - len);
+ return (i - len); // filename= µÄÆðʼϱê
+ } else {
+ return (-1);
+ }
+}
+
+
+int read_upload_info_from_file(const char *file, char *name)
+{
+
+ int fd_tcard_upload;
+ ssize_t read_len = 0;
+
+ if (NULL == name) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]name == NULL\n");
+ return -1;
+ }
+
+ if (-1 == access(TCARD_UPLOAD_FILE, F_OK)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]file is not exist\n");
+ return -1;
+ }
+
+ errno = 0;
+ if ((fd_tcard_upload = open(TCARD_UPLOAD_FILE, O_RDONLY)) < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]open file failed : %s\n", strerror(errno));
+ return -1;
+ }
+
+ errno = 0;
+
+ read_len = read(fd_tcard_upload, name, HTTPSHARE_BUF_NORMAL_LEN_MAX + 1);
+ if (read_len < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]read file failed : %s\n", strerror(errno));
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]read file ,upload name : %s\n", name);
+ }
+
+ close(fd_tcard_upload);
+
+ return 0;
+}
+
+int save_upload_info_to_file(const char *file, char *name)
+{
+ int fd_upload = -1;
+
+ if (name == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]save_upload_info_to_file error,name == NULL.\n");
+ return 0;
+ }
+
+ if (strlen(name) == 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]save_upload_info_to_file error,name == empty.\n");
+ return 0;
+ }
+
+ errno = 0;
+ fd_upload = open(TCARD_UPLOAD_FILE, O_CREAT | O_WRONLY, 0666);
+ if (-1 == fd_upload) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]save_upload_info_to_file open file failed:%s\n", strerror(errno));
+ return -1;
+ }
+
+ errno = 0;
+ if (write(fd_upload, name, strlen(name)) < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]save_upload_info_to_file write file failed:%s\n", strerror(errno));
+ }
+
+ close(fd_upload);
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]save_upload_info_to_file save up info.\n");
+ return 0;
+}
+
+static char* neutralize(char *path)
+{
+ if(path == NULL)
+ {
+ return NULL;
+ }
+ /* Ïà¶Ô·¾¶·À»¤ */
+ if (strstr(path, "../"))
+ {
+ return NULL;
+ }
+
+ /* ϵͳ·¾¶·À»¤ */
+ if (strncmp(path, "/etc/", 5) == 0)
+ {
+ return NULL;
+ }
+
+ /* null ·ûºÅ·À»¤*/
+ if (strstr(path, "%00"))
+ {
+ return NULL;
+ }
+
+ return path;
+}
+
+void zte_httpshare_check_upload_file()
+{
+ char cname[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1] = {0};
+ char *name = NULL;
+
+ if (0 == read_upload_info_from_file(TCARD_UPLOAD_FILE, cname)) {
+ cname[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN] = 0;
+ name = neutralize(cname);
+ if(name){
+ name[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN] = 0;
+ zte_del_file(name);
+ zte_del_file(TCARD_UPLOAD_FILE);
+ if ((access(name, F_OK) == 0) || (access(TCARD_UPLOAD_FILE, F_OK) == 0)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_check_upload_file del upload file fail!\n");
+ }
+ memset(file_buf_memory, 0, FILE_BUFFER_LEN);
+ memset(&pp_header, 0, sizeof(USER_COMMON_INFOR));
+ memset(download_file, 0, sizeof(download_file));
+ file_buf_memory_ptr = NULL;
+ tcard_file_size = 0;
+ file_end = FALSE;
+ }
+ }
+}
+
+int zte_get_upload_filename(webs_t wp, USER_COMMON_INFOR * pp_current)
+{
+ char *temp_name = NULL;
+ char URL[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1] = {0};
+
+ //snprintf(URL,sizeof(URL),"%s",wp->url);
+ //printf("[iphone]zte_get_upload_filename URL:%s\n",URL);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[iphone]zte_get_upload_filename url:%s\n", wp->url);
+ slog(MISC_PRINT, SLOG_DEBUG,"[iphone]zte_get_upload_filename path:%s\n", wp->path);
+
+ if ((wp->path == NULL) || (wp->url == NULL)) {
+ return -1;
+ }
+
+ websDecodeUrl(URL, wp->url, gstrlen(wp->url));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[iphone]zte_get_upload_filename URL:%s\n", URL);
+
+ if (strlen(URL) <= 0) {
+ return -1;
+ }
+
+ temp_name = strstr(URL, "cgi-bin/httpshare");
+
+ if (temp_name == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[iphone]zte_get_upload_filename url strstr cgi == NULL\n");
+ return -1;
+ }
+ temp_name += strlen("cgi-bin/httpshare")+1;
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[iphone]zte_get_upload_filename temp:%s\n", temp_name);
+
+// if (temp_name != NULL) {
+ if (strlen(temp_name) == 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[iphone]zte_get_upload_filename url name == NULL,get name from file header\n");
+ return 0;
+ }
+ if (strstr(temp_name, "#") != NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[iphone]zte_get_upload_filename url name have #,get name from file header\n");
+ return 0;
+ }
+// }else {
+// slog(MISC_PRINT, SLOG_ERR,"[iphone]zte_get_upload_filename temp == NULL\n");
+// return -1;
+// }
+
+
+ memset(pp_current->file_name, 0, sizeof(pp_current->file_name));
+
+ snprintf(pp_current->file_name, ZTE_HTTPSHARE_FILE_NAME_MAX_LEN, "%s", temp_name);
+ slog(MISC_PRINT, SLOG_DEBUG,"[iphone]zte_get_upload_filename url:%s, temp:%s, pp_header:%s\n", URL, temp_name, pp_current->file_name);
+
+ return 1;
+}
+
+char * zte_get_cgi_filename(webs_t wp, const char* text, USER_COMMON_INFOR * pp_current)
+{
+ char * head_index = NULL;
+ char *sp_name = NULL;
+ char *time_ptr = NULL;
+ int i = 0 ;
+ int j = 0;
+ int k = 0;
+ int name_head ;
+ sp_name = "filename=";
+ if (NULL == text) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_get_cgi_filename text is null.\n");
+ return NULL;
+ }
+ if (!strlen(pp_current->UnixYMDTime)) {
+ time_ptr = strstr(text, ZTE_HTTPSHARE_TIME);
+ if (time_ptr) {
+ time_ptr = time_ptr + strlen(ZTE_HTTPSHARE_TIME) + 5;
+ while (*time_ptr != 13) { // \r\n
+ pp_current->UnixYMDTime[k++] = *time_ptr;
+ time_ptr++;
+ }
+ pp_current->UnixYMDTime[k] = '\0';
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_get_cgi_filename UnixYMDTime is %s.\n", pp_current->UnixYMDTime);
+ }
+
+ name_head = zte_str_index(text, sp_name); //find 'filename='
+ //printf("[httpshare]zte_get_cgi_filename head is %d.\n",name_head);
+ if (name_head > 0) {
+ for (i = name_head; * (text + i) != '\0'; i++) { //ÕÒµ½filename="test.doc"µÄµÚÒ»¸öÒýºÅλÖÃ
+ if (*(text + i) == '"') {
+ name_head = i + 1;//ÉÏ´«ÎļþÃû³ÆÆðʼϱê
+ break;
+ }
+ }
+
+ for (i = name_head; * (text + i) != '"'; i++) {
+ if (*(text + i) == '\\') {
+ name_head = i + 1;
+ }
+ }
+
+ for (i = name_head, j = 0; * (text + i) != '"'; i++, j++) {
+ pp_current->file_name[j] = *(text + i);
+ }
+ pp_current->infor.file_head_len += i;
+
+ head_index = text + i;//head_index Ö¸Ïòfilename= " " ÒýºÅ
+ pp_current->file_name[j] = '\0';
+ if(strlen(pp_current->path) == 0){
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]get path NULL\n");
+ return NULL;
+ }
+
+ if (pp_current->path[strlen(pp_current->path) - 1] != '/')
+ strcat(pp_current->path, "/");
+
+ if (zte_get_upload_filename(wp, pp_current) == -1) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]get filename error\n");
+ return NULL;
+ }
+
+ strcat(pp_current->path, pp_current->file_name);
+
+ save_upload_info_to_file(TCARD_UPLOAD_FILE, pp_current->path);
+ }
+ return head_index;
+}
+
+
+
+char *zte_cgi_parse_file_head(char * buf, USER_COMMON_INFOR*user)
+{
+ char *fdindex = NULL;
+ if (!buf) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_cgi_parse_file_head file head is null\n");
+ return NULL;
+ }
+
+ boolean foud_head_first = FALSE;
+
+ fdindex = buf;
+#if 1
+ while (*fdindex) {
+ if (user->infor.file_head == ZTE_CGI_PARSE_FILE_HEAD_BEGIN) {
+ if ((*fdindex) == 13) { //»Ø³µ
+ user->infor.file_head = ZTE_CGI_PARSE_FINDE_HEAD_FIRST;
+ user->infor.file_head_len++;
+ fdindex++;
+ } else {
+ user->infor.file_head = ZTE_CGI_PARSE_FILE_HEAD_BEGIN;
+ user->infor.file_head_len++;
+ fdindex++;
+ }
+ } else if (user->infor.file_head == ZTE_CGI_PARSE_FINDE_HEAD_FIRST) {
+ if ((*fdindex) == 10) { //»»ÐÐ
+ user->infor.file_head = ZTE_CGI_PARSE_FINDE_HEAD_SEC;
+
+ user->infor.file_head_len++;
+ fdindex++;
+ } else {
+ user->infor.file_head = ZTE_CGI_PARSE_FILE_HEAD_BEGIN;
+ }
+ } else if (user->infor.file_head == ZTE_CGI_PARSE_FINDE_HEAD_SEC) {
+ if ((*fdindex) == 13) {
+ user->infor.file_head = ZTE_CGI_PARSE_FINDE_HEAD_THIRD;
+
+ user->infor.file_head_len++;
+ fdindex++;
+ } else {
+ user->infor.file_head = ZTE_CGI_PARSE_FILE_HEAD_BEGIN;
+ }
+ } else if (user->infor.file_head == ZTE_CGI_PARSE_FINDE_HEAD_THIRD) {
+ if ((*fdindex) == 10) {
+ user->infor.file_head = ZTE_CGI_PARSE_FINDE_FILE_HEAD;
+ user->infor.file_head_len++;
+ fdindex++;
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_cgi_parse_file_head file_head_len %d.\n", user->infor.file_head_len);
+ return fdindex;//Êý¾ÝÆðʼ
+ } else {
+ user->infor.file_head = ZTE_CGI_PARSE_FILE_HEAD_BEGIN;
+ }
+ }
+ }
+#endif
+ return NULL;
+}
+
+
+
+char *zte_cgi_parse_file_tail_address(char *buf, USER_COMMON_INFOR*user)
+{
+ char *fdindex = NULL;
+ if (!buf) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_cgi_parse_file_tail_address file tail is null\n");
+ return NULL;
+ }
+
+ fdindex = buf + ZTE_PARSE_CGI_TAIL_LEN - 1;
+ while ((*fdindex) && (user->infor.file_tail_len < ZTE_PARSE_CGI_TAIL_LEN)) {
+
+ if (user->infor.file_tail_addres == ZTE_CGI_PARSE_FILE_TAIL_ADD_BEGIN) {
+ if ((*fdindex) == 45) { //'-'
+ user->infor.file_tail_addres = ZTE_CGI_PARSE_FINDE_TAIL_ADD_FIRST;
+ user->infor.file_tail_len++;
+ fdindex--;
+ } else {
+ user->infor.file_tail_addres = ZTE_CGI_PARSE_FILE_TAIL_ADD_BEGIN;
+ user->infor.file_tail_len++;
+ fdindex--;
+ }
+ } else if (user->infor.file_tail_addres == ZTE_CGI_PARSE_FINDE_TAIL_ADD_FIRST) {
+ if ((*fdindex) == 10) {
+ user->infor.file_tail_addres = ZTE_CGI_PARSE_FINDE_TAIL_ADD_SEC;
+ user->infor.file_tail_len++;
+ fdindex--;
+ } else {
+ user->infor.file_tail_addres = ZTE_CGI_PARSE_FILE_TAIL_ADD_BEGIN;
+ }
+ } else if (user->infor.file_tail_addres == ZTE_CGI_PARSE_FINDE_TAIL_ADD_SEC) {
+ if ((*fdindex) == 13) {
+ user->infor.file_tail_addres = ZTE_CGI_PARSE_FINDE_FILE_TAIL_ADD;
+ user->infor.file_tail_len++;
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_cgi_parse_file_tail_address found file tail,file_tail_len->%d.\n", user->infor.file_tail_len);
+ return fdindex;//file_tail start
+ } else {
+ user->infor.file_tail_addres = ZTE_CGI_PARSE_FILE_TAIL_ADD_BEGIN;
+ }
+ }
+ }
+ return NULL;
+}
+
+
+char *zte_cgi_parse_file_tail(USER_COMMON_INFOR*pp_current, int left_file_size, char*text, int nbytes)
+{
+ char *fdindex = NULL;
+ char *file_tail = NULL;
+ int tail_record_size = 0;
+
+ if (!text) {
+ return NULL;
+ }
+
+ if (left_file_size == 0) {
+ if (nbytes >= ZTE_PARSE_CGI_TAIL_LEN) {
+ fdindex = text + (nbytes - ZTE_PARSE_CGI_TAIL_LEN);
+
+ file_tail = zte_cgi_parse_file_tail_address(fdindex, pp_current);
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]file info: tail len->%d.\n", pp_current->infor.file_tail_len);
+ if (file_tail) {
+ pp_current->infor.file_tail_len = strlen(file_tail);
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_cgi_parse_file_tail file tail len is %d\n", pp_current->infor.file_tail_len);
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]file info: tail->%s.\n", file_tail);
+ pp_current->infor.file_tail = ZTE_CGI_PARSE_FINDE_TAIL_IN_FILE;
+ return file_tail;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_cgi_parse_file_tail file_tail not found\n");
+ return NULL;
+ }
+ } else {
+ fdindex = text;
+ memcpy((pp_current->infor.file_tail_pool + pp_current->infor.file_tail_pool_len), fdindex, nbytes);
+ pp_current->infor.file_tail_pool_len = pp_current->infor.file_tail_pool_len + nbytes;
+ fdindex = pp_current->infor.file_tail_pool;
+ file_tail = zte_cgi_parse_file_tail_address(fdindex, pp_current);
+ if (file_tail) {
+ pp_current->infor.file_tail = ZTE_CGI_PARSE_FINDE_TAIL_IN_POOL;
+ return file_tail;
+ } else {
+ return NULL;
+ }
+ }
+ } else {
+ if ((nbytes + left_file_size) >= ZTE_PARSE_CGI_TAIL_LEN) {
+ tail_record_size = ZTE_PARSE_CGI_TAIL_LEN - left_file_size;
+ fdindex = text + (nbytes - tail_record_size);
+ memcpy((pp_current->infor.file_tail_pool + pp_current->infor.file_tail_pool_len), fdindex, tail_record_size);
+ pp_current->infor.file_tail_pool_len = tail_record_size + pp_current->infor.file_tail_pool_len;
+ pp_current->infor.file_tail = ZTE_CGI_PARSE_FINDE_TAIL_IN_FILE;
+ return fdindex;
+ } else {
+ fdindex = text;
+ memcpy((pp_current->infor.file_tail_pool + pp_current->infor.file_tail_pool_len), fdindex, nbytes);
+ pp_current->infor.file_tail_pool_len = nbytes + pp_current->infor.file_tail_pool_len;
+ pp_current->infor.file_tail = ZTE_CGI_PARSE_FINDE_TAIL_PROCESS;
+ return NULL;
+
+ }
+
+ }
+
+}
+
+
+boolean zte_bufer_combination(char *buf, int size)
+{
+ if ((tcard_file_size + size) < FILE_BUFFER_LEN - WEBS_SOCKET_BUFSIZ) {
+ //printf("[httpshare]zte_bufer_combination tcard_file_size->%d,size->%d.\n",tcard_file_size,size);
+ //printf("[httpshare]zte_bufer_combination FILE_BUFFER_LEN->%d,WEBS_SOCKET_BUFSIZ->%d.\n",FILE_BUFFER_LEN,WEBS_SOCKET_BUFSIZ);
+ memcpy(file_buf_memory_ptr, buf, size);
+ file_buf_memory_ptr = file_buf_memory_ptr + size;
+ tcard_file_size = tcard_file_size + size;
+ //printf("[httpshare]zte_bufer_combination tcard_file_size->%d,size->%d.\n",tcard_file_size,size);
+ return FALSE;
+ } else {
+ //printf("[httpshare]zte_bufer_combination begin to write file \n");
+ memcpy(file_buf_memory_ptr, buf, size);
+
+ file_buf_memory_ptr = file_buf_memory_ptr + size;
+ tcard_file_size = tcard_file_size + size;
+ return TRUE;
+ }
+}
+
+
+int zte_httpshare_write(webs_t wp, USER_COMMON_INFOR*pp_current) // 1 OK;-1 0 error
+{
+ int file_close = -1;
+ int file_handler = -1;
+ //USER_COMMON_INFOR *pp_current = NULL;
+ //if(0 == tcard_file_size)
+ //{
+ // return -1;
+ //}
+
+ if (NULL == pp_current) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_write:zte_get_user_position failed\n");
+ return -1;
+ }
+ if (1 != zte_check_sdcard_exist()) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_write:zte_get_user_position failed\n");
+ return -1;
+ }
+ file_handler = open(pp_current->path, O_CREAT | O_WRONLY | O_APPEND, 0666);
+
+ if (file_handler < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_write zte write file open file failed\n");
+ return -1;
+ } else {
+ (void)write(file_handler, file_buf_memory, tcard_file_size);
+ file_buf_memory_ptr = file_buf_memory;
+ memset(file_buf_memory, 0, FILE_BUFFER_LEN);
+ tcard_file_size = 0;
+ file_close = close(file_handler);
+ if (file_close < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_httpshare_write zte write file close file failed\n");
+
+ return -1;
+ }
+ file_handler = -1;
+ }
+ return 1;
+}
+
+int zte_write_file(webs_t wp, char*buf, int file_size, USER_COMMON_INFOR*pp_current) // 1 OK;-1 0 error
+{
+ int result = 0;
+ result = zte_bufer_combination(buf, file_size);
+ if (result == 1) {
+ return zte_httpshare_write(wp, pp_current);
+ //return 1;
+ } else {
+ if (file_end) {
+ return zte_httpshare_write(wp, pp_current);
+ //return 1;
+ } else
+ return 1;
+ }
+}
+
+
+#if 0
+int zte_process_cgi_write(webs_t wp, char *file_head, uint32 zte_clen, char * text, int nbytes, USER_COMMON_INFOR*pp_current)
+{
+ char *file_tail = NULL;
+ uint32 left_size = 0;
+ int file_close = -1;
+ if ((!text) && (!file_head)) {
+ return -1;
+ }
+ left_size = zte_clen - nbytes;
+
+ if (left_size < ZTE_PARSE_CGI_TAIL_LEN) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_process_cgi_write left_size->%d.nbytes->%d\n", left_size, nbytes);
+ file_tail = zte_cgi_parse_file_tail(pp_current, left_size, text, nbytes); //ÕÒµ½tail λÖÃ
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]file_tail->%-*.*s.\n", pp_current->infor.file_tail_len, pp_current->infor.file_tail_len, file_tail);
+ }
+
+ if (file_tail) {
+ if (pp_current->infor.data_no == ZTE_CGI_WRITE_THE_FIRST_DATA) {
+ pp_current->infor.file_raw_size = zte_clen; /*get all the data size*/
+ pp_current->infor.data_no = ZTE_CGI_WRITE_THE_SEC_DATA;
+ }
+
+ if (pp_current->infor.file_tail == ZTE_CGI_PARSE_FINDE_TAIL_IN_FILE) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_process_cgi_write ZTE_CGI_PARSE_FINDE_TAIL_IN_FILE.\n");
+
+ if (file_tail == file_head) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_process_cgi_write it is a null file\n");
+ file_close = close(open(pp_current->path, O_CREAT, 0666));
+ if (file_close < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_process_cgi_write zte write file close file failed\n");
+ }
+ return -1;
+
+ }
+ if (file_tail - file_head < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_process_cgi_write file_tail-file_head = %d < 0\n", file_tail - file_head);
+ return -1;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]file_tail-file_head->%d.\n", file_tail - file_head);
+ (void)zte_write_file(wp, file_head, (file_tail - file_head));
+ } else if (pp_current->infor.file_tail == ZTE_CGI_PARSE_FINDE_TAIL_IN_POOL) {
+ (void)zte_write_file(wp, pp_current->infor.file_tail_pool, (file_tail - pp_current->infor.file_tail_pool));
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_process_cgi_write some erro happened\n");
+ }
+
+ } else {
+ if (pp_current->infor.file_tail != ZTE_CGI_PARSE_FINDE_TAIL_PROCESS) {
+ if (pp_current->infor.data_no == ZTE_CGI_WRITE_THE_FIRST_DATA) {
+ pp_current->infor.file_raw_size = zte_clen; /*get all the data size*/
+
+ (void)zte_write_file(wp, file_head, nbytes - pp_current->infor.file_head_len);
+
+ pp_current->infor.data_no = ZTE_CGI_WRITE_THE_SEC_DATA;
+
+ printf("[httpshare]zte_process_cgi_write file head len-> %d\n", pp_current->infor.file_head_len);
+ } else {
+ (void)zte_write_file(wp, file_head, nbytes);
+ }
+ }
+ }
+ return 0;
+}
+
+#endif
+
+
+// 1 OK;-1 0 error
+int zte_process_cgi_write(webs_t wp, char *file_head, uint32 zte_clen, char * text, int nbytes, USER_COMMON_INFOR*pp_current)
+{
+ char *file_tail = NULL;
+ uint32 left_size = 0;
+ int file_close = -1;
+ int ret = -1;
+ if ((!text) && (!file_head)) {
+ return -1;
+ }
+ left_size = zte_clen - nbytes;
+
+ if (left_size < ZTE_PARSE_CGI_TAIL_LEN) {
+ file_tail = zte_cgi_parse_file_tail(pp_current, left_size, text, nbytes); //ÕÒµ½tail λÖÃ
+ }
+
+ if (file_tail) {
+ if (pp_current->infor.data_no == ZTE_CGI_WRITE_THE_FIRST_DATA) {
+ pp_current->infor.file_raw_size = zte_clen; /*get all the data size*/
+ pp_current->infor.data_no = ZTE_CGI_WRITE_THE_SEC_DATA;
+ }
+
+ if (pp_current->infor.file_tail == ZTE_CGI_PARSE_FINDE_TAIL_IN_FILE) {
+ printf("[httpshare]zte_process_cgi_write ZTE_CGI_PARSE_FINDE_TAIL_IN_FILE.\n");
+
+ //if(file_tail==file_head)
+ //{
+ // printf("[httpshare]zte_process_cgi_write it is a null file\n");
+ // file_close=close(open(pp_current->path, O_CREAT,0666 ));
+ // if(file_close<0)
+ // {
+ // printf("[httpshare]zte_process_cgi_write zte write file close file failed\n");
+ // return -1;
+ // }
+ //}
+ if (file_tail - file_head < 0) {
+ printf("[httpshare]zte_process_cgi_write file_tail-file_head = %d < 0\n", file_tail - file_head);
+ return -1;
+ }
+
+ file_end = TRUE;
+ ret = zte_write_file(wp, file_head, (file_tail - file_head), pp_current);
+ } else if (pp_current->infor.file_tail == ZTE_CGI_PARSE_FINDE_TAIL_IN_POOL) {
+ file_end = TRUE;
+ ret = zte_write_file(wp, pp_current->infor.file_tail_pool, (file_tail - pp_current->infor.file_tail_pool), pp_current);
+ } else {
+ printf("[httpshare]zte_process_cgi_write some erro happened\n");
+ ret = 0;
+ }
+
+ } else {
+ if (pp_current->infor.file_tail != ZTE_CGI_PARSE_FINDE_TAIL_PROCESS) {
+ if (pp_current->infor.data_no == ZTE_CGI_WRITE_THE_FIRST_DATA) {
+ pp_current->infor.file_raw_size = zte_clen; /*get all the data size*/
+
+ ret = zte_write_file(wp, file_head, nbytes - pp_current->infor.file_head_len, pp_current);
+
+ pp_current->infor.data_no = ZTE_CGI_WRITE_THE_SEC_DATA;
+ } else {
+ ret = zte_write_file(wp, file_head, nbytes, pp_current);
+ }
+ }
+ }
+ //printf("[zyl]zte_process_cgi_write:ret->%d\n",ret);
+ return ret;
+}
+
+
+
+
+/*¿ªÊ¼½ÓÊÕÎļþÊý¾Ý*/
+int zte_process_cgi_recv(webs_t wp, uint32 zte_clen, char *text, int nbytes)//-1,0 error; 1 OK
+{
+ uint32 b_free = 0;
+ char *file_head = NULL;
+ uint32 clen = zte_clen - 200;
+ USER_COMMON_INFOR *pp_current = &pp_header;
+ //pp_current = zte_process_user_auth(wp);//¶ÁÈ¡zte_reset_cgi_stateÖÐ×¢²áµÄpp_currentÐÅÏ¢
+ //pp_current = zte_get_user_position(wp);
+// if (NULL == pp_current || NULL == text) { // kw 3 pp_current point to pp_aheader's address, can not be NULL
+ if (NULL == text) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_process_cgi_begin recv failed.\n");
+ return -1;
+ }
+ if (pp_current->card_full) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]T card full %d \n", pp_current->card_full);
+ return 0;
+ }
+
+#if 0
+ b_free = zte_get_sd_free_size(b_free);
+ if (b_free >= 524288) { //2*1024*1024*1024/512/8 sd card bfree more than 2G
+ printf("[httpshare]T card available size: %d \n", b_free * 512 * 8 / 1024 / 1024); //ÉÏ´«Îļþ±ØÐëҪСÓÚ2G
+ } else if ((((int)clen) > (b_free * 512 * 8)) && ((int)clen > 0)) { //Ê£Óà¿Õ¼äСÓÚ2G£¬Ôò±È½ÏÉÏ´«Îļþ´óС
+ pp_current->card_full = 1;
+ printf("[httpshare]upload file too larg.\n");//ÈçºÎ֪ͨwebUI
+ return 1;
+ }
+#endif
+ //printf("[httpshare]file info: zte_clen->%d.\n",zte_clen);
+
+ if (pp_current->infor.file_head != ZTE_CGI_PARSE_FINDE_FILE_HEAD) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte upload to fild head.\n");
+
+ file_head = zte_cgi_parse_file_head(zte_get_cgi_filename(wp, text, pp_current), pp_current);
+ //ÕÒµ½Êý¾ÝÆðʼλfile_head
+ if (pp_current->infor.file_head == ZTE_CGI_PARSE_FINDE_FILE_HEAD && file_head) {
+ return zte_process_cgi_write(wp, file_head, zte_clen, text, nbytes, pp_current); // 1 OK;-1 0 error
+ }
+
+ return 1;
+ } else {
+ file_head = text;
+ return zte_process_cgi_write(wp, file_head, zte_clen, text, nbytes, pp_current);
+ }
+}
+
+
+
+void zte_write_httpShare_upload_result_to_web(webs_t wp, char_t *result, char_t*reason)
+{
+ if ((NULL == wp) || (NULL == result)) {
+ return;
+ }
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"result\":\"%s\",\"reason\":\"%s\"}"),
+ result, reason);
+}
+
+
+
+int zte_check_file_complete(char *temp_file_name, USER_COMMON_INFOR*user)
+{
+
+ int file_should_size = 0;
+ //int ret = 0;
+ struct stat statbuf;
+
+ if (!temp_file_name) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_check_file_complete:path NULL\n");
+
+ return 0;
+ }
+
+ if (!strlen(temp_file_name)) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_check_file_complete:strlen(path)==0\n");
+
+ return 0;
+ }
+
+
+ memset((void*)&statbuf, 0, sizeof(statbuf));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]path file name is = %s, len is %d\n", temp_file_name, strlen(temp_file_name));
+
+ //ret = stat(temp_file_name, &statbuf);
+
+ //slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]ret is %d\n", ret);
+ if (stat(temp_file_name, &statbuf) < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_check_file_complete stat : %s[%s]\n", strerror(errno),temp_file_name);
+ return 0;
+ }
+ file_should_size = user->infor.file_raw_size - user->infor.file_head_len - user->infor.file_tail_len;
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]the file size shoud is %d, actul is %d\n", file_should_size, statbuf.st_size);
+ if (statbuf.st_size != file_should_size) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]file transfer failed:the file size shoud is %d, actul is %d \n", file_should_size, statbuf.st_size);
+ return 0;
+ } else {
+ return 1;
+ }
+
+}
+
+
+void zte_release_user(USER_COMMON_INFOR* current)
+{
+ if (!current) return;
+
+ pp_header.cnt--;
+
+ if (pp_header.cnt == 0) {
+ file_buf_memory_ptr = NULL;
+#if 0
+ if (file_buf_memory) {
+ free(file_buf_memory);
+ file_buf_memory = file_buf_memory_ptr = NULL;
+ printf("[httpshare]release memory\n");
+ }
+#endif
+ }
+ free(current);
+ current = NULL;
+}
+
+void zte_remove_user()
+{
+ zte_del_file(TCARD_UPLOAD_FILE);
+ memset(&pp_header, 0, sizeof(pp_header));
+ memset(file_buf_memory, 0, FILE_BUFFER_LEN);
+ memset(download_file, 0, sizeof(download_file));
+ file_buf_memory_ptr = NULL;
+ tcard_file_size = 0;
+ file_end = FALSE;
+}
+
+int zte_httpshare_proc_end(webs_t wp)
+{
+ websDone(wp, 200);
+ sleep(1);
+ slog(MISC_PRINT, SLOG_NORMAL,"[httpshare]zte_process_cgi_end websDone\n");
+ zte_remove_user();
+ return 1;
+}
+
+void zte_pre_process_cgi_end(webs_t wp)
+{
+ USER_COMMON_INFOR *pp_current = &pp_header;
+#if 0 // kw 3 pp_current points to pp_haader' address, can not be null
+ if (NULL == pp_current) {
+ slog(MISC_PRINT, SLOG_ERR,"[httpshare]zte_process_cgi_end pp_current NULL.\n");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+#endif
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_process_cgi_end path =%s\n", pp_current->path);
+ if (pp_current->card_full) {
+ unlink(pp_current->path);
+ zte_write_httpShare_upload_result_to_web(wp, FAILURE, "space_not_enough");
+ return;
+ }
+
+ if (!zte_check_file_complete(pp_current->path, pp_current)) {
+ unlink(pp_current->path);
+ zte_write_httpShare_upload_result_to_web(wp, FAILURE, "data_lost");
+ slog(MISC_PRINT, SLOG_DEBUG,"[httpshare]zte_process_cgi_end data_lost.\n");
+ return;
+ } else {
+ (void)zte_httpshare_call_system("/bin/sync"); //write new file from momeroy to sdcard on time
+ zte_change_file_time(pp_current->path, pp_current->UnixYMDTime);
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+ }
+
+}
+
+
+int zte_process_cgi_end(webs_t wp)
+{
+ zte_pre_process_cgi_end(wp);
+ zte_httpshare_proc_end(wp);
+ return 1;
+}
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_httpshare.h b/ap/app/goahead/interface5.0/zte_web_httpshare.h
new file mode 100644
index 0000000..227aef9
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_httpshare.h
@@ -0,0 +1,260 @@
+#ifndef ZTE_WEB_HTTPSHARE_H
+#define ZTE_WEB_HTTPSHARE_H
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <string.h>
+#include <dirent.h>
+#include <sys/statvfs.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <utime.h>
+
+#include <linux/stat.h>
+
+#include "zte_web_interface.h"
+
+
+#ifndef uint16
+#define uint16 unsigned short
+#endif
+
+#ifndef uint32
+#define uint32 unsigned long
+#endif
+
+#ifndef boolean
+#define boolean unsigned char
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef WEBS_SOCKET_BUFSIZ
+#define WEBS_SOCKET_BUFSIZ 4096 /* Bytes read from socket */
+#endif
+
+#define ZTE_HTTPSHARE_PATH_NAME_MAX_LEN 4096
+#define ZTE_HTTPSHARE_FILE_NAME_MAX_LEN 1024
+#define ZTE_HTTPSHARE_DEFAULT_LEN 100
+#define ZTE_HTTPSHARE_MAX_NUM_SHOW_RECORD 10
+#define ZTE_IP_ADDRESS_LENGTH 40
+#define FILE_BUFFER_LEN 65536
+
+#define ZTE_HTTPSHARE_LEN_50 50
+#define ZTE_HTTPSHARE_LEN_64 64
+#define ZTE_HTTPSHARE_LEN_100 100
+#define ZTE_HTTPSHARE_LEN_12 12
+#define ZTE_HTTPSHARE_MAC_ADDR_MAX_LEN 18
+
+//#define ZTE_HTTPSHARE_TIMEOUT 600
+#define ZTE_PARSE_CGI_TAIL_LEN 100
+#define MAX_LEN_FOR_SQL 1024
+
+#define HTTPSHARE_BUF_NORMAL_LEN_MAX 255
+#define DECCHK( c ) ((c) >= '0' && (c) <= '9')
+
+
+#define ZTE_FOLDER_STR "document"
+#define ZTE_FILE_STR "file"
+#define SD_CARD_USB_MOUNT_PATH "/tmp/sd"
+#define ZTE_CREATE_TABLE_DOWNLOAD_SQL "CREATE TABLE IF NOT EXISTS download(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,path TEXT)"
+
+#define SD_CARD_PATH "/etc_rw/config/mmc2" // "/mmc2"
+#define SD_CARD_PATH_PR "/etc_rw/config"
+#define ZTE_HTTPSHARE_DB_DIR "/etc_rw/config/httpshare_db" //usr/httpshare_db
+#define ZTE_HTTPSHARE_DB_PATH "/etc_rw/config/httpshare_db/httpshare.db" //"/usr/httpshare_db/httpshare.db"
+#define TCARD_UPLOAD_FILE "/etc_rw/config/upload.data"
+
+#define SD_CARD_PATH_NAN "/mmc2/mmc2/mmc2"
+#define SD_CARD_SOFT_LINK "/usr/zte_web/web/mmc2"
+#define USB_DEV_SDCARD_PATH "/dev/mmcblk0p1"
+#define USB_DEV_SDCARD_PATH_BACK "/dev/mmcblk0"
+#define SDCARD_EXIST_FLAGE_FILE "/sys/class/android_usb/android0/tcard"
+#define NO_SDCARD "no_sdcad"
+#define ZTE_HTTPSHARE_TIME "path_SD_CARD_time_unix"
+
+#define SET_MODE_SHELL "./etc/init.d/mmchost"
+#define SET_MODE_USB "usb"
+#define SET_MODE_HTTP_SHARE "httpshare"
+
+#define USB_MODE "usb_mode"
+#define HTTP_SHARE_MODE "http_share_mode"
+#define ZTE_HTTPSHARE_DB_NAME "httpshare"
+
+#define TCARD_SIZE_FILE "/proc/proc_sd/size"
+
+//httpshare password
+#define HTTPSHARE_LOGIN_SUCCESS "0" // "share_login_ok"
+#define HTTPSHARE_LOGIN_FAIL "1" //"share_login_failure"
+#define HTTPSHARE_LOGIN_CHECK_FAIL "2" //"share_login_check_fail"
+#define HTTPSHARE_LOGIN_BAD_PASSWORD "3" // "share_login_bad_password"
+#define HTTPSHARE_LOGIN_ALREADY_LOGIN "4" //"share_login_already"
+#define HTTPSHARE_LOGIN_LOGIN_BEFORE "5" //"share_login_before"
+
+
+#define HTTPSHARE_LOGIN_TIMEOK "6" // "share_timeok"
+#define HTTPSHARE_LOGIN_TIMEOUT "7" //"share_timeout"
+#define HTTPSHARE_LOGIN_TIMEFAIL "8" //"share_timefail"
+
+
+#define ZTE_CREATE_TABLE_HTTPSHARE_SQL "CREATE TABLE IF NOT EXISTS httpshare(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,ip TEXT,path TEXT)"
+
+#define HTTPSHARE_PATH_INLEGAL "/mmc2/.." // user document path
+
+typedef enum {
+ ZTE_HTTPSHARE_DB_OK = 0,
+ ZTE_HTTPSHARE_DB_ERROR_INVAILD_PTR = 100,
+ ZTE_HTTPSHARE_DB_ERROR_NOT_OPEN_DB,
+ ZTE_HTTPSHARE_DB_ERROR_FULL,
+ ZTE_HTTPSHARE_DB_ERROR = -1
+} zte_httpshare_db_result_e_type;
+
+
+typedef enum {
+ ZTE_HTTPSHARE_FAILURE = -1,
+ ZTE_HTTPSHARE_SUCCESS = 0,
+ ZTE_HTTPSHARE_NOT_SUPPORT = 1,
+ ZTE_HTTPSHARE_MAX
+} zte_httpshare_return_e_type;
+
+
+typedef enum {
+ ZTE_CGI_PARSE_FILE_HEAD_BEGIN = 0,
+ ZTE_CGI_PARSE_FINDE_HEAD_FIRST = 1, //13
+ ZTE_CGI_PARSE_FINDE_HEAD_SEC = 2, //10
+ ZTE_CGI_PARSE_FINDE_HEAD_THIRD = 3, //13
+ ZTE_CGI_PARSE_FINDE_HEAD_FOUTH = 4, //10
+ ZTE_CGI_PARSE_FINDE_FILE_HEAD = 5, //10
+} zte_cgi_parse_file_head_type_e;
+
+
+typedef enum {
+ ZTE_CGI_PARSE_FILE_TAIL_ADD_BEGIN = 0,
+ ZTE_CGI_PARSE_FINDE_TAIL_ADD_FIRST = 1, //13
+ ZTE_CGI_PARSE_FINDE_TAIL_ADD_SEC = 2, //10
+ ZTE_CGI_PARSE_FINDE_TAIL_ADD_THIRD = 3, //13
+ ZTE_CGI_PARSE_FINDE_TAIL_ADD_FOUTH = 4, //10
+ ZTE_CGI_PARSE_FINDE_FILE_TAIL_ADD = 5, //10
+} zte_cgi_parse_file_tail_addres_type_e;
+
+
+
+
+typedef enum {
+ ZTE_CGI_PARSE_FILE_TAIL_BEGIN = 0,
+ ZTE_CGI_PARSE_FINDE_TAIL_IN_FILE = 1,
+ ZTE_CGI_PARSE_FINDE_TAIL_IN_POOL = 2,
+ ZTE_CGI_PARSE_FINDE_TAIL_PROCESS = 3,
+
+
+} zte_cgi_parse_file_tail_type_e;
+
+
+typedef enum {
+ ZTE_CGI_WRITE_THE_FIRST_DATA = 0,
+ ZTE_CGI_WRITE_THE_SEC_DATA = 1,
+} zte_cgi_write_e;
+
+
+struct user_upload_infor {
+ char file_tail_pool[ZTE_PARSE_CGI_TAIL_LEN];
+ int file_tail_pool_len;
+ int file_tail_len;
+ int file_head_len;
+ uint32 file_raw_size;
+ zte_cgi_parse_file_head_type_e file_head;
+ zte_cgi_parse_file_tail_type_e file_tail;
+ zte_cgi_parse_file_tail_addres_type_e file_tail_addres;
+ zte_cgi_write_e data_no;
+};
+
+typedef struct user_upload_infor USER_UPLOAD_INFOR;
+
+typedef struct user_common_infor_type {
+ char address[ZTE_IP_ADDRESS_LENGTH]; /* current user ip address of user */
+ char file_name[ZTE_HTTPSHARE_FILE_NAME_MAX_LEN]; /* curretn user user name for specific if it is the same user else reset infor. */
+ char path[ZTE_HTTPSHARE_FILE_NAME_MAX_LEN];
+ USER_UPLOAD_INFOR infor;
+ int requst_sid;
+ int card_full;
+ int cnt;
+ //int unixTime;
+ char UnixYMDTime[ZTE_IP_ADDRESS_LENGTH];
+ //struct user_common_infor_type *next;
+} USER_COMMON_INFOR;
+
+
+typedef struct {
+ int id;
+ char fileName[ZTE_HTTPSHARE_PATH_NAME_MAX_LEN + 1];
+ char attribute[ZTE_HTTPSHARE_DEFAULT_LEN];
+ uint32 size;
+ char lastUpdateTime[ZTE_HTTPSHARE_DEFAULT_LEN];
+
+} zte_file_record_s_type;
+
+
+typedef enum {
+ ZTE_ERROR_MODE = -1,
+ ZTE_HTTPSHARE_USB = 0,
+ ZTE_HTTPSHARE_HTTPSHARE = 1,
+ ZTE_RESERVE_MODE
+} zte_httpshare_current_mode_type;
+
+typedef struct {
+ char *dev_path;
+} httpshare_usb_mmc_dev;
+
+typedef enum {
+ ZTE_CHANGE_MODE_ERROR = 0,
+ ZTE_CHANGE_MODE_OK
+} zte_httpshare_change_mode_type;
+
+
+/*Óû§Ä£Ê½Ï³öUSB start*/
+
+#define ZTE_GET_USB_INFO_DEV "/dev/usbNVDev"
+#define ZTE_AT_PROXY4_DEV "/dev/ctrm_atproxy4"
+
+static int g_get_usb_info_fd = -1;
+static int g_at_proxy4_fd = -1;
+
+#define USBNV_IOCTL_W_CFGCDROMCHARGER 0x16
+
+typedef struct _T_REF_NV_USB_CFG {
+ UINT16 pid;
+ UINT16 vid;
+ UINT8 f_Tcard;
+ UINT8 f_Cdrom;
+ UINT8 f_AtExt;
+ UINT8 f_AtExt2;
+ CHAR Sn[64];
+} T_REF_NV_USB_CFG;
+
+/*Óû§Ä£Ê½Ï³öUSB end*/
+
+USER_COMMON_INFOR* zte_process_user_auth(webs_t wp);
+
+//record a defined count file record to show user
+extern zte_file_record_s_type httpshare_file_record[ZTE_HTTPSHARE_MAX_NUM_SHOW_RECORD];
+extern int zte_httpshare_change_current_mode(zte_httpshare_current_mode_type curr_mode);
+//extern void zte_httpshare_call_system(char * cmd);
+
+int save_upload_info_to_file(const char *file, char *name);
+int read_upload_info_from_file(const char *file, char *name);
+#endif
diff --git a/ap/app/goahead/interface5.0/zte_web_interface.h b/ap/app/goahead/interface5.0/zte_web_interface.h
new file mode 100755
index 0000000..7027a03
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_interface.h
@@ -0,0 +1,1118 @@
+/**
+ * @file zte_web_interface.h
+ * @brief Public APIs of Sanechips
+ *
+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.
+ * @author Hong Wu <wu.hong@sanechips.com.cn>
+ * @defgroup si_ap_app_webserver_id si_ap_app_webserver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+
+#ifndef ZTE_WEB_INTERFACE_H
+#define ZTE_WEB_INTERFACE_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+#include <time.h>
+#include "../server/webs.h"
+#include "message.h"
+//#include "errorcode.h"
+#include "cfg_nv_def.h"
+#include "cfg_api.h"
+#include "zte_web_mgmt.h"
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include "softap_api.h"
+#include "netotherapi.h"
+#include "net/zte_web_net_lan.h"
+#include "net/zte_web_net_wan.h"
+#include "net/zte_web_net_other.h"
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+#define cprintf(fmt, args...) do { \
+ FILE *fp = fopen("/dev/console", "w"); \
+ if (fp) { \
+ fprintf(fp, fmt, ## args); \
+ fclose(fp); \
+ } \
+} while (0)
+
+#define WEBLOG cprintf
+#define IFSTREQUAL(str1, str2) (strcmp((str1), (str2))?0:1)
+#define STR_EQUAL(a,b) ( strcmp((char*)a, (char*)b)==0 )
+#ifndef uint8
+#define uint8 unsigned char
+#endif
+
+#define ID "id"
+#define NAME "name"
+#define SITE "site"
+#define SUCCESS "success"
+#define FAILURE "failure"
+#define EXIST "exist"
+#define NOEXIST "noexist"
+#define PROCESSING "processing"
+#define MSG_INVALID_WEB_PARAM "MSG_INVALID_WEB_PARAM"
+#define ZTE_MC_OK_S (0)
+
+#define CFG_BUF_LENGTH 512
+#define CONFIG_DEFAULT_LENGTH 64
+
+#define DIAGLOG_DATA_PATH "/etc_ro/web/diaglog"
+
+/*** define about NV ***/
+#define NV_ITEM_VALUE_DEFAULT_STRING_LEN 128
+#define NV_ITEM_VALUE_BOOLEAN_LEN 1
+#define NV_ITEM_VALUE_YES_NO_LEN 5
+#define NV_ITEM_VALUE_IP_LEN 20
+#define NV_ITEM_MODE_STRING_LEN 25
+#define NV_ITEM_ADMIN_STRING_LEN 25
+#define NV_ITEM_VALUE_APN_STRING_LEN 400
+#define NV_ITEM_VALUE_NW_LIST_STRING_LEN 700
+#define NV_ITEM_STRING_LEN_5 5
+#define NV_ITEM_STRING_LEN_10 10
+#define NV_ITEM_STRING_LEN_20 20
+#define NV_ITEM_STRING_LEN_50 50
+#define NV_ITEM_STRING_LEN_64 64
+#define NV_ITEM_STRING_LEN_150 150
+#define NV_ITEM_STRING_LEN_200 200
+#define NV_FW_RULE_MAX_LEN_V6 400
+#define NV_ITEM_VALUE_STRING_LEN 50
+#define NVIO_MAX_LEN 1500
+#define NVIO_TMP_LEN 512
+#define NVIO_DEFAULT_LEN 50
+#define NV_ITEM_VALUE_STRING_LEN 50
+#define NV_ITEM_VALUE_MAX_LEN 1024
+#define zte_web_write(xx_item, xx_value) zte_nvconfig_write(xx_item, xx_value,(int)strlen(xx_value))
+#define zte_web_read(xx_item, xx_value) zte_nvconfig_read(xx_item, xx_value,sizeof(xx_value)) //modified,-1 deleted
+
+/*webuiÕʺÅ*/
+#define LOGIN_SUCCESS "0"
+#define LOGIN_FAIL "1"
+#define LOGIN_DUPLICATE_USER "2"
+#define LOGIN_BAD_PASSWORD "3"
+#define LOGIN_ALREADY_LOGGED "4"
+#define LOGIN_USER_NAME_NOT_EXSIT "5"
+#define LOGIN_TIMEOUT 600 //timeout after webui login
+#define LOGIN_PSW_MIN_LEN 1
+#define LOGIN_PSW_MAX_LEN 32
+#define LOGIN_FAIL_LOCK_TIME 300//the lock time after login failed
+#define LOGIN_FAIL_TIMES "5"
+#define LOGIN_RECORD_TIME 32
+
+#define COOKIE_SESSION_SIZE 32
+#define COOKIE_TOKEN_TIMEOUT 30
+
+#define NV_LANGUAGE "Language"
+#define NV_LOGINFO "loginfo"
+#define NV_USER_IP_ADDR "user_ip_addr"
+#define NV_LOGIN_LOCK_TIME "login_lock_time"
+#define NV_LAST_LOGIN_TIME "last_login_time"
+#define NV_USER_LOGIN_TIMEMARK "user_login_timemark"
+#define NV_COOKIE_ID "cookie_id"
+#define NV_WEB_TOKEN "web_token"
+
+/* ¿ìËÙÉèÖà */
+#define MAX_QUICK_SET_NUM 10
+
+/*Á÷Á¿Í³¼Æ*/
+#define ZTE_WEB_DATA_STATISTICS_CLEAR_ALL "ALL"
+#define ZTE_WEB_DATA_STATISTICS_CLEAR_TOTAL "TOTAL"
+#define ZTE_WEB_DATA_STATISTICS_CLEAR_CURRENT "CURRENT"
+
+
+
+//wan module
+#define ZTE_DAILNUM_LEN 8
+#define ZTE_ADDR_LEN 16
+#define ZTE_SEL_TYPE 8
+#define ZTE_PDP_TYPE_LEN 12
+#define ZTE_AUTH_TYPE_LEN 8
+#define ZTE_WAN_UMTS_MAX_PROFILE_NAME_LEN 32
+#define ZTE_WAN_UMTS_MAX_APN_STRING_LEN 104
+#define ZTE_WAN_UMTS_MAX_USERNAME_STRING_LEN 65
+#define ZTE_WAN_UMTS_MAX_PASSWD_STRING_LEN 65
+#define ZTE_USSD_DATA_TO_WEB_LEN 900
+#define CMD_CONNECTION_MODE "ConnectionMode"
+
+//pbm module
+#define CMD_PBM_DATA_INFO "pbm_data_info"
+#define CMD_PBM_DATA_TOTAL "pbm_data_total"
+#define CMD_PBM_CAPACITY_INFO "pbm_capacity_info"
+
+//sms module
+#define CMD_SMS_PAGE_DATA "sms_page_data"
+#define CMD_SMS_PARAMETER_INFO "sms_parameter_info"
+#define CMD_SMS_STATUS_INFO "sms_cmd_status_info"
+#define CMD_SMS_CAPACITY_INFO "sms_capacity_info"
+#define CMD_SMS_STATUS_RPT_DATA "sms_status_rpt_data"
+#define CMD_SMS_DATA_TOTAL "sms_data_total"
+#define CMD_SMS_UNREAD_COUNT "sms_unread_count"
+#define CMD_BROADCAST_DATA "broadcast_data"
+#define NV_SMS_UNREAD_NUM "sms_unread_num"
+
+//APN
+#define APN_SAVE_AND_SET_DEFAULT "0"
+#define APN_ONLY_SET_DEFAULT "1"
+#define ZTE_WEB_ACT_AUTO "auto"
+#define ZTE_WEB_ACT_MANUAL "manual"
+#define ZTE_WEB_ACT_SAVE "save"
+#define ZTE_WEB_ACT_SETDEFAULT "set_default"
+#define ZTE_WEB_ACT_SAVE_AND_SETDEFAULT "set_save_and_default"
+#define ZTE_WEB_ACT_DELETE "delete"
+#define ZTE_WEB_DIAL_MODE_AUTO "auto_dial"
+#define ZTE_WEB_DIAL_MODE_MANUAL "manual_dial"
+#define ZTE_WEB_DIAL_MODE_DEMAND "demand_dial"
+#define ZTE_WEB_MANUAL_DIAL_ACTION_CONN "connect"
+#define ZTE_WEB_MANUAL_DIAL_ACTION_DISCONN "disconnect"
+
+//nv for data limit settings
+#define NV_DATA_VOLUME_LIMIT_SWITCH "data_volume_limit_switch" /*0:disable;1:enable*/
+#define NV_DATA_VOLUME_LIMIT_UNIT "data_volume_limit_unit" /*time/data*/
+#define NV_DATA_VOLUME_LIMIT_SIZE "data_volume_limit_size"
+#define NV_DATA_VOLUME_ALERT_PERCENT "data_volume_alert_percent"
+#define DATA_VOLUME_LIMIT_UNIT_TIME "time"
+#define DATA_VOLUME_LIMIT_UNIT_DATA "data"
+#define NV_HTTPSHARE_STATUS "HTTP_SHARE_STATUS"
+#define NV_HTTPSHARE_WR_AUTH "HTTP_SHARE_WR_AUTH"
+#define NV_HTTPSHARE_FILE "HTTP_SHARE_FILE"
+
+//other fluxstat
+#define NV_DATA_TRAFFIC_SIM_PROVINCE "sim_home_location"
+#define NV_DATA_TRAFFIC_SWITCH "is_traffic_aline_on"
+#define NV_DATA_TRAFFIC_MONTH_TOTAL "traffic_month_total"
+#define NV_DATA_TRAFFIC_MONTH_USED "traffic_month_used"
+
+//fota module
+#define FOTA_ACTION_CANCEL_DOWNLOAD "0"
+#define FOTA_ACTION_CONFIRM_DOWNLOAD "1"
+#define FOTA_ACTION_DOWNLOADING_USER_CLICK_CANCEL "2"
+//#define FOTA_UPDATE_VERSION "version"
+#define FOTA_UPGRADE_RESULT "upgrade_result"
+//#define FOTA_PACK_SIZE_INFO "pack_size_info"
+//#define FOTA_UPDATE_INFO "update_info"
+//#define FOTA_SETTINGS_INFO "GetUpgAutoSetting"
+//#define FOTA_NEW_VERSION_STATE "new_version_state"
+
+//NET
+#define HOSTANME "hostname"
+#define MAC "mac"
+#define ADDR "ip"
+#define DOMAIN "domain"
+#define MAC_ADDR "mac_addr"
+#define DEVICES "devices"
+#define SITELIST "siteList"
+#define CMD_LAN_STATION_LIST "lan_station_list"
+#define CMD_CHILDREN_DEVICE_LIST "childGroupList"
+#define CMD_WHITE_SITE_LIST "site_white_list"
+#define CMD_GET_USER_MAC_ADDR "get_user_mac_addr"
+#define CMD_CURRENT_STATICADDR_LIST "current_static_addr_list"
+#define CMD_GET_POWERON_TIME "get_poweron_time"
+#define CMD_GET_LAN_DEV_INFO "get_lan_dev_info" //you wen ti
+#define CMD_GETDDNS_STATUS "getddns_status"
+#define CMD_USSD_DATA_INFO "ussd_data_info"
+#define CMD_GET_DEVICE_MODE "get_device_mode"
+
+//SD
+#define STR_SDCARD_MODE_OPT "sdcard_mode_option"
+
+
+/*useradded module start*/
+#define CMD_GET_SAMPLE "station_list"
+/*useradded module end*/
+
+/****************************All the Goform ID************************************/
+
+//#define GOFORM_MGMT_SET_WEB_DATA "SET_WEB_DATA"
+//#define GOFORM_MGMT_GUEST_USER_CONTROL "GUEST_USER_CONTROL"
+#define GOFORM_MGMT_SET_EXTERNAL_NV "SET_EXTERNAL_NV"
+/*management start*/
+#define GOFORM_MGMT_SET_WEB_LANGUAGE "SET_WEB_LANGUAGE"
+#define GOFORM_MGMT_SET_DEVICEMODE "SET_DEVICE_MODE"
+#define GOFORM_MGMT_LOGIN_IP "LOGIN"
+#define GOFORM_MGMT_LOGOUT_IP "LOGOUT"
+#define GOFORM_MGMT_CHANGE_PASSWORD "CHANGE_PASSWORD"
+#define GOFORM_MGMT_CHANGE_ACCOUNT "CHANGE_ACCOUNT"
+#define GOFORM_MGMT_RESTORE_FACTORY_SETTINGS "RESTORE_FACTORY_SETTINGS"
+#define GOFORM_MGMT_REBOOT "REBOOT_DEVICE"
+#define GOFORM_MGMT_POWEROFF "TURN_OFF_DEVICE"
+#define GOFORM_MGMT_POWER_ON_SPEED "MGMT_CONTROL_POWER_ON_SPEED"
+#define GOFORM_MGMT_QUICK_SETUP "QUICK_SETUP_EX"
+//#define GOFORM_SET_WORK_TYPE "SET_WORK_TYPE"
+#define GOFORM_MGMT_SNTP "SNTP"
+#define GOFORM_MGMT_SYSLOG "SYSLOG"
+//#define GOFORM_HTTP_REDIRECT "HTTP_REDIRECT"
+/*management end*/
+
+/*wan module start*/
+#define GOFORM_WAN_LOCK_FREQUENCY "LOCK_FREQUENCY"
+#define GOFORM_WAN_SET_NETWORK "SET_NETWORK"
+#define GOFORM_WAN_SET_CONNECTION_MODE "SET_CONNECTION_MODE"
+#define GOFORM_WAN_CONNECT_NETWORK "CONNECT_NETWORK"
+#define GOFORM_WAN_DISCONNECT_NETWORK "DISCONNECT_NETWORK"
+#define GOFORM_WAN_SCAN_NETWORK "SCAN_NETWORK"
+#define GOFORM_WAN_SET_BEARER_PREFERENCE "SET_BEARER_PREFERENCE"
+//#define GOFORM_WAN_SET_CONN_SETTING "SET_CONN_SETTING"
+//#define GOFORM_WAN_CANCEL_AUTO_RECONNECT "CANCEL_AUTO_RECONNECT"
+#define GOFORM_WAN_UNLOCK_NETWORK "UNLOCK_NETWORK"
+//statistics module
+#define GOFORM_WAN_RESET_DATA_COUNTER "RESET_DATA_COUNTER"
+#define GOFORM_WAN_DATA_LIMIT_SETTING "DATA_LIMIT_SETTING"
+#define GOFORM_WAN_DATA_FLOW_CALIBRATION_MANUAL "FLOW_CALIBRATION_MANUAL"
+#define GOFORM_SNTP_GETDATASTATIC "SNTP_Getdatastatic"
+//pin,puk module
+#define GOFORM_MGMT_ENTER_PIN "ENTER_PIN"
+#define GOFORM_MGMT_DISABLE_PIN "DISABLE_PIN"
+#define GOFORM_MGMT_ENABLE_PIN "ENABLE_PIN"
+//#define GOFORM_MGMT_MODIFY_PIN "MODIFY_PIN"
+#define GOFORM_MGMT_ENTER_PUK "ENTER_PUK"
+#define GOFORM_MGMT_AUTO_PIN "AUTO_PIN"
+//pbm
+#define GOFORM_PBM_CONTACT_ADD "PBM_CONTACT_ADD"
+#define GOFORM_PBM_CONTACT_DEL "PBM_CONTACT_DEL"
+//sms module
+#define GOFORM_SMS_SET_MSG_CENTER "SET_MESSAGE_CENTER"
+#define GOFORM_SMS_DELETE_SMS "DELETE_SMS"
+#define GOFORM_SMS_DELETE_SMS_ALL "ALL_DELETE_SMS"
+#define GOFORM_SMS_MOVE_TO_SIM "MOVE_TO_SIM"
+#define GOFORM_SMS_SAVE_SMS "SAVE_SMS"
+#define GOFORM_SMS_SEND_SMS "SEND_SMS"
+#define GOFORM_SMS_SET_MSG_READ "SET_MSG_READ"
+//ussd module
+//#define GOFORM_USSD_SEND_CMD "SEND_USSD_CMD"
+#define GOFORM_USSD_PROCESS "USSD_PROCESS"
+//apn module
+#define GOFORM_WAN_APN_PROC_EX "APN_PROC_EX"
+/*wan module end*/
+
+/*wifi module start*/
+#define GOFORM_WLAN_SET "SET_WIFI_INFO"
+//#define GOFORM_WIFI_SET_FOR_SLEEP "SET_WIFI_INFO_FOR_SLEEP"
+//#define GOFORM_SET_SHOW_SSID_KEY_OLED "SET_SHOW_SSID_KEY_OLED"
+#define GOFORM_WLAN_MAC_FILTER "WIFI_MAC_FILTER"
+#define GOFORM_WLAN_WPS_SET "WIFI_WPS_SET"
+#define GOFORM_WLAN_SSID1_SET "SET_WIFI_SSID1_SETTINGS"
+#define GOFORM_WLAN_SSID2_SET "SET_WIFI_SSID2_SETTINGS"
+#define GOFORM_WLAN_WIFI_SLEEP_SET "SET_WIFI_SLEEP_INFO"
+#define GOFORM_WLAN_WIFI_COVERAGE_SET "SET_WIFI_COVERAGE"
+#define GOFORM_WLAN_SET_TSW "SAVE_TSW"
+#define GOFORM_PARENT_CONTROL_SET "SAVE_TIME_LIMITED"
+//wifi station start
+#define GOFORM_WLAN_WIFI_STA_CONTROL "WIFI_STA_CONTROL"
+#define GOFORM_WLAN_WIFI_SPOT_PROFILE_UPDATE "WIFI_SPOT_PROFILE_UPDATE"
+#define GOFORM_WLAN_SET_STA_CON "WLAN_SET_STA_CON"
+#define GOFORM_WLAN_SET_STA_DISCON "WLAN_SET_STA_DISCON"
+#define GOFORM_WLAN_SET_STA_REFRESH "WLAN_SET_STA_REFRESH"
+/*wifi module end*/
+
+/*router module start*/
+#define GOFORM_ROUTER_DEL_IP_PORT_FILETER "DEL_IP_PORT_FILETER"
+#define GOFORM_ROUTER_ADD_IP_PORT_FILETER_V4V6 "ADD_IP_PORT_FILETER_V4V6"//ÉèÖö˿ڹýÂËÐÅÏ¢
+#define GOFORM_ROUTER_DEL_IP_PORT_FILETER_V4V6 "DEL_IP_PORT_FILETER_V4V6"
+#define GOFORM_ROUTER_ADD_PORT_FORWARE "FW_FORWARD_ADD"
+#define GOFORM_ROUTER_DEL_PORT_FORWARE "FW_FORWARD_DEL"
+#define GOFORM_ROUTER_ADD_PORT_MAP "ADD_PORT_MAP"
+#define GOFORM_ROUTER_DEL_PORT_MAP "DEL_PORT_MAP"
+#define GOFORM_ROUTER_BASIC_SETTING "BASIC_SETTING"
+#define GOFORM_ROUTER_FORWARD_SETTING "VIRTUAL_SERVER"
+#define GOFORM_ROUTER_SYSTEM_SECURITY "FW_SYS"
+#define GOFORM_ROUTER_DHCP_SETTING "DHCP_SETTING"
+#define GOFORM_ROUTER_STATIC_DHCP_SETTING "STATIC_DHCP_SETTING"
+#define GOFORM_ROUTER_UPNP_SETTING "UPNP_SETTING"
+#define GOFORM_ROUTER_DMZ_SETTING "DMZ_SETTING"
+#define GOFORM_ROUTER_EDIT_HOSTNAME "EDIT_HOSTNAME"
+#define GOFORM_BIND_STATIC_ADDRESS_SET "SET_BIND_STATIC_ADDRESS"
+#define GOFORM_BIND_STATIC_ADDRESS_ADD "BIND_STATIC_ADDRESS_ADD"
+#define GOFORM_BIND_STATIC_ADDRESS_DEL "BIND_STATIC_ADDRESS_DEL"
+#define GOFORM_ADD_CHILDREN_DEVICE "ADD_DEVICE"
+#define GOFORM_DEL_CHILDREN_DEVICE "DEL_DEVICE"
+#define GOFORM_ADD_WHITE_SITE "ADD_WHITE_SITE"
+#define GOFORM_REMOVE_WHITE_SITE "REMOVE_WHITE_SITE"
+#define GOFORM_URL_FILTER_DELETE "URL_FILTER_DELETE"
+#define GOFORM_URL_FILTER_ADD "URL_FILTER_ADD"
+#define GOFORM_DDNS "DDNS"
+//#define GOFORM_DNS_MODE_SET "SET_DNS_MODE"
+//#define GOFORM_DNS_SERVER_SET "SET_DNS_SERVER"
+
+// wan pppoe *
+#define GOFORM_SET_OPERATION_MODE "OPERATION_MODE"
+//#define GOFORM_SET_WAN_GATEWAYMODE "WAN_GATEWAYMODE"
+#define GOFORM_SET_WAN_GATEWAYMODE_PPPOE "WAN_GATEWAYMODE_PPPOE"
+#define GOFORM_SET_WAN_GATEWAYMODE_DHCP "WAN_GATEWAYMODE_DHCP"
+#define GOFORM_SET_WAN_GATEWAYMODE_STATIC "WAN_GATEWAYMODE_STATIC"
+#define GOFORM_SET_WAN_GATEWAYMODE_AUTO "WAN_GATEWAYMODE_AUTO"
+/*router module end*/
+
+/*httpShare module start*/
+#define GOFORM_HTTPSHARE_GETCARD_VAULE "HTTPSHARE_GETCARD_VALUE"
+#define GOFORM_HTTPSHARE_ENTERFOLD "HTTPSHARE_ENTERFOLD"
+#define GOFORM_HTTPSHARE_NEW "HTTPSHARE_NEW"
+#define GOFORM_HTTPSHARE_DEL "HTTPSHARE_DEL"
+#define GOFORM_HTTPSHARE_FILE_RENAME "HTTPSHARE_FILE_RENAME"
+#define GOFORM_HTTPSHARE_AUTH_SET "HTTPSHARE_AUTH_SET"
+#define GOFORM_HTTPSHARE_MODE_SET "HTTPSHARE_MODE_SET"
+#define GOFORM_HTTPSHARE_CHECK_FILE "GOFORM_HTTPSHARE_CHECK_FILE"
+#define CMD_HTTPSHARE_GETCARD_VAULE "HTTPSHARE_GETCARD_VALUE"
+#define CMD_HTTPSHARE_GETCARD_NMEA "HTTPSHARE_GETCARD_NAME"
+#define CMD_HTTPSHARE_AUTH_GET "HTTPSHARE_AUTH_GET"
+/*httpShare module end*/
+
+/*FOTA module start*/
+#define GOFORM_SET_FOTAAUTOUPDATE "IF_UPGRADE"
+#define GOFORM_SET_FOTASETTINGS "SetUpgAutoSetting"
+/*FOTA module end*/
+
+/*ping test*/
+#define GOFORM_PING_DIAGNOSTICS_START "PINT_DIAGNOSTICS_START"
+#define GOFORM_PING_DIAGNOSTICS_STOP "PINT_DIAGNOSTICS_STOP"
+/*ping test*/
+
+/*useradded module start*/
+#define GOFORM_SET_SAMPLE "GOFORM_SET_SAMPLE"
+/*useradded module end*/
+
+
+/****************************All the web pages' URL************************************/
+#define ZTE_WEB_PAGE_LOGIN_NAME "index.html"
+#define ZTE_WEB_MOBILE_PAGE_LOGIN_NAME "mobile.html"
+
+#define ZTE_WEB_PAGE_MSG "/message.asp"
+#define ZTE_WEB_PAGE_NET_CONNECT "/air_network/net_connect.asp"
+#define ZTE_WEB_PAGE_PPP_CONNECTING "/air_network/pppconnect.asp"
+#define ZTE_WEB_PAGE_PPP_DISCONNECT "/air_network/pppdisconnect.asp"
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+/**
+ * @brief time
+ * @param sec second
+ * @param usec Microsecond
+ * @note
+ * @warning
+ */
+struct os_time {
+ long sec;
+ long usec;
+};
+
+
+/**
+ * @brief goform/cmd table's struct
+ * @param goform_id the message id extract from URL
+ * @param proc_func the handler of this goform_id
+ * @note
+ * @warning
+ */
+typedef struct web_goform_struct {
+ char goform_id[50];
+ void (*proc_func)(webs_t wp);
+} web_goform_type;
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+typedef enum _data_safe_result_type_t {
+ DATA_NO_SAFE = 0,
+ DATA_SAFE = 1
+} data_safe_result_type_t;
+
+typedef enum {
+ ZTE_NVIO_FAIL = 0,
+ ZTE_NVIO_DONE = 1,
+ ZTE_NVIO_BUSY = 2,
+ ZTE_NVIO_BADCMD = 3,
+ ZTE_NVIO_MAX
+} zte_topsw_state_e_type;
+
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+/**
+* @brief Get current systime
+*
+* @param
+*
+* @return currentTime
+* @note
+* @warning
+*/
+int zte_web_getCurrentTime();
+
+/**
+* @brief the entry of zte code in goahead.
+*
+* @param
+*
+* @return currentTime
+* @note
+* @warning
+*/
+extern void zte_web_init();
+
+/**
+ * @brief Read the NV's value from the nv file.
+ *
+ * @param item Pointer to the NV's name.
+ * @param data Pointer to the NV's value.
+ * @param dataLen data's length.
+ *
+ * @return zte_topsw_state_e_type result number
+ * @note
+ * @warning
+ */
+zte_topsw_state_e_type zte_nvconfig_read(char *item, char *data, int dataLen);
+
+/**
+* @brief Write the NV's name and value into the nv file.
+*
+* @param item Pointer to the NV's name.
+* @param data Pointer to the NV's value.
+* @param dataLen data's length.
+*
+* @return zte_topsw_state_e_type result number
+* @note
+* @warning
+*/
+zte_topsw_state_e_type zte_nvconfig_write(char *item, char *data, int dataLen);
+
+/**
+* @brief goform entry from web pages to get fw para, call the related functions according to the cmd
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+void zte_goform_get_cmd_process(webs_t wp, char *path, char *query);
+
+/**
+* @brief goform entry from web pages to set fw para, call the related functions according to the goformId
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+void zte_goform_set_cmd_process(webs_t wp, char *path, char *query);
+
+/**
+* @brief Feed back web page at top location.
+*
+* @param i_wp HTTP Request Info.
+* @param i_pageName The page name.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_webs_feedback_top(webs_t i_wp, char *i_pageName);
+
+/**
+* @brief Check whether the login timeout.
+*
+* @param i_wp HTTP Request Info.
+* @param i_pageName The page name.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_mgmt_login_timeout_check();
+
+/**
+* @brief Send SMS.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_sms_send_msg_process(webs_t wp);
+
+/**
+* @brief Save SMS.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_sms_save_msg_process(webs_t wp);
+
+/**
+* @brief Delete message.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_sms_delete_msg_process(webs_t wp);
+
+/**
+* @brief Move message to SIM.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_sms_move_to_sim_msg_process(webs_t wp);
+
+/**
+* @brief Delete all messages.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_goform_sms_alldel_msg_process(webs_t wp);
+
+/**
+* @brief Set SMS related parameters.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_sms_set_message_center(webs_t wp);
+
+/**
+* @brief To set the viewed message as read.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_sms_view_msg_process(webs_t wp);
+
+/**
+* @brief Add new contact.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_goform_pbm_contact_add_process(webs_t wp);
+
+/**
+* @brief Delete contact.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_goform_pbm_contact_del_process(webs_t wp);
+
+/**
+* @brief Set WiFi basic parameter.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_basic_set(webs_t wp);
+
+/**
+* @brief Set WiFi MAC filter parameters.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_mac_filter_set(webs_t wp);
+
+/**
+* @brief Set WiFi WPS mode.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_wps_mode_set(webs_t wp);
+
+/**
+* @brief Set WiFi sleep and wake up at regular time.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_set_tsw(webs_t wp);
+
+/**
+* @brief Set WiFi SSID1 parameters.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_web_ssid1_set(webs_t wp);
+
+/**
+* @brief Set WiFi SSID2 parameters.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_ssid2_set(webs_t wp);
+
+/**
+* @brief To set the WiFi sleep mode.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_sleep_set(webs_t wp);
+
+/**
+* @brief Set WiFi coverage mode.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_coverage_set(webs_t wp);
+
+/**
+* @brief Set WiFi apstation parameters.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_station_set(webs_t wp);
+
+/**
+* @brief Update the wifi spot profile.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_station_spot_profile_update(webs_t wp);
+
+/**
+* @brief Connect to wifi spot.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_station_connect(webs_t wp);
+
+/**
+* @brief Disconnect wifi spot.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_station_disconnect(webs_t wp);
+
+/**
+* @brief Scan the wifi spot.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_station_refresh(webs_t wp);
+
+/**
+* @brief Get the wlan port's information.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wlan_get_station_list(webs_t wp);
+extern void zte_wlan_get_wps_pin(webs_t wp);
+extern void zte_wlan_get_wps_defpin(webs_t wp);
+
+
+
+/**
+* @brief Register network after manual search.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_set_network(webs_t wp);
+
+/**
+* @brief Set connect mode.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_set_connection_mode(webs_t wp);
+
+/**
+* @brief Connect to the network.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_connect_network(webs_t wp);
+
+/**
+* @brief Disonnect the network.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_disconnect_network(webs_t wp);
+
+/**
+* @brief Scan the network.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_scan_network(webs_t wp);
+
+/**
+* @brief Set the mode of searching network.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_network_select(webs_t wp);
+
+/**
+* @brief Set the management of network flow.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_data_limit_setting(webs_t wp);
+
+/**
+* @brief Calibrate the network flow by manual.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_data_flow_calibration_manual(webs_t wp);
+
+
+/**
+* @brief Clear the network flow records.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_wan_data_statistics_clear_process(webs_t wp, char_t *path, char_t *query);//11
+
+/**
+* @brief Init the httpshare.
+*
+* @param
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpshare_init();
+
+/**
+* @brief Get file list from httpshare's database.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_enterFold(webs_t wp);
+
+/**
+* @brief Creat a new folder.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_new(webs_t wp);
+
+/**
+* @brief Delete file or folder from SD card.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_del(webs_t wp);
+
+/**
+* @brief Set the httpshare's configs.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_auth_set(webs_t wp);
+
+/**
+* @brief Set the SD card's mode:usb mode or httpshare mode.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_modeset(webs_t wp);
+
+/**
+* @brief Creat a new folder.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_rename(webs_t wp);
+
+/**
+* @brief Check file exists.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_check_file(webs_t wp);
+
+/**
+* @brief Get the httpshare's configs.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_auth_get(webs_t wp);
+
+/**
+* @brief Get the SD card's name:"MicroSD Card".
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_getcard_name(webs_t wp);
+
+/**
+* @brief Get the SD card's available capacity and total capacity.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_httpShare_getcard_value(webs_t wp);
+
+/**
+* @brief Ussd's operator process.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_goform_ussd_process(webs_t wp);
+
+/**
+* @brief Handle the auto or manual apn set for ipv4ipv6.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_form_multi_apn_proc_ex(webs_t wp);
+
+/**
+* @brief Set the user's selection:update or cancel.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_fota_update(webs_t wp);
+
+/**
+* @brief Set the fota's configs.
+*
+* @param wp HTTP Request Info.
+*
+* @return
+* @note
+* @warning
+*/
+extern void zte_fota_settings(webs_t wp);
+
+
+extern void zte_init_login_psw_time(void);
+extern int zte_apn_param_check(webs_t wp, char * type);
+extern void zte_get_login_lock_time(webs_t wp);
+extern void zte_get_login_status_value(webs_t wp, char *login_status);
+extern void zte_get_ddns_status(webs_t wp);
+extern void zte_dhcpv6_state_set(webs_t wp);
+extern void zte_mtu_set(webs_t wp);
+extern void zte_dns_mode_set(webs_t wp);
+//extern void zte_dns_server_set(webs_t wp);
+extern void zte_ping_diagnostics_start(webs_t wp);
+extern void zte_ping_diagnostics_stop(webs_t wp);
+extern void zte_get_poweron_time(webs_t wp);
+extern void zte_get_lan_dev_info(webs_t wp);
+extern void zte_goform_set_external_nv(webs_t wp);
+extern void zte_goform_set_work_type(webs_t wp);
+
+//other sntp + fluxstat + parent_control_set
+extern void zte_goform_sntp_getdatastatic_process(webs_t wp);
+extern void zte_parent_control_set(webs_t wp);//parent mode time control
+
+/*useradded module start*/
+extern void zte_goform_set_sample(webs_t wp);
+/*useradded module end*/
+
+
+/**
+* @brief Data to be decoded.
+*
+* @param src Data to be decoded.
+* @param len Length of the data to be decoded.
+* @param out_len Pointer to output length variable.
+*
+* @return Allocated buffer of out_len bytes of decoded data,or NULL on failure
+* @note Caller is responsible for freeing the returned buffer.
+* @warning
+*/
+extern unsigned char * zte_base64_decode(const unsigned char *src, size_t len, size_t *out_len);
+#ifdef WEBS_SECURITY
+extern char *zte_base64_encode(const char *data, int data_len);
+#endif
+
+extern int zte_Safe_valid_SpecialChar(char single_data);
+extern int zte_Safe_valid_SpecialChar_other(char single_data);
+extern int zte_valid_length_str(char *string_s, int min, int max);
+
+extern data_safe_result_type_t zte_Safe_isMacValid(char *str);
+extern data_safe_result_type_t zte_Safe_isIpValid(char *str);
+extern data_safe_result_type_t zte_Safe_isNumOnly(char *str);
+extern data_safe_result_type_t zte_Safe_noSpecialChar(char *str);
+extern data_safe_result_type_t zte_Safe_noSpecialChar_other(char *str);
+extern data_safe_result_type_t zte_Safe_isStringOnly(char *str);
+extern data_safe_result_type_t zte_Safe_isNumorStringOnly(char *str);
+
+extern int web_set_pwd(char *buf);
+extern void web_init_pwd(void);
+extern int web_check_pwd(char* buf);
+
+extern int web_aes_init(void);
+
+#endif
+
diff --git a/ap/app/goahead/interface5.0/zte_web_mc.c b/ap/app/goahead/interface5.0/zte_web_mc.c
new file mode 100644
index 0000000..908dc61
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_mc.c
@@ -0,0 +1,568 @@
+/************************************************************************
+* °æÈ¨ËùÓÐ (C)2012, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º zte_web_mc.c
+* Îļþ±êʶ£º
+* ÄÚÈÝÕªÒª£º
+* ÆäËü˵Ã÷£º
+* µ±Ç°°æ±¾£º V0.1
+* ×÷ Õߣº liuyingnan
+* Íê³ÉÈÕÆÚ£º 2012-10-25
+*
+* Ð޸ļǼ1£º
+* ÐÞ¸ÄÄÚÈÝ£º³õʼ°æ±¾
+************************************************************************/
+
+#include "zte_web_mc.h"
+#include "message.h"
+
+/******************************************************
+* Function: zte_mc_relay_sms_send_msg
+* Description: the fun to relay SMS send send msg to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_sms_send_msg(T_zUfiSms_SendReq *msg_ptr)
+{
+ int ret_code = 0;
+ T_zGoaheadMsgBuf send_msg;
+
+
+ memset(&send_msg, 0, sizeof(send_msg));
+
+ /*check the input param*/
+ if (msg_ptr == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "the zte_mc_relay_sms_send_msg fun's input param is valid!"); /*lint !e26*/
+ return -1;
+ }
+
+ /*set the value*/
+ send_msg.msg_hdr.type = ZTE_SMS_RELAY_TYPE;
+ send_msg.msg_hdr.id = ZTE_MC_SMS_SEND_MSG_CMD;
+ send_msg.msg_hdr.result = OK;
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(T_zUfiSms_SendReq) > ZTE_MODEM_RELAY_MSGBUF_MAX_LEN) { /*lint !e506*/
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_sms_send_msg_ui_req_info_s_type is more than the msg buf , sizeof(zte_sms_send_msg_ui_req_info_s_type) = %d!"
+ , sizeof(T_zUfiSms_SendReq));/*lint !e26*/
+ return -1;
+ }
+#endif
+ memcpy(send_msg.msg_data, msg_ptr, sizeof(T_zUfiSms_SendReq));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message sms send msg start!"); /*lint !e26*/
+
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,MSG_CMD_SEND_SMS, sizeof(send_msg), (char*)&send_msg);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SMS, MSG_CMD_SEND_SMS, sizeof(send_msg), (char*)&send_msg, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message sms send msg end!"); /*lint !e26*/
+
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay sms send msg fail"); /*lint !e26*/
+ return -1;
+ }
+
+ return OK;
+}
+
+
+/******************************************************
+* Function: zte_mc_relay_sms_modify_tag
+* Description: the fun to relay SMS send modify tag msg to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_sms_modify_tag(T_zUfiSms_ModifyFlag *modify_info_tmp)
+{
+ int ret_code = 0;
+ T_zGoaheadMsgBuf send_msg;
+ //zte_wms_modify_tag_s_type modify_info_tmp;
+
+ memset(&send_msg, 0, sizeof(send_msg));
+ //memset(&modify_info_tmp, 0, sizeof(modify_info_tmp));
+
+ /*set the value*/
+ send_msg.msg_hdr.type = ZTE_SMS_RELAY_TYPE;
+ send_msg.msg_hdr.id = ZTE_MC_SMS_MODIFY_TAG_CMD;
+ send_msg.msg_hdr.result = OK;
+
+ //modify_info_tmp.sms_file = sms_file;
+ //modify_info_tmp.sms_id = msg_id;
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(T_zUfiSms_ModifyFlag) > ZTE_MODEM_RELAY_MSGBUF_MAX_LEN) { /*lint !e506*/
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_mc_relay_sms_modify_s_type is more than the msg buf , sizeof(zte_mc_relay_sms_modify_s_type) = %d!"
+ , sizeof(T_zUfiSms_ModifyFlag));/*lint !e26*/
+ return -1;
+ }
+#endif
+ memcpy(send_msg.msg_data, modify_info_tmp, sizeof(T_zUfiSms_ModifyFlag));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message sms modify tag start!"); /*lint !e26*/
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,MSG_CMD_SMS_MODIFY_TAG, sizeof(send_msg), (char*)&send_msg);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SMS, MSG_CMD_SMS_MODIFY_TAG, sizeof(send_msg), (char*)&send_msg, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message sms modify tag end!"); /*lint !e26*/
+
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay sms send modify tag msg fail"); /*lint !e26*/
+ return -1;
+ }
+
+ return OK;
+}
+
+
+/******************************************************
+* Function: zte_mc_relay_sms_write_msg
+* Description: the fun to relay SMS send write msg to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_sms_write_msg(T_zUfiSms_SaveReq *msg_ptr)
+{
+ int ret_code = 0;
+ T_zGoaheadMsgBuf send_msg;
+
+ memset(&send_msg, 0, sizeof(send_msg));
+
+ /*check the input param*/
+ if (msg_ptr == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "the zte_mc_relay_sms_write_msg fun's input param is valid!"); /*lint !e26*/
+ return -1;
+ }
+
+ /*set the value*/
+ send_msg.msg_hdr.type = ZTE_SMS_RELAY_TYPE;
+ send_msg.msg_hdr.id = ZTE_MC_SMS_WRITE_MSG_CMD;
+ send_msg.msg_hdr.result = OK;
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(T_zUfiSms_SaveReq) > ZTE_MODEM_RELAY_MSGBUF_MAX_LEN) { /*lint !e506*/
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_sms_write_msg_info_s_type is more than the msg buf , sizeof(zte_sms_write_msg_info_s_type) = %d!"
+ , sizeof(T_zUfiSms_SaveReq));/*lint !e26*/
+ return -1;
+ }
+#endif
+ memcpy(send_msg.msg_data, msg_ptr, sizeof(T_zUfiSms_SaveReq));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message sms write msg start!"); /*lint !e26*/
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,MSG_CMD_DRAFTS_SAVE,sizeof(send_msg), (char*)&send_msg);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SMS, MSG_CMD_DRAFTS_SAVE, sizeof(send_msg), (char*)&send_msg, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message sms write msg end!"); /*lint !e26*/
+
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay sms send write msg fail"); /*lint !e26*/
+ return -1;
+ }
+
+ return OK;
+}
+
+
+/******************************************************
+* Function: zte_mc_relay_sms_delete_msg
+* Description: the fun to relay SMS send delete msg to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_sms_delete_msg(T_zUfiSms_DelReq *del_info_ptr)
+{
+ int ret_code = 0;
+
+ //int tmp = 0;
+ //int i_tmp = 0;
+
+ /*check the input param*/
+ if (del_info_ptr == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"the zte_mc_relay_sms_delete_msg fun's input param is valid!");/*lint !e26*/
+ return -1;
+ }
+
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(T_zUfiSms_DelReq) > MSG_DATA_MAX_LEN) {
+ slog(MISC_PRINT, SLOG_ERR,"the size of zte_sms_delete_msg_info_s_type is more than the msg buf , sizeof(zte_sms_delete_msg_info_s_type) = %d!"
+ , sizeof(T_zUfiSms_DelReq));/*lint !e26*/
+ return -1;
+ }
+#endif
+
+ //slog(MISC_PRINT,SLOG_NORMAL,"del_info_ptr->db is %d\n",del_info_ptr->db);/*lint !e26*/
+
+ //ret_code = zte_send_message(ZTE_SOCKET_PATH_MAIN_CONTROL, sizeof(send_msg), (char*)&send_msg);
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL, MSG_CMD_DEL_SMS_BY_INDEX, sizeof(T_zUfiSms_DelReq), (char *)del_info_ptr);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SMS, MSG_CMD_DEL_SMS_BY_INDEX, sizeof(T_zUfiSms_DelReq), (char *)del_info_ptr, 0);
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_send_message sms delete msg end!");/*lint !e26*/
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR,"mc lib relay sms send delete msg fail");/*lint !e26*/
+ return -1;
+ }
+ return OK;
+}
+/******************************************************
+* Function: zte_mc_relay_sms_move_to_sim_msg
+* Description: the fun to SMS move to sim msg to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_sms_move_to_sim_msg(T_zUfiSms_DelReq *del_info_ptr)
+{
+ int ret_code = 0;
+
+ int tmp = 0;
+ int i_tmp = 0;
+
+ /*check the input param*/
+ if (del_info_ptr == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "the zte_mc_relay_sms_move_to_sim_msg fun's input param is valid!");
+ return -1;
+ }
+
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(T_zUfiSms_DelReq) > MSG_DATA_MAX_LEN) {
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_sms_delete_msg_info_s_type is more than the msg buf , sizeof(zte_sms_delete_msg_info_s_type) = %d!"
+ , sizeof(T_zUfiSms_DelReq));
+ return -1;
+ }
+#endif
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message sms move to sim msg start!");
+ //slog(MISC_PRINT,SLOG_DEBUG,"del_info_ptr->db is %d\n",del_info_ptr->db);
+
+ //ret_code = zte_send_message(ZTE_SOCKET_PATH_MAIN_CONTROL, sizeof(send_msg), (char*)&send_msg);
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL, MSG_CMD_COPY_SMS, sizeof(T_zUfiSms_DelReq), (char *)del_info_ptr);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SMS, MSG_CMD_COPY_SMS, sizeof(T_zUfiSms_DelReq), (char *)del_info_ptr, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message sms move to sim msg end!");
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay sms send move to sim msg fail");
+ return -1;
+ }
+ return OK;
+}
+
+/******************************************************
+* Function: zte_mc_relay_sms_set_parameter
+* Description: the fun to relay SMS send set_parameter to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_sms_set_parameter(T_zUfiSms_ParaInfo *parameter_ptr)
+{
+ int ret_code = 0;
+ T_zGoaheadMsgBuf send_msg;
+
+ memset(&send_msg, 0, sizeof(send_msg));
+
+ /*check the input param*/
+ if (parameter_ptr == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "the zte_mc_relay_sms_set_parameter fun's input param is valid!"); /*lint !e26*/
+ return -1;
+ }
+
+ /*set the value*/
+ send_msg.msg_hdr.type = ZTE_SMS_RELAY_TYPE;
+ send_msg.msg_hdr.id = ZTE_MC_SMS_SET_PARAM_CMD;
+ send_msg.msg_hdr.result = OK;
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(T_zUfiSms_ParaInfo) > ZTE_MODEM_RELAY_MSGBUF_MAX_LEN) { /*lint !e506*/
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_sms_parameter_info_s_type is more than the msg buf , sizeof(zte_sms_parameter_info_s_type) = %d!"
+ , sizeof(T_zUfiSms_ParaInfo));/*lint !e26*/
+ return -1;
+ }
+#endif
+ memcpy(send_msg.msg_data, parameter_ptr, sizeof(T_zUfiSms_ParaInfo));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message sms set parameter( start!"); /*lint !e26*/
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,MSG_CMD_SMS_LOCATION_SET, sizeof(send_msg), (char*)&send_msg);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SMS, MSG_CMD_SMS_LOCATION_SET, sizeof(send_msg), (char*)&send_msg, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message sms set parameter( end!"); /*lint !e26*/
+
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay sms set parameter msg fail"); /*lint !e26*/
+ return -1;
+ }
+
+ return OK;
+}
+
+
+
+
+/******************************************************
+* Function: zte_mc_relay_pbm_create_modify_record
+* Description: the fun to relay PBM send create modify to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_pbm_create_modify_record(zte_pbm_create_ext_record_s_type *pbm_recv_record)
+{
+ int ret_code = 0;
+ T_zGoaheadMsgBuf send_msg;
+
+ memset(&send_msg, 0, sizeof(send_msg));
+
+ /*check the input param*/
+ if (pbm_recv_record == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "the zte_mc_relay_pbm_create_modify_record fun's input is NULL "); /*lint !e26*/
+ return -1;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "enter the zte_mc_relay_pbm_create_modify_record fun "); /*lint !e26*/
+
+ /*set the value*/
+ send_msg.msg_hdr.type = ZTE_PBM_RELAY_TYPE;
+ send_msg.msg_hdr.id = ZTE_MC_PBM_CREATE_MODIFY_RECORD_CMD;
+ send_msg.msg_hdr.result = OK;
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(zte_pbm_create_ext_record_s_type) > ZTE_MODEM_RELAY_MSGBUF_MAX_LEN) { /*lint !e506*/
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_pbm_create_ext_record_s_type is more than the msg buf , sizeof(zte_pbm_create_ext_record_s_type) = %d!"
+ , sizeof(zte_pbm_create_ext_record_s_type));/*lint !e26*/
+ return -1;
+ }
+#endif
+ memcpy(send_msg.msg_data, pbm_recv_record, sizeof(zte_pbm_create_ext_record_s_type));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message PBM create modify record start!"); /*lint !e26*/
+#if 0 // cov M when zte_send_message is commented, ret_code!= OK is unreachable
+ //ret_code = zte_send_message(ZTE_SOCKET_PATH_MAIN_CONTROL, sizeof(send_msg), (char*)&send_msg);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message PBM create modify record end!"); /*lint !e26*/
+
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm send create modify record fail"); /*lint !e26*/
+ return -1;
+ }
+#endif
+ return OK;
+}
+
+
+
+/******************************************************
+* Function: zte_mc_relay_pbm_del_one_record
+* Description: the fun to relay PBM send del one record to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_pbm_del_one_record(zte_pbm_del_multi_records_s_type *pbm_recv_record)
+{
+ int ret_code = 0;
+ T_zGoaheadMsgBuf send_msg;
+
+ memset(&send_msg, 0, sizeof(send_msg));
+
+ /*check the input param*/
+ if (pbm_recv_record == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "the zte_mc_relay_pbm_del_multi_record fun's input is NULL "); /*lint !e26*/
+ return -1;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "enter the zte_mc_relay_pbm_del_one_record fun "); /*lint !e26*/
+
+ /*set the value*/
+ send_msg.msg_hdr.type = ZTE_PBM_RELAY_TYPE;
+ send_msg.msg_hdr.id = ZTE_MC_PBM_DEL_ONE_RECORD_CMD;
+ send_msg.msg_hdr.result = OK;
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(zte_pbm_del_multi_records_s_type) > ZTE_MODEM_RELAY_MSGBUF_MAX_LEN) { /*lint !e506*/
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_pbm_del_multi_records_s_type is more than the msg buf , sizeof(zte_pbm_del_multi_records_s_type) = %d!"
+ , sizeof(zte_pbm_create_ext_record_s_type));/*lint !e26*/
+ return -1;
+ }
+#endif
+ memcpy(send_msg.msg_data, pbm_recv_record, sizeof(zte_pbm_del_multi_records_s_type));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message PBM del one record start!"); /*lint !e26*/
+#if 0 // cov M when zte_send_message is commented, ret_code!= OK is unreachable
+ //ret_code = zte_send_message(ZTE_SOCKET_PATH_MAIN_CONTROL, sizeof(send_msg), (char*)&send_msg);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message PBM del one record end!"); /*lint !e26*/
+
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm del one record msg fail"); /*lint !e26*/
+ return -1;
+ }
+#endif
+ return OK;
+}
+
+/******************************************************
+* Function: zte_mc_relay_pbm_del_multi_record
+* Description: the fun to relay PBM send del multi record to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_pbm_del_multi_record(zte_pbm_del_multi_records_s_type *pbm_recv_record)
+{
+ int ret_code = 0;
+ T_zGoaheadMsgBuf send_msg;
+
+ memset(&send_msg, 0, sizeof(send_msg));
+
+ /*check the input param*/
+ if (pbm_recv_record == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "the zte_mc_relay_pbm_del_multi_record fun's input is NULL "); /*lint !e26*/
+ return -1;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "enter the zte_mc_relay_pbm_del_multi_record fun "); /*lint !e26*/
+
+ /*set the value*/
+ send_msg.msg_hdr.type = ZTE_PBM_RELAY_TYPE;
+ send_msg.msg_hdr.id = ZTE_MC_PBM_DEL_MULTI_RECORD_CMD;
+ send_msg.msg_hdr.result = OK;
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(zte_pbm_del_multi_records_s_type) > ZTE_MODEM_RELAY_MSGBUF_MAX_LEN) { /*lint !e506*/
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_pbm_del_multi_records_s_type is more than the msg buf , sizeof(zte_pbm_del_multi_records_s_type) = %d!"
+ , sizeof(zte_pbm_create_ext_record_s_type));/*lint !e26*/
+ return -1;
+ }
+#endif
+ memcpy(send_msg.msg_data, pbm_recv_record, sizeof(zte_pbm_del_multi_records_s_type));
+
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message PBM del multi record start!"); /*lint !e26*/
+#if 0 // cov M when zte_send_message is commented, ret_code!= OK is unreachable
+ //ret_code = zte_send_message(ZTE_SOCKET_PATH_MAIN_CONTROL, sizeof(send_msg), (char*)&send_msg);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message PBM del multi record end!"); /*lint !e26*/
+
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm del multi record msg fail"); /*lint !e26*/
+ return -1;
+ }
+#endif
+ return OK;
+}
+
+
+/******************************************************
+* Function: zte_mc_relay_pbm_del_all_record
+* Description: the fun to relay PBM send del all record to the mc process
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 20121025 V1.0 liuyingnan create
+*******************************************************/
+int zte_mc_relay_pbm_del_all_record(zte_pbm_del_multi_records_s_type *pbm_recv_record)
+{
+ int ret_code = 0;
+ T_zGoaheadMsgBuf send_msg;
+
+ memset(&send_msg, 0, sizeof(send_msg));
+
+ /*check the input param*/
+ if (pbm_recv_record == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "the zte_mc_relay_pbm_del_all_record fun's input is NULL "); /*lint !e26*/
+ return -1;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "enter the zte_mc_relay_pbm_del_all_record fun "); /*lint !e26*/
+
+ /*set the value*/
+ send_msg.msg_hdr.type = ZTE_PBM_RELAY_TYPE;
+ send_msg.msg_hdr.id = ZTE_MC_PBM_DEL_ALL_RECORD_CMD;
+ send_msg.msg_hdr.result = OK;
+#if 0 // kw 3 INVARIANT_CONDITION.UNREACH
+ /*check the length before memcpy for safe*/
+ if (sizeof(zte_pbm_del_multi_records_s_type) > ZTE_MODEM_RELAY_MSGBUF_MAX_LEN) { /*lint !e506*/
+ slog(MISC_PRINT, SLOG_ERR, "the size of zte_pbm_del_multi_records_s_type is more than the msg buf , sizeof(zte_pbm_del_multi_records_s_type) = %d!"
+ , sizeof(zte_pbm_create_ext_record_s_type));/*lint !e26*/
+ return -1;
+ }
+#endif
+ memcpy(send_msg.msg_data, pbm_recv_record, sizeof(zte_pbm_del_multi_records_s_type));
+
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_send_message PBM del all record start!"); /*lint !e26*/
+#if 0 // cov M // when zte_send_message is commented, ret_code != OK is unreachable
+ //ret_code = zte_send_message(ZTE_SOCKET_PATH_MAIN_CONTROL, sizeof(send_msg), (char*)&send_msg);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_send_message PBM del all record end!"); /*lint !e26*/
+
+ if (ret_code != OK) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm del all record msg fail"); /*lint !e26*/
+ return -1;
+ }
+#endif
+
+ return OK;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_mc.h b/ap/app/goahead/interface5.0/zte_web_mc.h
new file mode 100644
index 0000000..4461beb
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_mc.h
@@ -0,0 +1,90 @@
+
+
+#include "zte_web_interface.h"
+#include "zte_web_get_fw_para.h"
+#include "zte_web_pbm.h"
+//#include "SMS_main.h"
+#include "zte_web_sms.h"
+
+#ifndef ULONG
+#define ULONG unsigned long
+#endif
+
+#ifndef OK
+#define OK 0
+#endif
+
+//typedef int m_boolean;
+
+#define ZTE_SOCKET_PATH_MAIN_CONTROL "zte_mc_path" /*MAIN CONTROL SOCKET PATH NAME */
+
+/*command type*/
+
+
+/*the msg id of relay SMS info */
+typedef enum {
+ ZTE_MC_SMS_MIN_CMD = 0,
+
+ ZTE_MC_SMS_SET_PARAM_CMD,
+ ZTE_MC_SMS_SEND_MSG_CMD,
+ ZTE_MC_SMS_WRITE_MSG_CMD,
+ ZTE_MC_SMS_DELETE_MSG_CMD,
+ ZTE_MC_SMS_MODIFY_TAG_CMD,
+
+ ZTE_MC_SMS_MAX_CMDS
+
+} zte_mc_msg_relay_sms_e_type;
+
+/*the msg id of relay pbm info */
+typedef enum {
+ ZTE_MC_PBM_MIN_CMD = 0,
+
+ ZTE_MC_PBM_CREATE_MODIFY_RECORD_CMD,
+ ZTE_MC_PBM_DEL_MULTI_RECORD_CMD,
+ ZTE_MC_PBM_DEL_ONE_RECORD_CMD,
+ ZTE_MC_PBM_DEL_ALL_RECORD_CMD,
+
+ ZTE_MC_PBM_MAX_CMDS
+
+} zte_mc_msg_relay_pbm_e_type;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_mgmt.c b/ap/app/goahead/interface5.0/zte_web_mgmt.c
new file mode 100755
index 0000000..a4e1311
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_mgmt.c
@@ -0,0 +1,3658 @@
+/************************************************************************
+* °æÈ¨ËùÓÐ (C)2010, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º zte_web_mgmt.c
+* Îļþ±êʶ£º
+* ÄÚÈÝÕªÒª£º
+* ÆäËü˵Ã÷£º
+* µ±Ç°°æ±¾£º V0.1
+* ×÷ Õߣº zyt
+* Íê³ÉÈÕÆÚ£º 2010-11-06
+*
+* Ð޸ļǼ1£º
+* ÐÞ¸ÄÄÚÈÝ£º³õʼ°æ±¾
+
+
+* ECµ¥ºÅ:EC616000235556 ¿ª·¢¹ÊÕÏ
+* ¹ÊÕÏÖ÷Ìâ:¿ª»ú¸üÐÂʧ°ÜºóÁ¢¼´ÖØÆô£¬ÖØÆôºóÈÔÏÔʾ¸üÐÂʧ°ÜÎÊÌâ / Ôö¼Ówebui fota´¦Àílog
+* ÐÞ¸Äʱ¼ä:20140715
+************************************************************************/
+#include <sys/time.h>
+#include <sys/types.h>
+#include <string.h>
+#include <pthread.h>
+#include <dirent.h>
+#include <stdlib.h>
+
+#include <signal.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+
+#include <openssl/aes.h>
+
+#include "zte_web_interface.h"
+#include "zte_web_get_fw_para.h"
+#include "zte_web_mgmt_wifi.h"
+#include "fota_common.h"
+#include "nv_api.h"
+#include "libkey.h"
+
+/****************************************************************************
+* È«¾Ö±äÁ¿¶¨ÒåÇø
+****************************************************************************/
+/* password check result*/
+typedef enum _psw_check_result_type_t {
+ PSW_EMPTY = 0,
+ PSW_OK = 1,
+ PSW_TOO_LONG = 2,
+ PSW_TIME_OUT = 3,
+ PSW_OTHER = 4
+} psw_check_result_type_t;
+
+typedef enum {
+ PIN_MANAGE_DISABLE = 0,
+ PIN_MANAGE_ENABLE,
+ PIN_MANAGE_MODIFY
+} emPIN_MANAGE_ACTION;
+
+typedef struct UNLOCK_PARA {
+ char unlock_code[20];
+} UNLOCK_PARA_ST;
+
+//quick setting
+typedef void (*funcWPType)(webs_t);
+
+pthread_mutex_t g_login_timemark_mutex = PTHREAD_MUTEX_INITIALIZER;
+#define TIME_SEM_KEY_1 0x0A2B
+#define TIME_SEM_KEY_2 0x3A4B
+
+//bsim
+typedef struct
+{
+ unsigned int pubKeyRsaE[32];
+ unsigned int pubKeyRsaN[32];
+ unsigned int secureFlag;
+ unsigned int pubKeyHash[4];
+ unsigned int secureDevId[3];
+}T_ZDrvEfuse_Secure;
+
+#define EFUSE_IOC_MAGIC 'E'
+#define EFUSE_GET_DATA _IOWR(EFUSE_IOC_MAGIC, 1, char *)
+#define PPPOE_CODE_LEN 32 //webui limit 30
+
+static unsigned char web_aes_key[16] = {0};
+
+#define APNCONFIG_NUM_MAX 10
+//bsim end
+
+/****************************************************************************
+* staticº¯ÊýÉùÃ÷Çø
+****************************************************************************/
+void deal_quick_setup_apn_ex(webs_t wp);
+void deal_quick_setup_wifi_basic(webs_t wp);
+void deal_quick_setup_wifi_security(webs_t wp);
+int zte_mgmt_handle_account(webs_t wp);
+void zte_setLastLoginTime();
+int zte_checkLoginTime();
+void zte_reduct_login_times();
+psw_check_result_type_t zte_password_check(webs_t wp, char* psw);
+static void wait_verify(char *wait_name, char *wait_value);
+static void zte_mgmt_enable_pin(webs_t wp, char_t *old_pin);
+static void zte_mgmt_modify_pin(webs_t wp, char_t *old_pin, char_t *new_pin);
+void deal_quick_setup_wifi_basic(webs_t wp);
+void deal_quick_setup_wifi_security(webs_t wp);
+static void deal_quick_setup_wps(webs_t wp);
+static char *split_str_by_sep(char *src, char *sep, char *dst, int len);
+static void set_apn_to_cfg(APN_PROFILE *apn_profile, IPV6_APN_PROFILE *ipv6_apn_profile);
+#ifdef WEBS_SECURITY
+static void js_aes_wifi_encode(void);
+#endif
+
+/* ¿ìËÙÉèÖà */
+const funcWPType G_ZQUICK_SET[MAX_QUICK_SET_NUM] = {
+ deal_quick_setup_apn_ex,
+ deal_quick_setup_wifi_basic,
+ deal_quick_setup_wifi_security,
+ zte_mgmt_handle_account,
+ quick_dhcp_set
+};
+
+/******************************************************
+* Function: void zte_mgmt_login(webs_t wp)
+* Description: deal with the login goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_mgmt_login(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User login!\n"));
+ char_t *psw = NULL;
+ char_t *user = NULL;
+ char_t *save_flag = NULL;
+ char_t *ip_address = NULL;
+
+ int user_name_len = 0;
+ char_t *pUser = NULL;
+ char user_name[CONFIG_DEFAULT_LENGTH] = {0};
+ int zte_password_len = 0;
+ char_t *zte_password = NULL;
+ char zte_psw_admin[CONFIG_DEFAULT_LENGTH] = {0};
+ psw_check_result_type_t psw_cheak_result = PSW_EMPTY;
+ char buf[CONFIG_DEFAULT_LENGTH] = {0};
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[login] zte_mgmt_login enter====\n");
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR,"[login] zte_mgmt_login: wp is null.");/*lint !e26*/
+ zte_write_result_to_web(wp, LOGIN_FAIL);
+ return;
+ }
+
+ psw = websGetVar(wp, T("password"), T(""));
+ user = websGetVar(wp, T("username"), NULL);
+
+ if ('\0' == (*psw)) {
+ slog(MISC_PRINT, SLOG_ERR,"[login] zte_mgmt_login: psw is empty.");/*lint !e26*/
+ zte_write_result_to_web(wp, LOGIN_FAIL);
+ return;
+ }
+
+ if (user != NULL) {
+ slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login user = %s\n", user);
+ pUser = (char *)zte_base64_decode((const unsigned char *)user, strlen(user), (unsigned int*)&user_name_len);
+ if (NULL == pUser) {
+ zte_write_result_to_web(wp, LOGIN_FAIL);
+ return;
+ }
+
+ //strncpy(user_name, pUser, user_name_len);
+ if(user_name_len < sizeof(user_name))
+ snprintf(user_name,user_name_len+1,"%s",pUser);
+ else
+ snprintf(user_name,sizeof(user_name),"%s",pUser);
+ free(pUser);
+
+ slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login user_name = %s\n", user_name);
+ sc_cfg_get("admin_user", buf, sizeof(buf));
+ if (0 != strcmp(user_name, buf)) {
+ slog(MISC_PRINT, SLOG_ERR," zte_mgmt_login user_name fail \n");
+ zte_write_result_to_web(wp, LOGIN_USER_NAME_NOT_EXSIT);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login uername correct \n");
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[login] login1 -> zte_password_encode:%s.\n", psw); /*lint !e26*/
+#ifdef WEBS_SECURITY
+ zte_password = js_aes_decode(psw, strlen(psw), (unsigned int*)&zte_password_len);
+#else
+ zte_password = (char *)zte_base64_decode((const unsigned char *)psw, strlen(psw), (unsigned int*)&zte_password_len);
+#endif
+ slog(MISC_PRINT, SLOG_DEBUG,"[login] login2 -> zte_password:%s.\n", zte_password); /*lint !e26*/
+
+ if (NULL == zte_password) {
+ slog(MISC_PRINT, SLOG_ERR,"[login] zte_mgmt_login: psw is empty.\n");/*lint !e26*/
+ zte_write_result_to_web(wp, LOGIN_FAIL);
+ return;
+ }
+ //zte_password will long than zte_password_len, then strncpy zte_password_len data to zte_psw_admin
+ if(zte_password_len < sizeof(zte_psw_admin))
+ snprintf(zte_psw_admin,zte_password_len+1,"%s",zte_password);
+ else
+ snprintf(zte_psw_admin,sizeof(zte_psw_admin),"%s",zte_password);
+ //strncpy(zte_psw_admin, zte_password, zte_password_len);
+ free(zte_password);
+ slog(MISC_PRINT, SLOG_DEBUG,"[login] login3 -> zte_psw_admin:%s.\n", zte_psw_admin); /*lint !e26*/
+ psw_cheak_result = zte_password_check(wp, zte_psw_admin);
+
+ if (psw_cheak_result != PSW_OK) {
+ slog(MISC_PRINT, SLOG_ERR,"[login] zte_mgmt_login psw_cheak_result != PSW_OK\n");
+ zte_write_result_to_web(wp, LOGIN_FAIL);
+ return;
+ }
+
+ //get request ip addr
+ ip_address = websGetRequestIpaddr(wp);
+#if 0 // kw 3
+ if (NULL == ip_address) {
+ slog(MISC_PRINT, SLOG_ERR,"[login] zte_mgmt_login: ip_address is null.\n");/*lint !e26*/
+ zte_write_result_to_web(wp, LOGIN_FAIL);
+ return;
+ }
+#endif
+ //memset(&buf, 0, sizeof(buf));
+ //sc_cfg_get("admin_Password", buf, sizeof(buf));
+ //if (0 == strcmp(zte_psw_admin, buf)) {
+ if (0 == web_check_pwd(zte_psw_admin)) {
+ save_flag = websGetVar(wp, T("save_login"), T(""));
+ if (('\0' != (*save_flag)) && (IFSTREQUAL("1", save_flag))) {
+ sc_cfg_set("psw_save", zte_psw_admin);
+ }
+ } else {
+ zte_reduct_login_times();
+ slog(MISC_PRINT, SLOG_ERR,"[login] zte_mgmt_login: error pass.");/*lint !e26*/
+ zte_write_result_to_web(wp, LOGIN_BAD_PASSWORD);
+ security_log(MODULE_ID_WEB_CGI,"web login err pwd ip=%s",ip_address);
+ return;
+ }
+
+ if (zte_mgmt_login_timemark_set()) {
+ char id[COOKIE_SESSION_SIZE+1] = {0};
+ int ret = web_make_salt_base64(id, sizeof(id));
+ if(ret == 0)
+ {
+ slog(MISC_PRINT, SLOG_ERR,"[login] web_get_cookie_id fail\n");
+ zte_write_result_to_web(wp, LOGIN_FAIL);
+ return;
+ }
+ (void)zte_web_write(NV_USER_IP_ADDR, ip_address);
+ (void)zte_web_write(NV_LOGINFO, "ok");
+ (void)zte_web_write("save_login", save_flag);
+ (void)zte_web_write("psw_fail_num_str", LOGIN_FAIL_TIMES);
+ (void)zte_web_write(NV_COOKIE_ID, id);
+#ifdef WEBS_SECURITY
+ js_aes_wifi_encode();
+#endif
+ //zte_write_result_to_web(wp, LOGIN_SUCCESS);
+ websWrite(wp, T("HTTP/1.1 200 OK\n"));
+ websWrite(wp, T("Server: %s\r\n"), WEBS_NAME);
+#ifdef WEBINSPECT_FIX
+ websWrite(wp, T("X-Frame-Options: SAMEORIGIN\n"));
+#endif
+ websWrite(wp, T("Pragma: no-cache\n"));
+ websWrite(wp, T("Cache-control: no-cache\n"));
+ websWrite(wp, T("Content-Type: text/html\n"));
+#ifdef WEBS_SECURITY
+ websWrite(wp, T("Expires: 0\n"));
+ if (websSSLIsOpen())
+ websWrite(wp, T("Set-Cookie: id=%s; secure; HttpOnly; SameSite=Lax;\n"),id);
+ else
+ websWrite(wp, T("Set-Cookie: id=%s; HttpOnly; SameSite=Lax;\n"),id);
+#endif
+ websWrite(wp, T("\n"));
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ zte_rest_result_write(wp, LOGIN_SUCCESS);
+ } else {
+ websWrite(wp, T("{\"result\":\"%s\"}"), LOGIN_SUCCESS);
+ }
+ security_log(MODULE_ID_WEB_CGI,"web login suc ip=%s",ip_address);
+ return;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[login] zte_mgmt_login_timemark_set fail\n");
+ zte_write_result_to_web(wp, LOGIN_FAIL);
+ return;
+ }
+}
+/******************************************************
+* Function: int zte_mgmt_login_timemark_set()
+* Description: save the setting operate time
+* Input:
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+*******************************************************/
+int zte_mgmt_login_timemark_set()
+{
+ char_t login_timemark[NV_ITEM_STRING_LEN_64] = {0};
+ long timemark = 0;
+ int sem_id = -1;
+
+ int rc = TRUE;
+
+ sem_id = get_sem(TIME_SEM_KEY_2);
+ if (sem_id != -1) {
+ sem_p(sem_id);
+ }
+
+ timemark = time(0);
+ sprintf(login_timemark, "%ld", timemark);
+ if(ZTE_NVIO_DONE != zte_web_write(NV_USER_LOGIN_TIMEMARK, login_timemark))
+ {
+ rc = FALSE; // kw 3
+ }
+
+ if (sem_id != -1) {
+ sem_v(sem_id);
+ }
+
+ return rc;
+}
+void zte_mgmt_login_timeout_check()
+{
+ char_t user_login_timemark[NV_ITEM_STRING_LEN_64] = {0};
+ char_t login_info[NV_ITEM_STRING_LEN_20] = {0};
+
+ long time_now = 0;
+ int sem_id = -1;
+ long luser_login_timemark = 0;
+
+ zte_web_read(NV_LOGINFO, login_info);
+
+ if (0 == strcmp(login_info, "ok")) {
+ zte_web_read(NV_USER_LOGIN_TIMEMARK, user_login_timemark);
+ luser_login_timemark = atol(user_login_timemark);
+ if(luser_login_timemark < 0 || luser_login_timemark > LONG_MAX-1){
+ luser_login_timemark = LONG_MAX;
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_mgmt_login_timemark_check: user_login_timemark is out of range [0, LONG_MAX).");
+ }
+
+ sem_id = get_sem(TIME_SEM_KEY_2);
+ if (sem_id != -1) {
+ sem_p(sem_id);
+ }
+ //timemark_check = time(0) - luser_login_timemark;
+ time_now = time(0);
+ if (sem_id != -1) {
+ sem_v(sem_id);
+ }
+
+ if ((time_now - luser_login_timemark) > LOGIN_TIMEOUT) {
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_mgmt_login_timemark_check: the login is timeout .");
+ (void)zte_web_write(NV_USER_IP_ADDR, "");
+ (void)zte_web_write(NV_LOGINFO, "timeout");
+ (void)zte_web_write(NV_COOKIE_ID, "");
+ (void)zte_web_write(NV_WEB_TOKEN, "");
+ (void)zte_web_write(NV_USER_LOGIN_TIMEMARK, "0");
+ security_log(MODULE_ID_WEB_CGI,"web logout timeout");
+ return;
+ }
+#ifdef WEBS_SECURITY
+ static long time_update_token = 0;
+ if ((time_now - time_update_token) > COOKIE_TOKEN_TIMEOUT) {
+ time_update_token = time_now;
+ (void)zte_web_write(NV_WEB_TOKEN, "");
+ }
+#endif
+ }
+
+}
+/******************************************************
+* Function: void zte_mgmt_logout(webs_t wp)
+* Description: deal with the logout goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_mgmt_logout(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User logout!\n"));
+
+ if (NULL == wp) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ sc_cfg_set(NV_USER_IP_ADDR, "");
+ sc_cfg_set(NV_LOGINFO, "");
+ sc_cfg_set(NV_COOKIE_ID, "");
+ sc_cfg_set(NV_WEB_TOKEN, "");
+ zte_write_result_to_web(wp, SUCCESS);
+ security_log(MODULE_ID_WEB_CGI,"web logout");
+}
+
+/******************************************************
+* Function: void zte_mgmt_set_language(webs_t wp)
+* Description: deal with the set language goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*2012/09/14 liuyingnan modification
+*******************************************************/
+void zte_mgmt_set_language(webs_t wp)
+{
+ char_t* language = websGetVar(wp, T("Language"), T("en"));
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User set language!\n"));
+
+ sc_cfg_set(NV_LANGUAGE, language);
+
+ //sc_cfg_save();
+ if ('\0' == (*language)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_mgmt_set_language: web para:[language] is empty string.\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+
+
+}
+
+
+/******************************************************
+* Function: void zte_mgmt_set_devicemode(webs_t wp)
+* Description: user/develop mode switch
+* Input: HTTP page info(debug_enable = 1 develop mode)
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* Feb 27, 2014 V1.0 jhy create
+*******************************************************/
+void zte_mgmt_set_devicemode(webs_t wp)
+{
+ char_t* debug_enable = websGetVar(wp, T("debug_enable"), T(""));
+ char_t* auth = websGetVar(wp, T("auth"), T(""));
+
+ char strCfgGetItem[16] = {0};
+ nv_get_item(NV_RO, "usb_modetype", strCfgGetItem, sizeof(strCfgGetItem));
+
+ slog(MISC_PRINT, SLOG_NORMAL,"[goahead]debug_enable->%s current->%s\n", debug_enable, strCfgGetItem);
+ if((strcmp(strCfgGetItem,"user")== 0)&&(atoi(debug_enable) != 0))
+ {
+/* if(verify_device_key(auth,strlen(auth),SEED,strlen(SEED)) != 1)
+ {
+ slog(MISC_PRINT, SLOG_ERR, "zte_mgmt_set_devicemode: auth %s fail.\n",auth);
+ zte_write_result_to_web(wp, "set_devicemode fail:auth fail!");
+ return;
+ }*/
+ }
+
+ if ('\0' == (*debug_enable)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_mgmt_set_devicemode: web para:[debug_enable] is empty string.\n");
+ zte_write_result_to_web(wp, "set_devicemode fail:parameter debug_enable is empty!");
+ return;
+ }
+
+ if (atoi(debug_enable) < 0 || atoi(debug_enable) > 3) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_mgmt_set_devicemode: web para:[debug_enable] is illegal string.\n");
+ zte_write_result_to_web(wp, "set_devicemode fail:parameter debug_enable is illegal!");
+ return;
+ }
+ char ss[20] = {0};
+ unsigned char bootmode[] = {0x54,0x4D};
+ switch (atoi(debug_enable)) {
+ case 0:
+ slog(MISC_PRINT, SLOG_NORMAL,"[goahead]debug_enable->user\n");
+ nv_set_item(NV_RO, "usb_modetype", "user", 1);
+ bootmode[1] =0x00;
+ amt_set_bootmode(bootmode);
+ break;
+ case 1:
+ slog(MISC_PRINT, SLOG_NORMAL,"[goahead]debug_enable->debug\n");
+ nv_set_item(NV_RO, "usb_modetype", "debug", 1);
+ bootmode[1] =0x01;
+ amt_set_bootmode(bootmode);
+ break;
+ case 2:
+ slog(MISC_PRINT, SLOG_NORMAL,"[goahead]debug_enable->factory\n");
+ nv_set_item(NV_RO, "usb_modetype", "factory", 1);
+ bootmode[1] =0x02;
+ amt_set_bootmode(bootmode);
+ break;
+ case 3:
+ slog(MISC_PRINT, SLOG_NORMAL,"[goahead]debug_enable->amt\n");
+ //nv_set_item(NV_RO, "usb_modetype", "amt", 1);
+ amt_set_bootmode(bootmode);
+ break;
+ default:
+ slog(MISC_PRINT, SLOG_NORMAL,"[goahead]error!\n");
+ zte_write_result_to_web(wp, "set_devicemode fail:parameter debug_enable is illegal!");
+ return;;
+ }
+ nv_commit(NV_RO);////default_parameter_roÖеÄNV±£´æ±ØÐëÓÃnv_commit²»ÄÜÓÃsc_cfg_save
+ zte_write_result_to_web(wp, "set_devicemode successfully!");
+
+}
+
+/******************************************************
+* Function: void zte_mgmt_restore(webs_t wp)
+* Description: deal with the restore goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_mgmt_restore(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL,"webui reset send message to blc\n");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_RESET_REQUEST, 0, NULL, 0);
+ system("sleep 2");//WH:delete?
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+
+/******************************************************
+* Function: void zte_mgmt_poweroff(webs_t wp)
+* Description: deal with the poweroff goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2015/5/26 V1.0 lsl create
+*******************************************************/
+void zte_mgmt_poweroff(webs_t wp)
+{
+ zte_write_result_to_web(wp, SUCCESS);
+ slog(MISC_PRINT, SLOG_NORMAL,"webui poweroff send message to blc\n");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_POWEROFF_REQUEST, 0, NULL, 0);
+}
+
+/******************************************************
+* Function: void zte_mgmt_control_power_on_speed(webs_t wp)
+* Description: deal with the power_on_speed goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2015/5/26 V1.0 lsl create
+*******************************************************/
+void zte_mgmt_control_power_on_speed(webs_t wp)
+{
+ char_t* mgmt_quicken_power_on = websGetVar(wp, T("mgmt_quicken_power_on"), T(""));
+
+ if ('\0' == (*mgmt_quicken_power_on)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ } else if (strcmp(mgmt_quicken_power_on, "0") != 0 && strcmp(mgmt_quicken_power_on, "1") != 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ sc_cfg_set("mgmt_quicken_power_on", mgmt_quicken_power_on);
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/******************************************************
+* Function: void zte_goform_mgmt_reboot_process(webs_t wp)
+* Description: deal with the restore goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_goform_mgmt_reboot_process(webs_t wp)
+{
+ MSG_BUF stMsg = {0};
+ SINT32 iMsgSize = sizeof(MSG_BUF) - sizeof(SINT32);
+ char buf[NV_ITEM_STRING_LEN_20] = {0};
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User reboot!\n"));
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_RESTART_REQUEST, 0, NULL, 0);
+}
+
+
+void zte_goform_mgmt_syslog_process(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_goform_mgmt_syslog_process coming\n"); /*lint !e26*/
+ char_t *syslog_mode = NULL;
+ /* get value from web page */
+ syslog_mode = websGetVar(wp, T("syslog_mode"), T("all"));
+
+ char_t *syslog_flag = NULL;
+ /* get value from web page */
+ syslog_flag = websGetVar(wp, T("syslog_flag"), T("close"));
+
+ if (strcmp(syslog_flag, "close") == 0) {
+ sc_cfg_set("debug_level", "0");
+ zte_write_result_to_web(wp, SUCCESS);
+ } else if (strcmp(syslog_flag, "delete") == 0) {
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User delete syslog!\n"));
+ slog(MISC_PRINT, SLOG_DEBUG, "delete syslog====\n"); /*lint !e26*/
+ //system("cat /dev/null > /var/log/webshow_messages");
+ system("cat /dev/null > /usr/netlog/misc.log");
+ system("cat /dev/null > /etc_ro/web/webshow_messages");
+
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ //sc_cfg_set("debug_level","7");/*added by jhy */
+ if (0 == strcmp("ufi", syslog_mode)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("mkdir -p /etc_ro/web");
+ system("log.sh UFI");
+ sc_cfg_set("syslog_mode", "ufi");
+ }/*added by jhy */
+ else if (0 == strcmp("wan_connect", syslog_mode)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("log.sh wan_connect info");
+ sc_cfg_set("syslog_mode", "wan_connect");
+ } else if (0 == strcmp("voip", syslog_mode)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("log.sh voip info");
+ sc_cfg_set("syslog_mode", "voip");
+ } else if (0 == strcmp("sms", syslog_mode)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("log.sh sms info");
+ sc_cfg_set("syslog_mode", "sms");
+ } else if (0 == strcmp("tr069", syslog_mode)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("log.sh tr069 info");
+ sc_cfg_set("syslog_mode", "tr069");
+ } else if (0 == strcmp("dlna", syslog_mode)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("log.sh dlna info");
+ sc_cfg_set("syslog_mode", "dlna");
+ } else if (0 == strcmp("wlan", syslog_mode)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("log.sh wlan info");
+ sc_cfg_set("syslog_mode", "wlan");
+ } else if (0 == strcmp("router", syslog_mode)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("log.sh router info");
+ sc_cfg_set("syslog_mode", "router");
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "syslog_mode=====%s\n", syslog_mode); /*lint !e26*/
+ system("log.sh all info");
+ sc_cfg_set("syslog_mode", "all");
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+ }
+
+}
+
+
+/******************************************************
+* Function: void zte_mgmt_change_password(webs_t wp)
+* Description: deal with the user account modify goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_mgmt_change_password(webs_t wp)
+{
+ char_t *old_pass = NULL;
+ char_t *new_pass = NULL;
+ char_t *current_psw = NULL;
+ char_t *new_psw = NULL;
+ int current_psw_len = 0;
+ int new_psw_len = 0;
+ char new_psw_admin[CONFIG_DEFAULT_LENGTH] = {0};
+ char old_psw_admin[CONFIG_DEFAULT_LENGTH] = {0};
+ //char admin_psw_buf[CONFIG_DEFAULT_LENGTH] = {0};
+
+ old_pass = websGetVar(wp, T("oldPassword"), T(""));
+ new_pass = websGetVar(wp, T("newPassword"), T(""));
+
+ if (0 == strlen(old_pass) || 0 == strlen(new_pass)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "user_modify:new_psw_encode:%s\n", new_pass); /*lint !e26*/
+#ifdef WEBS_SECURITY
+ current_psw = js_aes_decode(old_pass, strlen(old_pass), (unsigned int *)¤t_psw_len);
+ new_psw = js_aes_decode(new_pass, strlen(new_pass), (unsigned int *)&new_psw_len);
+#else
+ current_psw = (char*)zte_base64_decode((const unsigned char *)old_pass, strlen(old_pass), (unsigned int *)¤t_psw_len);
+ new_psw = (char*)zte_base64_decode((const unsigned char *)new_pass, strlen(new_pass), (unsigned int *)&new_psw_len);
+#endif
+
+ if (NULL == current_psw || NULL == new_psw) {
+ slog(MISC_PRINT, SLOG_ERR, "current_psw or new_psw is NULL\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ free(current_psw);
+ free(new_psw);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "user_modify:new_psw:%s\n", new_psw); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "user_modify:new_psw_len:%d\n", new_psw_len); /*lint !e26*/
+ if(current_psw_len < sizeof(old_psw_admin))
+ snprintf(old_psw_admin,current_psw_len+1,"%s",current_psw);
+ else
+ snprintf(old_psw_admin,sizeof(old_psw_admin),"%s",current_psw);
+ //strncpy(old_psw_admin, current_psw, CONFIG_DEFAULT_LENGTH-1);
+ if(new_psw_len < sizeof(new_psw_admin))
+ snprintf(new_psw_admin,new_psw_len+1,"%s",new_psw);
+ else
+ snprintf(new_psw_admin,sizeof(new_psw_admin),"%s",new_psw);
+ //strncpy(new_psw_admin, new_psw, CONFIG_DEFAULT_LENGTH-1);
+ free(current_psw);
+ free(new_psw);
+ slog(MISC_PRINT, SLOG_DEBUG, "user_modify:new_psw_admin:%s\n", new_psw_admin); /*lint !e26*/
+
+ if (LOGIN_PSW_MIN_LEN > new_psw_len || LOGIN_PSW_MAX_LEN < new_psw_len) {
+ slog(MISC_PRINT, SLOG_ERR, "new_psw_len is too long\n"); /*lint !e26*/
+ sc_cfg_set("data_safe", "failed");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(old_psw_admin)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(new_psw_admin)) {
+ slog(MISC_PRINT, SLOG_ERR, "Get Data is no Safe:old_pass:%s,new_pass:%s\n", old_psw_admin, new_psw_admin); /*lint !e26*/
+ sc_cfg_set("data_safe", "failed");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //sc_cfg_get("admin_Password", admin_psw_buf, sizeof(admin_psw_buf));
+ //if (0 != strcmp(old_psw_admin, admin_psw_buf)) {
+ if (0 != web_check_pwd(old_psw_admin)) {
+#ifdef WEBS_SECURITY
+ sc_cfg_set(NV_USER_IP_ADDR, "");
+ sc_cfg_set(NV_LOGINFO, "");
+ sc_cfg_set(NV_COOKIE_ID, "");
+ sc_cfg_set(NV_WEB_TOKEN, "");
+ security_log(MODULE_ID_WEB_CGI,"web changepwd fail logout");
+#endif
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User change passwd!\n"));
+
+ //sc_cfg_set("admin_Password", new_psw_admin);
+ web_set_pwd(new_psw_admin);
+ //sc_cfg_set("user_save", "");
+ sc_cfg_set("psw_save", "");
+ sc_cfg_set("save_login", "");
+ sc_cfg_set("psw_changed", "1");/*³õʼÃÜÂëÐ޸ıêʶ*/
+/*
+ char cmd[82] = {0};
+ sprintf(cmd, "mksmbpasswd.sh \'%s\'", new_psw_admin);
+ system(cmd);
+ system("killall smbd");
+ system("killall nmbd");
+ system("smbd -D");
+ system("nmbd -D");
+*/
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+int zte_mgmt_check_password(webs_t wp)
+{
+ char_t *tmp_old_psw = NULL;
+ char_t *old_psw = NULL;
+ int old_psw_len = 0;
+ char old_psw_admin[CONFIG_DEFAULT_LENGTH] = {0};
+ //char admin_psw_buf[CONFIG_DEFAULT_LENGTH] = {0};
+
+ tmp_old_psw = websGetVar(wp, T("oldPassword"), NULL);
+ if (NULL != tmp_old_psw) {
+ old_psw = (char*)zte_base64_decode((const unsigned char *)tmp_old_psw, strlen(tmp_old_psw), (unsigned int *)&old_psw_len);
+ if (NULL == old_psw) {
+ slog(MISC_PRINT, SLOG_DEBUG, "current_psw or new_psw is NULL\n"); /*lint !e26*/
+ return -1;
+ }
+ slog(MISC_PRINT, SLOG_NORMAL,"zte_mgmt_check_password old_psw:%s!\n", old_psw);
+ if(old_psw_len < sizeof(old_psw_admin))
+ snprintf(old_psw_admin,old_psw_len+1,"%s",old_psw);
+ else
+ snprintf(old_psw_admin,sizeof(old_psw_admin),"%s",old_psw);
+ //strncpy(old_psw_admin, old_psw, CONFIG_DEFAULT_LENGTH-1);
+ free(old_psw);
+
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(old_psw_admin)) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_mgmt_check_password old_psw_admin Get Data is no Safe!\n");
+ sc_cfg_set("data_safe", "failed");
+ return -1;
+ }
+
+ //sc_cfg_get("admin_Password", admin_psw_buf, sizeof(admin_psw_buf));
+ //if (0 != strcmp(old_psw_admin, admin_psw_buf)) {
+ if (0 != web_check_pwd(old_psw_admin)) {
+#ifdef WEBS_SECURITY
+ sc_cfg_set(NV_USER_IP_ADDR, "");
+ sc_cfg_set(NV_LOGINFO, "");
+ sc_cfg_set(NV_COOKIE_ID, "");
+ sc_cfg_set(NV_WEB_TOKEN, "");
+ security_log(MODULE_ID_WEB_CGI,"web checkpwd fail logout");
+#endif
+ slog(MISC_PRINT, SLOG_ERR,"zte_mgmt_check_password admin_Password fail!\n");
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int zte_mgmt_handle_account(webs_t wp)
+{
+ char_t *tmp_new_user = NULL;
+ char_t *tmp_new_psw = NULL;
+ char_t *new_user = NULL;
+ char_t *new_psw = NULL;
+ int new_psw_len = 0;
+ int new_user_len = 0;
+ char new_user_admin[CONFIG_DEFAULT_LENGTH] = {0};
+ char new_psw_admin[CONFIG_DEFAULT_LENGTH] = {0};
+
+ tmp_new_psw = websGetVar(wp, T("newPassword"), NULL);
+ tmp_new_user = websGetVar(wp, T("newUserName"), NULL);
+
+ if (NULL == tmp_new_psw || NULL == tmp_new_user) {
+ return -1;
+ }
+
+ new_psw = (char*)zte_base64_decode((const unsigned char *)tmp_new_psw, strlen(tmp_new_psw), (unsigned int *)&new_psw_len);
+ if (NULL == new_psw) {
+ slog(MISC_PRINT, SLOG_ERR, "new_psw is NULL\n"); /*lint !e26*/
+ return -1;
+ }
+ new_user = (char*)zte_base64_decode((const unsigned char *)tmp_new_user, strlen(tmp_new_user), (unsigned int *)&new_user_len);
+
+ if (NULL == new_user) {
+ free(new_psw);
+ slog(MISC_PRINT, SLOG_ERR, "new_user is NULL\n"); /*lint !e26*/
+ return -1;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_mgmt_handle_account new_psw:%s!\n", new_psw);
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_mgmt_handle_account new_user:%s!\n", new_user);
+ if(new_psw_len < sizeof(new_psw_admin))
+ snprintf(new_psw_admin,new_psw_len+1,"%s",new_psw);
+ else
+ snprintf(new_psw_admin,sizeof(new_psw_admin),"%s",new_psw);
+ //strncpy(new_psw_admin, new_psw, CONFIG_DEFAULT_LENGTH-1);
+ if(new_user_len < sizeof(new_user_admin))
+ snprintf(new_user_admin,new_user_len+1,"%s",new_psw);
+ else
+ snprintf(new_user_admin,sizeof(new_user_admin),"%s",new_psw);
+ //strncpy(new_user_admin, new_user, CONFIG_DEFAULT_LENGTH-1);
+ free(new_psw);
+ free(new_user);
+
+ if (LOGIN_PSW_MIN_LEN > new_psw_len || LOGIN_PSW_MAX_LEN < new_psw_len) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_mgmt_handle_account new_psw_len is too long!\n");
+ sc_cfg_set("data_safe", "failed");
+ return -1;
+ }
+
+ if (LOGIN_PSW_MIN_LEN > new_user_len || LOGIN_PSW_MAX_LEN < new_user_len) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_mgmt_handle_account new_user_len is too long!\n");
+ sc_cfg_set("data_safe", "failed");
+ return -1;
+ }
+
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(new_psw_admin)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(new_user_admin)) {
+ slog(MISC_PRINT, SLOG_ERR,"zte_mgmt_handle_account Get Data is no Safe!\n");
+ sc_cfg_set("data_safe", "failed");
+ return -1;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User change account!\n"));
+
+ sc_cfg_set("admin_user", new_user_admin);
+ //sc_cfg_set("admin_Password", new_psw_admin);
+ web_set_pwd(new_psw_admin);
+ //sc_cfg_set("user_save", "");
+ sc_cfg_set("psw_save", "");
+ sc_cfg_set("save_login", "");
+ //sc_cfg_save();
+/*
+ char cmd[82] = {0};
+ sprintf(cmd, "mksmbpasswd.sh \'%s\'", new_psw_admin);
+ system(cmd);
+ system("killall smbd");
+ system("killall nmbd");
+ system("smbd -D");
+ system("nmbd -D");
+*/
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_mgmt_handle_account success!\n");
+ return 0;
+}
+
+void zte_mgmt_change_account(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL,"zte_mgmt_change_account ====================!\n");
+
+ if (0 != zte_mgmt_check_password(wp)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (0 != zte_mgmt_handle_account(wp)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+
+/******************************************************
+* Function: void zte_mgmt_pin_input(webs_t wp)
+* Description: deal with the pin code input goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_mgmt_pin_input(webs_t wp)
+{
+ char *pPinCode = NULL;
+ UINT32 length = 0;
+ T_zAt_CpinPukSet para = {0};
+ UINT32 ret = 0;
+ char modem_main_state[NV_ITEM_STRING_LEN_50] = {0};
+
+ pPinCode = websGetVar(wp, T("PinNumber"), T(""));
+ length = strlen(pPinCode);
+ if (0 == length || length >= sizeof(para.pin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ strncpy(para.pin, pPinCode,sizeof(para.pin)-1);
+ sc_cfg_set(NV_PIN_PUK_PROCESS, "begin");
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_VERIFY_PIN_REQ, sizeof(T_zAt_CpinPukSet), (UCHAR *)¶, 0);
+ if (0 != ret) {
+ sc_cfg_set(NV_PIN_PUK_PROCESS, "");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ wait_verify(NV_PIN_PUK_PROCESS, "end");
+
+ (void)sleep(1);
+ (void)zte_web_read(NV_MODEM_MAIN_STATE, modem_main_state);
+
+ if (0 != strcmp(modem_main_state, "modem_waitpin")) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ zte_write_result_to_web(wp, FAILURE);
+ }
+}
+/******************************************************
+* Function: void zte_mgmt_puk_input(webs_t wp)
+* Description: deal with the puk code input goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_mgmt_puk_input(webs_t wp)
+{
+ char *pPukCode = NULL;
+ char *pNewPin = NULL;
+ int length = 0;
+ int ret = 0;
+ T_zAt_CpinPukSet para = {0};
+ CHAR modem_main_state[NV_ITEM_STRING_LEN_50] = {0};
+
+ pPukCode = websGetVar(wp, T("PUKNumber"), T(""));
+ pNewPin = websGetVar(wp, T("PinNumber"), T(""));
+
+ length = strlen(pPukCode);
+ if (0 == length || length >= sizeof(para.pin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ length = strlen(pNewPin);
+ if (0 == length || length >= sizeof(para.newpin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ strncpy(para.pin, pPukCode,sizeof(para.pin)-1);
+ strncpy(para.newpin, pNewPin,sizeof(para.newpin)-1);
+ sc_cfg_set(NV_PIN_PUK_PROCESS, "begin");
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_VERIFY_PUK_REQ, sizeof(T_zAt_CpinPukSet), (UCHAR *)¶, 0);
+ if (0 != ret) {
+ sc_cfg_set(NV_PIN_PUK_PROCESS, "");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ wait_verify(NV_PIN_PUK_PROCESS, "end");
+
+ (void)sleep(1);
+ (void)zte_web_read("pinset_result", modem_main_state);
+
+ if (0 != strcmp(modem_main_state, "fail")) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ zte_write_result_to_web(wp, FAILURE);
+ }
+}
+
+void zte_mgmt_auto_pin(webs_t wp)
+{
+ char *pPinEable = NULL;
+ char *pPinCode = NULL;
+ int length = 0;
+
+ pPinEable = websGetVar(wp, T("auto_simpin"), T(""));
+ pPinCode = websGetVar(wp, T("auto_simpin_code"), T(""));
+
+ length = strlen(pPinCode);
+ if (0 == length || length > 8) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ length = strlen(pPinEable);
+ if (1 != length) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ sc_cfg_set("auto_simpin", pPinEable);
+ sc_cfg_set("auto_simpin_code", pPinCode);
+ zte_write_result_to_web(wp, SUCCESS);
+
+}
+/******************************************************
+* Function: void zte_mgmt_unlock_network(webs_t wp)
+* Description: deal with the unlock code input goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_mgmt_unlock_network(webs_t wp)
+{
+ char *unlock_code = NULL;
+ UNLOCK_PARA_ST para;
+ int length = 0;
+ int ret = 0;
+
+ memset(¶, 0, sizeof(UNLOCK_PARA_ST));
+
+ unlock_code = websGetVar(wp, T("unlock_network_code"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "unlock_code=%s", unlock_code); /*lint !e26*/
+ length = strlen(unlock_code);
+ if (0 == length || length >= sizeof(para.unlock_code)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ strncpy(para.unlock_code, unlock_code,sizeof(para.unlock_code)-1);
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_UNLOCK_REQ, sizeof(UNLOCK_PARA_ST), (UCHAR *)¶, 0);
+ if (0 != ret) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ wait_verify("unlock_at_wait", "0");
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+
+/*PINÂë½ûÓÃ*/
+void zte_mgmt_disable_pin(webs_t wp)
+{
+ char *pOldPin = NULL;
+ T_zAt_PinManage para = {0};
+ int length = 0;
+ int ret = 0;
+ char pin_manage_result[NV_ITEM_STRING_LEN_5] = {0};
+
+ pOldPin = websGetVar(wp, T("OldPinNumber"), T(""));
+ length = strlen(pOldPin);
+ if (0 == length || length >= sizeof(para.oldPin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ strncpy(para.oldPin, pOldPin,sizeof(para.oldPin)-1);
+ para.action = PIN_MANAGE_DISABLE;
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User disable pin!\n"));
+
+ (void)zte_web_write("pin_manage_process", "begin");
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_goform_mgmt_pin_mgmt_process send message: ZUFI_MODULE_ID_AT_MAIN, MSG_CMD_WEB_REQ_PIN_MANAGE");
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_PIN_MANAGE_REQ, sizeof(T_zAt_PinManage), (UCHAR *)¶, 0);
+ if (0 != ret) {
+ sc_cfg_set("pin_manage_process", "");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ /*ÉèÖõȴýpinÂë¹ÜÀí¶¯×÷AT´¦Àí½áÊø*/
+ wait_verify("pin_manage_process", "end");
+
+ (void)zte_web_read("pin_manage_result", pin_manage_result);
+ (void)zte_web_write("pin_manage_result", "");
+
+ if (0 == strcmp(pin_manage_result, "0")) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ zte_write_result_to_web(wp, FAILURE);
+ }
+}
+
+/*PINÂëÆôÓûòÐÞ¸Ä*/
+void zte_mgmt_pin_enable_or_modify(webs_t wp)
+{
+ CHAR *pOldPin = NULL;
+ CHAR *pNewPin = NULL;
+
+ if (NULL == wp) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ pOldPin = websGetVar(wp, T("OldPinNumber"), T(""));
+ pNewPin = websGetVar(wp, T("NewPinNumber"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG, "web para:[OldPinNumber] is [%s].", pOldPin);
+ slog(MISC_PRINT, SLOG_DEBUG, "web para:[NewPinNumber] is [%s].", pNewPin);
+
+ if ('\0' == (*pOldPin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (0 == strcmp(pNewPin, "")) {
+ zte_mgmt_enable_pin(wp, pOldPin);
+ } else {
+ zte_mgmt_modify_pin(wp, pOldPin, pNewPin);
+ }
+
+
+}
+static void zte_mgmt_enable_pin(webs_t wp, CHAR *pOldPin)
+{
+ T_zAt_PinManage para = {0};
+ int ret = 0;
+ char pin_manage_result[NV_ITEM_STRING_LEN_5] = {0};
+
+
+ if ((NULL == wp) || (NULL == pOldPin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ strncpy(para.oldPin, pOldPin,sizeof(para.oldPin)-1);
+ para.action = PIN_MANAGE_ENABLE;
+ if ('\0' == (*pOldPin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User enable pin!\n"));
+
+ (void)zte_web_write("pin_manage_process", "begin");
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_mgmt_enable_pin send message : ZUFI_MODULE_ID_AT_MAIN, MSG_CMD_WEB_REQ_PIN_MANAGE.");
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_PIN_MANAGE_REQ, sizeof(T_zAt_PinManage), (UCHAR *)¶, 0);
+ if (0 != ret) {
+ sc_cfg_set("pin_manage_process", "");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ /*ÉèÖõȴýpinÂë¹ÜÀí¶¯×÷AT´¦Àí½áÊø*/
+ wait_verify("pin_manage_process", "end");
+
+ (void)zte_web_read("pin_manage_result", pin_manage_result);
+ (void)zte_web_write("pin_manage_result", "");
+
+ if (0 == strcmp(pin_manage_result, "0")) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ zte_write_result_to_web(wp, FAILURE);
+ }
+}
+
+/**********************************************************************
+* Function: zte_mgmt_modify_pin
+* Description: to modify pin
+* Input: wp: the web para;old_pin: old pin number; new_pin:new pin number
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2011/11/16 V1.0 chenyi first version
+**********************************************************************/
+
+static void zte_mgmt_modify_pin(webs_t wp, CHAR *pOldPin, CHAR *pNewPin)
+{
+ int length = 0;
+ int ret = 0;
+ T_zAt_PinManage para = {0};
+ char pin_manage_result[NV_ITEM_STRING_LEN_5] = {0};
+
+ if ((NULL == wp) || (NULL == pOldPin) || (NULL == pNewPin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (('\0' == (*pOldPin)) || ('\0' == (*pNewPin))) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ length = strlen(pNewPin);
+ if (0 == length || length >= sizeof(para.newPin)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User modify pin!\n"));
+
+ para.action = PIN_MANAGE_MODIFY;
+ strncpy(para.oldPin, pOldPin,sizeof(para.oldPin)-1);
+ strncpy(para.newPin, pNewPin,sizeof(para.newPin)-1);
+ (void)zte_web_write("pin_manage_process", "begin");
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_mgmt_modify_pin send message : ZUFI_MODULE_ID_AT_MAIN, MSG_CMD_WEB_REQ_PIN_MANAGE.");
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_PIN_MANAGE_REQ, sizeof(T_zAt_PinManage), (UCHAR *)¶, 0);
+ if (0 != ret) {
+ sc_cfg_set("pin_manage_process", "");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ /*ÉèÖõȴýpinÂë¹ÜÀí¶¯×÷AT´¦Àí½áÊø*/
+ wait_verify("pin_manage_process", "end");
+
+
+ (void)zte_web_read("pin_manage_result", pin_manage_result);
+ (void)zte_web_write("pin_manage_result", "");
+
+ if (0 == strcmp(pin_manage_result, "0")) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ zte_write_result_to_web(wp, FAILURE);
+ }
+}
+/******************************************************
+* Function: void zte_quick_setup(webs_t wp)
+* Description: deal with the quick setup goform
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void zte_quick_setup(webs_t wp)
+{
+ int iFunc = 0;
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User quick setup!\n"));
+
+ for (iFunc = 0; iFunc < MAX_QUICK_SET_NUM; iFunc++) {
+ if (G_ZQUICK_SET[iFunc] != NULL) {
+ G_ZQUICK_SET[iFunc](wp);
+ }
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+int save_data_to_file(char *file_path, unsigned char *data, int len)
+{
+ int file_fd = -1;
+ int ret = -1;
+
+
+ if (NULL == file_path || NULL == data) {
+ slog(MISC_PRINT, SLOG_ERR,"Input para is invalid, null point!");
+ return -1;
+ }
+
+ // O_TRUNC:½«Îļþ³¤¶È½Ø¶ÏΪ0£¬×öΪÐÂÎļþдÈë
+ file_fd = open(file_path, O_RDWR | O_CREAT | O_TRUNC | O_SYNC, 777);
+ if (file_fd < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"Open file fail, error:%s, file path:%s", strerror(errno), file_path);
+ return -1;
+ }
+
+ ret = write(file_fd, (void *)data, len);
+ if (ret != len) {
+ slog(MISC_PRINT, SLOG_ERR,"Write data to file fail, error:%s, file path:%s", strerror(errno), file_path);
+ goto error;
+ }
+
+ ret = fsync(file_fd);
+ if (ret < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"Sync Failed:%s, file path:%s", strerror(errno), file_path);
+ goto error;
+ }
+
+
+ ret = 0;
+ goto end;
+
+error:
+ ret = -1;
+
+end:
+ close(file_fd);
+
+ file_fd = -1;
+
+ return ret;
+
+}
+
+/******************************************************
+* Function: void zte_goform_mgmt_sntp_process(webs_t wp)
+* Description: deal with the sntp
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2011/04/13 V1.0 mengyuan create
+*******************************************************/
+void zte_goform_mgmt_sntp_process(webs_t wp)
+{
+ MSG_BUF msg;
+ int lTgtMsgID = 0;
+ char *mode = NULL;
+ char *sntp_server0 = NULL;
+ char *sntp_server1 = NULL;
+ char *sntp_server2 = NULL;
+ char *sntp_timezone = NULL;
+ int result = 0;
+ LONG msgSize = sizeof(MSG_BUF) - sizeof(LONG);
+ char *ntp_server = NULL;
+ int sem_id = 0;
+ char state[NV_ITEM_STRING_LEN_20] = {0};
+ char sntp_timezone_tmp[NV_ITEM_STRING_LEN_64] = {0};
+ //char cmd[100] = {0};
+
+ memset(&msg, 1, sizeof(MSG_BUF));
+ mode = websGetVar(wp, T("manualsettime"), T(""));
+ sc_cfg_set("sntp_time_set_mode", mode);
+
+ sntp_server0 = websGetVar(wp, T("sntp_server1_ip"), T(""));
+ sntp_server1 = websGetVar(wp, T("sntp_server2_ip"), T(""));
+ sntp_server2 = websGetVar(wp, T("sntp_server3_ip"), T(""));
+ sc_cfg_set("sntp_server0", sntp_server0);
+ sc_cfg_set("sntp_server1", sntp_server1);
+ sc_cfg_set("sntp_server2", sntp_server2);
+
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User set sntp time!\n"));
+
+ if (strcmp(sntp_server0, "Other") == 0) {
+ sc_cfg_set("sntp_other_server0", websGetVar(wp, T("sntp_other_server0"), T("")));
+ }
+ if (strcmp(sntp_server1, "Other") == 0) {
+ sc_cfg_set("sntp_other_server1", websGetVar(wp, T("sntp_other_server1"), T("")));
+ }
+ if (strcmp(sntp_server2, "Other") == 0) {
+ sc_cfg_set("sntp_other_server2", websGetVar(wp, T("sntp_other_server2"), T("")));
+ }
+ sc_cfg_set("sntp_timezone_index", websGetVar(wp, T("sntp_timezone_index"), T("")));
+ //sc_cfg_set("sntp_timezone", websGetVar(wp, T("timezone"), T("")));
+ sc_cfg_set("sntp_dst_enable", websGetVar(wp, T("DaylightEnabled"), T("")));
+
+ sc_cfg_set("manual_time_year", websGetVar(wp, T("time_year"), T("")));
+ sc_cfg_set("manual_time_month", websGetVar(wp, T("time_month"), T("")));
+ sc_cfg_set("manual_time_day", websGetVar(wp, T("time_day"), T("")));
+ sc_cfg_set("manual_time_hour", websGetVar(wp, T("time_hour"), T("")));
+ sc_cfg_set("manual_time_minute", websGetVar(wp, T("time_minute"), T("")));
+ sc_cfg_set("manual_time_second", websGetVar(wp, T("time_second"), T("")));
+ //ÉèÖÃÊ±Çø
+ sntp_timezone = websGetVar(wp, T("timezone"), T(""));
+ sc_cfg_set("sntp_timezone", sntp_timezone);
+
+ //memset(cmd, 0, 100);
+ //sprintf(cmd, "echo \"%s\" > /etc_rw/TZ", sntp_timezone);
+ //system(cmd);
+ snprintf(sntp_timezone_tmp,sizeof(sntp_timezone_tmp),"%s\n",sntp_timezone);
+ save_data_to_file("/etc_rw/TZ",sntp_timezone_tmp,strlen(sntp_timezone_tmp));
+
+ if (strcmp(mode, "manual") == 0) {
+ sem_id = get_sem(TIME_SEM_KEY_1);
+ if (sem_id != -1) {
+ sem_p(sem_id);
+ slog(MISC_PRINT, SLOG_DEBUG,"[MANUAL] manual_set_time, sem_p, sem_id = %d\r\n", sem_id);
+ }
+
+ result = manual_set_time();
+
+ if (sem_id != -1) {
+ sem_v(sem_id);
+ slog(MISC_PRINT, SLOG_DEBUG,"[MANUAL] manual_set_time, sem_v, sem_id = %d\r\n", sem_id);
+ }
+
+ sc_cfg_set("sntp_year", websGetVar(wp, T("time_year"), T("")));
+ sc_cfg_set("sntp_month", websGetVar(wp, T("time_month"), T("")));
+ sc_cfg_set("sntp_day", websGetVar(wp, T("time_day"), T("")));
+ sc_cfg_set("sntp_hour", websGetVar(wp, T("time_hour"), T("")));
+ sc_cfg_set("sntp_minute", websGetVar(wp, T("time_minute"), T("")));
+ sc_cfg_set("sntp_second", websGetVar(wp, T("time_second"), T("")));
+ sc_cfg_set("sntp_process_result", "success");
+ if (result < 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ } else {
+ if (!zte_mgmt_login_timemark_set()) {
+ slog(MISC_PRINT, SLOG_ERR, "[ERROR]zte_goform_whitelist_check -> timemark set error .\n"); /*lint !e26*/
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+ }
+ } else if (strcmp(mode, "auto") == 0) {
+ sc_cfg_get("sntp_process_state", state, sizeof(state));
+ if (strcmp(state, "over") != 0) {
+ zte_write_result_to_web(wp, PROCESSING);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] already runing return \n");
+ return;
+ }
+ sc_cfg_set("sntp_process_state", "idle");
+ //sc_cfg_set("systime_mode", "auto");
+ //sc_cfg_set("sntp_cmd_from", "WEBUI");
+ sc_cfg_set("sntp_process_result", "");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SNTP, MSG_CMD_SNTP_START, 0, NULL, 0);
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ sem_id = get_sem(TIME_SEM_KEY_1);
+ if (sem_id != -1) {
+ sem_p(sem_id);
+ slog(MISC_PRINT, SLOG_DEBUG,"[MANUAL] manual_set_time, sem_p, sem_id = %d\r\n", sem_id);
+ }
+
+ result = manual_set_time();
+
+ if (sem_id != -1) {
+ sem_v(sem_id);
+ slog(MISC_PRINT, SLOG_DEBUG,"[MANUAL] manual_set_time, sem_v, sem_id = %d\r\n", sem_id);
+ }
+
+ sc_cfg_set("sntp_year", websGetVar(wp, T("time_year"), T("")));
+ sc_cfg_set("sntp_month", websGetVar(wp, T("time_month"), T("")));
+ sc_cfg_set("sntp_day", websGetVar(wp, T("time_day"), T("")));
+ sc_cfg_set("sntp_hour", websGetVar(wp, T("time_hour"), T("")));
+ sc_cfg_set("sntp_minute", websGetVar(wp, T("time_minute"), T("")));
+ sc_cfg_set("sntp_second", websGetVar(wp, T("time_second"), T("")));
+
+ if (result < 0) {
+ zte_write_result_to_web(wp, FAILURE);
+ } else {
+ if (!zte_mgmt_login_timemark_set()) {
+ slog(MISC_PRINT, SLOG_ERR, "[ERROR]zte_goform_whitelist_check -> timemark set error .\n"); /*lint !e26*/
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+ }
+ }
+}
+
+static void wait_verify(char *wait_name, char *wait_value)
+{
+ int i = 0;
+ char buf[NV_ITEM_STRING_LEN_200] = {0};
+
+ if (NULL == wait_name || NULL == wait_value) {
+ return;
+ }
+
+ for (i = 0; i < 10; i++) {
+ sleep(2);
+ sc_cfg_get(wait_name, buf, sizeof(buf));
+ if (0 == strcmp(wait_value, buf)) {
+ break;
+ }
+ }
+ return;
+}
+
+
+void deal_quick_setup_wifi_basic(webs_t wp)
+{
+ deal_quick_setup_wifi_basic_mgmt(wp);
+}
+static int deal_quick_setup_auto_apn_set()
+{
+ APN_PROFILE newProfile = { 0 };
+ char ppp_status[NV_ITEM_STRING_LEN_50] = {0};
+
+ get_autoapn_profile(&newProfile);
+ set_apn_to_cfg(&newProfile, NULL);
+ sc_cfg_set("ipv6_wan_apn", newProfile.apn_name);
+
+ sc_cfg_get("ppp_status", ppp_status, sizeof(ppp_status));
+ if (0 == strcmp("ppp_disconnected", ppp_status) || 0 == strcmp("ppp_ready", ppp_status)) {
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_APN_SET_REQ, 0, NULL, 0);
+ }
+ return 0;
+}
+static void set_apn_to_cfg(APN_PROFILE *apn_profile, IPV6_APN_PROFILE *ipv6_apn_profile)
+{
+ if (apn_profile != NULL) {
+ sc_cfg_set("m_profile_name", apn_profile->profile_name);
+ sc_cfg_set("wan_apn", apn_profile->apn_name);
+ sc_cfg_set("apn_select", apn_profile->apn_select);
+ sc_cfg_set("wan_dial", apn_profile->dial_num);
+ sc_cfg_set("ppp_auth_mode", apn_profile->ppp_auth_mode);
+ sc_cfg_set("ppp_username", apn_profile->ppp_username);
+ sc_cfg_set("ppp_passtmp", apn_profile->ppp_passwd);
+ sc_cfg_set("pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("ipv6_pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("pdp_select", apn_profile->pdp_select);
+ sc_cfg_set("pdp_addr", apn_profile->pdp_addr);
+ apn_encrypt_code();
+ }
+
+ if (ipv6_apn_profile != NULL) {
+ sc_cfg_set("m_profile_name", ipv6_apn_profile->profile_name);
+ sc_cfg_set("ipv6_wan_apn", ipv6_apn_profile->apn_name);
+ sc_cfg_set("apn_select", ipv6_apn_profile->apn_select);
+ sc_cfg_set("wan_dial", ipv6_apn_profile->dial_num);
+ sc_cfg_set(NV_IPV6_PPP_AUTH_MODE, ipv6_apn_profile->ppp_auth_mode);
+ sc_cfg_set("ipv6_ppp_username", ipv6_apn_profile->ppp_username);
+ sc_cfg_set("ipv6_ppp_passtmp", ipv6_apn_profile->ppp_passwd);
+ sc_cfg_set("pdp_type", ipv6_apn_profile->pdp_type);
+ sc_cfg_set("ipv6_pdp_type", ipv6_apn_profile->pdp_type);
+ sc_cfg_set("pdp_select", ipv6_apn_profile->pdp_select);
+ sc_cfg_set("pdp_addr", ipv6_apn_profile->pdp_addr);
+ ipv6apn_encrypt_code();
+ }
+}
+
+
+static void deal_quick_setup_manual_apn_set(webs_t wp)
+{
+ IPV6_APN_PROFILE newIpv6Profile = { 0 };
+ APN_PROFILE newProfile = { 0 };
+ int index_apn = atoi(websGetVar(wp, "index", T("")));
+ char *pdp_type = websGetVar(wp, "pdp_type", T(""));
+ char *apn_name = websGetVar(wp, "wan_apn", T(""));
+ char *ipv6_wan_apn = websGetVar(wp, "ipv6_wan_apn", T(""));
+ char ppp_status[NV_ITEM_STRING_LEN_50] = {0};
+ char *ppp_auth_mode = websGetVar(wp, "ppp_auth_mode", T(""));
+ char *ppp_username = websGetVar(wp, "ppp_username", T(""));
+ char *ppp_passwd = websGetVar(wp, "ppp_passtmp", T(""));
+ char *ipv6_pdp_auth_mode = websGetVar(wp, NV_IPV6_PPP_AUTH_MODE, T(""));
+ char *ipv6_ppp_username = websGetVar(wp, "ipv6_ppp_username", T(""));
+ char *ipv6_ppp_passwd = websGetVar(wp, "ipv6_ppp_passtmp", T(""));
+
+ slog(MISC_PRINT, SLOG_NORMAL,"[goahead] deal_quick_setup_manual_apn_set wan_apn %s. %s.\n", apn_name,ppp_username);
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User manual apn set!\n"));
+ if (0 == strcmp(pdp_type, "IPv6")) {
+ get_ipv6apn_profile_by_index(index_apn, &newIpv6Profile);
+ strncpy(newIpv6Profile.apn_name, ipv6_wan_apn,sizeof(newIpv6Profile.apn_name)-1);
+ strncpy(newIpv6Profile.ppp_auth_mode, ipv6_pdp_auth_mode,sizeof(newIpv6Profile.ppp_auth_mode)-1);
+ strncpy(newIpv6Profile.ppp_username, ipv6_ppp_username,sizeof(newIpv6Profile.ppp_username)-1);
+ strncpy(newIpv6Profile.ppp_passwd, ipv6_ppp_passwd,sizeof(newIpv6Profile.ppp_passwd)-1);
+ set_ipv6_apn_profile_by_index(index_apn, &newIpv6Profile);
+ set_ipv6_apn_prof_aes_by_index(index_apn, &newIpv6Profile);
+
+ set_apn_to_cfg(NULL, &newIpv6Profile);
+ } else if (0 == strcmp(pdp_type, "IPv4v6")) {
+ get_ipv4v6apn_profile_by_index(index_apn, &newProfile, &newIpv6Profile);
+ strncpy(newProfile.apn_name, apn_name,sizeof(newProfile.apn_name)-1);
+ strncpy(newProfile.ppp_auth_mode, ppp_auth_mode,sizeof(newProfile.ppp_auth_mode)-1);
+ strncpy(newProfile.ppp_username, ppp_username,sizeof(newProfile.ppp_username)-1);
+ strncpy(newProfile.ppp_passwd, ppp_passwd,sizeof(newProfile.ppp_passwd)-1);
+
+ strncpy(newIpv6Profile.apn_name, ipv6_wan_apn,sizeof(newIpv6Profile.apn_name)-1);
+ strncpy(newIpv6Profile.ppp_auth_mode, ipv6_pdp_auth_mode,sizeof(newIpv6Profile.ppp_auth_mode)-1);
+ strncpy(newIpv6Profile.ppp_username, ipv6_ppp_username,sizeof(newIpv6Profile.ppp_username)-1);
+ strncpy(newIpv6Profile.ppp_passwd, ipv6_ppp_passwd,sizeof(newIpv6Profile.ppp_passwd)-1);
+ set_ipv4v6_apn_profile_by_index(index_apn, &newProfile, &newIpv6Profile);
+ set_ipv4v6_apn_prof_aes_by_index(index_apn, &newProfile, &newIpv6Profile);
+
+ set_apn_to_cfg(&newProfile, &newIpv6Profile);
+ } else {
+ get_apn_profile_by_index(index_apn, &newProfile);
+ strncpy(newProfile.apn_name, apn_name,sizeof(newProfile.apn_name)-1);
+ strncpy(newProfile.ppp_auth_mode, ppp_auth_mode,sizeof(newProfile.ppp_auth_mode)-1);
+ strncpy(newProfile.ppp_username, ppp_username,sizeof(newProfile.ppp_username)-1);
+ strncpy(newProfile.ppp_passwd, ppp_passwd,sizeof(newProfile.ppp_passwd)-1);
+ set_apn_profile_by_index(index_apn, &newProfile);
+ set_apn_prof_aes_by_index(index_apn, &newProfile);
+
+ set_apn_to_cfg(&newProfile, NULL);
+ }
+
+ sc_cfg_get("ppp_status", ppp_status, sizeof(ppp_status));
+ if (0 == strcmp("ppp_disconnected", ppp_status) || 0 == strcmp("ppp_ready", ppp_status)) {
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_APN_SET_REQ, 0, NULL, 0);
+ }
+}
+
+void deal_quick_setup_apn_ex(webs_t wp)
+{
+ if (strcmp(ZTE_WEB_ACT_MANUAL, websGetVar(wp, "apn_mode", T(""))) == 0) {
+ zte_web_write("apn_mode", ZTE_WEB_ACT_MANUAL);
+ deal_quick_setup_manual_apn_set(wp);
+ } else {
+ zte_web_write("apn_mode", ZTE_WEB_ACT_AUTO);
+ deal_quick_setup_auto_apn_set(); // cov low, deal_quick_setup_auto_apn_set does not need parameter
+ }
+}
+
+void deal_quick_setup_wifi_security(webs_t wp)
+{
+ deal_quick_setup_wifi_security_mgmt(wp);
+}
+
+static void deal_quick_setup_wps(webs_t wp)
+{
+ deal_quick_setup_wps_mgmt(wp);
+}
+/******************************************************
+* Function: void get_apn_profile_by_index(int index, APN_PROFILE *profile)
+* Description: get a apn profile by index from config
+* Input: index:the index of apn profile which to get
+* Output: profile:the result of apn profile config after splited
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void get_apn_profile_by_index(int index, APN_PROFILE *profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+ char *pos_begin = NULL;
+
+ if (NULL == profile) {
+ return;
+ }
+ //È¡Ã÷ÎÄAPN_configtmp,Õâʱ²»ÓÃÈ¡ÃÜÎÄ
+ sprintf(cfg_name, "APN_configtmp%d", index);
+
+ sc_cfg_get(cfg_name, cfg_value, sizeof(cfg_value));
+ pos_begin = cfg_value;
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->profile_name, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->apn_name, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->apn_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->dial_num, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_auth_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_username, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_passwd, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_type, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_addr, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->dns_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->prefer_dns_manual, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->standby_dns_manual, PROFILE_MEMBER_LEN);
+ return;
+}
+
+void get_ipv6apn_profile_by_index(int index, IPV6_APN_PROFILE *profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+ char *pos_begin = NULL;
+
+ if (NULL == profile) {
+ return;
+ }
+
+ sprintf(cfg_name, "ipv6_APN_configtmp%d", index);
+
+ sc_cfg_get(cfg_name, cfg_value, sizeof(cfg_value));
+ slog(MISC_PRINT, SLOG_DEBUG, "get_ipv6apn_profile_by_index cfg_value=%s", cfg_value); /*lint !e26*/
+
+ pos_begin = cfg_value;
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->profile_name, PROFILE_MEMBER_LEN);
+ slog(MISC_PRINT, SLOG_DEBUG, "========= profile->profile_name=%s=======", profile->profile_name); /*lint !e26*/
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->apn_name, PROFILE_APN_LEN);
+ slog(MISC_PRINT, SLOG_DEBUG, "=========profile->apn_name=%s=======", profile->apn_name); /*lint !e26*/
+
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->apn_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->dial_num, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_auth_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_username, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_passwd, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_type, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_addr, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->dns_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->prefer_dns_manual, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->standby_dns_manual, PROFILE_MEMBER_LEN);
+ return;
+}
+
+
+void get_ipv4v6apn_profile_by_index(int index, APN_PROFILE *profile, IPV6_APN_PROFILE *ipv6profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+ char *pos_begin = NULL;
+
+ char ipv6_cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char ipv6_cfg_value[APNCONFIG_MEMORY] = {0};
+ char *ipv6_pos_begin = NULL;
+
+
+ if (NULL == profile) {
+ return;
+ }
+ if (NULL == ipv6profile) {
+ return;
+ }
+
+ sprintf(cfg_name, "APN_configtmp%d", index);
+ sc_cfg_get(cfg_name, cfg_value, sizeof(cfg_value));
+ pos_begin = cfg_value;
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->profile_name, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->apn_name, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->apn_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->dial_num, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_auth_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_username, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_passwd, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_type, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_addr, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->dns_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->prefer_dns_manual, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->standby_dns_manual, PROFILE_MEMBER_LEN);
+
+
+ sprintf(ipv6_cfg_name, "ipv6_APN_configtmp%d", index);
+ sc_cfg_get(ipv6_cfg_name, ipv6_cfg_value, sizeof(ipv6_cfg_value));
+ ipv6_pos_begin = ipv6_cfg_value;
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->profile_name, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->apn_name, PROFILE_APN_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->apn_select, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->dial_num, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->ppp_auth_mode, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->ppp_username, PROFILE_APN_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->ppp_passwd, PROFILE_APN_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->pdp_type, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->pdp_select, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->pdp_addr, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->dns_mode, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->prefer_dns_manual, PROFILE_MEMBER_LEN);
+ ipv6_pos_begin = split_str_by_sep(ipv6_pos_begin, "($)", ipv6profile->standby_dns_manual, PROFILE_MEMBER_LEN);
+
+
+ return;
+}
+
+
+
+void get_autoapn_profile(APN_PROFILE *profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+ char *pos_begin = NULL;
+ char buf[NV_ITEM_STRING_LEN_20] = {0};
+
+ int auto_apn_index = 0;
+ slog(MISC_PRINT, SLOG_DEBUG, "get_autoapn_profile\n"); /*lint !e26*/
+
+ sc_cfg_get("auto_apn_index", buf, sizeof(buf));
+ auto_apn_index = atoi(buf);
+ slog(MISC_PRINT, SLOG_DEBUG, "auto_apn_index=%d\n", auto_apn_index); /*lint !e26*/
+ if (NULL == profile) {
+ return;
+ }
+
+ if (0 != auto_apn_index) {
+ sprintf(cfg_name, "apn_auto_config%d", auto_apn_index);
+ } else {
+ sprintf(cfg_name, "apn_auto_config");
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "cfg_name=%s\n", cfg_name); /*lint !e26*/
+
+ sc_cfg_get(cfg_name, cfg_value, sizeof(cfg_value));
+ pos_begin = cfg_value;
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->profile_name, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->apn_name, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->apn_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->dial_num, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_auth_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_username, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->ppp_passwd, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_type, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->pdp_addr, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->dns_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->prefer_dns_manual, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile->standby_dns_manual, PROFILE_MEMBER_LEN);
+ return;
+}
+
+/******************************************************
+* Function: void set_apn_profile_by_index(int index, APN_PROFILE *profile)
+* Description: set a apn profile into config by index
+* Input: index:the index of apn profile which to set
+* profile:the struct of apn profile.
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+* 2010/11/26 V1.0 zyt create
+*******************************************************/
+void set_apn_profile_by_index(int index, APN_PROFILE *profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+
+ if (NULL == profile) {
+ return;
+ }
+
+ sprintf(cfg_name, "APN_configtmp%d", index);
+ if (0 == strcmp(profile->pdp_type, "IPv6")) {
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "");
+ } else {
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ profile->apn_name,
+ profile->apn_select,
+ profile->dial_num,
+ profile->ppp_auth_mode,
+ profile->ppp_username,
+ profile->ppp_passwd,
+ profile->pdp_type,
+ profile->pdp_select,
+ profile->pdp_addr,
+ profile->dns_mode,
+ profile->prefer_dns_manual,
+ profile->standby_dns_manual);
+ }
+ sc_cfg_set(cfg_name, cfg_value);
+
+ return;
+}
+
+void set_ipv6_apn_profile_by_index(int index, IPV6_APN_PROFILE *profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+
+ if (NULL == profile) {
+ return;
+ }
+
+ sprintf(cfg_name, "ipv6_APN_configtmp%d", index);
+ if (0 == strcmp(profile->pdp_type, "IP")) {
+ slog(MISC_PRINT, SLOG_DEBUG, "pdp_type=IP cpsnprintf "); /*lint !e26*/
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "");
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "pdp_type=else cpsnprintf "); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "profile->profile_name=%s ", profile->profile_name); /*lint !e26*/
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ profile->apn_name,
+ profile->apn_select,
+ profile->dial_num,
+ profile->ppp_auth_mode,
+ profile->ppp_username,
+ profile->ppp_passwd,
+ profile->pdp_type,
+ profile->pdp_select,
+ profile->pdp_addr,
+ profile->dns_mode,
+ profile->prefer_dns_manual,
+ profile->standby_dns_manual);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "cfg_value=%s", cfg_value); /*lint !e26*/
+ sc_cfg_set(cfg_name, cfg_value);
+
+ return;
+}
+
+void set_ipv4v6_apn_profile_by_index(int index, APN_PROFILE *profile, IPV6_APN_PROFILE *ipv6profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+
+ if (NULL == profile) {
+ return;
+ }
+
+ sprintf(cfg_name, "APN_configtmp%d", index);
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ profile->apn_name,
+ profile->apn_select,
+ profile->dial_num,
+ profile->ppp_auth_mode,
+ profile->ppp_username,
+ profile->ppp_passwd,
+ profile->pdp_type,
+ profile->pdp_select,
+ profile->pdp_addr,
+ profile->dns_mode,
+ profile->prefer_dns_manual,
+ profile->standby_dns_manual);
+
+ sc_cfg_set(cfg_name, cfg_value);
+
+ memset(cfg_name, 0, sizeof(cfg_name));
+ memset(cfg_value, 0, sizeof(cfg_value));
+ sprintf(cfg_name, "ipv6_APN_configtmp%d", index);
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ ipv6profile->profile_name,
+ ipv6profile->apn_name,
+ ipv6profile->apn_select,
+ ipv6profile->dial_num,
+ ipv6profile->ppp_auth_mode,
+ ipv6profile->ppp_username,
+ ipv6profile->ppp_passwd,
+ ipv6profile->pdp_type,
+ ipv6profile->pdp_select,
+ ipv6profile->pdp_addr,
+ ipv6profile->dns_mode,
+ ipv6profile->prefer_dns_manual,
+ ipv6profile->standby_dns_manual);
+
+ sc_cfg_set(cfg_name, cfg_value);
+
+ return;
+}
+
+static char *split_str_by_sep(char *src, char *sep, char *dst, int len)
+{
+ char *pos_begin = NULL;
+ char *pos_end = NULL;
+
+ if (NULL == src || NULL == sep || NULL == dst || 0 == len) {
+ return NULL;
+ }
+
+ pos_begin = src;
+ pos_end = strstr(pos_begin, sep);
+
+ if (NULL == pos_end) {
+ return NULL;
+ }
+
+ if (len <= (pos_end - pos_begin)) {
+ return NULL;
+ }
+
+ strncpy(dst, pos_begin, pos_end - pos_begin);
+ pos_end += strlen(sep);
+ return pos_end;
+}
+
+void zte_mgmt_set_login_timemark()
+{
+ char login_timemark[NV_ITEM_STRING_LEN_20] = {0};
+ long now_timemark = time(0);
+
+ sprintf(login_timemark, "%ld", now_timemark);
+ zte_web_write(NV_USER_LOGIN_TIMEMARK, login_timemark);
+ slog(MISC_PRINT, SLOG_NORMAL,"[SNTP] [manual] timemark, user_login_timemark=%ld\n", now_timemark);
+}
+
+int manual_set_time()
+{
+ struct timeval tp;
+ time_t nowtime;
+ time_t SynBeforeTime = 0;
+ int ltime = 0, mtime = 0, ntime = 0;
+ char SynSystemTotal[16] = {0};
+ char SynPppTotal[16] = {0};
+ char SynSecond[16] = {0};
+ int year = 0, month = 0, day = 0;
+ int hour = 0, minute = 0, second = 0;
+ int days = 0;
+ int LeapYear = 0;
+ int CommonYear = 0;
+ int YearTotal = 0;
+ int count;
+ int flag = 0;
+ int i;
+ int ret = 0;
+ char buf[NV_ITEM_STRING_LEN_10] = {0};
+ char ppp_status[NV_ITEM_STRING_LEN_50] = {0};
+ struct tm timeToSet = {0};
+ int dataLen = 0;
+ sc_cfg_get("manual_time_year", buf, sizeof(buf));
+ year = atoi(buf);
+ if(year < 1970 || year > 2100)//for kw
+ {
+ return -1;
+ }
+
+ memset(&buf, 0, sizeof(buf));
+ sc_cfg_get("manual_time_month", buf, sizeof(buf));
+ month = atoi(buf);
+ if(month<1 || month>12)
+ {
+ month = 1;
+ }
+
+ memset(&buf, 0, sizeof(buf));
+ sc_cfg_get("manual_time_day", buf, sizeof(buf));
+ day = atoi(buf);
+ if(day<1 || day>31)
+ {
+ day = 1;
+ }
+
+ memset(&buf, 0, sizeof(buf));
+ sc_cfg_get("manual_time_hour", buf, sizeof(buf));
+ hour = atoi(buf);
+ if(hour<0 || hour>24)
+ {
+ hour = 0;
+ }
+
+ memset(&buf, 0, sizeof(buf));
+ sc_cfg_get("manual_time_minute", buf, sizeof(buf));
+ minute = atoi(buf);
+ if(minute<0 || minute>60)
+ {
+ minute = 0;
+ }
+
+ memset(&buf, 0, sizeof(buf));
+ sc_cfg_get("manual_time_second", buf, sizeof(buf));
+ second = atoi(buf);
+ if(second<0 || second>60)
+ {
+ second = 0;
+ }
+
+ YearTotal = year - 1970;
+ for (count = 0; count < YearTotal; count++) {
+ i = 1971 + count;
+ if (i % 4 == 0 && i % 100 != 0) {
+ if (YearTotal == count + 1) {
+ CommonYear++;
+ } else {
+ LeapYear++;
+ }
+ continue;
+ } else if (i % 400 == 0) {
+ if (YearTotal == count + 1) {
+ CommonYear++;
+ } else {
+ LeapYear++;
+ }
+ continue;
+ } else {
+ CommonYear++;
+ }
+ }
+
+ /****************flag==1±íʾµ±ÄêΪÈòÄê*************************/
+ if (year % 4 == 0 && year % 100 != 0) {
+ flag = 1;
+ } else if (year % 400 == 0) {
+ flag = 1;
+ } else {
+ flag = 0;
+ }
+
+ switch (month - 1) {
+ case 0:
+ days = day;
+ break;
+ case 1:
+ days = 31 + day;
+ break;
+ case 2:
+ days = 31 + 28 + day;
+ break;
+ case 3:
+ days = 31 + 28 + 31 + day;
+ break;
+ case 4:
+ days = 31 + 28 + 31 + 30 + day;
+ break;
+ case 5:
+ days = 31 + 28 + 31 + 30 + 31 + day;
+ break;
+ case 6:
+ days = 31 + 28 + 31 + 30 + 31 + 30 + day;
+ break;
+ case 7:
+ days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + day;
+ break;
+ case 8:
+ days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + day;
+ break;
+ case 9:
+ days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day;
+ break;
+ case 10:
+ days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day;
+ break;
+ case 11:
+ days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day;
+ break;
+ }
+ if ((month - 1) >= 2 && 1 == flag) {
+ days++;
+ }
+
+
+ nowtime = COMMONYEARSEC * CommonYear + LEAPYEARSEC * LeapYear + (days - 1) * DAYSEC + hour * 3600 + minute * 60 + second;
+ tp.tv_usec = 0;
+ tp.tv_sec = nowtime;
+
+ time(&SynBeforeTime);
+ slog(MISC_PRINT, SLOG_DEBUG, "Now time is %d", SynBeforeTime); /*lint !e26*/
+
+ sc_cfg_get("syn_after_time", SynSecond, sizeof(SynSecond));
+ sscanf(SynSecond, "%d", <ime);
+ if(ltime < 0 || ltime > INT_MAX-1) // kw 3
+ {
+ ltime = 0;
+ }
+
+ sc_cfg_get("syn_system_total", SynSystemTotal, sizeof(SynSystemTotal));
+
+ sscanf(SynSystemTotal, "%d", &mtime);
+ if(mtime < 0 || mtime > INT_MAX-1) // kw 3
+ {
+ mtime = 0;
+ }
+
+ if (0 != mtime) {
+ mtime += (SynBeforeTime - ltime);
+ } else {
+ mtime = (SynBeforeTime - JAN_2000);
+ }
+ sprintf(SynSystemTotal, "%d", mtime);
+ sc_cfg_set("syn_system_total", SynSystemTotal);
+
+ sc_cfg_get("ppp_status", ppp_status, sizeof(ppp_status));
+ if ((0 == strcmp(ppp_status, "ppp_connected")) || (0 == strcmp(ppp_status, "ipv6_connected")) || (0 == strcmp(ppp_status, "ipv4_ipv6_connected"))) {
+ sc_cfg_get("syn_ppp_total", SynPppTotal, sizeof(SynPppTotal));
+
+ sscanf(SynPppTotal, "%d", &mtime);
+ if(mtime < 0 || mtime > INT_MAX-1) // kw 3
+ {
+ mtime = 0;
+ }
+ if (0 != mtime) {
+ mtime += (SynBeforeTime - ltime);
+ } else {
+ memset(&SynSecond, 0, sizeof(SynSecond));
+ sc_cfg_get("ppp_start_time", SynSecond, sizeof(SynSecond));
+
+ sscanf(SynSecond, "%d", &ntime);
+ if(ntime < 0 || ntime > INT_MAX-1) // kw 3
+ {
+ ntime = 0;
+ }
+
+ mtime = SynBeforeTime - ntime;
+ }
+ sprintf(SynPppTotal, "%d", mtime);
+ sc_cfg_set("syn_ppp_total", SynPppTotal);
+ sc_cfg_set("syn_order_flag", "ppp_on");
+ } else {
+ sc_cfg_set("syn_order_flag", "ppp_off");
+ sc_cfg_set("syn_ppp_total", "0");
+ }
+
+ timeToSet.tm_year = year-1900;
+ timeToSet.tm_mon = month-1;
+ timeToSet.tm_mday = day;
+ timeToSet.tm_hour = hour;
+ timeToSet.tm_min = minute;
+ timeToSet.tm_sec = second;
+ dataLen = sizeof(struct tm);
+ slog(MISC_PRINT, SLOG_DEBUG, "SetTime:year:%d, mon:%d, day:%d, hour:%d, min:%d, sec:%d \n",
+ timeToSet.tm_year, timeToSet.tm_mon, timeToSet.tm_mday,
+ timeToSet.tm_hour, timeToSet.tm_min, timeToSet.tm_sec );
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SNTP, MSG_CMD_SNTP_SET_TIME,
+ dataLen, &timeToSet, 0);
+ if (0 != ret) {
+ slog(MISC_PRINT, SLOG_ERR, "send MSG_CMD_SNTP_SET_TIME to sntp fail!");
+ }
+
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_SYCTIME_SET_REQ, 0, NULL, 0);
+ if (0 != ret) {
+ slog(MISC_PRINT, SLOG_ERR, "sync time to cp fail!");
+ }
+
+ memset(&buf, 0, sizeof(buf));
+ sc_cfg_get("outdate_delete", buf, sizeof(buf));
+ if (0 == strcmp(buf, "1")) {
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SMS, MSG_CMD_SMS_OUTDATE_CHECK, 0, NULL, 0);
+ }
+
+ sprintf(SynSecond, "%d", (int)(time((time_t *)NULL)));
+ sc_cfg_set("syn_after_time", SynSecond);
+ //sc_cfg_set("systime_mode", "manual");
+ sc_cfg_set("need_clear_traffic_data", "yes");
+ zte_mgmt_set_login_timemark();
+ return 0;
+}
+char * timei2s(int itime)
+{
+ static char buf[64];
+ int hours, min, sec;
+ memset(buf, 0, 64);
+
+ hours = itime / 3600;
+ min = (itime / 60) % 60;
+ sec = itime % 60;
+
+ sprintf(buf, "%d:%02d:%02d", hours, min, sec);
+ return buf ;
+}
+void timeen2ch(char *time)
+{
+ char timetmp[128] = {0};
+ char year[5] = {0};
+ char month[4] = {0};
+ char day[3] = {0};
+ char weekday[4] = {0};
+ char nowtime[16] = {0};
+ char hour[4] = {0};
+ char second[4] = {0};
+ char minute[4] = {0};
+ //int imonth;
+ char imonth[4] = {0};
+ strncpy(timetmp, time,sizeof(timetmp)-1);
+ char *loc = timetmp;
+ char *tmp = NULL;
+ memset(time, 0, 128);
+ char str_buf[10] = {0};
+ int temp;
+ int month_temp;
+
+ while (*loc == ' ') {
+ loc++;
+ }
+ tmp = strtok(loc, " ");
+ if(tmp == NULL) return;
+ strncpy(weekday, tmp, sizeof(weekday)-1);
+ tmp = strtok(NULL, " ");
+ if(tmp == NULL) return;
+ strncpy(month, tmp, sizeof(month)-1);
+ tmp = strtok(NULL, " ");
+ if(tmp == NULL) return;
+ strncpy(day, tmp, sizeof(day)-1);
+ slog(MISC_PRINT, SLOG_DEBUG, "strlen(tmp)=%d", strlen(tmp)); /*lint !e26*/
+ if (strlen(tmp) == 1) {
+ temp = atoi(tmp);
+ slog(MISC_PRINT, SLOG_DEBUG, "====temp=%d", temp); /*lint !e26*/
+ if(temp < 10 && temp > 0)
+ snprintf(day,sizeof(day), "0%d", temp);
+ slog(MISC_PRINT, SLOG_DEBUG, "====day=%s", day); /*lint !e26*/
+ } else {
+ strncpy(day, tmp,sizeof(day)-1);
+ }
+ tmp = strtok(NULL, " ");
+ if(tmp == NULL) return;
+ strncpy(nowtime, tmp, sizeof(nowtime)-1);
+ tmp = strtok(NULL, " ");
+ if(tmp == NULL) return;
+ strncpy(year, tmp, sizeof(year)-1);
+ if (0 == strcmp("Jan", month)) {
+ strncpy(imonth, "01", sizeof(imonth)-1);
+ } else if (0 == strcmp("Feb", month)) {
+ strncpy(imonth, "02", sizeof(imonth)-1);
+ } else if (0 == strcmp("Mar", month)) {
+ strncpy(imonth, "03", sizeof(imonth)-1);
+ } else if (0 == strcmp("Apr", month)) {
+ strncpy(imonth, "04", sizeof(imonth)-1);
+ } else if (0 == strcmp("May", month)) {
+ strncpy(imonth, "05", sizeof(imonth)-1);
+ } else if (0 == strcmp("Jun", month)) {
+ strncpy(imonth, "06", sizeof(imonth)-1);
+ } else if (0 == strcmp("Jul", month)) {
+ strncpy(imonth, "07", sizeof(imonth)-1);
+ } else if (0 == strcmp("Aug", month)) {
+ strncpy(imonth, "08", sizeof(imonth)-1);
+ } else if (0 == strcmp("Sep", month)) {
+ strncpy(imonth, "09", sizeof(imonth)-1);
+ } else if (0 == strcmp("Oct", month)) {
+ strncpy(imonth, "10", sizeof(imonth)-1);
+ } else if (0 == strcmp("Nov", month)) {
+ strncpy(imonth, "11", sizeof(imonth)-1);
+ } else if (0 == strcmp("Dec", month)) {
+ strncpy(imonth, "12", sizeof(imonth)-1);
+ }
+ sprintf(time, "%s-%s-%s %s", year, imonth, day, nowtime);
+ slog(MISC_PRINT, SLOG_DEBUG, "====nowtime=%s", nowtime); /*lint !e26*/
+
+
+ tmp = strtok(nowtime, ":");
+ if(tmp == NULL) return;
+ strncpy(hour, tmp,sizeof(hour)-1);
+ slog(MISC_PRINT, SLOG_DEBUG, "====hour=%s", hour); /*lint !e26*/
+ tmp = strtok(NULL, ":");
+ if(tmp == NULL) return;
+ strncpy(minute, tmp,sizeof(minute)-1);
+ slog(MISC_PRINT, SLOG_DEBUG, "====minute=%s", minute); /*lint !e26*/
+ tmp = strtok(NULL, ":");
+ if(tmp == NULL) return;
+ strncpy(second, tmp,sizeof(second)-1);
+ slog(MISC_PRINT, SLOG_DEBUG, "====second=%s", second); /*lint !e26*/
+ sc_cfg_set("sntp_hour", hour);
+ sc_cfg_set("sntp_minute", minute);
+ sc_cfg_set("sntp_second", second);
+
+ sc_cfg_set("sntp_year", year);
+ sc_cfg_set("sntp_month", imonth);
+ sc_cfg_set("sntp_day", day);
+}
+void datastatic(char *rec, char *send, char *onlinetime, char *runtime, char *localtime)
+{
+ char Receive_Amount[20] = {0};
+ char Transmit_Amount[20] = {0};
+ char syn_system_total[20] = {0};
+ char syn_after_time[20] = {0};
+ char syn_ppp_total[20] = {0};
+ char ppp_start_time[20] = {0};
+ char timestr[128] = {0};
+ int mtime;
+ int ltime;
+ int ntime;
+ int otime;
+ time_t timenow;
+ char ppp_status[NV_ITEM_STRING_LEN_50] = {0};
+ char buf[NV_ITEM_STRING_LEN_20] = {0};
+
+ sc_cfg_get("syn_system_total", syn_system_total, sizeof(syn_system_total));
+
+ sscanf(syn_system_total, "%d", <ime);
+ if(ltime < 0 || ltime > INT_MAX-1) // kw 3
+ {
+ ltime = 0;
+ }
+ sc_cfg_get("syn_after_time", syn_after_time, sizeof(syn_after_time));
+
+ sscanf(syn_after_time, "%d", &ntime);
+ if(ntime < 0 || ntime > INT_MAX-1) // kw 3
+ {
+ ntime = 0;
+ }
+ sc_cfg_get("ppp_start_time", ppp_start_time, sizeof(ppp_start_time));
+
+ sscanf(ppp_start_time, "%d", &otime);
+ if(otime < 0 || otime > INT_MAX-1) // kw 3
+ {
+ otime = 0;
+ }
+
+ sc_cfg_get("ppp_status", ppp_status, sizeof(ppp_status));
+ if ((0 != strcmp(ppp_status, "ppp_connected")) && (0 != strcmp(ppp_status, "ipv6_connected")) && (0 != strcmp(ppp_status, "ipv4_ipv6_connected"))) {
+ sc_cfg_set("syn_ppp_total", "0");
+ }
+
+ sc_cfg_get("syn_ppp_total", syn_ppp_total, sizeof(syn_ppp_total));
+
+ sscanf(syn_ppp_total, "%d", &mtime);
+ if(mtime < 0 || mtime > INT_MAX-1) // kw 3
+ {
+ mtime = 0;
+ }
+
+ time(&timenow);
+ if (ntime == 0) {
+ strncpy(onlinetime, timei2s(timenow - otime), 63);
+ strncpy(runtime, timei2s(timenow - JAN_2000), 63);
+ } else {
+ sc_cfg_get("syn_order_flag", buf, sizeof(buf));
+ if (0 == strcmp(buf, "ppp_on")) {
+ strncpy(onlinetime, timei2s(timenow - ntime + mtime), 63);
+ } else {
+ strncpy(onlinetime, timei2s(timenow - otime), 63);
+ }
+ strncpy(runtime, timei2s(timenow - ntime + ltime), 63);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "----runtime=%s", runtime); /*lint !e26*/
+ strncpy(timestr, ctime(&timenow),sizeof(timestr)-1);
+ slog(MISC_PRINT, SLOG_DEBUG, "----timestr=%s", timestr); /*lint !e26*/
+ timeen2ch(timestr);
+ strncpy(localtime, timestr,sizeof(localtime)-1);
+ slog(MISC_PRINT, SLOG_DEBUG, "----localtime=%s", localtime); /*lint !e26*/
+
+}
+
+void zte_goform_sntp_getdatastatic_process(webs_t wp)
+{
+ char receive[30], send[30], onlinetime[64], runtime[64], localtime[128];
+
+ memset(receive, 0, 30);
+ memset(send, 0, 30);
+ memset(onlinetime, 0, 64);
+ memset(runtime, 0, 64);
+ memset(localtime, 0, 128);
+
+ datastatic(receive, send, onlinetime, runtime, localtime);
+
+ websWrite(wp, T("{\"receive\":\"%s\",\"send\":\"%s\",\"onlinetime\":\"%s\",\"runtime\":\"%s\",\"localtime\":\"%s\"}"), receive, send, onlinetime, runtime, localtime);
+}
+
+
+typedef struct LOG_FILES {
+ char filename[64];
+} LOG_FILES;
+
+int start_diaglog()
+{
+ int ret = 0;
+ slog(MISC_PRINT, SLOG_NORMAL, "start_diaglog"); /*lint !e26*/
+ system("/sbin/diaglog &");
+ return ret;
+}
+
+int stop_diaglog()
+{
+ int ret = 0;
+ slog(MISC_PRINT, SLOG_NORMAL, "get killall SIGINT"); /*lint !e26*/
+ system("killall -9 diaglog");//SIGINT=2
+ return ret;
+}
+#if 0
+int del_diaglog(char *fllename)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, "del log name=%s", fllename); /*lint !e26*/
+ int ret = 0;
+ char cmd[128];
+ sprintf(cmd, "rm %s", fllename);
+ system(cmd);
+ return ret;
+}
+#endif
+
+int getDiaglogFile(LOG_FILES *files, int n_files)
+{
+ char ext[] = ".dlf";
+ int i = 0;
+
+ DIR *dp;
+ struct dirent *entry;
+
+ dp = opendir(DIAGLOG_DATA_PATH);
+ if (dp == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "dp==NULL");
+ return 0;
+ }
+
+ i = 0;
+ while ((entry = readdir(dp)) != NULL && (i < n_files)) {
+ {
+ int len = strlen(entry->d_name);
+ if ((len > strlen(ext)) && !strcmp(entry->d_name + len - strlen(ext), ext)) { //*.dlf *.zm
+ strncpy(files[i].filename, entry->d_name, sizeof(files[i].filename)-1);
+ slog(MISC_PRINT, SLOG_DEBUG, "entry->d_name=%s", entry->d_name);
+ i++;
+ }
+ }
+ }
+ closedir(dp);
+
+ return i;
+
+}
+
+
+void getdialog_url(int eid, webs_t wp, int argc, char_t **argv)
+{
+ char filename[128] = {0};
+ LOG_FILES files[10];
+ int n, i;
+ char *p = filename;
+ n = getDiaglogFile(files, 10);
+ i = 0;
+ if (n > 0) {
+ while (i < n) {
+ slog(MISC_PRINT, SLOG_DEBUG, "i=%d", i); /*lint !e26*/
+ strcpy(p, files[i].filename);
+ p += strlen(files[i].filename);
+ *p = ';';
+ p++;
+ slog(MISC_PRINT, SLOG_DEBUG, "filename=%s", files[i].filename); /*lint !e26*/
+ i++;
+ }
+ websWrite(wp, T(filename));
+ } else {
+ websWrite(wp, T(""));
+ }
+}
+
+/******************************************************
+* Function: zte_fota_get_upgrade_result
+* Description: get fota upgrade result
+* Input: http request info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2013/03/14 V1.0 chenyi create
+*******************************************************/
+void zte_fota_get_upgrade_result(webs_t wp)
+{
+ zte_topsw_state_e_type nv_result = ZTE_NVIO_MAX;
+
+ char nv_upgrade_result[NV_ITEM_STRING_LEN_50] = {0};
+
+ nv_result = zte_web_read(NV_FOTA_UPGRADE_RESULT, nv_upgrade_result);
+ if (ZTE_NVIO_DONE != nv_result) {
+ slog(MISC_PRINT, SLOG_ERR,"read nv [%s] fail.\n", NV_FOTA_UPGRADE_RESULT);
+ }
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"%s\":\"%s\"}"), FOTA_UPGRADE_RESULT, nv_upgrade_result);
+
+ if ((0 == strcmp("success", nv_upgrade_result)) || (0 == strcmp("fail", nv_upgrade_result))) {
+ (void)zte_web_write(NV_FOTA_UPGRADE_RESULT, ""); //reset
+
+ // ÖØÖÃNVºó±£´æ¸ÃNV²ÎÊý£¬±ÜÃâÒò¿ìËÙÖØÆô£¬NVÐÂֵδ±£´æµ¼Öµĸüнá¹ûÖØ¸´Éϱ¨ÎÊÌâ
+ //sc_cfg_save();
+ slog(MISC_PRINT, SLOG_ERR,"reset nv [%s]. nv_upgrade_result:%s\n", NV_FOTA_UPGRADE_RESULT, nv_upgrade_result);
+ }
+}
+
+#if 0
+/******************************************************
+* Function: zte_fota_get_dp_pack_info
+* Description: get fota dp info
+* Input: http request info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2013/01/06 V1.0 chenyi create
+*******************************************************/
+void zte_fota_get_dp_pack_info(webs_t wp)
+{
+ char dp_total_size[NV_ITEM_STRING_LEN_50] = {0};
+ char dp_download_size[NV_ITEM_STRING_LEN_50] = {0};
+
+ //get dp pack info
+ (void)zte_web_read(NV_FOTA_PKG_TOTAL_SIZE, dp_total_size);
+ (void)zte_web_read(NV_FOTA_PKG_DL_SIZE, dp_download_size);
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%s\"}"), \
+ NV_FOTA_PKG_TOTAL_SIZE, dp_total_size, NV_FOTA_PKG_DL_SIZE, dp_download_size);
+}
+#endif
+/**********************************************************************
+* Function: zte_fota_update
+* Description: send msg to fota update module
+* Input: wp:the web para;
+* Output:
+* Return:
+* Others: add from uFi
+* Modify Date Version Author Modification
+* -----------------------------------------------
+*
+**********************************************************************/
+int zte_fota_SendMsg2DM(int cmd)
+{
+ slog(MISC_PRINT, SLOG_NORMAL,"goahead send cmd=%d to fota\n", cmd);
+ return ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_DM_WEBUI_AT, cmd, 0, NULL, 0);
+}
+
+void zte_fota_update(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User check new version!\n"));
+ char *update_action = NULL;
+ zte_topsw_state_e_type nv_result = ZTE_NVIO_MAX;
+ char new_version_state[NV_ITEM_STRING_LEN_150] = {0};
+ BOOL new_state_version_check = FALSE;
+ int iDlPara = -1;
+
+ if (NULL == wp) {
+ return;
+ }
+
+ update_action = websGetVar(wp, T("select_op"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG,"websGetVar FOTA upgrade action[%s].\n", update_action);
+
+ if ('\0' == *update_action) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+
+ //ÓëdeviceUiµÄ»¥³â±£»¤´¦Àí
+ zte_web_read(NV_FOTA_NEW_VERSION_STATE, new_version_state);
+
+ if ((0 == strcmp(update_action, FOTA_ACTION_CONFIRM_DOWNLOAD)) || (0 == strcmp(update_action, FOTA_ACTION_CANCEL_DOWNLOAD))) {
+ if ((0 == strcmp(new_version_state, HAS_OPTIONAL)) || (0 == strcmp(new_version_state, HAS_CRITICAL))) {
+ new_state_version_check = TRUE;
+ }
+ if (!new_state_version_check) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ }
+
+ if (0 == strcmp(update_action, FOTA_ACTION_CONFIRM_DOWNLOAD)) {
+ zte_web_write(NV_FOTA_UPGRADE_SELECTOR, "accept");
+ //zte_web_write(NV_FOTA_NEED_USER_CONFIRM,"0");
+ slog(MISC_PRINT, SLOG_DEBUG,"web :zte_fota_update. update_action = FOTA_ACTION_CONFIRM_DOWNLOAD, set NV_FOTA_UPGRADE_SELECTOR accept!\n");
+ //zte_fota_SendMsg2DM(MSG_CMD_FOTA_WEBUI_START_DOWNLOAD);
+ //ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_DM_WEBUI_AT,MSG_CMD_FOTA_WEBUI_START_DOWNLOAD, 2, "1", 0);
+ iDlPara = 1;
+ ipc_send_message(MODULE_ID_AT_CTL, MODULE_ID_DM_WEBUI_AT, MSG_CMD_FOTADL_REQ, sizeof(iDlPara), (UCHAR *)(&iDlPara), 0);
+ } else if (0 == strcmp(update_action, FOTA_ACTION_CANCEL_DOWNLOAD)) {
+ (void)zte_web_write(NV_FOTA_UPGRADE_SELECTOR, "cancel");
+ zte_web_write(NV_FOTA_NEW_VERSION_STATE, IDLE);
+ zte_web_write(NV_FOTA_CURR_UPGRADE_STATE, IDLE);
+
+ slog(MISC_PRINT, SLOG_DEBUG,"web :zte_fota_update. update_action = FOTA_ACTION_CANCEL_DOWNLOAD, set NV_FOTA_UPGRADE_SELECTOR cancel!\n");
+ zte_write_result_to_web(wp, SUCCESS);
+ return; //no need to send msg to ota module
+ } else if (0 == strcmp(update_action, "check")) {
+ slog(MISC_PRINT, SLOG_DEBUG,"goahead :zte_fota_update. begin to check!!\n");
+ zte_fota_SendMsg2DM(MSG_CMD_FOTA_WEBUI_START_FOTA);
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/**********************************************************************
+* Function: zte_fota_settings
+* Description: to set fota settings
+* Input: wp:the web para;dm_nextpollingtime;dm_pollingcycle;pollingswitch;
+* Output:
+* Return:
+* Others: add from uFi
+* Modify Date Version Author Modification
+* -----------------------------------------------
+*
+**********************************************************************/
+void zte_fota_settings(webs_t wp)
+{
+ char_t *updateMode = NULL;
+ char_t *allowRoamingUpdate = NULL;
+ zte_topsw_state_e_type status = ZTE_NVIO_MAX;
+
+ if (NULL == wp) {
+ return;
+ }
+
+ updateMode = websGetVar(wp, T("UpgMode"), T(""));
+ allowRoamingUpdate = websGetVar(wp, T("UpgRoamPermission"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_fota_settings web para:[updateMode] is [%s].\n", updateMode);
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_fota_settings web para:[allowRoamingUpdate] is [%s].\n", allowRoamingUpdate);
+
+ if ('\0' == (*updateMode)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ status = zte_web_write("fota_allowRoamingUpdate", allowRoamingUpdate);
+ if (ZTE_NVIO_DONE != status) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+
+ status = zte_web_write("fota_updateMode", updateMode);
+ if (ZTE_NVIO_DONE != status) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ zte_fota_SendMsg2DM(MSG_CMD_FOTA_WEBUI_CHANGE_PARAMETER);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+#if 0
+
+/**********************************************************************
+* Function: zte_get_fota_settings
+* Description: to get fota settings
+* Input: wp:the web para;
+* Output:
+* Return:
+* Others: add from uFi
+* Modify Date Version Author Modification
+* -----------------------------------------------
+*
+**********************************************************************/
+void zte_get_fota_settings(webs_t wp)
+{
+ zte_topsw_state_e_type status = ZTE_NVIO_MAX;
+
+ char_t updateMode[NV_ITEM_STRING_LEN_20] = {0};
+ char_t updateIntervalDay[NV_ITEM_STRING_LEN_20] = {0};
+ char_t allowRoamingUpdate[NV_ITEM_STRING_LEN_20] = {0};
+
+ status = zte_web_read("fota_allowRoamingUpdate", allowRoamingUpdate);
+ if (ZTE_NVIO_DONE != status) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ status = zte_web_read("fota_updateIntervalDay", updateIntervalDay);
+ if (ZTE_NVIO_DONE != status) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ status = zte_web_read("fota_updateMode", updateMode);
+ if (ZTE_NVIO_DONE != status) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ WEBLOG("zte_get_fota_settings:[updateMode] is [%s].\n", updateMode);
+ WEBLOG("zte_get_fota_settings:[updateIntervalDay] is [%s].\n", updateIntervalDay);
+ WEBLOG("zte_get_fota_settings:[allowRoamingUpdate] is [%s].\n", allowRoamingUpdate);
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+
+ if ('\0' != *updateMode)
+ zte_rest_cmd_write(wp, "UpgMode", updateMode, 1);
+ else
+ zte_rest_cmd_write(wp, "UpgMode", "0", 1);
+
+ if ('\0' != *updateIntervalDay)
+ zte_rest_cmd_write(wp, "UpgIntervalDay", updateIntervalDay, 1);
+ else
+ zte_rest_cmd_write(wp, "UpgIntervalDay", "1", 1);
+
+ if ('\0' != *allowRoamingUpdate)
+ zte_rest_cmd_write(wp, "UpgRoamPermission", allowRoamingUpdate, 0);
+ else
+ zte_rest_cmd_write(wp, "UpgRoamPermission", "0", 0);
+
+ zte_rest_cmd_write_foot(wp);
+}
+
+
+/******************************************************
+* Function: zte_fota_get_update_info
+* Description: get fota update info
+* Input: http request info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2013/01/06 V1.0 chenyi create
+*******************************************************/
+void zte_fota_get_update_info(webs_t wp)
+{
+ char version[NV_ITEM_STRING_LEN_64 + 1] = {0};
+
+ (void)zte_web_read(NV_FOTA_VERSION, version);
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"%s\":\"%s\"}"), FOTA_UPDATE_VERSION, version);
+}
+#endif
+
+void zte_wan_lock_frequency_process(webs_t wp)
+{
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_wan_lock_frequency_process coming");
+ CHAR *actionlte = NULL;
+ CHAR *uarfcnlte = NULL;
+ CHAR *cellParaIdlte = NULL;
+
+ /* get value from web page */
+ actionlte = websGetVar(wp, T("actionlte"), T(""));
+ uarfcnlte = websGetVar(wp, T("uarfcnlte"), T(""));
+ cellParaIdlte = websGetVar(wp, T("cellParaIdlte"), T(""));
+
+ sc_cfg_set("actionlte", actionlte);
+ sc_cfg_set("uarfcnlte", uarfcnlte);
+ sc_cfg_set("cellParaIdlte", cellParaIdlte);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_CELL_LOCK_REQ, 0, NULL, 0);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+void zte_setLastLoginTime()
+{
+ int curr_time = 0;
+ char login_time[LOGIN_RECORD_TIME] = {0};
+ curr_time = zte_web_getCurrentTime();
+ sprintf(login_time, "%d", curr_time);
+ (void)zte_web_write(NV_LAST_LOGIN_TIME, login_time);
+}
+
+int zte_checkLoginTime()
+{
+ char last_record_time[LOGIN_RECORD_TIME] = {0};
+ int last_record_time_num = 0;
+ int curr_record_time_num = 0;
+ int lock_time = 0;
+ zte_web_read(NV_LAST_LOGIN_TIME, last_record_time);
+ last_record_time_num = atoi(last_record_time);
+ if(last_record_time_num < 0 || last_record_time_num > INT_MAX-1) // kw 3
+ {
+ last_record_time_num = 0;
+ }
+
+ curr_record_time_num = zte_web_getCurrentTime();
+ lock_time = curr_record_time_num - last_record_time_num;
+ if (lock_time < LOGIN_FAIL_LOCK_TIME) {
+ return -1;
+ } else {
+ return 1;
+ }
+}
+
+void zte_reduct_login_times()
+{
+ char psw_fail_num_str[12] = {0};
+ int login_times = 0;
+ zte_web_read("psw_fail_num_str", psw_fail_num_str);
+ login_times = atoi(psw_fail_num_str);
+ if(login_times < 0 || login_times > INT_MAX-1) // kw 3
+ {
+ login_times = 0;
+ }
+
+ login_times--;
+ sprintf(psw_fail_num_str, "%d", login_times);
+ (void)zte_web_write("psw_fail_num_str", psw_fail_num_str);
+}
+/******************************************************
+* Function: void zte_password_check(webs_t wp)
+* Description: password check when login
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+*
+*******************************************************/
+psw_check_result_type_t zte_password_check(webs_t wp, char* psw)
+{
+ int psw_len = 0;
+ int psw_fail_num = 0;
+ char psw_fail_num_str[10] = {0};
+ int check_lock = 0;
+
+ if (NULL == psw) {
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_mgmt_login: psw is empty.");
+ return PSW_EMPTY;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_mgmt_login:psw:%s", psw);
+ //don't foget add the nv psw_fail_num_str
+ zte_web_read("psw_fail_num_str", psw_fail_num_str);
+ psw_fail_num = atoi(psw_fail_num_str);
+ psw_len = strlen(psw);
+
+ if (0 == psw_len) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_mgmt_login: psw is empty.");
+ return PSW_EMPTY;
+ }
+
+ if (psw_fail_num <= 0) {
+ check_lock = zte_checkLoginTime(); // check the current time if it is time out
+ if (check_lock < 0) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_mgmt_login: psw number use out.");
+ return PSW_TIME_OUT;
+// } else if (check_lock > 0) { // kw 3
+ }else{
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_mgmt_login: login time out, can login.");
+ (void)zte_web_write("psw_fail_num_str", LOGIN_FAIL_TIMES);
+ }
+ }
+ zte_setLastLoginTime(); //record current time to nv
+ if (LOGIN_PSW_MIN_LEN > psw_len || LOGIN_PSW_MAX_LEN < psw_len) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_mgmt_login: psw is too long.");
+ return PSW_TOO_LONG;
+ } else {
+ return PSW_OK;
+ }
+}
+
+void zte_get_ddns_status(webs_t wp)
+{
+ char * line = NULL;
+ size_t len = 0;
+ int lsize = 0; //klocwork
+ char path_conf[100] = {0};
+ char path_file[500] = {0};
+ sc_cfg_get("path_conf", path_conf, sizeof(path_conf));
+ sprintf(path_file, "%s/inadyn.status", path_conf);
+ FILE *proc_file = fopen(path_file, "r");
+
+ if (proc_file == NULL) {
+ //websWrite(wp, T("4"));
+ websWrite(wp, T("{\"%s\":\"%s\"}"), "getddns_status", "4");
+ return;
+ }
+ if ((lsize = getline(&line, &len, proc_file)) != -1 && line) {
+ if (strstr(line, "RC_IP_INVALID_REMOTE_ADDR")) {
+ //websWrite(wp, T("2"));
+ websWrite(wp, T("{\"%s\":\"%s\"}"), "getddns_status", "2");
+ } else if (strstr(line, "RC_DYNDNS_RSP_NOTOK")) {
+ //websWrite(wp, T("1"));
+ websWrite(wp, T("{\"%s\":\"%s\"}"), "getddns_status", "1");
+ } else if (strstr(line, "RC_OK")) {
+ //websWrite(wp, T("0"));
+ websWrite(wp, T("{\"%s\":\"%s\"}"), "getddns_status", "0");
+ } else if (strstr(line, "RC_REGISTERING")) {
+ //websWrite(wp, T("3"));
+ websWrite(wp, T("{\"%s\":\"%s\"}"), "getddns_status", "3");
+ } else {
+ //websWrite(wp, T("5"));
+ websWrite(wp, T("{\"%s\":\"%s\"}"), "getddns_status", "5");
+ }
+ } else {
+ //websWrite(wp, T("-1"));
+ websWrite(wp, T("{\"%s\":\"%s\"}"), "getddns_status", "-1");
+ }
+ if (line) {
+ free(line);
+ }
+ fclose(proc_file);
+ return;
+
+}
+
+void zte_goform_set_work_type(webs_t wp)
+{
+ char_t *work_type = NULL;
+ work_type = websGetVar(wp, T("work_type"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[zyl]zte_goform_set_work_type:work_type->%s\n", work_type);
+
+ if (work_type == NULL) {
+ slog(MISC_PRINT, SLOG_ERR,"[zyl]zte_goform_set_work_type:empty!\n");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ if ((strncmp(work_type, "0", 1) == 0) || (strncmp(work_type, "1", 1) == 0)) {
+ char LanEnable[5] = {0};
+ (void)zte_web_read("LanEnable", LanEnable);
+ if (strncmp(LanEnable, work_type, 1) == 0) {
+ return zte_write_result_to_web(wp, SUCCESS);
+ }
+ (void)zte_web_write("LanEnable", work_type);
+ slog(MISC_PRINT, SLOG_DEBUG,"[zyl]zte_goform_set_work_type:work_type->%s\n", work_type);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MAIN_CTRL, MSG_CMD_RESTART_REQUEST, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL,"[zyl]zte_goform_set_work_type:device reboot now\n");
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"[zyl]zte_goform_set_work_type:work_type->%s error!\n", work_type);
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+}
+
+/******************************************************
+* Function: void zte_goform_set_sample(webs_t wp)
+* Description: example function
+* Input: HTTP page info
+* Output:
+* Return: none
+* Others:
+* Modify Date Version Author Modification
+*
+*******************************************************/
+void zte_goform_set_sample(webs_t wp)
+{
+ //´ÓWEBÇëÇóÖлñÈ¡²ÎÊý,ûÓвÎÊýÔò²»ÐèÒªÕâÒ»²½
+
+ // ÉèÖÃNV»ò·¢ÏûÏ¢¸øÏàӦģ¿é
+ //ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_PDP_ACT_REQ, 0, NULL, 0);
+
+ //·µ»ØJSON ¸ñʽ½á¹û£¬Èç¹ûÐèÒª²éѯÉèÖýá¹ûÔòÐèÒªwebuiͨ¹ý»ñÈ¡ppp_statusÕâ¸öNVÖµÀ´»ñÈ¡
+ zte_write_result_to_web(wp, SUCCESS);
+ return;
+}
+
+//bsim
+static int bs_string2bytes(const char* pSrc, unsigned char* pDst, int nSrcLength)
+{
+ int i=0;
+
+ //УÑé²ÎÊý
+ if(pSrc == NULL || pDst == NULL || nSrcLength < 0)
+ {
+ return -1;
+ }
+
+ for(i = 0; i < nSrcLength; i += 2)
+ {
+ // Êä³ö¸ß4λ
+ if(*pSrc >= '0' && *pSrc <= '9')
+ {
+ *pDst = (*pSrc - '0') << 4;
+ }
+ else
+ {
+ *pDst = ((toupper(*pSrc) - 'A') + 10) << 4;
+ }
+
+ pSrc++;
+
+ // Êä³öµÍ4λ
+ if(*pSrc >= '0' && *pSrc <= '9')
+ {
+ *pDst |= *pSrc - '0';
+ }
+ else
+ {
+ *pDst |= (toupper(*pSrc) - 'A') + 10;
+ }
+
+ pSrc++;
+ pDst++;
+ }
+
+ // ·µ»ØÄ¿±êÊý¾Ý³¤¶È
+ return nSrcLength / 2;
+}
+
+static int bs_bytes2string(const unsigned char* pSrc, char* pDst, int nSrcLength)
+{
+ const char tab[]="0123456789ABCDEF"; // 0x0-0xfµÄ×Ö·û²éÕÒ±í
+ int i = 0;
+
+ //УÑé²ÎÊý
+ if(pSrc == NULL || pDst == NULL || nSrcLength < 0)
+ {
+ return -1;
+ }
+
+ for(i=0; i<nSrcLength; i++)
+ {
+ *pDst++ = tab[*pSrc >> 4]; // Êä³öµÍ4λ
+ *pDst++ = tab[*pSrc & 0x0f]; // Êä³ö¸ß4λ
+ pSrc++;
+ }
+
+ // ·µ»ØÄ¿±ê×Ö·û´®³¤¶È
+ return nSrcLength * 2;
+}
+
+static int bs_aes_init_key(unsigned char *aes_key, int k_len)
+{
+ int efuse_fd = -1;
+ T_ZDrvEfuse_Secure efuse = {0};
+
+ memset(&efuse, 0, sizeof(efuse));
+ efuse_fd = open("/dev/efuse", O_RDWR);
+ if (efuse_fd < 0) {
+ printf("wifi_aes_init_key efuse open errno=%d\n", errno);
+ return 0;
+ }
+ if(ioctl(efuse_fd , EFUSE_GET_DATA, &efuse) != 0) {
+ printf("wifi_aes_init_key efuse ioctl errno=%d\n", errno);
+ close(efuse_fd);
+ return 0;
+ }
+ close(efuse_fd);
+ memcpy(aes_key, efuse.pubKeyHash, k_len);
+
+ return 1;
+}
+
+static int bs_aes_encrypt(char* in, int len, char* out, unsigned char* key, int key_len)
+{
+ if (!in || !out || !key || len <=0 || (len%AES_BLOCK_SIZE)!=0 || (key_len!=16 && key_len!=24 && key_len!=32)) {
+ printf("bs_aes_encrypt err in=%p out=%p key=%p len=%d key_len=%d\n",in,key,out,len,key_len);
+ return 0;
+ }
+
+ AES_KEY aes = {0}; //cov h
+ if (AES_set_encrypt_key(key, key_len*8, &aes) < 0) {
+ printf("bs_aes_encrypt AES_set_encrypt_key err\n");
+ return 0;
+ }
+
+ int en_len = 0;
+ while (en_len < len) {
+ AES_encrypt((unsigned char*)in, (unsigned char*)out, &aes);
+ in += AES_BLOCK_SIZE;
+ out += AES_BLOCK_SIZE;
+ en_len += AES_BLOCK_SIZE;
+ }
+
+ return 1;
+}
+
+static int bs_aes_decrypt(char* in, int len, char* out, char* key, int key_len)
+{
+ if (!in || !out || !key || len <=0 || (len%AES_BLOCK_SIZE)!=0 || (key_len!=16 && key_len!=24 && key_len!=32)) {
+ printf("bs_aes_decrypt err in=%p out=%p key=%p len=%d key_len=%d\n",in,key,out,len,key_len);
+ return 0;
+ }
+
+ AES_KEY aes = {0}; //cov h
+ if (AES_set_decrypt_key((unsigned char*)key, key_len*8, &aes) < 0) {
+ printf("bs_aes_decrypt AES_set_decrypt_key err\n");
+ return 0;
+ }
+
+ int en_len = 0;
+ while (en_len < len) {
+ AES_decrypt((unsigned char*)in, (unsigned char*)out, &aes);
+ in += AES_BLOCK_SIZE;
+ out += AES_BLOCK_SIZE;
+ en_len += AES_BLOCK_SIZE;
+ }
+
+ return 1;
+}
+
+static int bs_aes_cbc_encrypt(char* in, int len, char* out, unsigned char* key, int key_len)
+{
+ if (!in || !out || !key || len <=0 || (len%AES_BLOCK_SIZE)!=0 || (key_len!=16 && key_len!=24 && key_len!=32)) {
+ printf("bs_aes_encrypt err in=%p out=%p key=%p len=%d key_len=%d\n",in,key,out,len,key_len);
+ return 0;
+ }
+
+ AES_KEY aes = {0}; //cov h
+ if (AES_set_encrypt_key(key, key_len*8, &aes) < 0) {
+ printf("bs_aes_encrypt AES_set_encrypt_key err\n");
+ return 0;
+ }
+
+ unsigned char iv[AES_BLOCK_SIZE] = {0};
+ memcpy(iv, key, AES_BLOCK_SIZE);
+
+ AES_cbc_encrypt((unsigned char*)in, (unsigned char*)out, len,
+ &aes, iv, AES_ENCRYPT);
+
+
+ return 1;
+}
+
+static int bs_aes_cbc_decrypt(char* in, int len, char* out, char* key, int key_len)
+{
+ if (!in || !out || !key || len <=0 || (len%AES_BLOCK_SIZE)!=0 || (key_len!=16 && key_len!=24 && key_len!=32)) {
+ printf("bs_aes_decrypt err in=%p out=%p key=%p len=%d key_len=%d\n",in,key,out,len,key_len);
+ return 0;
+ }
+
+ AES_KEY aes = {0}; //cov h
+ if (AES_set_decrypt_key((unsigned char*)key, key_len*8, &aes) < 0) {
+ printf("bs_aes_decrypt AES_set_decrypt_key err\n");
+ return 0;
+ }
+
+ unsigned char iv[AES_BLOCK_SIZE] = {0};
+ memcpy(iv, key, AES_BLOCK_SIZE);
+
+ AES_cbc_encrypt((unsigned char*)in, (unsigned char*)out, len,
+ &aes, iv, AES_DECRYPT);
+
+ return 1;
+}
+
+
+static int apn_profile_encrypt_code(char *w_code, int len, char *b_aes, char *s_aes)
+{
+ bs_aes_encrypt(w_code, len, b_aes, web_aes_key, sizeof(web_aes_key));
+ bs_bytes2string(b_aes, s_aes, len);
+
+ printf("encrypt apn_profile w_code=%s, s_aes=%s\n", w_code, s_aes);
+
+ return 1;
+}
+
+void set_apn_prof_aes_by_index(int index, APN_PROFILE *profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+
+ if (NULL == profile) {
+ return;
+ }
+
+ sprintf(cfg_name, "APN_config%d", index);
+ if (0 == strcmp(profile->pdp_type, "IPv6")) {
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "");
+ } else {
+ char ppp_aes[PROFILE_APN_AES_LEN] = {0};
+ char ppp_aes_b[PROFILE_APN_LEN - 1] = {0};
+ apn_profile_encrypt_code(profile->ppp_passwd, PROFILE_APN_LEN - 1 , ppp_aes_b, ppp_aes);
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ profile->apn_name,
+ profile->apn_select,
+ profile->dial_num,
+ profile->ppp_auth_mode,
+ profile->ppp_username,
+ ppp_aes,//profile->ppp_passwd,
+ profile->pdp_type,
+ profile->pdp_select,
+ profile->pdp_addr,
+ profile->dns_mode,
+ profile->prefer_dns_manual,
+ profile->standby_dns_manual);
+ }
+ sc_cfg_set(cfg_name, cfg_value);
+
+ return;
+}
+
+void set_ipv6_apn_prof_aes_by_index(int index, IPV6_APN_PROFILE *profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+
+ if (NULL == profile) {
+ return;
+ }
+
+ sprintf(cfg_name, "ipv6_APN_config%d", index);
+ if (0 == strcmp(profile->pdp_type, "IP")) {
+ slog(MISC_PRINT, SLOG_DEBUG, "pdp_type=IP cpsnprintf "); /*lint !e26*/
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "");
+ } else {
+ char ppp_aes[PROFILE_APN_AES_LEN] = {0};
+ char ppp_aes_b[PROFILE_APN_LEN - 1] = {0};
+ apn_profile_encrypt_code(profile->ppp_passwd, PROFILE_APN_LEN - 1 , ppp_aes_b, ppp_aes);
+ slog(MISC_PRINT, SLOG_DEBUG, "pdp_type=else cpsnprintf "); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "profile->profile_name=%s ", profile->profile_name); /*lint !e26*/
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ profile->apn_name,
+ profile->apn_select,
+ profile->dial_num,
+ profile->ppp_auth_mode,
+ profile->ppp_username,
+ ppp_aes,//profile->ppp_passwd,
+ profile->pdp_type,
+ profile->pdp_select,
+ profile->pdp_addr,
+ profile->dns_mode,
+ profile->prefer_dns_manual,
+ profile->standby_dns_manual);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "cfg_value=%s", cfg_value); /*lint !e26*/
+ sc_cfg_set(cfg_name, cfg_value);
+
+ return;
+}
+
+void set_ipv4v6_apn_prof_aes_by_index(int index, APN_PROFILE *profile, IPV6_APN_PROFILE *ipv6profile)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+ char ppp_aes[PROFILE_APN_AES_LEN] = {0};
+ char ppp_aes_b[PROFILE_APN_LEN - 1] = {0};
+
+ if (NULL == profile) {
+ return;
+ }
+
+ sprintf(cfg_name, "APN_config%d", index);
+ apn_profile_encrypt_code(profile->ppp_passwd, PROFILE_APN_LEN - 1 , ppp_aes_b, ppp_aes);
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ profile->profile_name,
+ profile->apn_name,
+ profile->apn_select,
+ profile->dial_num,
+ profile->ppp_auth_mode,
+ profile->ppp_username,
+ ppp_aes,//profile->ppp_passwd,
+ profile->pdp_type,
+ profile->pdp_select,
+ profile->pdp_addr,
+ profile->dns_mode,
+ profile->prefer_dns_manual,
+ profile->standby_dns_manual);
+ sc_cfg_set(cfg_name, cfg_value);
+
+ memset(cfg_name, 0, sizeof(cfg_name));
+ memset(cfg_value, 0, sizeof(cfg_value));
+ memset(ppp_aes, 0, sizeof(ppp_aes));
+ memset(ppp_aes_b, 0, sizeof(ppp_aes_b));
+ sprintf(cfg_name, "ipv6_APN_config%d", index);
+ apn_profile_encrypt_code(ipv6profile->ppp_passwd, PROFILE_APN_LEN - 1 , ppp_aes_b, ppp_aes);
+ snprintf(cfg_value, APNCONFIG_MEMORY,
+ "%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)%s($)",
+ ipv6profile->profile_name,
+ ipv6profile->apn_name,
+ ipv6profile->apn_select,
+ ipv6profile->dial_num,
+ ipv6profile->ppp_auth_mode,
+ ipv6profile->ppp_username,
+ ppp_aes,//ipv6profile->ppp_passwd,
+ ipv6profile->pdp_type,
+ ipv6profile->pdp_select,
+ ipv6profile->pdp_addr,
+ ipv6profile->dns_mode,
+ ipv6profile->prefer_dns_manual,
+ ipv6profile->standby_dns_manual);
+ sc_cfg_set(cfg_name, cfg_value);
+
+ return;
+}
+
+//APN_config0~n
+static void apn_decode_profile_by_index(int index)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+ char ppp_aes[PROFILE_APN_AES_LEN] = {0};
+ char b_aes[PROFILE_APN_LEN] = {0};
+ //char ppp_s[PROFILE_APN_LEN] = {0};
+ char *pos_begin = NULL;
+ APN_PROFILE profile = {0};
+
+ sprintf(cfg_name, "APN_config%d", index);
+ sc_cfg_get(cfg_name, cfg_value, sizeof(cfg_value));
+ if (strlen(cfg_value) == 0)
+ return;
+ pos_begin = cfg_value;
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.profile_name, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.apn_name, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.apn_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.dial_num, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.ppp_auth_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.ppp_username, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", ppp_aes, PROFILE_APN_AES_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.pdp_type, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.pdp_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.pdp_addr, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.dns_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.prefer_dns_manual, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.standby_dns_manual, PROFILE_MEMBER_LEN);
+
+ if (strlen(ppp_aes) == (PROFILE_APN_AES_LEN - 1)) {
+ bs_string2bytes(ppp_aes, b_aes, PROFILE_APN_AES_LEN - 1);
+ bs_aes_decrypt(b_aes, PROFILE_APN_LEN - 1, profile.ppp_passwd, web_aes_key, sizeof(web_aes_key));
+// printf("decrypt ppp_tmp[%d]=%s\n", index, profile.ppp_passwd);
+ } else if (strlen(ppp_aes) > 0){
+ //fotaÉý¼¶À´µÄÃ÷ÎÄ
+ strncpy(profile.ppp_passwd, ppp_aes,sizeof(profile.ppp_passwd)-1);
+ set_apn_prof_aes_by_index(index, &profile);
+// printf("decrypt fota ppp_tmp[%d]=%s\n", index, profile.ppp_passwd);
+ }
+
+ set_apn_profile_by_index(index, &profile);
+
+ return;
+}
+
+static void ipv6apn_decode_profile_by_index(int index)
+{
+ char cfg_name[PROFILE_MEMBER_LEN] = {0};
+ char cfg_value[APNCONFIG_MEMORY] = {0};
+ char ppp_aes[PROFILE_APN_AES_LEN] = {0};
+ char b_aes[PROFILE_APN_LEN] = {0};
+ char *pos_begin = NULL;
+ IPV6_APN_PROFILE profile = {0};
+
+
+ sprintf(cfg_name, "ipv6_APN_config%d", index);
+ sc_cfg_get(cfg_name, cfg_value, sizeof(cfg_value));
+ if (strlen(cfg_value) == 0)
+ return;
+ pos_begin = cfg_value;
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.profile_name, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.apn_name, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.apn_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.dial_num, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.ppp_auth_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.ppp_username, PROFILE_APN_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", ppp_aes, PROFILE_APN_AES_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.pdp_type, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.pdp_select, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.pdp_addr, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.dns_mode, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.prefer_dns_manual, PROFILE_MEMBER_LEN);
+ pos_begin = split_str_by_sep(pos_begin, "($)", profile.standby_dns_manual, PROFILE_MEMBER_LEN);
+
+ if (strlen(ppp_aes) == (PROFILE_APN_AES_LEN - 1)) {
+ bs_string2bytes(ppp_aes, b_aes, PROFILE_APN_AES_LEN - 1);
+ bs_aes_decrypt(b_aes, PROFILE_APN_LEN - 1, profile.ppp_passwd, web_aes_key, sizeof(web_aes_key));
+// printf("decrypt ppp_v6tmp[%d]=%s\n", index, profile.ppp_passwd);
+ } else if (strlen(ppp_aes) > 0){
+ //fotaÉý¼¶À´µÄÃ÷ÎÄ
+ strncpy(profile.ppp_passwd, ppp_aes,sizeof(profile.ppp_passwd)-1);
+ set_ipv6_apn_prof_aes_by_index(index, &profile);
+// printf("decrypt fota ppp_v6tmp[%d]=%s\n", index, profile.ppp_passwd);
+ }
+ set_ipv6_apn_profile_by_index(index, &profile);
+
+ return;
+}
+
+static int apn_profile_decrypt_code(void)
+{
+ int index = 0;//APN_config0ÊÇDefault,¿É²»´¦Àí?
+
+ for (index = 0; index < APNCONFIG_NUM_MAX; index++) {
+ apn_decode_profile_by_index(index);
+ ipv6apn_decode_profile_by_index(index);
+ }
+
+ return 1;
+}
+
+int apn_encrypt_code(void)
+{
+ char w_code[PROFILE_APN_LEN] = {0};
+ char b_aes[PROFILE_APN_LEN] = {0};
+ char s_aes[PROFILE_APN_AES_LEN] = {0};
+
+ sc_cfg_get("ppp_passtmp", w_code, sizeof(w_code));
+ bs_aes_encrypt(w_code, PROFILE_APN_LEN - 1, b_aes, web_aes_key, sizeof(web_aes_key));
+ bs_bytes2string(b_aes, s_aes, PROFILE_APN_LEN - 1);
+ sc_cfg_set("ppp_passwd", s_aes);
+ printf("apn_encrypt_code w_code=%s, s_aes=%s\n", w_code, s_aes);
+
+ return 1;
+}
+
+int ipv6apn_encrypt_code(void)
+{
+ char w_code[PROFILE_APN_LEN] = {0};
+ char b_aes[PROFILE_APN_LEN] = {0};
+ char s_aes[PROFILE_APN_AES_LEN] = {0};
+
+ sc_cfg_get("ipv6_ppp_passtmp", w_code, sizeof(w_code));
+ bs_aes_encrypt(w_code, PROFILE_APN_LEN - 1, b_aes, web_aes_key, sizeof(web_aes_key));
+ bs_bytes2string(b_aes, s_aes, PROFILE_APN_LEN - 1);
+ sc_cfg_set("ipv6_ppp_passwd", s_aes);
+ printf("ipv6apn_encrypt_code w_code=%s, s_aes=%s\n", w_code, s_aes);
+
+ return 1;
+}
+#if 0
+//2±íʾfota´ÓÀϰ汾ÍùÉÏÉý¼¶£¬ppp_password´æµÄÊÇÃ÷ÎÄÃÜÂ룬а汾ÊÇÃÜÎÄ
+static int apn_decrypt_code(void)
+{
+ char w_code[PROFILE_APN_LEN]= {0};
+ char b_aes[PROFILE_APN_LEN] = {0};
+ char s_aes[PROFILE_APN_AES_LEN] = {0};
+ int flag = 0;
+
+ sc_cfg_get("ppp_passwd", s_aes, sizeof(s_aes));
+ if (strlen(s_aes) == (PROFILE_APN_AES_LEN - 1)) {
+ bs_string2bytes(s_aes, b_aes, PROFILE_APN_AES_LEN - 1);
+ bs_aes_decrypt(b_aes, PROFILE_APN_LEN - 1, w_code, web_aes_key, sizeof(web_aes_key));
+ sc_cfg_set("ppp_passtmp", w_code);
+ printf("apn_decrypt_code w_code=%s, s_aes=%s\n", w_code, s_aes);
+ } else if (strlen(s_aes) > 0){
+ sc_cfg_set("ppp_passtmp", s_aes);
+ return 2;
+ }
+
+ return 1;
+}
+
+static int ipv6apn_decrypt_code(void)
+{
+ char w_code[PROFILE_APN_LEN]= {0};
+ char b_aes[PROFILE_APN_LEN] = {0};
+ char s_aes[PROFILE_APN_AES_LEN] = {0};
+ int flag = 0;
+
+ sc_cfg_get("ipv6_ppp_passwd", s_aes, sizeof(s_aes));
+ if (strlen(s_aes) == (PROFILE_APN_AES_LEN - 1)) {
+ bs_string2bytes(s_aes, b_aes, PROFILE_APN_AES_LEN - 1);
+ bs_aes_decrypt(b_aes, PROFILE_APN_LEN - 1, w_code, web_aes_key, sizeof(web_aes_key));
+ sc_cfg_set("ipv6_ppp_passtmp", w_code);
+ printf("apn_decrypt_code w_code=%s, s_aes=%s\n", w_code, s_aes);
+ } else if (strlen(s_aes) > 0){
+ sc_cfg_set("ipv6_ppp_passtmp", s_aes);
+ return 2;
+ }
+
+ return 1;
+}
+#endif
+#ifdef WEBS_SECURITY
+static void js_aes_wifi_encode(void)
+{
+ char js_aes_key[24 + 1]={0};
+ char imei_buf[15 + 1] = {0};
+ char rnum_buf[9 + 1] = {0};
+
+ char wificode[WIFI_PSW_DEFAULT_LENGTH] = {0};
+ char b_aes[WIFI_PSW_DEFAULT_LENGTH] = {0};
+ char *basestr = NULL;
+
+ sc_cfg_get("imei", imei_buf, sizeof(imei_buf));
+ sc_cfg_get("rnum_js", rnum_buf, sizeof(rnum_buf));
+ snprintf(js_aes_key, sizeof(js_aes_key), "%s%sFFFFFFFFFFFFFFF", rnum_buf, imei_buf);
+
+ sc_cfg_get("WPAPSK1", wificode, sizeof(wificode));
+ bs_aes_cbc_encrypt(wificode, sizeof(wificode)-1, b_aes, js_aes_key, sizeof(js_aes_key)-1);
+ basestr = zte_base64_encode(b_aes, sizeof(b_aes)-1);
+ if (NULL == basestr) {
+ slog(MISC_PRINT, SLOG_ERR, "basestr is NULL.\n");/*lint !e26*/
+ return;
+ }
+ (void)zte_web_write("WPAPSK1_enaes", basestr);
+ free(basestr);
+ basestr = NULL;
+
+ memset(wificode, 0, sizeof(wificode));
+ sc_cfg_get("m_WPAPSK1", wificode, sizeof(wificode));
+ bs_aes_cbc_encrypt(wificode, sizeof(wificode)-1, b_aes, js_aes_key, sizeof(js_aes_key)-1);
+ basestr = zte_base64_encode(b_aes, sizeof(b_aes)-1);
+ if (NULL == basestr) {
+ slog(MISC_PRINT, SLOG_ERR, "basestr-m is NULL.\n");/*lint !e26*/
+ return;
+ }
+ (void)zte_web_write("m_WPAPSK1_enaes", basestr);
+ free(basestr);
+ basestr = NULL;
+
+}
+
+
+static void js_aes_rand(void)
+{
+ char rstr[10] = {0};
+ unsigned int rnum = 0;
+
+ srand( (unsigned)time( NULL ) );
+ rnum = rand();
+ rnum %= 1000000000;
+
+ snprintf((char *)rstr, sizeof(rstr), "%09ld", rnum);
+ sc_cfg_set("rnum_js", rstr);
+}
+//cbc
+char *js_aes_decode(char *src, size_t len, size_t *out_len)
+{
+ unsigned char *aes_password = NULL;
+ size_t aes_len = 0;
+
+ char *out = NULL;
+
+ char js_aes_key[24 + 1]={0};
+ char imei_buf[15 + 1] = {0};
+ char rnum_buf[9 + 1] = {0};
+
+ aes_password = (char *)zte_base64_decode((const unsigned char *)src, len, (unsigned int*)&aes_len);
+ if (aes_password == NULL)
+ return NULL;
+
+
+ out = malloc(aes_len + 1);
+ if (out == NULL) {
+ free(aes_password);
+ return NULL;
+ }
+ memset(out, 0, aes_len + 1);
+
+ sc_cfg_get("imei", imei_buf, sizeof(imei_buf));
+ sc_cfg_get("rnum_js", rnum_buf, sizeof(rnum_buf));
+ snprintf(js_aes_key, sizeof(js_aes_key), "%s%sFFFFFFFFFFFFFFF", rnum_buf, imei_buf);
+
+ bs_aes_cbc_decrypt(aes_password, aes_len, out, js_aes_key, sizeof(js_aes_key)-1);
+ //printf("decrypt js_aes_decode[%d]=%s\n", aes_len, out);
+
+ free(aes_password);
+
+ if (strlen(out) > aes_len) {
+ free(out);
+ return NULL;
+ }
+
+ *out_len = strlen(out);
+
+ return out;
+}
+#endif
+int web_aes_init(void)
+{
+ bs_aes_init_key(web_aes_key, sizeof(web_aes_key));
+ apn_profile_decrypt_code();
+#ifdef WEBS_SECURITY
+ js_aes_rand();
+#endif
+ return 1;
+}
+
diff --git a/ap/app/goahead/interface5.0/zte_web_mgmt.h b/ap/app/goahead/interface5.0/zte_web_mgmt.h
new file mode 100755
index 0000000..d33248b
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_mgmt.h
@@ -0,0 +1,125 @@
+/************************************************************************
+* °æÈ¨ËùÓÐ (C)2010, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º zte_web_mgmt.h
+* Îļþ±êʶ£º
+* ÄÚÈÝÕªÒª£º
+* ÆäËü˵Ã÷£º
+* µ±Ç°°æ±¾£º V0.1
+* ×÷ Õߣº zyt
+* Íê³ÉÈÕÆÚ£º 2010-11-24
+*
+* Ð޸ļǼ1£º
+* ÐÞ¸ÄÄÚÈÝ£º³õʼ°æ±¾
+************************************************************************/
+
+#ifndef ZTE_WEB_MGMT_H
+#define ZTE_WEB_MGMT_H
+
+#define APNCONFIG_MEMORY 1024
+#define PROFILE_MEMBER_LEN 32
+#define PROFILE_APN_LEN 65
+#define PROFILE_APN_AES_LEN 129
+#define DAYSEC 86400
+#define COMMONYEARSEC 31536000
+#define LEAPYEARSEC 31622400
+#define JAN_2000 946684791
+typedef struct tag_APN_PROFILE {
+ char profile_name[PROFILE_MEMBER_LEN];
+ char apn_name[PROFILE_APN_LEN];
+ char apn_select[PROFILE_MEMBER_LEN];
+ char dial_num[PROFILE_MEMBER_LEN];
+ char ppp_auth_mode[PROFILE_MEMBER_LEN];
+ char ppp_username[PROFILE_APN_LEN];
+ char ppp_passwd[PROFILE_APN_LEN];
+ char pdp_type[PROFILE_MEMBER_LEN];
+ char pdp_select[PROFILE_MEMBER_LEN];
+ char pdp_addr[PROFILE_MEMBER_LEN];
+ char dns_mode[PROFILE_MEMBER_LEN];
+ char prefer_dns_manual[PROFILE_MEMBER_LEN];
+ char standby_dns_manual[PROFILE_MEMBER_LEN];
+} APN_PROFILE;
+
+
+typedef struct tag_IPv6_APN_PROFILE {
+ char profile_name[PROFILE_MEMBER_LEN];
+ char apn_name[PROFILE_APN_LEN];
+ char apn_select[PROFILE_MEMBER_LEN];
+ char dial_num[PROFILE_MEMBER_LEN];
+ char ppp_auth_mode[PROFILE_MEMBER_LEN];
+ char ppp_username[PROFILE_APN_LEN];
+ char ppp_passwd[PROFILE_APN_LEN];
+ char pdp_type[PROFILE_MEMBER_LEN];
+ char pdp_select[PROFILE_MEMBER_LEN];
+ char pdp_addr[PROFILE_MEMBER_LEN];
+ char dns_mode[PROFILE_MEMBER_LEN];
+ char prefer_dns_manual[PROFILE_MEMBER_LEN];
+ char standby_dns_manual[PROFILE_MEMBER_LEN];
+} IPV6_APN_PROFILE;
+
+
+/* management */
+extern void zte_mgmt_login(webs_t wp);//11
+extern void zte_mgmt_logout(webs_t wp);//11
+extern void zte_mgmt_set_language(webs_t wp);//11
+extern void zte_mgmt_restore(webs_t wp);//11
+extern void zte_mgmt_poweroff(webs_t wp);
+extern void zte_mgmt_control_power_on_speed(webs_t wp);
+extern void zte_mgmt_change_password(webs_t wp);//11
+extern void zte_mgmt_change_account(webs_t wp);//
+extern void zte_goform_mgmt_set_not_login_process(webs_t wp);
+extern void zte_mgmt_disable_pin(webs_t wp);//11
+extern void zte_mgmt_pin_input(webs_t wp);//11
+extern void zte_mgmt_puk_input(webs_t wp);//11
+extern void zte_mgmt_auto_pin(webs_t wp);
+extern void zte_mgmt_pin_enable_or_modify(webs_t wp);//11
+extern void zte_mgmt_unlock_network(webs_t wp);//11
+extern void zte_goform_mgmt_pin_mgmt_process(webs_t wp);
+extern void zte_quick_setup(webs_t wp);//11
+//extern void zte_quick_set_first(webs_t wp);//11
+void deal_quick_setup_apn_ex(webs_t wp);
+extern void zte_mgmt_set_devicemode(webs_t wp);
+
+
+
+extern void zte_goform_mgmt_sntp_process(webs_t wp);
+
+
+extern void zte_goform_mgmt_reboot_process(webs_t wp);
+extern void zte_goform_mgmt_syslog_process(webs_t wp);
+
+extern void get_autoapn_profile(APN_PROFILE *apn_profile);
+extern void get_apn_profile_by_index(int index, APN_PROFILE *profile);
+extern void get_ipv6apn_profile_by_index(int index, IPV6_APN_PROFILE *ipv6profile);
+extern void get_ipv4v6apn_profile_by_index(int index, APN_PROFILE *profile, IPV6_APN_PROFILE *ipv6profile);
+extern void get_autoapn_profile(APN_PROFILE *profile);
+extern void set_apn_profile_by_index(int index, APN_PROFILE *profile);
+extern void set_ipv6_apn_profile_by_index(int index, IPV6_APN_PROFILE *ipv6profile);
+extern void set_ipv4v6_apn_profile_by_index(int index, APN_PROFILE *profile, IPV6_APN_PROFILE *ipv6profile);
+extern void set_apn_prof_aes_by_index(int index, APN_PROFILE *profile);
+extern void set_ipv6_apn_prof_aes_by_index(int index, IPV6_APN_PROFILE *profile);
+extern void set_ipv4v6_apn_prof_aes_by_index(int index, APN_PROFILE *profile, IPV6_APN_PROFILE *ipv6profile);
+extern int apn_encrypt_code(void);
+extern int ipv6apn_encrypt_code(void);
+
+extern void zte_wan_lock_frequency_process(webs_t wp);
+
+extern int manual_set_time();
+
+extern void getdialog_url(int eid, webs_t wp, int argc, char_t **argv);
+extern void getddns_status(int eid, webs_t wp, int argc, char_t **argv);
+extern char * timei2s(int);
+extern void timeen2ch(char *);
+extern void datastatic(char *, char *, char *, char *, char *);
+
+extern int zte_fota_notifyPushMsg(int cmd);
+
+extern void zte_fota_get_upgrade_result(webs_t wp);
+extern void zte_fota_get_dp_pack_info(webs_t wp);
+extern void zte_fota_get_update_info(webs_t wp);
+//extern void zte_fota_get_dm_last_check_time(webs_t wp);
+#ifdef WEBS_SECURITY
+extern char *js_aes_decode(char *src, size_t len, size_t *out_len);
+#endif
+#endif
+
diff --git a/ap/app/goahead/interface5.0/zte_web_pbm.c b/ap/app/goahead/interface5.0/zte_web_pbm.c
new file mode 100755
index 0000000..f73b8ba
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_pbm.c
@@ -0,0 +1,971 @@
+/************************************************************************
+* °æÈ¨ËùÓÐ (C)2010, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º zte_web_pbm.c
+* Îļþ±êʶ£º
+* ÄÚÈÝÕªÒª£º
+* ÆäËü˵Ã÷£º
+* µ±Ç°°æ±¾£º V0.1
+* ×÷ Õߣº zyt
+* Íê³ÉÈÕÆÚ£º 2010-11-06
+*
+* Ð޸ļǼ1£º
+* ÐÞ¸ÄÄÚÈÝ£º³õʼ°æ±¾
+************************************************************************/
+
+#include "zte_web_interface.h"
+//#include "../../phonebook/phonebook.h"
+#include "zte_web_get_fw_para.h"
+#include "zte_web_pbm.h"
+
+static void zte_web_pbm_feed_back_empty(webs_t wp);
+
+#define IFSTREQUAL(str1, str2) (strcmp((str1), (str2))?0:1)
+
+int zte_web_pbm_check_can_process()
+{
+ char flag[20] = {0};
+
+ (void)zte_web_read(ZTE_PBM_NV, flag);
+ if (0 == strcmp(flag, PBM_OPRATING)) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[PB] zte_web_pbm_check_can_process flag=%s, not can process.\n", flag);
+ return 0;
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG,"[PB] zte_web_pbm_check_can_process flag=%s, can process.\n", flag);
+ return -1;
+ }
+}
+
+static data_safe_result_type_t zte_Safe_noSpecialChar_ucs2(char *str)
+{
+ int i = 0;
+ int len = 0;
+ if (NULL == str || strlen(str) < 4) {
+ return 0;
+ }
+ len = strlen(str);
+ for (i = 0; i < len; i=i+4) {
+ if (str[i] == '0' && str[i+1] == '0') {
+ if(str[i+2] == '2') {//"'/
+ if(str[i+3] == '2' || str[i+3] == '7' || str[i+3] == 'f' || str[i+3] == 'F')
+ return 0;
+ } else if(str[i+2] == '3') {//<>
+ if(str[i+3] == 'c' || str[i+3] == 'C' || str[i+3] == 'e' || str[i+3] == 'E')
+ return 0;
+ } else if(str[i+2] == '5') {//\
+ if(str[i+3] == 'c' || str[i+3] == 'C')
+ return 0;
+ }
+ }
+ }
+ return 1;
+
+}
+
+/**********************************************************************
+* Function: zte_web_pbm_contact_saveto_sim
+* Description:
+* Input: wp:web para;sim_contact_location:save location
+* Output:
+* Return: void
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120926 V1.0 liuyingnan first version
+**********************************************************************/
+static void zte_web_pbm_contact_saveto_sim(webs_t wp, int sim_contact_location)
+{
+ /*contact added type*/
+ zte_pbm_create_ext_record_s_type sim_contact_add;
+ int ret_code = 0;
+ //add by liuyingnan for server safe start
+ char* pbm_name = NULL;
+ char* pbm_mobilephone_num = NULL;
+ //add by liuyingnan for server safe end
+
+ /*LOG*/
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_web_pbm->zte_web_pbm_contact_saveto_sim()."); /*lint !e26*/
+
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_goform_pbm_contact_add_process(): invalid input.."); /*lint !e26*/
+ return;
+ }
+
+ //add by liuyingnan for server safe for xss attack start
+ pbm_name = websGetVar(wp, T("name"), T(""));
+ pbm_mobilephone_num = websGetVar(wp, T("mobilephone_num"), T(""));
+
+ if (PBM_MAX_TEXT_LENGTH < strlen(pbm_name) || PBM_MAX_NUM_LENGTH < strlen(pbm_mobilephone_num)
+ ||DATA_NO_SAFE == zte_Safe_noSpecialChar_ucs2(pbm_name)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(pbm_mobilephone_num)
+ ) {
+ slog(MISC_PRINT, SLOG_ERR, "Get Data is no Safe:pbm_name:%s\n", pbm_name); /*lint !e26*/
+ sc_cfg_set("data_safe", "failed");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //add by liuyingnan for server safe for xss attack end
+
+ /*init contact_add*/
+ memset(&sim_contact_add, 0, sizeof(sim_contact_add));
+ /*set struct value*/
+ sim_contact_add.zte_pbm_del_id = atoi(websGetVar(wp, T("delId"), T("-1")));
+ sim_contact_add.zte_pbm_location = sim_contact_location;
+ sim_contact_add.zte_pbm_id = atoi(websGetVar(wp, T("edit_index"), T("")));
+
+ memcpy(sim_contact_add.zte_pbm_name, websGetVar(wp, T("name"), T("")),
+ sizeof(sim_contact_add.zte_pbm_name));
+ memcpy(sim_contact_add.zte_pbm_number, websGetVar(wp, T("mobilephone_num"), T("")),
+ sizeof(sim_contact_add.zte_pbm_number));
+ memcpy(sim_contact_add.zte_pbm_anr, websGetVar(wp, T("homephone_num"), T("")),
+ sizeof(sim_contact_add.zte_pbm_anr));
+ memcpy(sim_contact_add.zte_pbm_anr1, websGetVar(wp, T("officephone_num"), T("")),
+ sizeof(sim_contact_add.zte_pbm_anr1));
+ memcpy(sim_contact_add.zte_pbm_email, websGetVar(wp, T("email"), T("")),
+ sizeof(sim_contact_add.zte_pbm_email));
+ memcpy(sim_contact_add.zte_pbm_sne, websGetVar(wp, T("nick_name"), T("")),
+ sizeof(sim_contact_add.zte_pbm_sne));
+ if (sim_contact_add.zte_pbm_number[ZTE_WEB_PBM_NUMBER_TYPE_START] ==
+ ZTE_WEB_PBM_NUMBER_TYPE_SPLIT) {
+ sim_contact_add.zte_pbm_type = ZTE_WEB_PBM_NUMBER_TYPE_1;
+ } else {
+ sim_contact_add.zte_pbm_type = ZTE_WEB_PBM_NUMBER_TYPE_2;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_web_pbm_contact_saveto_sim:send messsage to mc start"); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sim_contact_add.zte_pbm_id:%d", sim_contact_add.zte_pbm_id); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sim_contact_add.name:%s", sim_contact_add.zte_pbm_name); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sim_contact_add.mobilephone_num:%s", sim_contact_add.zte_pbm_number); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sim_contact_add.zte_pbm_type:%d", sim_contact_add.zte_pbm_type); /*lint !e26*/
+
+ /*send msg to mc*/
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,ZTE_PBM_WRITE_REC_MSG, sizeof(sim_contact_add), (char*)&sim_contact_add);
+ (void)zte_web_write(ZTE_PBM_NV, PBM_OPRATING);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_PB, MSG_CMD_WRITE_PB, sizeof(sim_contact_add), (char*)&sim_contact_add, 0);
+ if (ret_code != 0) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm send create modify record fail"); /*lint !e26*/
+ (void)zte_web_write(ZTE_PBM_NV, "14");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_web_pbm_contact_saveto_sim:send messsage to mc end"); /*lint !e26*/
+ /*goto web page*/
+ zte_write_result_to_web(wp, "success");
+ return;
+}
+/**********************************************************************
+* Function: zte_web_pbm_contact_saveto_pc
+* Description: wp:web para;pc_contact_location:save location
+* Input: null
+* Output: null
+* Return: void
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120926 V1.0 liuyingnan first version
+**********************************************************************/
+static void zte_web_pbm_contact_saveto_pc(webs_t wp, int pc_contact_location)
+{
+ /*contact added type*/
+ zte_pbm_create_ext_record_s_type pc_contact_add;
+ int ret_code = 0;
+ //add by liuyingnan for server safe start
+ char* pbm_name = NULL;
+ char* pbm_mobilephone_num = NULL;
+ //add by liuyingnan for server safe end
+ /*LOG*/
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_web_pbm->zte_web_pbm_contact_saveto_pc()."); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG,"[PB] zte_web_pbm_contact_saveto_pc entry\n");
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_contact_saveto_pc(): invalid input.."); /*lint !e26*/
+ return;
+ }
+ //add by liuyingnan for server safe for xss attack start
+ pbm_name = websGetVar(wp, T("name"), T(""));
+ pbm_mobilephone_num = websGetVar(wp, T("mobilephone_num"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG,"[PB] zte_web_pbm_contact_saveto_pc entry1\n");
+ if (PBM_MAX_TEXT_LENGTH < strlen(pbm_name) || PBM_MAX_NUM_LENGTH < strlen(pbm_mobilephone_num)
+ ||DATA_NO_SAFE == zte_Safe_noSpecialChar_ucs2(pbm_name)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(pbm_mobilephone_num)
+ ) {
+ slog(MISC_PRINT, SLOG_ERR, "Get Data is no Safe:pbm_name:%s\n", pbm_name); /*lint !e26*/
+ sc_cfg_set("data_safe", "failed");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //add by liuyingnan for server safe for xss attack end
+ slog(MISC_PRINT, SLOG_DEBUG,"[PB] zte_web_pbm_contact_saveto_pc entry2\n");
+ /*init contact_add*/
+ memset(&pc_contact_add, 0, sizeof(pc_contact_add));
+ /*set struct value*/
+ pc_contact_add.zte_pbm_del_id = atoi(websGetVar(wp, T("delId"), T("-1")));
+ pc_contact_add.zte_pbm_location = pc_contact_location;
+ pc_contact_add.zte_pbm_id = atoi(websGetVar(wp, T("add_index_pc"), T("")));
+ memcpy(pc_contact_add.zte_pbm_name, websGetVar(wp, T("name"), T("")),
+ sizeof(pc_contact_add.zte_pbm_name));
+ memcpy(pc_contact_add.zte_pbm_number, websGetVar(wp, T("mobilephone_num"), T("")),
+ sizeof(pc_contact_add.zte_pbm_number));
+ memcpy(pc_contact_add.zte_pbm_anr, websGetVar(wp, T("homephone_num"), T("")),
+ sizeof(pc_contact_add.zte_pbm_anr));
+ memcpy(pc_contact_add.zte_pbm_anr1, websGetVar(wp, T("officephone_num"), T("")),
+ sizeof(pc_contact_add.zte_pbm_anr1));
+ memcpy(pc_contact_add.zte_pbm_email, websGetVar(wp, T("email"), T("")),
+ sizeof(pc_contact_add.zte_pbm_email));
+ memcpy(pc_contact_add.zte_pbm_sne, websGetVar(wp, T("nick_name"), T("")),
+ sizeof(pc_contact_add.zte_pbm_sne));
+ memcpy(pc_contact_add.zte_pbm_group, websGetVar(wp, T("groupchoose"), T("")),
+ sizeof(pc_contact_add.zte_pbm_group));
+
+ if (pc_contact_add.zte_pbm_number[ZTE_WEB_PBM_NUMBER_TYPE_START] ==
+ ZTE_WEB_PBM_NUMBER_TYPE_SPLIT) {
+ pc_contact_add.zte_pbm_type = ZTE_WEB_PBM_NUMBER_TYPE_1;
+ } else {
+ pc_contact_add.zte_pbm_type = ZTE_WEB_PBM_NUMBER_TYPE_2;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_web_pbm_contact_saveto_pc:send messsage to mc start"); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sim_contact_add.zte_pbm_id:%d", pc_contact_add.zte_pbm_id); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sim_contact_add.name:%s", pc_contact_add.zte_pbm_name); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sim_contact_add.mobilephone_num:%s", pc_contact_add.zte_pbm_number); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sim_contact_add.zte_pbm_type:%d", pc_contact_add.zte_pbm_type); /*lint !e26*/
+ printf("[PB] zte_web_pbm_contact_saveto_pc entry3\n");
+ /*send msg to mc*/
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,ZTE_PBM_WRITE_REC_MSG, sizeof(pc_contact_add), (char*)&pc_contact_add);
+ (void)zte_web_write(ZTE_PBM_NV, PBM_OPRATING);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_PB, MSG_CMD_WRITE_PB, sizeof(pc_contact_add), (char*)&pc_contact_add, 0);
+ if (ret_code != 0) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm send create modify record fail"); /*lint !e26*/
+ (void)zte_web_write(ZTE_PBM_NV, "14");
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ printf("zte_web_pbm_contact_saveto_pc:%d,%d,%d,%d\n", ret_code, MODULE_ID_WEB_CGI, MODULE_ID_PB, MSG_CMD_WRITE_PB);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_web_pbm_contact_saveto_pc:send messsage to mc end"); /*lint !e26*/
+ /*goto web page*/
+ zte_write_result_to_web(wp, "success");
+}
+
+/**********************************************************************
+* Function: zte_web_pbm_utils_parseStr
+* Description:
+* Input:
+* Output:
+* Return: void
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120409 V1.0 chenyi first version
+**********************************************************************/
+static int zte_web_pbm_utils_parseStr
+(
+ char *input, char *output, int srcLen, int destLen, char separator
+)
+{
+ /*index*/
+ int input_ind = 0;
+ int dest_ind = 0;
+ int all_ind = 0;
+
+ /*check input*/
+ if (NULL == input || NULL == output || srcLen == 0 || destLen == 0) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_utils_parseStr():invalid input."); /*lint !e26*/
+ return 0;
+ }
+
+ /*handler*/
+ for (input_ind = 0; input_ind < srcLen; input_ind++) {
+ //kw
+ if (all_ind > destLen) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_utils_parseStr():invalid param."); /*lint !e26*/
+ return 0;
+ }
+
+ if ('\0' == input[input_ind]) {
+ *(output + destLen * dest_ind + all_ind) = '\0';
+ return dest_ind + 1;
+ }
+
+ if (separator == input[input_ind]) {
+ *(output + destLen * dest_ind + all_ind) = '\0';
+ if ('\0' != input[input_ind + 1]) {
+ all_ind = 0;
+ dest_ind++;
+ }
+ } else {
+ *(output + destLen * dest_ind + all_ind) = input[input_ind];
+ all_ind++;
+ }
+ }
+
+ /*return value*/
+ return dest_ind;
+}
+
+
+/**********************************************************************
+* Function: zte_web_pbm_contact_del_part
+* Description:
+* Input: web para
+* Output:
+* Return: void
+* Others: reason of error.
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120409 V1.0 chenyi first version
+**********************************************************************/
+static void zte_web_pbm_contact_del_part(webs_t wp)
+{
+ int ret_code = 0;
+ /*deleted index get from page*/
+ char del_index[PBM_WEB_MAX_CHAR_LEN] = {0};
+ /*split deleted index*/
+ char split_index[ZTE_PB_INDEX_MAX][ZTE_WEB_PBM_REC_LEN+1];
+ /*flag of contact number*/
+ /*index for for circle*/
+ int num_ind = 0;
+ /*data struct */
+ zte_pbm_del_multi_records_s_type sendto_data;
+
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_contact_del_part(): invalid input.."); /*lint !e26*/
+ return;
+ }
+
+ /*init*/
+ memset(del_index, 0, sizeof(del_index));
+ memset(&sendto_data, 0, sizeof(sendto_data));
+ memset(split_index, 0, sizeof(split_index));
+
+ /*set data struct*/
+ //sendto_data.zte_del_pbm_location = atoi(websGetVar(wp,T("savelocation1"), T("")));
+ memcpy(del_index, websGetVar(wp, T("delete_id"), T("")), sizeof(del_index));
+ sendto_data.zte_del_pbm_total = zte_web_pbm_utils_parseStr(del_index, (char *)split_index,
+ (int)ZTE_PB_INDEX_MAX, (int)ZTE_WEB_PBM_REC_LEN, (char)ZTE_WEB_PBM_INDEX_SPLIT_FLAG);
+ slog(MISC_PRINT, SLOG_DEBUG,"liuyingnan sendto_data.zte_del_pbm_total:%d", sendto_data.zte_del_pbm_total); /*lint !e26*/
+
+ /*del one contact*/
+ if (ZTE_WEB_PBM_DEL_MULT_OR_ONE_FLAG == sendto_data.zte_del_pbm_total) {
+ sendto_data.zte_del_pbm_id[ZTE_WEB_PBM_DEL_ONE_IND] = atoi(split_index[ZTE_WEB_PBM_DEL_ONE_IND]);
+
+#if 0
+ if (-1 == zte_mc_relay_pbm_del_one_record(&sendto_data)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_contact_del_part():delete one contact failed."); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+#endif
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_web_pbm_contact_del_part:send messsage start"); /*lint !e26*/
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,ZTE_PBM_DEL_A_REC_MSG, sizeof(sendto_data), (char*)&sendto_data);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_PB, MSG_CMD_DEL_A_PB, sizeof(sendto_data), (char*)&sendto_data, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_web_pbm_contact_del_part:send messsage end"); /*lint !e26*/
+ if (ret_code != 0) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm send DEL A record fail"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ } else {
+ /*handler*/
+ for (num_ind = 0; num_ind < sendto_data.zte_del_pbm_total; num_ind ++) {
+ sendto_data.zte_del_pbm_id[num_ind] = atoi(split_index[num_ind]);
+ printf("zte_web_pbm->zte_web_pbm_contact_del_part():split_index=[%d]", sendto_data.zte_del_pbm_id[num_ind]); /*lint !e26*/
+ }
+
+ /*handler*/
+#if 0
+ if (-1 == zte_mc_relay_pbm_del_multi_record(&sendto_data)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_contact_del_part():delete mult contact failed."); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+#endif
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,ZTE_PBM_DEL_MUTI_REC_MSG, sizeof(sendto_data), (char*)&sendto_data);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_PB, MSG_CMD_DEL_MUTI_PB, sizeof(sendto_data), (char*)&sendto_data, 0);
+ if (ret_code != 0) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm send DEL MUTI record fail"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ }
+ /*goto differ page*/
+ (void)zte_web_write(ZTE_PBM_NV, PBM_OPRATING);
+ zte_write_result_to_web(wp, "success");
+ //zte_web_pbm_goto_diff_page(wp,sendto_data.zte_del_pbm_location);
+}
+/**********************************************************************
+* Function: zte_web_pbm_contact_del_all
+* Description:
+* Input: web para
+* Output: null
+* Return: void
+* Others: reason of error.
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120409 V1.0 chenyi first version
+**********************************************************************/
+static void zte_web_pbm_contact_del_all(webs_t wp)
+{
+ int ret_code = 0;
+ /*data struct*/
+ zte_pbm_del_multi_records_s_type sendto_data;
+
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_contact_del_all(): invalid input.."); /*lint !e26*/
+ return;
+ }
+
+ /*init*/
+ memset(&sendto_data, 0, sizeof(sendto_data));
+
+ /*set data struct*/
+ sendto_data.zte_del_pbm_location = atoi(websGetVar(wp, T("del_all_location"), T("")));
+ slog(MISC_PRINT, SLOG_DEBUG, "liuyingnan sendto_data.zte_del_pbm_location:%d", sendto_data.zte_del_pbm_location); /*lint !e26*/
+
+ /*handler del all*/
+ //(void)zte_mc_relay_pbm_del_all_record(&sendto_data);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_web_pbm_contact_del_all:send messsage start"); /*lint !e26*/
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,ZTE_PBM_DEL_ALL_REC_MSG, sizeof(sendto_data), (char*)&sendto_data);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_PB, MSG_CMD_DEL_ALL_PB, sizeof(sendto_data), (char*)&sendto_data, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_web_pbm_contact_del_all:send messsage end"); /*lint !e26*/
+ if (ret_code != 0) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm send DEL ALL record fail"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ /*goto differ page*/
+ (void)zte_web_write(ZTE_PBM_NV, PBM_OPRATING);
+ zte_write_result_to_web(wp, "success");
+ //zte_web_pbm_goto_diff_page(wp,sendto_data.zte_del_pbm_location);
+}
+/**********************************************************************
+* Function: zte_web_pbm_contact_del_by_group
+* Description:
+* Input: web para
+* Output:
+* Return: void
+* Others: reason of error.
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120711 V1.0 chenyi first version
+**********************************************************************/
+static void zte_web_pbm_contact_del_by_group(webs_t wp)
+{
+ int ret_code = 0;
+ zte_pbm_del_multi_records_s_type sendto_data;
+ char *group = NULL;
+
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_contact_del_by_group(): invalid input.."); /*lint !e26*/
+ return;
+ }
+
+ /*init*/
+ memset(&sendto_data, 0, sizeof(zte_pbm_del_multi_records_s_type));
+
+ group = websGetVar(wp, T("del_group"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "liuyingnan group:%s", group); /*lint !e26*/
+ if (0 == strcmp(group, "")) {
+ slog(MISC_PRINT, SLOG_ERR, "pbm:group is empty.\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ /*set data struct*/
+ sendto_data.zte_del_pbm_location = atoi(websGetVar(wp, T("del_all_location"), T("0")));
+ slog(MISC_PRINT, SLOG_DEBUG, "liuyingnan sendto_data.zte_del_pbm_location:%d", sendto_data.zte_del_pbm_location); /*lint !e26*/
+
+ if (ZTE_NVIO_DONE != zte_web_write("pbm_group", group)) {
+ slog(MISC_PRINT, SLOG_ERR, "write the nv [pbm_group] failure.\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ (void)zte_web_write(ZTE_PBM_NV, PBM_OPRATING);
+
+#if 0
+ if (ZTE_MC_OK_S != zte_mc_relay_pbm_del_all_record(&sendto_data)) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_mc_relay_pbm_del_all_record fail.\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ } else {
+ zte_write_result_to_web(wp, SUCCESS);
+ }
+#endif
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_web_pbm_contact_del_by_group:send messsage start"); /*lint !e26*/
+ //ret_code = zte_send_message(ZUFI_MODULE_ID_AT_LOCAL,ZTE_PBM_DEL_ALL_REC_MSG, sizeof(sendto_data), (char*)&sendto_data);
+ ret_code = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_PB, MSG_CMD_DEL_ALL_PB, sizeof(sendto_data), (char*)&sendto_data, 0);
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_web_pbm_contact_del_by_group:send messsage end"); /*lint !e26*/
+ if (ret_code != 0) {
+ slog(MISC_PRINT, SLOG_ERR, "mc lib relay pbm send DEL record by group fail"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ zte_write_result_to_web(wp, "success");
+}
+
+
+/**********************************************************************
+* Function: zte_goform_pbm_contact_add_process
+* Description:
+* Input: null
+* Output: null
+* Return: void
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120926 V1.0 liuyingnan first version
+**********************************************************************/
+void zte_goform_pbm_contact_add_process(webs_t wp)
+{
+ /*contact location*/
+ int contact_location = 0;
+
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_goform_pbm_contact_add_process(): invalid input.."); /*lint !e26*/
+ return;
+ }
+
+ if (0 == zte_web_pbm_check_can_process()) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ /*get the saved mem*/
+ contact_location = atoi(websGetVar(wp, T("location"), T("")));
+ slog(MISC_PRINT, SLOG_DEBUG,"[PB] zte_web_pbm_check_can_process contact_location=%d, can process.\n", contact_location);
+ /*goto different mem handler*/
+ switch (contact_location) {
+ case ZTE_WEB_PBM_CONTACT_SIM: { /*goto sim mem handler*/
+ slog(MISC_PRINT, SLOG_DEBUG,"[PB] zte_web_pbm_check_can_process sim=%d, can process.\n", ZTE_WEB_PBM_CONTACT_SIM);
+ zte_web_pbm_contact_saveto_sim(wp, ZTE_WEB_PBM_CONTACT_SIM);
+ break;
+ }
+ case ZTE_WEB_PBM_CONTACT_PC: { /*goto pc mem handler*/
+ slog(MISC_PRINT, SLOG_DEBUG,"[PB] zte_web_pbm_check_can_process pc=%d, can process.\n", ZTE_WEB_PBM_CONTACT_PC);
+ zte_web_pbm_contact_saveto_pc(wp, ZTE_WEB_PBM_CONTACT_PC);
+ break;
+ }
+
+ default: { /*unknown mem*/
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_goform_pbm_contact_add_process():unknown pbm mem."); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+ }
+}
+
+void zte_goform_pbm_contact_del_process(webs_t wp)
+{
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_web_pbm_contact_del_all(): invalid input.."); /*lint !e26*/
+ return;
+ }
+
+ if (0 == zte_web_pbm_check_can_process()) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ /*del the given index contact in specified mem*/
+ if (0 == strcmp(websGetVar(wp, T("del_option"), T("")), ZTE_WEB_PBM_PAGE_DEL_PART)) {
+ zte_web_pbm_contact_del_part(wp);
+ }
+
+ /*del all the contact in specified mem*/
+ else if (0 == strcmp(websGetVar(wp, T("del_option"), T("")), ZTE_WEB_PBM_PAGE_DEL_ALL)) {
+ zte_web_pbm_contact_del_all(wp);
+ }
+ //delete the pbm data by group
+ else if (0 == strcmp(websGetVar(wp, T("del_option"), T("")), ZTE_WEB_PBM_DEL_BY_GROUP)) {
+ zte_web_pbm_contact_del_by_group(wp);
+ }
+
+ else {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_pbm->zte_goform_pbm_contact_del_process():unknown pbm del."); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+
+}
+
+
+/**********************************************************************
+* Function: zte_get_pbm_data
+* Description: to get the pbm data info
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/04/10 V1.0 chenyi first version
+**********************************************************************/
+void zte_get_pbm_data(webs_t wp)
+{
+ zte_pbm_query_req_s_type pbm_query_req;
+ zte_pbm_query_resp_s_type *p_pbm_query_result = NULL;
+ int result = 0;
+ int i = 0;
+ char_t *page = NULL;
+ char_t *data_per_page = NULL;
+ char_t *mem_store = NULL;
+
+ memset(&pbm_query_req, 0, sizeof(zte_pbm_query_req_s_type));
+
+ page = websGetVar(wp, "page", T(""));
+ data_per_page = websGetVar(wp, "data_per_page", T(""));
+ mem_store = websGetVar(wp, "mem_store", T(""));
+
+ if (('\0' == *page) || ('\0' == *data_per_page) || ('\0' == *mem_store)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_get_pbm_data: invalid web para.\n"); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ return ;
+ }
+ int tmp_page = atoi(page);
+ int tmp_num_per_page = atoi(data_per_page);
+ int location = atoi(mem_store);
+ if((tmp_page < 0 || tmp_page > 255)
+ ||(tmp_num_per_page < 0 || tmp_num_per_page > 255)
+ ||(location < PBM_LOCATION_SIM || location > PBM_LOCATION_MAX)){
+ slog(MISC_PRINT, SLOG_ERR, "zte_get_pbm_data:err[%d,%d,%d]\n", tmp_page,tmp_num_per_page,location); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ return ;
+ }
+ pbm_query_req.page = (uint8)tmp_page;
+ pbm_query_req.num_per_page = (uint8)tmp_num_per_page;
+ pbm_query_req.location = (zte_pbm_location_e_type)location; //0:sim;1:device
+
+ slog(MISC_PRINT, SLOG_DEBUG, "pbm_query_req:[%u,%u,%d].\n", pbm_query_req.page, pbm_query_req.num_per_page, pbm_query_req.location); /*lint !e26*/
+
+ p_pbm_query_result = (zte_pbm_query_resp_s_type*)malloc(4 + sizeof(zte_pbm_create_ext_record_s_type) * (pbm_query_req.num_per_page));
+ if (NULL == p_pbm_query_result) {
+ slog(MISC_PRINT, SLOG_ERR, "malloc pbm result mem fail.\n"); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ return ;/*lint !e429*/
+ }
+
+ memset(p_pbm_query_result, 0, (4 + sizeof(zte_pbm_create_ext_record_s_type) * (pbm_query_req.num_per_page))); /*lint !e668*/
+
+ slog(MISC_PRINT, SLOG_DEBUG, "GET PBM DATA FROM DB START.\n"); /*lint !e26*/
+ result = zte_libpbm_get_rec_data(&pbm_query_req, p_pbm_query_result);
+ slog(MISC_PRINT, SLOG_DEBUG, "GET PBM DATA FROM DB END.\n"); /*lint !e26*/
+
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_libpbm_get_rec_data fail.\n"); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ //free
+// if (NULL != p_pbm_query_result) { // kw 3
+ free(p_pbm_query_result);
+ p_pbm_query_result = NULL;
+// }
+ return ;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "total query count [%u].\n", (*p_pbm_query_result).count); /*lint !e26*/
+
+ if (0 == (*p_pbm_query_result).count) {
+ zte_web_pbm_feed_back_empty(wp);
+ //free
+// if (NULL != p_pbm_query_result) { kw 3
+ free(p_pbm_query_result);
+ p_pbm_query_result = NULL;
+// }
+ return ;
+ }
+
+ //write the pbm data to web
+ for (i = 0; i < (*p_pbm_query_result).count; i++) {
+ if (0 == i) {
+ web_feedback_header(wp);
+ zte_rest_get_pbm_data_head(wp);
+ if (0 == pbm_query_req.location) {
+ zte_rest_get_pbm_data_sim(wp, p_pbm_query_result, i, 0);
+ } else {
+ zte_rest_get_pbm_data_other(wp, p_pbm_query_result, i, 0);
+ }
+ } else {
+ if (0 == pbm_query_req.location) {
+ zte_rest_get_pbm_data_sim(wp, p_pbm_query_result, i, 1);
+ } else {
+ zte_rest_get_pbm_data_other(wp, p_pbm_query_result, i, 1);
+ }
+ }
+ }
+ zte_rest_get_pbm_data_foot(wp);
+ //(void)websWrite(wp, T("]}"));
+
+ //free
+// if (NULL != p_pbm_query_result) { // kw 3
+ free(p_pbm_query_result);
+ p_pbm_query_result = NULL;
+// }
+}
+
+/**********************************************************************
+* Function: zte_get_pbm_data_total
+* Description: to get the total pbm data
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/04/10 V1.0 chenyi first version
+**********************************************************************/
+void zte_get_pbm_data_total(webs_t wp)
+{
+ zte_pbm_query_req_s_type pbm_query_req;
+ zte_pbm_query_resp_s_type *p_pbm_query_result = NULL;
+ int result = 0;
+ int i = 0;
+ char_t *page = NULL;
+ char_t *data_per_page = NULL;
+ char_t *mem_store = NULL;
+ char *pbm_group = NULL;
+
+ int total_pages = 0;
+ int leave_nums = 0;
+ int curr_page = 0;
+ int total_pbm = 0;
+
+ int idata_per_page = 0;
+
+ memset(&pbm_query_req, 0, sizeof(zte_pbm_query_req_s_type));
+
+ page = websGetVar(wp, "page", T(""));
+ data_per_page = websGetVar(wp, "data_per_page", T(""));
+ mem_store = websGetVar(wp, "mem_store", T(""));
+ pbm_group = websGetVar(wp, "pbm_group", T("")); //not to check whether is empty
+
+ if (('\0' == *page) || ('\0' == *data_per_page) || ('\0' == *mem_store)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_get_pbm_data: invalid web para.\n"); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ return ;
+ }
+
+
+#if 0
+ //calculate the total pages
+ total_pages = (atoi(data_per_page)) / PBM_PAGE_RECORD_MAX_NUM;
+ leave_nums = (atoi(data_per_page)) % PBM_PAGE_RECORD_MAX_NUM;
+
+ if (0 != leave_nums) {
+ total_pages++;
+ }
+
+#else
+ idata_per_page = atoi(data_per_page);
+ if(idata_per_page < 0 || idata_per_page > INT_MAX-1)
+ {
+ total_pages = 1;
+ leave_nums = 0;
+ }
+ else
+ {
+ //calculate the total pages
+ total_pages = idata_per_page / PBM_PAGE_RECORD_MAX_NUM;
+ leave_nums = idata_per_page % PBM_PAGE_RECORD_MAX_NUM;
+
+ if (0 != leave_nums) {
+ total_pages++;
+ }
+ }
+#endif
+
+ slog(MISC_PRINT, SLOG_DEBUG, "pbm:total_pages,leave_nums:[%d][%d]", total_pages, leave_nums); /*lint !e26*/
+
+ p_pbm_query_result = (zte_pbm_query_resp_s_type*)malloc(4 + sizeof(zte_pbm_create_ext_record_s_type) * PBM_PAGE_RECORD_MAX_NUM);
+ if (NULL == p_pbm_query_result) {
+ slog(MISC_PRINT, SLOG_ERR, "malloc pbm result mem fail.\n"); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ return ;/*lint !e429*/
+ }
+
+ (void)zte_web_write("pbm_group", pbm_group); //only wrtite one time
+
+ for (curr_page = 0; curr_page < total_pages; curr_page++) {
+
+ //reset
+ memset(&pbm_query_req, 0, sizeof(zte_pbm_query_req_s_type));
+
+ pbm_query_req.page = curr_page;
+ pbm_query_req.num_per_page = PBM_PAGE_RECORD_MAX_NUM;
+ /*lint -e64*/
+ pbm_query_req.location = atoi(mem_store); //0:sim;1:device
+
+ slog(MISC_PRINT, SLOG_DEBUG, "pbm_query_req:[%u,%u,%d].\n", pbm_query_req.page, pbm_query_req.num_per_page, pbm_query_req.location); /*lint !e26*/
+
+ //reset
+ memset(p_pbm_query_result, 0, 4 + sizeof(zte_pbm_create_ext_record_s_type)*PBM_PAGE_RECORD_MAX_NUM); /*lint !e668*/
+
+ slog(MISC_PRINT, SLOG_NORMAL, "GET PBM DATA FROM DB START.\n"); /*lint !e26*/
+ result = zte_libpbm_get_rec_data(&pbm_query_req, p_pbm_query_result);
+ slog(MISC_PRINT, SLOG_DEBUG, "GET PBM DATA FROM DB END.\n"); /*lint !e26*/
+
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_DEBUG, "read pbm page [%d] fail.\n", curr_page); /*lint !e26*/
+ //free
+// if (NULL != p_pbm_query_result) { // kw 3
+ free(p_pbm_query_result);
+ p_pbm_query_result = NULL;
+// }
+
+ if (0 == curr_page) {
+ zte_web_pbm_feed_back_empty(wp);
+ return ;
+ } else {
+ break;
+ }
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "pbm:total query count [%u].\n", (*p_pbm_query_result).count); /*lint !e26*/
+
+ if (0 == (*p_pbm_query_result).count) {
+ //free
+// if (NULL != p_pbm_query_result) { // kw 3
+ free(p_pbm_query_result);
+ p_pbm_query_result = NULL;
+// }
+
+ if (0 == curr_page) {
+ zte_web_pbm_feed_back_empty(wp);
+ return ;
+ } else {
+ break;
+ }
+ }
+
+ //write the pbm data to web
+ for (i = 0; (i < (*p_pbm_query_result).count) && (total_pbm < atoi(data_per_page)); i++, total_pbm++) {
+ if ((0 == i) && (0 == curr_page)) {
+ web_feedback_header(wp);
+ zte_rest_get_pbm_data_head(wp);
+ if (0 == pbm_query_req.location) {
+ zte_rest_get_pbm_data_sim(wp, p_pbm_query_result, i, 0);
+ } else {
+ zte_rest_get_pbm_data_other(wp, p_pbm_query_result, i, 0);
+ }
+ } else {
+ if (0 == pbm_query_req.location) {
+ zte_rest_get_pbm_data_sim(wp, p_pbm_query_result, i, 1);
+ } else {
+ zte_rest_get_pbm_data_other(wp, p_pbm_query_result, i, 1);
+ }
+ }
+ }
+
+ }
+
+
+ zte_rest_get_pbm_data_foot(wp);
+ //free
+// if (NULL != p_pbm_query_result) { // kw 3
+ free(p_pbm_query_result);
+ p_pbm_query_result = NULL;
+// }
+}
+
+/**********************************************************************
+* Function: zte_get_pbm_parameter_info
+* Description: to get the pbm parameter info
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/04/10 V1.0 chenyi first version
+**********************************************************************/
+void zte_get_pbm_parameter_info(webs_t wp)
+{
+ zte_pbm_query_req_s_type pbm_para_query_info;
+ zte_pbm_sim_capability_s_type pbm_sim_capability_s;
+ zte_pbm_device_capability_s_type pbm_device_capability_s;
+ char *pbm_location = NULL;
+ int result = 0;
+
+ //initialize
+ memset(&pbm_para_query_info, 0, sizeof(zte_pbm_query_req_s_type));
+ memset(&pbm_sim_capability_s, 0, sizeof(zte_pbm_sim_capability_s_type));
+ memset(&pbm_device_capability_s, 0, sizeof(zte_pbm_device_capability_s_type));
+
+ pbm_location = websGetVar(wp, "pbm_location", T(""));
+
+ if (0 == strcmp(pbm_location, "")) {
+ slog(MISC_PRINT, SLOG_ERR, "pbm_location is empty.\n"); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "pbm_location is [%s].\n", pbm_location); /*lint !e26*/
+
+ if (0 == strcmp(pbm_location, PBM_NATIVE)) {
+ pbm_para_query_info.location = PBM_LOCATION_DEVICE;
+ } else if (0 == strcmp(pbm_location, PBM_SIM)) {
+ pbm_para_query_info.location = PBM_LOCATION_SIM;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "invalid pbm_location[%s].\n", pbm_location); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_NORMAL, "GET PBM DATA FROM DB START.\n"); /*lint !e26*/
+ result = zte_libpbm_get_capability(&pbm_para_query_info, &pbm_sim_capability_s, &pbm_device_capability_s);
+ slog(MISC_PRINT, SLOG_DEBUG, "GET PBM DATA FROM DB END.\n"); /*lint !e26*/
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_libpbm_get_capability fail.\n"); /*lint !e26*/
+ zte_web_pbm_feed_back_empty(wp);
+ return ;
+ }
+
+ web_feedback_header(wp);
+ if (0 == strcmp(pbm_location, PBM_NATIVE)) {
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write_int(wp, PBM_DEV_MAX_RECORD_NUM, pbm_device_capability_s.max_record_number, 1);
+ zte_rest_cmd_write_int(wp, PBM_DEV_USED_RECORD_NUM, pbm_device_capability_s.used_record_number, 0);
+ zte_rest_cmd_write_foot(wp);
+ } else {
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write_int(wp, PBM_SIM_SIM_TYPE, pbm_sim_capability_s.sim_type, 1);
+ zte_rest_cmd_write_int(wp, PBM_SIM_MAX_RECORD_NUM, pbm_sim_capability_s.max_record_number, 1);
+ zte_rest_cmd_write_int(wp, PBM_SIM_USED_RECORD_NUM, pbm_sim_capability_s.used_record_number, 1);
+ zte_rest_cmd_write_int(wp, PBM_SIM_MAX_NAME_LEN, pbm_sim_capability_s.max_name_len, 1);
+ zte_rest_cmd_write_int(wp, PBM_SIM_MAX_NUMBER_LEN, pbm_sim_capability_s.max_number_len, 0);
+ zte_rest_cmd_write_foot(wp);
+ }
+}
+
+/**********************************************************************
+* Function: zte_web_pbm_feed_back_empty
+* Description: to write empty info to web
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/04/10 V1.0 chenyi first version
+**********************************************************************/
+
+static void zte_web_pbm_feed_back_empty(webs_t wp)
+{
+ if (NULL == wp) {
+ return;
+ }
+
+ web_feedback_header(wp);
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<%s>empty</%s>\n"), PBM_DATA, PBM_DATA);
+ } else {
+ (void)websWrite(wp, T("{\"%s\":[]}"), PBM_DATA);
+ }
+ //(void)websWrite(wp, T("{\"%s\":[]}"),PBM_DATA);
+}
+//added by chenyi for handle the http request end 20111118
+
diff --git a/ap/app/goahead/interface5.0/zte_web_pbm.h b/ap/app/goahead/interface5.0/zte_web_pbm.h
new file mode 100644
index 0000000..89a70eb
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_pbm.h
@@ -0,0 +1,194 @@
+
+
+
+#ifndef boolean
+#define boolean unsigned char
+#endif
+
+#ifndef PBM_MAX_DEL_LEN
+#define PBM_MAX_DEL_LEN 50
+#endif
+
+#ifndef ZTE_PB_INDEX_MAX
+#define ZTE_PB_INDEX_MAX 100
+#endif
+
+#ifndef ZTE_WEB_PBM_REC_LEN
+#define ZTE_WEB_PBM_REC_LEN 32
+#endif
+
+#ifndef PBM_WEB_MAX_CHAR_LEN
+#define PBM_WEB_MAX_CHAR_LEN ZTE_WEB_PBM_REC_LEN*ZTE_PB_INDEX_MAX
+#endif
+
+#ifndef PBM_MAX_NUM_LENGTH
+#define PBM_MAX_NUM_LENGTH 40
+#endif
+
+#ifndef PBM_NUM_SIZE
+#define PBM_NUM_SIZE (PBM_MAX_NUM_LENGTH+2) /* + and null for string */
+#endif
+
+
+#ifndef uint16
+#define uint16 unsigned short
+#endif
+
+#ifndef PBM_MAX_TEXT_LENGTH
+#define PBM_MAX_TEXT_LENGTH 90
+#endif
+
+#ifndef PBM_TEXT_SIZE_CHARS
+#define PBM_TEXT_SIZE_CHARS (PBM_MAX_TEXT_LENGTH+1) /* Null terminated string */
+#endif
+
+#ifndef PBM_TEXT_SIZE_BYTES
+#define PBM_TEXT_SIZE_BYTES (PBM_TEXT_SIZE_CHARS*sizeof(uint16)) /* size in bytes */
+#endif
+
+#ifndef ZTE_PBM_NV
+#define ZTE_PBM_NV "pbm_write_flag"
+#endif
+
+#define PBM_OPRATING "20"
+
+#define PBM_SIM "pbm_sim"
+#define PBM_NATIVE "pbm_native"
+
+//pbm device capacity
+#define PBM_DEV_MAX_RECORD_NUM "pbm_dev_max_record_num"
+#define PBM_DEV_USED_RECORD_NUM "pbm_dev_used_record_num"
+
+//pbm sim capacity
+#define PBM_SIM_SIM_TYPE "pbm_sim_type"
+#define PBM_SIM_MAX_RECORD_NUM "pbm_sim_max_record_num"
+#define PBM_SIM_USED_RECORD_NUM "pbm_sim_used_record_num"
+#define PBM_SIM_MAX_NAME_LEN "pbm_sim_max_name_len"
+#define PBM_SIM_MAX_NUMBER_LEN "pbm_sim_max_number_len"
+#define PBM_SIM_MAX_ANR_NUM "pbm_sim_max_anr_num"
+#define PBM_SIM_MAX_ANR_LEN "pbm_sim_max_anr_len"
+#define PBM_SIM_MAX_ANR1_NUM "pbm_sim_max_anr1_num"
+#define PBM_SIM_MAX_ANR1_LEN "pbm_sim_max_anr1_len"
+#define PBM_SIM_MAX_EMAIL_NUM "pbm_sim_max_email_num"
+#define PBM_SIM_MAX_EMAIL_LEN "pbm_sim_max_email_len"
+#define PBM_SIM_MAX_SNE_LEN "pbm_sim_max_sne_len"
+
+#define ZTE_WEB_PBM_NUMBER_TYPE_1 145
+#define ZTE_WEB_PBM_NUMBER_TYPE_2 129
+#define ZTE_WEB_PBM_NUMBER_TYPE_SPLIT '+'
+#define ZTE_WEB_PBM_NUMBER_TYPE_START 0
+#define ZTE_WEB_PBM_PAGE_DEL_PART "delete_num"
+#define ZTE_WEB_PBM_PAGE_DEL_ALL "delete_all"
+#define ZTE_WEB_PBM_DEL_BY_GROUP "delete_all_by_group"
+#define ZTE_WEB_PBM_REC_LEN 32
+#define ZTE_WEB_PBM_INDEX_SPLIT_FLAG ','
+#define ZTE_WEB_PBM_DEL_MULT_OR_ONE_FLAG 1
+#define ZTE_WEB_PBM_DEL_MULT_FLAG 0
+#define ZTE_WEB_PBM_DEL_ONE_IND 0
+#define ZTE_WEB_PBM_MEM_SIM 0
+
+#define PBM_PAGE_RECORD_MAX_NUM 10
+
+#define PBM_DATA "pbm_data"
+
+#define PBM_ID "pbm_id"
+#define PBM_INDEX "pbm_index"
+#define PBM_LOCATION "pbm_location"
+#define PBM_NAME "pbm_name"
+#define PBM_NUMBER "pbm_number"
+#define PBM_TYPE "pbm_type"
+#define PBM_ANR "pbm_anr"
+#define PBM_ANR1 "pbm_anr1"
+#define PBM_EMAIL "pbm_email"
+#define PBM_SNE "pbm_sne"
+#define PBM_GROUP "pbm_group"
+
+typedef struct zte_pbm_create_ext_record_s_type {
+ int zte_pbm_id; //the id in the pbm table,unique,ASC
+ int zte_pbm_index;
+ int zte_pbm_location;
+ char zte_pbm_name[PBM_TEXT_SIZE_BYTES];
+ char zte_pbm_number[PBM_NUM_SIZE];
+ int zte_pbm_type;
+ char zte_pbm_anr[PBM_NUM_SIZE];
+ char zte_pbm_anr1[PBM_NUM_SIZE];
+ char zte_pbm_email[PBM_TEXT_SIZE_BYTES];
+ //char zte_pbm_sne[PBM_TEXT_SIZE_BYTES];
+ //char zte_pbm_group[PBM_TEXT_SIZE_BYTES];
+ char zte_pbm_sne[32];// 91*2 ---> 32 ÔÝʱδÓõ½¸Ã²ÎÊý
+ char zte_pbm_group[32]; // 91*2 ---> 32
+ int zte_pbm_del_id;
+} zte_pbm_create_ext_record_s_type;
+
+
+
+typedef enum zte_web_pbm_contact_save {
+ ZTE_WEB_PBM_CONTACT_SIM,
+ ZTE_WEB_PBM_CONTACT_PC,
+
+ ZTE_WEB_PBM_MAX
+} zte_web_pbm_contact_save_e_type;
+
+typedef struct zte_pbm_del_multi_records_s_type {
+ int zte_del_pbm_id[PBM_MAX_DEL_LEN];
+ int zte_del_pbm_total;
+ int zte_del_pbm_location;
+ int zte_del_pbm_index[PBM_MAX_DEL_LEN];
+} zte_pbm_del_multi_records_s_type;
+
+
+typedef enum {
+ PBM_LOCATION_SIM = 0, //sim card only,exsit in database
+ PBM_LOCATION_DEVICE = 1, //device only,exit in database
+ PBM_LOCATION_ALL = 2, //sim card and device, not exsit in database, only use in pbm code
+ PBM_LOCATION_GROUP = 3, //group in device,for example:common,family and so on,not exsit in database, only use in pbm code
+
+ PBM_LOCATION_MAX
+} zte_pbm_location_e_type;
+
+typedef struct {
+ uint8 page;
+ uint8 num_per_page;
+ zte_pbm_location_e_type location;
+ boolean asc_flag;
+ uint8 order_by;
+} zte_pbm_query_req_s_type;
+
+
+
+
+typedef struct {
+ uint8 count;
+ zte_pbm_create_ext_record_s_type data[0]; /*lint !e1501*/
+} zte_pbm_query_resp_s_type;
+
+
+typedef struct {
+ int sim_type;
+ int max_record_number;
+ int used_record_number;
+ int max_name_len;
+ int max_number_len;
+ int max_anr_num;
+ int max_anr_len;
+ int max_anr1_num;
+ int max_anr1_len;
+ int max_email_num;
+ int max_email_len;
+ int max_sne_len;
+} zte_pbm_sim_capability_s_type;
+
+
+typedef struct {
+ int max_record_number;
+ int used_record_number;
+} zte_pbm_device_capability_s_type;
+
+extern void zte_rest_get_pbm_data_head(webs_t wp);
+extern void zte_rest_get_pbm_data_foot(webs_t wp);
+extern void zte_rest_get_pbm_data_sim(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index, int tag);
+extern void zte_rest_get_pbm_data_other(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index, int tag);
+
+
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_regist.c b/ap/app/goahead/interface5.0/zte_web_regist.c
new file mode 100644
index 0000000..7ad06b1
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_regist.c
@@ -0,0 +1,25 @@
+/**
+ * @file zte_web_regist.c
+ * @brief goform mesage processing
+ *
+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.
+ * @author Hong Wu <wu.hong@sanechips.com.cn>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+//#include "zte_web_interface.h"
+//#include "zte_web_get_fw_para.h"
+
+/*******************************************************************************
+ * Global variable definitions *
+ ******************************************************************************/
+//web_goform_type web_goform_set_cmd_table²Î¼ûzte_web_util.c
+
diff --git a/ap/app/goahead/interface5.0/zte_web_rest.c b/ap/app/goahead/interface5.0/zte_web_rest.c
new file mode 100644
index 0000000..95b1f8f
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_rest.c
@@ -0,0 +1,461 @@
+#include "message.h"
+#include "zte_web_rest.h"
+#include "zte_web_pbm.h"
+#include "zte_web_sms.h"
+//#include "SMS_main.h"
+
+
+/*lint -e123*/
+int websXMLPostHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, char_t *url, char_t *path, char_t *query)
+{
+ //int result = 0;
+ //char_t *cmd = NULL;
+ slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:START!"); /*lint !e26*/
+ if (NULL == wp ) {
+ slog(MISC_PRINT, SLOG_ERR, "wp is null!"); /*lint !e26*/
+ return 1;
+ }
+ if (NULL == urlPrefix || NULL == webDir || NULL == url || NULL == path || NULL == query) {
+ slog(MISC_PRINT, SLOG_ERR, "In put is null!"); /*lint !e26*/
+ websError(wp, 200, T("websXMLPostHandler:input is NULL"));
+ return 1;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:middle!"); /*lint !e26*/
+
+#if 0
+ cmd = websGetVar(wp, T("action_process"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:websGetVar->action_process:[%s]", cmd); /*lint !e26*/
+ cmd = websGetVar(wp, T("goformId"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:websGetVar->goformid:[%s]", cmd); /*lint !e26*/
+ cmd = websGetVar(wp, T("cmd"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:websGetVar->cmd:[%s]", cmd); /*lint !e26*/
+
+ cmd = websGetVar(wp, T("xml_tag"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:websGetVar->setdata:[%s]", cmd); /*lint !e26*/
+ websWrite(wp, T("liuyingnan:xml_tag:%s\n"), cmd);
+#endif
+
+ zte_xml_switch_handler(wp);
+ return 0;
+}
+
+
+void zte_xml_switch_handler(webs_t wp)
+{
+ char_t *action = NULL;
+ char_t *zte_goform_id = NULL;
+
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_xml_switch_handler>>wp->path]:%s\n", wp->query); /*lint !e26 !e1013*/
+ zte_goform_id = websGetVar(wp, T("goformId"), T(""));
+ action = websGetVar(wp, T("action_process"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_xml_switch_handler>>test websGetVar]:%s\n", zte_goform_id); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_xml_switch_handler>>action]:%s\n", action); /*lint !e26*/
+ if (0 == strcmp(action, "get")) {
+
+ zte_goform_get_cmd_process(wp,T(""),T("")); /*lint !e1013*/
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_xml_switch_handler]:get action end\n"); /*lint !e26*/
+ return;
+ } else if (0 == strcmp(action, "set")) {
+ zte_goform_set_cmd_process(wp,T(""),T(""));/*lint !e1013*/
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_xml_switch_handler]:set action end\n"); /*lint !e26*/
+ return;
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_xml_switch_handler]:Can not find action\n"); /*lint !e26*/
+ return;
+ }
+
+}
+#if 0 //for kw
+void zte_change_wp_query(webs_t wp, char_t *xml_str)
+{
+ //char goformId[50] = {0};
+ //char getData[500] = {0};
+ //char setData[500] = {0};
+ //char action[20] = {0};
+ ezxml_root_t root = NULL;
+ ezxml_t xml = NULL;
+ ezxml_t action_tag = NULL;
+
+ root = (ezxml_root_t)ezxml_parse_str(xml_str, strlen(xml_str));
+ xml = & (root->xml);
+ if(xml == NULL)
+ return;
+ //slog(MISC_PRINT,SLOG_DEBUG,"[zte_change_wp_query_new]:xml->name:%s",xml->name);/*lint !e26*/
+ action_tag = xml->child;
+
+ if (! action_tag) {
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_change_wp_query_new]:action_tag is NULL or the xml_str is not full!"); /*lint !e26*/
+ //zte_write_result_to_web(wp,"action_tag is NULL!");
+ return;
+ } else {
+ while (action_tag) {
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_change_wp_query_new]:name:%s", action_tag->name); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "[zte_change_wp_query_new]:text:%s", action_tag->txt); /*lint !e26*/
+ websSetVar(wp, action_tag->name, action_tag->txt);
+ action_tag = action_tag->sibling;
+ }
+
+ }
+
+ return;
+}
+#endif
+
+void zte_rest_result_write(webs_t wp, char_t *result)
+{
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<data>\n"));
+ websWrite(wp, T("<result>%s</result>\n"), result);
+ websWrite(wp, T("</data>\n"));
+ websWrite(wp, T("\n"));
+}
+
+void zte_rest_cmd_write(webs_t wp, char_t *name, char_t *value, int r_flag)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<%s>%s</%s>\n"), name, value, name);
+ } else {
+ if (r_flag == 1) {
+ websWrite(wp, T("\"%s\":\"%s\","), name, value);
+ } else {
+ websWrite(wp, T("\"%s\":\"%s\""), name, value);
+ }
+ }
+}
+
+void zte_rest_cmd_write_int(webs_t wp, char_t *name, int value, int r_flag)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<%s>%d</%s>\n"), name, value, name);
+ } else {
+ if (r_flag == 1) {
+ websWrite(wp, T("\"%s\":\"%d\","), name, value);
+ } else {
+ websWrite(wp, T("\"%s\":\"%d\""), name, value);
+ }
+ }
+}
+
+void zte_rest_cmd_write_head(webs_t wp)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<data>\n"));
+ } else {
+ websWrite(wp, T("{"));
+ }
+}
+
+void zte_rest_cmd_write_foot(webs_t wp)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("</data>\n"));
+ } else {
+ websWrite(wp, T("}"));
+ }
+}
+
+void zte_rest_get_pbm_data_head(webs_t wp)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<data>\n"));
+ } else {
+ (void)websWrite(wp, T("{\"%s\":["), PBM_DATA);
+ }
+}
+
+void zte_rest_get_pbm_data_foot(webs_t wp)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("</data>\n"));
+ } else {
+ (void)websWrite(wp, T("]}"));
+ }
+}
+
+
+void zte_rest_get_pbm_data_sim_start(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<data>\n"));
+ websWrite(wp, T("<%s>\n"), PBM_DATA);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, PBM_ID);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, PBM_INDEX);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, PBM_LOCATION);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, PBM_NAME);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, PBM_NUMBER);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, PBM_TYPE);
+ websWrite(wp, T("</%s>\n"), PBM_DATA);
+ } else {
+ (void)websWrite(wp, T("{\"%s\":[{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%d\"}"), \
+ PBM_DATA, PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, \
+ PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, \
+ PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, \
+ PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, \
+ PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, \
+ PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type);
+ }
+}
+
+void zte_rest_get_pbm_data_sim(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index, int tag)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<%s>\n"), PBM_DATA);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, PBM_ID);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, PBM_INDEX);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, PBM_LOCATION);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, PBM_NAME);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, PBM_NUMBER);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, PBM_TYPE);
+ websWrite(wp, T("</%s>\n"), PBM_DATA);
+ } else {
+ if (tag == 1) {
+ websWrite(wp, T(","));
+ }
+ (void)websWrite(wp, T("{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%d\"}"), \
+ PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, \
+ PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, \
+ PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, \
+ PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, \
+ PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, \
+ PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type);
+ }
+
+}
+
+
+
+
+void zte_rest_get_pbm_data_other_start(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<data>\n"));
+ websWrite(wp, T("<%s>\n"), PBM_DATA);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, PBM_ID);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, PBM_INDEX);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, PBM_LOCATION);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, PBM_NAME);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, PBM_NUMBER);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, PBM_TYPE);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_ANR, (*p_pbm_query_result).data[index].zte_pbm_anr, PBM_ANR);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_ANR1, (*p_pbm_query_result).data[index].zte_pbm_anr1, PBM_ANR1);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_EMAIL, (*p_pbm_query_result).data[index].zte_pbm_email, PBM_EMAIL);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_SNE, (*p_pbm_query_result).data[index].zte_pbm_sne, PBM_SNE);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_GROUP, (*p_pbm_query_result).data[index].zte_pbm_group, PBM_GROUP);
+ websWrite(wp, T("</%s>\n"), PBM_DATA);
+ } else {
+ (void)websWrite(wp, T("{\"%s\":[{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%d\""\
+ ",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\"}"), \
+ PBM_DATA, PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, \
+ PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, \
+ PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, \
+ PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, \
+ PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, \
+ PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, \
+ PBM_ANR, (*p_pbm_query_result).data[index].zte_pbm_anr, \
+ PBM_ANR1, (*p_pbm_query_result).data[index].zte_pbm_anr1, \
+ PBM_EMAIL, (*p_pbm_query_result).data[index].zte_pbm_email, \
+ PBM_SNE, (*p_pbm_query_result).data[index].zte_pbm_sne, \
+ PBM_GROUP, (*p_pbm_query_result).data[index].zte_pbm_group);
+ }
+}
+
+
+void zte_rest_get_pbm_data_other(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index, int tag)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<%s>\n"), PBM_DATA);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, PBM_ID);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, PBM_INDEX);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, PBM_LOCATION);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, PBM_NAME);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, PBM_NUMBER);
+ websWrite(wp, T("<%s>%d</%s>\n"), PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, PBM_TYPE);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_ANR, (*p_pbm_query_result).data[index].zte_pbm_anr, PBM_ANR);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_ANR1, (*p_pbm_query_result).data[index].zte_pbm_anr1, PBM_ANR1);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_EMAIL, (*p_pbm_query_result).data[index].zte_pbm_email, PBM_EMAIL);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_SNE, (*p_pbm_query_result).data[index].zte_pbm_sne, PBM_SNE);
+ websWrite(wp, T("<%s>%s</%s>\n"), PBM_GROUP, (*p_pbm_query_result).data[index].zte_pbm_group, PBM_GROUP);
+ websWrite(wp, T("</%s>\n"), PBM_DATA);
+ } else {
+ if (tag == 1) {
+ websWrite(wp, T(","));
+ }
+ (void)websWrite(wp, T("{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%d\""\
+ ",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\"}"), \
+ PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, \
+ PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, \
+ PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, \
+ PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, \
+ PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, \
+ PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, \
+ PBM_ANR, (*p_pbm_query_result).data[index].zte_pbm_anr, \
+ PBM_ANR1, (*p_pbm_query_result).data[index].zte_pbm_anr1, \
+ PBM_EMAIL, (*p_pbm_query_result).data[index].zte_pbm_email, \
+ PBM_SNE, (*p_pbm_query_result).data[index].zte_pbm_sne, \
+ PBM_GROUP, (*p_pbm_query_result).data[index].zte_pbm_group);
+ }
+}
+
+void zte_rest_get_sms_data_head(webs_t wp)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<data>\n"));
+ } else {
+ (void)websWrite(wp, T("{\"%s\":["), SMS_MESSAGES);
+ }
+}
+
+void zte_rest_get_sms_data_foot(webs_t wp)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("</data>\n"));
+ } else {
+ (void)websWrite(wp, T("]}"));
+ }
+}
+
+void zte_rest_get_bro_data_head(webs_t wp)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<data>\n"));
+ } else {
+ (void)websWrite(wp, T("{\"%s\":"), SMS_MESSAGES);
+ }
+}
+void zte_rest_get_bro_data_foot(webs_t wp)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("</data>\n"));
+ } else {
+ (void)websWrite(wp, T("}"));
+ }
+}
+
+
+void zte_rest_get_sms_data(webs_t wp, zte_sms_query_result *p_sms_query_result, int i, int tag)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_rest_get_sms_data WEBS_XML_CLIENT_REQUEST");
+ char *tmp_num = NULL;
+ char pbm_name[100] = {0};
+ int len = 0;
+ len = strlen(p_sms_query_result->data[i].number);
+ slog(MISC_PRINT, SLOG_DEBUG, "len=%d", len);
+ slog(MISC_PRINT, SLOG_DEBUG, "p_sms_query_result->data[i].number=%s", p_sms_query_result->data[i].number);
+ if (len > NUMBER_SIZE) {
+ tmp_num = p_sms_query_result->data[i].number + (len - NUMBER_SIZE);
+ } else {
+ tmp_num = p_sms_query_result->data[i].number;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "tmp_num=%s", tmp_num);
+ memset(pbm_name, 0, sizeof(pbm_name));
+ zte_libpbm_get_name_by_number(tmp_num, pbm_name);
+ slog(MISC_PRINT, SLOG_DEBUG, "pbm_name=%s", pbm_name);
+ websWrite(wp, T("<%s>\n"), SMS_MESSAGES);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_ID, (*p_sms_query_result).data[i].id, SMS_ID);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_NUMBER);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_NAME, pbm_name, SMS_NAME);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, SMS_CONTENT);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_TAG, (*p_sms_query_result).data[i].tag, SMS_TAG);
+ websWrite(wp, T("<%s>%s,%s,%s,%s,%s,%s,%s</%s>\n"), SMS_DATE, (*p_sms_query_result).data[i].date.year, \
+ (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, \
+ (*p_sms_query_result).data[i].date.sec, (*p_sms_query_result).data[i].date.timezone, SMS_DATE);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_DRAFT_GROUP_ID, (*p_sms_query_result).data[i].draft_group_id, SMS_DRAFT_GROUP_ID);
+ websWrite(wp, T("</%s>\n"), SMS_MESSAGES);
+ } else {
+ if (tag == 1) {
+ websWrite(wp, T(","));
+ }
+ (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\",\"%s\":\"%s\"}"), \
+ SMS_ID, (*p_sms_query_result).data[i].id, \
+ SMS_NUMBER, (*p_sms_query_result).data[i].number, \
+ SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
+ SMS_TAG, (*p_sms_query_result).data[i].tag, \
+ SMS_DATE, (*p_sms_query_result).data[i].date.year, \
+ (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, \
+ (*p_sms_query_result).data[i].date.sec, (*p_sms_query_result).data[i].date.timezone, \
+ SMS_DRAFT_GROUP_ID, (*p_sms_query_result).data[i].draft_group_id);
+ }
+
+}
+
+void zte_rest_sms_parameter(webs_t wp, zte_wms_parameter_info_s_type sms_parameter_info)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<data>\n"));
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_PARAMETER_SCA, sms_parameter_info.sca, SMS_PARAMETER_SCA);
+ websWrite(wp, T("<%s>%d</%s>\n"), SMS_PARAMETER_MEM_STORE, sms_parameter_info.mem_store, SMS_PARAMETER_MEM_STORE);
+ websWrite(wp, T("<%s>%u</%s>\n"), SMS_PARAMETER_VALIDITY_PERIOD, sms_parameter_info.tp_validity_period, SMS_PARAMETER_VALIDITY_PERIOD);
+ websWrite(wp, T("<%s>%u</%s>\n"), SMS_PARAMETER_STATUS_REPORT, sms_parameter_info.status_report_on, SMS_PARAMETER_STATUS_REPORT);
+ websWrite(wp, T("<%s>%u</%s>\n"), SMS_PARAMETER_SEND_RETRY, sms_parameter_info.sendfail_retry_on, SMS_PARAMETER_SEND_RETRY);
+ websWrite(wp, T("<%s>%u</%s>\n"), SMS_PARAMETER_OUTDATE_DELETE, sms_parameter_info.outdate_delete_on, SMS_PARAMETER_OUTDATE_DELETE);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_PARAMETER_DEFAULT_STORE, sms_parameter_info.default_store, SMS_PARAMETER_DEFAULT_STORE);
+ websWrite(wp, T("</data>\n"));
+ } else {
+ (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%d\",\"%s\":\"%u\",\"%s\":\"%u\",\"%s\":\"%u\",\"%s\":\"%u\",\"%s\":\"%s\"}"), \
+ SMS_PARAMETER_SCA, sms_parameter_info.sca, \
+ SMS_PARAMETER_MEM_STORE, sms_parameter_info.mem_store, \
+ SMS_PARAMETER_VALIDITY_PERIOD, sms_parameter_info.tp_validity_period, \
+ SMS_PARAMETER_STATUS_REPORT, sms_parameter_info.status_report_on, \
+ SMS_PARAMETER_SEND_RETRY, sms_parameter_info.sendfail_retry_on, \
+ SMS_PARAMETER_OUTDATE_DELETE, sms_parameter_info.outdate_delete_on, \
+ SMS_PARAMETER_DEFAULT_STORE, sms_parameter_info.default_store);
+ }
+}
+
+void zte_rest_sms_status_rpt(webs_t wp, zte_sms_query_result *p_sms_query_result, int i, int tag)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<%s>\n"), SMS_MESSAGES);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_ID, (*p_sms_query_result).data[i].id, SMS_ID);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_NUMBER);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, SMS_CONTENT);
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_TAG, (*p_sms_query_result).data[i].tag, SMS_TAG);
+ websWrite(wp, T("<%s>%s,%s,%s,%s,%s,%s,%s</%s>\n"), SMS_DATE, (*p_sms_query_result).data[i].date.year, \
+ (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, \
+ (*p_sms_query_result).data[i].date.sec, (*p_sms_query_result).data[i].date.timezone, SMS_DATE);
+ websWrite(wp, T("</%s>\n"), SMS_MESSAGES);
+ } else {
+ if (tag == 1) {
+ websWrite(wp, T(","));
+ }
+ (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\"}"), \
+ SMS_ID, (*p_sms_query_result).data[i].id, \
+ SMS_NUMBER, (*p_sms_query_result).data[i].number, \
+ SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
+ SMS_DATE, (*p_sms_query_result).data[i].date.year, (*p_sms_query_result).data[i].date.month, \
+ (*p_sms_query_result).data[i].date.day, (*p_sms_query_result).data[i].date.hour, \
+ (*p_sms_query_result).data[i].date.min, (*p_sms_query_result).data[i].date.sec, \
+ (*p_sms_query_result).data[i].date.timezone);
+ }
+}
+
+
+void zte_rest_boradcast_data(webs_t wp, zte_wms_cell_bro_s_type *p_bro_query_result)
+{
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<%s>%s</%s>\n"), SMS_MESSAGES, (*p_bro_query_result).content, SMS_MESSAGES);
+ } else {
+ (void)websWrite(wp, T("\"%s\""), (*p_bro_query_result).content);
+ }
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_rest.h b/ap/app/goahead/interface5.0/zte_web_rest.h
new file mode 100755
index 0000000..e660ae4
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_rest.h
@@ -0,0 +1,6 @@
+#include "zte_web_interface.h"
+
+
+extern void zte_xml_switch_handler(webs_t wp);
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_safe.c b/ap/app/goahead/interface5.0/zte_web_safe.c
new file mode 100644
index 0000000..55b48ca
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_safe.c
@@ -0,0 +1,171 @@
+#include "zte_web_interface.h"
+
+
+
+
+data_safe_result_type_t zte_Safe_isMacValid(char *str)
+{
+ int i, len = strlen(str);
+ if (len != 17)
+ return 0;
+
+ for (i = 0; i < 5; i++) {
+ if ((!isxdigit(str[i * 3])) || (!isxdigit(str[i * 3 + 1])) || (str[i * 3 + 2] != ':'))
+ return 0;
+ }
+ return (isxdigit(str[15]) && isxdigit(str[16])) ? 1 : 0;
+}
+
+
+data_safe_result_type_t zte_Safe_isIpValid(char *str)
+{
+ struct in_addr addr; /*lint !e565 !e1080*/
+ if ((! strcmp(T("any"), str)) || (! strcmp(T("any/0"), str)))
+ return 1;
+
+ if (!(inet_aton(str, &addr))) {
+ slog(MISC_PRINT, SLOG_DEBUG, "isIpValid(): %s is not a valid IP address.\n", str); /*lint !e26*/
+ return 0;
+ }
+ return 1;
+}
+
+data_safe_result_type_t zte_Safe_isNumOnly(char *str)
+{
+ int i, len = strlen(str);
+ for (i = 0; i < len; i++) {
+ if ((str[i] >= '0' && str[i] <= '9'))
+ continue;
+ return 0;
+ }
+ return 1;
+}
+
+
+data_safe_result_type_t zte_Safe_noSpecialChar(char *str)
+{
+ int i = 0;
+ int len = 0;
+ if (NULL == str) {
+ return 0;
+ }
+ len = strlen(str);
+ for (i = 0; i < len; i++) {
+ if (zte_Safe_valid_SpecialChar(str[i]) != 0) {
+ continue;
+ } else {
+ return 0;
+ }
+ }
+ return 1;
+
+}
+
+data_safe_result_type_t zte_Safe_noSpecialChar_other(char *str)
+{
+ int i = 0;
+ int len = 0;
+ if (NULL == str) {
+ return 0;
+ }
+ len = strlen(str);
+ for (i = 0; i < len; i++) {
+ if (zte_Safe_valid_SpecialChar_other(str[i]) != 0) {
+ continue;
+ } else {
+ return 0;
+ }
+ }
+ return 1;
+
+}
+
+
+data_safe_result_type_t zte_Safe_isStringOnly(char *str)
+{
+ int i = 0;
+ int len = 0;
+ if (NULL == str) {
+ return 0;
+ }
+ len = strlen(str);
+ for (i = 0; i < len; i++) {
+ if ((str[i] <= 'Z' && str[i] >= 'A')
+ || (str[i] <= 'z' && str[i] >= 'a')
+ )
+ continue;
+ else {
+ return 0;
+ }
+
+ }
+ return 1;
+}
+
+data_safe_result_type_t zte_Safe_isNumorStringOnly(char *str)
+{
+ int i = 0;
+ int len = 0;
+ if (NULL == str) {
+ return 0;
+ }
+ len = strlen(str);
+ for (i = 0; i < len; i++) {
+ if ((str[i] <= 'Z' && str[i] >= 'A') || (str[i] <= 'z' && str[i] >= 'a') || (str[i] <= '9' && str[i] >= '0'))
+ continue;
+ else {
+ return 0;
+ }
+
+ }
+ return 1;
+}
+
+int zte_Safe_valid_SpecialChar(char single_data)
+{
+ if (single_data == '"') return 0;
+ else if (single_data == '\'') return 0;
+ else if (single_data == '<') return 0;
+ else if (single_data == '>') return 0;
+ else if (single_data == '\\') return 0;
+ else return 1;
+}
+
+int zte_Safe_valid_SpecialChar_other(char single_data)
+{
+ if (single_data == '&') return 0;
+ else if (single_data == '<') return 0;
+ else if (single_data == '>') return 0;
+ else if (single_data == '\\') return 0;
+ else if (single_data == '\'') return 0;
+ else if (single_data == '/') return 0;
+ else return 1;
+}
+
+
+
+int zte_valid_length_str(char *string_s, int min, int max)/*lint !e123*/
+{
+ int str_len = 0;
+ str_len = strlen(string_s);
+ if (str_len < min || str_len > max) { /*lint !e123*/
+ return -1;
+ } else {
+ return 1;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_sem.c b/ap/app/goahead/interface5.0/zte_web_sem.c
new file mode 100755
index 0000000..e4e7ea5
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_sem.c
@@ -0,0 +1,94 @@
+#include <sys/sem.h>
+#include <sys/ipc.h>
+#include <errno.h>
+#include "softap_log.h"
+
+//´Ë´¦È¡ÖµÓëFLUXSTATÎļþÖеÄȡֵÊÇÒ»ÖµÄ
+//ÓÃÓÚ²»Í¬µÄ½ø³Ì¼äͬ²½
+#define TIME_SEM_KEY 0x0666
+
+extern int init_sem(int sem_id, int init_value);
+extern int del_sem(int sem_id);
+extern int sem_p(int sem_id);
+extern int sem_v(int sem_id);
+extern int get_sem(key_t sem_key);
+
+
+union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+};
+
+int get_sem(key_t sem_key)
+{
+ int sem_id = -1;
+
+ sem_id = semget(sem_key, 1, 0666 | IPC_CREAT | IPC_EXCL);
+ if (sem_id < 0) {
+ //printf("[goahead]semget errno=%d\n", errno);
+ if (errno == EEXIST) {
+ //printf("[goahead]semget already exist==\n");
+ return semget(sem_key, 1, 0666 | IPC_CREAT);
+ }
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]semget == -1, return fail\n");
+ return -1;
+ }
+
+ union semun sem_union;
+ sem_union.val = 1;
+ if (semctl(sem_id, 0, SETVAL, sem_union) == -1) {
+ return -1;
+ }
+ //printf("[goahead]semget sem_id= %d, get sem success\n",sem_id);;
+ return sem_id;
+}
+
+
+// ½«ÐźÅÁ¿sem_idÉèÖÃΪinit_value
+int init_sem(int sem_id, int init_value)
+{
+ union semun sem_union;
+ sem_union.val = init_value;
+ if (semctl(sem_id, 0, SETVAL, sem_union) == -1) {
+ return -1;
+ }
+ return 0;
+}
+
+// ɾ³ýsem_idÐźÅÁ¿
+int del_sem(int sem_id)
+{
+ union semun sem_union = {0}; //cov h
+ if (semctl(sem_id, 0, IPC_RMID, sem_union) == -1) {
+ return -1;
+ }
+ return 0;
+}
+
+// ¶Ôsem_idÖ´ÐÐp²Ù×÷
+int sem_p(int sem_id)
+{
+ struct sembuf sem_buf;
+ sem_buf.sem_num = 0; //ÐźÅÁ¿±àºÅ
+ sem_buf.sem_op = -1; //P²Ù×÷
+ sem_buf.sem_flg = SEM_UNDO; //ϵͳÍ˳öǰδÊÍ·ÅÐźÅÁ¿£¬ÏµÍ³×Ô¶¯ÊÍ·Å
+ if (semop(sem_id, &sem_buf, 1) == -1) {
+ return -1;
+ }
+ return 0;
+}
+
+// ¶Ôsem_idÖ´ÐÐV²Ù×÷
+int sem_v(int sem_id)
+{
+ struct sembuf sem_buf;
+ sem_buf.sem_num = 0;
+ sem_buf.sem_op = 1; //V²Ù×÷
+ sem_buf.sem_flg = SEM_UNDO;
+ if (semop(sem_id, &sem_buf, 1) == -1) {
+ return -1;
+ }
+ return 0;
+}
+
diff --git a/ap/app/goahead/interface5.0/zte_web_sms.c b/ap/app/goahead/interface5.0/zte_web_sms.c
new file mode 100755
index 0000000..23b544e
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_sms.c
@@ -0,0 +1,1698 @@
+/************************************************************************
+* °æÈ¨ËùÓÐ (C)2010, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º zte_web_mgmt.c
+* Îļþ±êʶ£º
+* ÄÚÈÝÕªÒª£º
+* ÆäËü˵Ã÷£º
+* µ±Ç°°æ±¾£º V0.1
+* ×÷ Õߣº zyt
+* Íê³ÉÈÕÆÚ£º 2010-11-06
+*
+* Ð޸ļǼ1£º
+* ÐÞ¸ÄÄÚÈÝ£º³õʼ°æ±¾
+************************************************************************/
+
+/**************************************************************************
+* Ð޸ıàºÅ : й¦ÄÜ
+* ÐÞ ¸Ä ÈË : chenjie10092374
+* ÐÞ¸ÄÈÕÆÚ : 2014.6.24
+* ÐÞ¸ÄÄÚÈÝ : Ìí¼ÓÖ§³Öufi monitor¹¦ÄÜ´¦Àí´úÂë
+**************************************************************************/
+
+#include "zte_web_interface.h"
+//#include "sms_com.h"
+#include "zte_web_get_fw_para.h"
+#include "zte_web_sms.h"
+
+
+#define UPCASE( c ) ( ((c) >= 'a' && (c) <= 'z') ? ((c) - 0x20) : (c) )
+
+extern void zte_rest_get_sms_data_head(webs_t wp);
+extern void zte_rest_get_sms_data_foot(webs_t wp);
+extern void zte_rest_get_bro_data_head(webs_t wp);
+extern void zte_rest_get_bro_data_foot(webs_t wp);
+extern void zte_rest_get_sms_data(webs_t wp, zte_sms_query_result *p_sms_query_result, int i, int tag);
+extern void zte_rest_sms_parameter(webs_t wp, T_zUfiSms_ParaInfo sms_parameter_info);
+extern void zte_rest_sms_status_rpt(webs_t wp, zte_sms_query_result *p_sms_query_result, int i, int tag);
+extern void zte_rest_boradcast_data(webs_t wp, zte_wms_cell_bro_s_type *p_bro_query_result);
+static void zte_web_feed_back_empty(webs_t wp);
+static unsigned int parseStrBySeparator(unsigned char *input, unsigned char *output, int destLen, unsigned char separator);
+//static int asc_util_atoi(unsigned int *val_arg_ptr, const unsigned char *s, unsigned int r);
+//static int sms_util_asc_to_hex(unsigned char *in_ptr, unsigned char *out_ptr, int len);
+
+#define WebSms_LOG(priority,...) do { \
+ printf(__VA_ARGS__); \
+} while(0)
+
+
+VOID zte_sms_handle_DB_status_whenSend(int cmd_status)
+{
+ T_zUfiSms_StatusInfo statusInfo;
+ memset((void*)&statusInfo, 0, sizeof(T_zUfiSms_StatusInfo));
+ statusInfo.cmd = WMS_SMS_CMD_MSG_SEND;
+ statusInfo.cmd_status = cmd_status;
+ statusInfo.err_code = ZTE_SMS_CMS_NONE;
+ statusInfo.send_failed_count = 0;
+ statusInfo.delete_failed_count = 0;
+
+ zte_libwms_setSmsCmdStatus(&statusInfo);
+}
+
+VOID zte_sms_handle_DB_status(int cmd, int cmd_status)
+{
+ T_zUfiSms_StatusInfo statusInfo;
+ memset((void*)&statusInfo, 0, sizeof(T_zUfiSms_StatusInfo));
+ statusInfo.cmd = cmd;
+ statusInfo.cmd_status = cmd_status;
+ statusInfo.err_code = ZTE_SMS_CMS_NONE;
+ statusInfo.send_failed_count = 0;
+ statusInfo.delete_failed_count = 0;
+
+ zte_libwms_setSmsCmdStatus(&statusInfo);
+}
+
+/*
+*Ôö¼Ó´Ëº¯ÊýÅжÏÖ÷ÒªÊÇÒòΪÁ÷Á¿Ð£×¼¹¦ÄÜÒ²»á·¢¶ÌÐÅ
+*ΪÁ˱£Ö¤ATSERVERÁ÷³Ì´¦ÀíµÄÒ»ÖÂÐÔ£¬¼Ó´ËÅжÏ
+*/
+int zte_sms_check_can_send_sms()
+{
+ T_zUfiSms_StatusInfo cmd_status_info = {0};
+ int result = 0;
+ char buf1[NV_ITEM_STRING_LEN_10] = {0};
+ char buf2[NV_ITEM_STRING_LEN_10] = {0};
+ char buf3[NV_ITEM_STRING_LEN_20] = {0};
+
+ /*
+ *ÒÔϼ¸ÖÖÇé¿ö¿ÉÒÔ²»ÅжÏ:
+ *(1)Á÷Á¿Ð£×¼¹¦ÄÜδ´ò¿ª;
+ *(2)Á÷Á¿Ð£×¼¹¦ÄÜÒÑ´ò¿ª£¬µ«ÊÇĿǰ²»ÔÚÔËÐÐÖУ»
+ *(3)Á÷Á¿Ð£×¼¹¦ÄÜÒÑ´ò¿ªÇÒÔÚÔËÐÐÖУ¬µ«²»ÔÚ·¢ËͶÌÐŹý³ÌÖУ»
+ *×¢:ʵ¼ÊÉÏÊöÈýµãÌõ¼þ¶¼¿ÉÒÔ¹éΪÌõ¼þ(3)Ò»Ìõ½øÐÐÅжϼ´¿É£¬
+ * µ«´Ë´¦ÎªÁ˱ãÓÚÀí½âά»¤£¬»¹ÊÇÔÚ´úÂë²ãÃæ·ÖÈý¸öÌõ¼þÅжϴ¦Àí¡£
+ */
+ sc_cfg_get(NV_DATA_TRAFFIC_SWITCH, &buf1, sizeof(buf1));
+ sc_cfg_get("is_traffic_alining", buf2, sizeof(buf2));
+ sc_cfg_get("traffic_sms_number", buf3, sizeof(buf3));
+
+ if ((0 != strcmp(buf1, "yes"))
+ || (0 == strcmp(buf2, "no"))
+ || (0 == strcmp(buf3, "0"))) {
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_sms_check_can_send_sms, no need to check!\n");
+ return 0;
+ }
+
+ cmd_status_info.cmd = WMS_SMS_CMD_MSG_SEND;
+ result = zte_libwms_get_cmd_status(&cmd_status_info);
+ if (result == -1) {
+ return 0;
+ }
+
+ if (cmd_status_info.cmd_status == WMS_CMD_PROCESSING) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int hex_check(char *buf)
+{
+ int i = 0;
+ int len = strlen(buf);
+ for (i = 0; i < len; i++) {
+ if(!isxdigit(buf[i]))
+ return -1;
+ }
+ return i;
+}
+
+void zte_sms_send_msg_process(webs_t wp)
+{
+ unsigned int i = 0;
+ //int j = 0;
+ int message_content_len = 0;
+ unsigned int rec_count = 0;
+ unsigned char encode_type = 0;
+ char_t *sms_encode_type = NULL;
+ char_t *msg_id = NULL;
+ unsigned char *msg_content_web = NULL;
+ //char_t *which_page = NULL;
+ char_t *sms_time = NULL;
+ int s_flag = 0; //to distinguish time field from time string
+ int index = 0;
+ unsigned char *rec_number = NULL;
+ unsigned char rec_separate[ZTE_WMS_SEND_NUM_MAX][ZTE_WMS_ADDRESS_LEN_MAX + 1] = {0};
+ T_zUfiSms_SendReq MSG_SEND_ST;
+
+ memset(&MSG_SEND_ST, 0, sizeof(T_zUfiSms_SendReq));
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User send msg!\n"));
+ //which_page = websGetVar(wp, "which_cgi", T(""));
+ rec_number = websGetVar(wp, "Number", T(""));
+ msg_content_web = websGetVar(wp, "MessageBody", T(""));
+ msg_id = websGetVar(wp, "ID", T(""));
+ sms_encode_type = websGetVar(wp, "encode_type", T(""));
+ sms_time = websGetVar(wp, "sms_time", T(""));
+
+ //add by liuyingnan for server safe for xss attack start
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(msg_content_web)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(rec_number)
+ || hex_check(msg_content_web) < 0) {
+ sc_cfg_set("data_safe", "failed");
+ slog(MISC_PRINT, SLOG_ERR,"Get Data is no Safe:msg_content_web:%s\n", msg_content_web); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //add by liuyingnan for server safe for xss attack end
+
+ /* adjust the number and contents' form */
+ message_content_len = strlen(msg_content_web) / 2;
+ slog(MISC_PRINT, SLOG_DEBUG, "goahead==message_content_len=%d", message_content_len); /*lint !e26*/
+ rec_count = parseStrBySeparator(rec_number, (unsigned char *)rec_separate, ZTE_WMS_ADDRESS_LEN_MAX + 1, SEPARATOR_CHARACTER);
+
+ if (0 == strcmp("ASCII", sms_encode_type)) { //not include chinese
+ encode_type = DCS_ASC;
+ } else if (0 == strcmp("UNICODE", sms_encode_type)) {
+ encode_type = DCS_UNICODE;
+ } else if (0 == strcmp("GSM7_span", sms_encode_type)) {
+ encode_type = DCS_SPANISH;
+ } else if (0 == strcmp("GSM7_default", sms_encode_type)) {
+ slog(MISC_PRINT, SLOG_DEBUG, "goahead==GSM7_default==sms_encode_type=%s", sms_encode_type); /*lint !e26*/
+ encode_type = DCS_GSM7_DEFAULT;
+ slog(MISC_PRINT, SLOG_DEBUG,"goahead==end==encode_type=%d", encode_type); /*lint !e26*/
+ } else if (0 == strcmp("GSM7_turkey", sms_encode_type)) {
+ encode_type = DCS_TURKISH;
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "invalid sms_encode_type [%s]! \n", sms_encode_type); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //parse the time field
+ for (i = 0; i < strlen(sms_time); i++) {
+ if (';' == sms_time[i]) {
+ s_flag++;
+ index = 0;
+ continue;
+ }
+
+ if ((0 == s_flag) && (index < (sizeof(MSG_SEND_ST.date.year) - 1))) {
+ MSG_SEND_ST.date.year[index++] = sms_time[i];
+ } else if ((1 == s_flag) && (index < (sizeof(MSG_SEND_ST.date.month) - 1))) {
+ MSG_SEND_ST.date.month[index++] = sms_time[i];
+ } else if ((2 == s_flag) && (index < (sizeof(MSG_SEND_ST.date.day) - 1))) {
+ MSG_SEND_ST.date.day[index++] = sms_time[i];
+ } else if ((3 == s_flag) && (index < (sizeof(MSG_SEND_ST.date.hour) - 1))) {
+ MSG_SEND_ST.date.hour[index++] = sms_time[i];
+ } else if ((4 == s_flag) && (index < (sizeof(MSG_SEND_ST.date.min) - 1))) { /*lint !e123*/
+ MSG_SEND_ST.date.min[index++] = sms_time[i];/*lint !e123*/
+ } else if ((5 == s_flag) && (index < (sizeof(MSG_SEND_ST.date.sec) - 1))) {
+ MSG_SEND_ST.date.sec[index++] = sms_time[i];
+ } else if ((6 == s_flag) && (index < (sizeof(MSG_SEND_ST.date.timezone) - 1))) {
+ MSG_SEND_ST.date.timezone[index++] = sms_time[i];
+ }
+
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_sms_send_msg_process:year is [%s];"\
+ "month is [%s];day is [%s];hour is [%s];minute is [%s];second is [%s];timezone is [%s].\n", \
+ MSG_SEND_ST.date.year, MSG_SEND_ST.date.month, MSG_SEND_ST.date.day, \
+ MSG_SEND_ST.date.hour, MSG_SEND_ST.date.min, MSG_SEND_ST.date.sec, \
+ MSG_SEND_ST.date.timezone);/*lint !e26 !e123 */
+
+ /* stuff the struct which is sending to mc */
+ slog(MISC_PRINT, SLOG_DEBUG, "goahead==============msg_content_web==========%s", msg_content_web); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "goahead=========message_content_len=%d", message_content_len); /*lint !e26*/
+// concat sms
+ zte_libwms_db_write_send_msg_content_data(msg_content_web);
+ //doSystem("sleep 1");
+ slog(MISC_PRINT, SLOG_NORMAL, "Send message to database succesful!\n"); /*lint !e26*/
+#if 0 // ÔÀ´²»Ö§³Ö¼¶Áª¶ÌÐŵĴúÂë
+ (void)sms_util_asc_to_hex(msg_content_web, MSG_SEND_ST.msg_content, message_content_len);
+#endif
+ MSG_SEND_ST.msg_len = message_content_len;
+
+ MSG_SEND_ST.dcs = encode_type;
+
+ MSG_SEND_ST.receiver_count = rec_count;
+ memcpy(MSG_SEND_ST.dest_num, rec_separate, sizeof(rec_separate));
+
+ //handle whether to delete the old sms begin
+ if (0 != strcmp(msg_id, "")) {
+ MSG_SEND_ST.id = atol(msg_id); //-1:new msg
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "invalid msg_id [%s]! \n", msg_id); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //handle whether to delete the old sms end
+
+#if 0
+ if (0 == strcmp(which_page, NEW_MESSAGE)) {
+ MSG_SEND_ST.db = ZTE_WMS_TABLE_NV;
+ } else if (0 == strcmp(which_page, NATIVE_INBOX) || 0 == strcmp(which_page, NATIVE_DRAFTBOX)) {
+ MSG_SEND_ST.db = ZTE_WMS_TABLE_NV;
+ } else if (0 == strcmp(which_page, SIM_INBOX) || 0 == strcmp(which_page, SIM_DRAFTBOX)) {
+ MSG_SEND_ST.db = ZTE_WMS_TABLE_SIM;
+ } else {
+ WebSms_LOG(LOG_INFO, "invalid which_page [%s]! \n", which_page); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+#endif
+
+ if (0 != zte_sms_check_can_send_sms()) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ /* mc interface */
+ zte_sms_handle_DB_status_whenSend(WMS_CMD_PROCESSING);
+ if (ZTE_MC_OK_S == zte_mc_relay_sms_send_msg((T_zUfiSms_SendReq*)(&MSG_SEND_ST))) {
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_sms_send_msg_process:Send message to mc successful!\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ zte_sms_handle_DB_status_whenSend(WMS_CMD_FAILED);
+ slog(MISC_PRINT, SLOG_ERR, "zte_sms_send_msg_process:Send message to mc fail!\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+
+}
+void zte_sms_save_msg_process(webs_t wp)
+{
+ //int j = 0;
+ unsigned int i = 0;
+ unsigned int rec_count = 0;
+ unsigned char *rec_number = NULL;
+ char_t *msg_id = NULL;
+ int message_content_len = 0;
+ unsigned char encode_type = 0;
+ unsigned char *msg_content_web = NULL;
+ char_t *sms_encode_type = NULL;
+ //char_t *which_page = NULL;
+ char_t *sms_time = NULL;
+ int s_flag = 0; //to distinguish time field from time string
+ int index = 0;
+ unsigned char rec_separate[ZTE_WMS_SEND_NUM_MAX][ZTE_WMS_ADDRESS_LEN_MAX + 1] = {0}; //separate receiver phone number
+ T_zUfiSms_SaveReq MSG_SAVE_ST;
+ char_t *mem_store = NULL;
+ char_t *tags = NULL;
+ char_t *draft_group_id = NULL;
+
+ memset(&MSG_SAVE_ST, 0, sizeof(T_zUfiSms_SaveReq));
+ mem_store = websGetVar(wp, "location", T("1"));
+ tags = websGetVar(wp, "tags", T("4"));
+ //which_page = websGetVar(wp, "which_cgi", T(""));
+ msg_content_web = websGetVar(wp, "SMSMessage", T(""));
+ rec_number = websGetVar(wp, "SMSNumber", T(""));
+ msg_id = websGetVar(wp, "Index", T(""));
+ sms_encode_type = websGetVar(wp, "encode_type", T(""));
+ sms_time = websGetVar(wp, "sms_time", T(""));
+ draft_group_id = websGetVar(wp, "draft_group_id", T(""));
+
+ //add by liuyingnan for server safe for xss attack start
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(msg_content_web)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(rec_number)
+ || hex_check(msg_content_web) < 0) {
+ sc_cfg_set("data_safe", "failed");
+ slog(MISC_PRINT, SLOG_DEBUG, "Get Data is no Safe:msg_content_web:%s\n", msg_content_web); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //add by liuyingnan for server safe for xss attack end
+
+ /* adjust the contents' form */
+ message_content_len = strlen(msg_content_web) / 2;
+
+ if (0 == strcmp("ASCII", sms_encode_type)) { //not include chinese
+ encode_type = DCS_ASC;
+ } else if (0 == strcmp("UNICODE", sms_encode_type)) {
+ encode_type = DCS_UNICODE;
+ } else if (0 == strcmp("GSM7_span", sms_encode_type)) {
+ encode_type = DCS_SPANISH;
+ } else if (0 == strcmp("GSM7_default", sms_encode_type)) {
+ encode_type = DCS_GSM7_DEFAULT;
+ } else if (0 == strcmp("GSM7_turkey", sms_encode_type)) {
+ encode_type = DCS_TURKISH;
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "invalid sms_encode_type [%s]! \n", sms_encode_type); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //parse the time field
+ for (i = 0; i < strlen(sms_time); i++) {
+ if (';' == sms_time[i]) {
+ s_flag++;
+ index = 0;
+ continue;
+ }
+
+ if ((0 == s_flag) && (index < (sizeof(MSG_SAVE_ST.date.year) - 1))) {
+ MSG_SAVE_ST.date.year[index++] = sms_time[i];
+ } else if ((1 == s_flag) && (index < (sizeof(MSG_SAVE_ST.date.month) - 1))) {
+ MSG_SAVE_ST.date.month[index++] = sms_time[i];
+ } else if ((2 == s_flag) && (index < (sizeof(MSG_SAVE_ST.date.day) - 1))) {
+ MSG_SAVE_ST.date.day[index++] = sms_time[i];
+ } else if ((3 == s_flag) && (index < (sizeof(MSG_SAVE_ST.date.hour) - 1))) {
+ MSG_SAVE_ST.date.hour[index++] = sms_time[i];
+ } else if ((4 == s_flag) && (index < (sizeof(MSG_SAVE_ST.date.min) - 1))) { /*lint !e123*/
+ MSG_SAVE_ST.date.min[index++] = sms_time[i];/*lint !e123*/
+ } else if ((5 == s_flag) && (index < (sizeof(MSG_SAVE_ST.date.sec) - 1))) {
+ MSG_SAVE_ST.date.sec[index++] = sms_time[i];
+ } else if ((6 == s_flag) && (index < (sizeof(MSG_SAVE_ST.date.timezone) - 1))) {
+ MSG_SAVE_ST.date.timezone[index++] = sms_time[i];
+ }
+
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_sms_save_msg_process:year is [%s];"\
+ "month is [%s];day is [%s];hour is [%s];minute is [%s];second is [%s];timezone is [%s].\n", \
+ MSG_SAVE_ST.date.year, MSG_SAVE_ST.date.month, MSG_SAVE_ST.date.day, \
+ MSG_SAVE_ST.date.hour, MSG_SAVE_ST.date.min, MSG_SAVE_ST.date.sec, \
+ MSG_SAVE_ST.date.timezone);/*lint !e26 !e123 */
+//CONCAT_SMS
+ zte_libwms_db_write_send_msg_content_data(msg_content_web);
+ //doSystem("sleep 1");
+ slog(MISC_PRINT, SLOG_DEBUG, "Send message to database succesful!\n"); /*lint !e26*/
+#if 0 // ÔÀ´²»Ö§³Ö¼¶Áª¶ÌÐŵĴúÂë
+ /* stuff the struct which is sending to mc */
+ (void)sms_util_asc_to_hex(msg_content_web, MSG_SAVE_ST.msg_content, message_content_len);
+#endif
+
+ MSG_SAVE_ST.msg_len = message_content_len;
+ rec_count = parseStrBySeparator(rec_number, (unsigned char *)rec_separate, ZTE_WMS_ADDRESS_LEN_MAX + 1, SEPARATOR_CHARACTER);
+
+
+ MSG_SAVE_ST.receiver_count = rec_count;
+ memcpy(MSG_SAVE_ST.dest_num, rec_separate, sizeof(rec_separate));
+ memcpy(MSG_SAVE_ST.draft_group_id, draft_group_id, sizeof(MSG_SAVE_ST.draft_group_id));
+
+ MSG_SAVE_ST.dcs = encode_type;
+ MSG_SAVE_ST.mem_store = (unsigned char)atoi(mem_store);
+ MSG_SAVE_ST.tags = (unsigned char)atoi(tags);
+ //handle whether to delete the old sms begin
+ if (0 != strcmp(msg_id, "")) {
+ MSG_SAVE_ST.id = atol(msg_id); //-1:new msg
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "invalid msg_id [%s]! \n", msg_id); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ //handle whether to delete the old sms end
+
+#if 0
+ if (0 == strcmp(which_page, NEW_MESSAGE)) {
+ MSG_SAVE_ST.db = ZTE_WMS_TABLE_NV;
+ } else if (0 == strcmp(which_page, NATIVE_INBOX) || 0 == strcmp(which_page, NATIVE_DRAFTBOX)) {
+ MSG_SAVE_ST.db = ZTE_WMS_TABLE_NV;
+ } else if (0 == strcmp(which_page, SIM_INBOX) || 0 == strcmp(which_page, SIM_DRAFTBOX)) {
+ MSG_SAVE_ST.db = ZTE_WMS_TABLE_SIM;
+ } else {
+ WebSms_LOG(LOG_INFO, "invalid which_page [%s]! \n", which_page); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+#endif
+
+ /* print log */
+ for (i = 0; i < rec_count; i++) {
+ slog(MISC_PRINT, SLOG_DEBUG, "MSG_SAVE_ST.dest_num = [%s]\n", MSG_SAVE_ST.dest_num[i]); /*lint !e26*/
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "web_sms:message_content_len = [%d]\n", message_content_len); /*lint !e26*/
+#if 0
+ for (j = 0; j < message_content_len; j++) {
+ WebSms_LOG(LOG_INFO, "web_sms:MSG_SAVE_ST content=[%x]\n", MSG_SAVE_ST.msg_content[j]); /*lint !e26*/
+ }
+#endif
+ /* mc interface */
+
+ if (ZTE_MC_OK_S == zte_mc_relay_sms_write_msg((T_zUfiSms_SaveReq*)(&MSG_SAVE_ST))) {
+ slog(MISC_PRINT, SLOG_NORMAL, "web_sms:Send message to mc successful!(save msg)\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "web_sms:Send message to mc fail!(save msg)\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+
+ //zte_write_result_to_web(wp,SUCCESS);
+}
+
+void zte_sms_delete_msg_process(webs_t wp)
+{
+ unsigned int i = 0;
+ unsigned int j = 0;
+ unsigned int msg_id_count = 0;
+ unsigned char *msg_id = NULL; //receiver phone number get from web
+ unsigned char msg_id_separate[ZTE_WMS_DELETE_COUNT_MAX][WMS_MODULE_ID_LEN] = {0}; //separate receiver phone number
+ T_zUfiSms_DelReq del_sms_setting;
+ //char_t *which_page = NULL;
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User delete msg!\n"));
+ WebSms_LOG(LOG_INFO, T("[SMS] User delete msg!"));
+
+ memset(&del_sms_setting, 0, sizeof(T_zUfiSms_DelReq));
+
+ msg_id = websGetVar(wp, "msg_id", T(""));
+ //which_page = websGetVar(wp, "which_cgi", T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG, "web para:[msg_id] is [%s].\n", msg_id); /*lint !e26*/
+ //WebSms_LOG(LOG_INFO,"web para:[which_page] is [%s].\n",which_page);/*lint !e26*/
+
+ msg_id_count = parseStrBySeparator(msg_id, (unsigned char *)msg_id_separate, WMS_MODULE_ID_LEN, SEPARATOR_CHARACTER);
+ slog(MISC_PRINT, SLOG_DEBUG,"!!!!goahead enter delete msg!!msg_id:%s/msg_id_count:%d.\n", msg_id, msg_id_count);
+
+ del_sms_setting.all_or_count = msg_id_count;
+ for (i = 0; i < msg_id_count; i++) {
+ del_sms_setting.id[i] = atoi(msg_id_separate[i]);
+ }
+
+ for (j = 0; j < msg_id_count; j++) {
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_sms_delete_msg_process:delete msg number:[%lu]\n", del_sms_setting.id[j]);/*lint !e26*/
+ }
+ /* mc interface */
+
+ zte_sms_handle_DB_status(WMS_SMS_CMD_MSG_DELETE, WMS_CMD_PROCESSING);
+ if (ZTE_MC_OK_S == zte_mc_relay_sms_delete_msg((T_zUfiSms_DelReq*)(&del_sms_setting))) {
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_sms_delete_msg_process:send delete sms cmd to mc success.\n");/*lint !e26*/
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_sms_delete_msg_process:send delete sms cmd to mc fail.\n");/*lint !e26*/
+ zte_sms_handle_DB_status(WMS_SMS_CMD_MSG_DELETE, WMS_CMD_FAILED);
+ zte_write_result_to_web(wp, FAILURE);
+ }
+
+ //zte_write_result_to_web(wp,SUCCESS);
+}
+
+void zte_sms_move_to_sim_msg_process(webs_t wp)
+{
+ unsigned int i = 0;
+ unsigned int j = 0;
+ unsigned int msg_id_count = 0;
+ unsigned char *msg_id = NULL; //receiver phone number get from web
+ unsigned char msg_id_separate[ZTE_WMS_DELETE_COUNT_MAX][WMS_MODULE_ID_LEN] = {0}; //separate receiver phone number
+ T_zUfiSms_DelReq del_sms_setting;
+ //char_t *which_page = NULL;
+
+ memset(&del_sms_setting, 0, sizeof(T_zUfiSms_DelReq));
+
+ msg_id = websGetVar(wp, "msg_id", T(""));
+ //which_page = websGetVar(wp, "which_cgi", T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"web para:[msg_id] is [%s].\n", msg_id);
+ //WEBLOG("web para:[which_page] is [%s].\n",which_page);
+
+ msg_id_count = parseStrBySeparator(msg_id, (unsigned char *)msg_id_separate, WMS_MODULE_ID_LEN, SEPARATOR_CHARACTER);
+
+ del_sms_setting.all_or_count = msg_id_count;
+ for (i = 0; i < msg_id_count; i++) {
+ del_sms_setting.id[i] = atoi(msg_id_separate[i]);
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_sms_move_to_sim_msg_process:del_sms_setting.all_or_count is [%lu]\n", del_sms_setting.all_or_count);
+
+ for (j = 0; j < msg_id_count; j++) {
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_sms_move_to_sim_msg_process:move msg number:[%lu]\n", del_sms_setting.id[j]);
+ }
+ /* mc interface */
+
+
+ if (ZTE_MC_OK_S == zte_mc_relay_sms_move_to_sim_msg((T_zUfiSms_DelReq*)(&del_sms_setting))) {
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_sms_move_to_sim_msg_process:send move sms cmd to mc success.\n");
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "zte_sms_move_to_sim_msg_process:send move sms cmd to mc fail.\n");
+ zte_write_result_to_web(wp, FAILURE);
+ }
+
+ //zte_write_result_to_web(wp,SUCCESS);
+}
+void zte_goform_sms_alldel_msg_process(webs_t wp)
+{
+ int ret = 0;
+ char strPage[16] = {0};
+ WEB_DEL_SMS_BY_TYPE MSG_DEL_TYPE_ST;
+ memset(&MSG_DEL_TYPE_ST, 0, sizeof(WEB_DEL_SMS_BY_TYPE));
+
+ strncpy(strPage, websGetVar(wp, "which_page", T("")),sizeof(strPage)-1);
+ if (0 == strcmp(strPage, "inbox")) {
+ MSG_DEL_TYPE_ST.eLocation = SMS_LOCATION_SIM;
+ MSG_DEL_TYPE_ST.eBoxName = SMS_INBOX;
+ } else if (0 == strcmp(strPage, "outbox")) {
+ MSG_DEL_TYPE_ST.eLocation = SMS_LOCATION_SIM;
+ MSG_DEL_TYPE_ST.eBoxName = SMS_OUTBOX;
+ } else if (0 == strcmp(strPage, "draftbox")) {
+ MSG_DEL_TYPE_ST.eLocation = SMS_LOCATION_SIM;
+ MSG_DEL_TYPE_ST.eBoxName = SMS_DRAFTBOX;
+ } else if (0 == strcmp(strPage, "me_inbox")) {
+ MSG_DEL_TYPE_ST.eLocation = SMS_LOCATION_ME;
+ MSG_DEL_TYPE_ST.eBoxName = SMS_INBOX;
+ } else if (0 == strcmp(strPage, "me_outbox")) {
+ MSG_DEL_TYPE_ST.eLocation = SMS_LOCATION_ME;
+ MSG_DEL_TYPE_ST.eBoxName = SMS_OUTBOX;
+ } else if (0 == strcmp(strPage, "me_draftbox")) {
+ MSG_DEL_TYPE_ST.eLocation = SMS_LOCATION_ME;
+ MSG_DEL_TYPE_ST.eBoxName = SMS_DRAFTBOX;
+ }
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_goform_sms_alldel_msg_process send message: MODULE_ID_SMS, MSG_CMD_DEL_SMS_BY_TYPE");/*lint !e26*/
+ //ret = zte_send_message(MODULE_ID_SMS, MSG_CMD_DEL_SMS_BY_TYPE,sizeof(WEB_DEL_SMS_BY_TYPE),(UCHAR *)&MSG_DEL_TYPE_ST); /*lint !e26 !e55*/
+ ret = ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_SMS, MSG_CMD_DEL_SMS_BY_TYPE, sizeof(WEB_DEL_SMS_BY_TYPE), (UCHAR *)&MSG_DEL_TYPE_ST, 0);
+ if (0 != ret) {
+ zte_write_result_to_web(wp, FAILURE);
+ WebSms_LOG(LOG_ERR, "Delete all the message to sms failed(send msg)\n");/*lint !e26*/
+ return;
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+}
+void zte_sms_set_message_center(webs_t wp)
+{
+ T_zUfiSms_ParaInfo sms_setting_st;
+ char_t *sms_center_number = NULL;
+ char_t *mem_store = NULL;
+ char_t *validity_period = NULL;
+ char_t *status_report = NULL;
+ char_t *send_retry = NULL;
+ char_t *outdate_delete = NULL;
+ char_t *default_store = NULL;
+
+ memset(&sms_setting_st, 0, sizeof(T_zUfiSms_ParaInfo));
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User set message center!\n"));
+
+ sms_center_number = websGetVar(wp, "MessageCenter", T(""));
+ mem_store = websGetVar(wp, "save_location", T(""));
+ validity_period = websGetVar(wp, "save_time", T(""));
+ status_report = websGetVar(wp, "status_save", T(""));
+ send_retry = websGetVar(wp, "sendfail_retry", T(""));
+ outdate_delete = websGetVar(wp, "outdate_delete", T(""));
+ default_store = websGetVar(wp, "default_store", T(""));
+
+ if (('\0' == (*sms_center_number)) || ('\0' == (*mem_store))
+ || ('\0' == (*validity_period)) || ('\0' == (*status_report))) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (('\0' != (*send_retry)) || ('\0' != (*outdate_delete))
+ || ('\0' != (*default_store))) {
+ sms_setting_st.sendfail_retry_on = atoi(send_retry); //open--->1;close--->0;
+ sms_setting_st.outdate_delete_on = atoi(outdate_delete); //open--->1;close--->0;
+ }
+ strncpy(sms_setting_st.default_store, default_store,sizeof(sms_setting_st.default_store)-1);
+
+ strncpy(sms_setting_st.sca, sms_center_number,sizeof(sms_setting_st.sca)-1);
+ sms_setting_st.status_report_on = atoi(status_report); //open--->1;close--->0;
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_setting_st.sca=%s", sms_setting_st.sca); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_setting_st.status_report_on=%d", sms_setting_st.status_report_on); /*lint !e26*/
+
+ if (!strcmp(mem_store, "native")) { //location of saving message
+ sms_setting_st.mem_store = 1;
+ } else if (!strcmp(mem_store, "sim_card")) {
+ sms_setting_st.mem_store = 0;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR,"zte_sms_set_message_center: invalid mem_store.\n"); /*lint !e26*/
+ sms_setting_st.mem_store = 1;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_setting_st.mem_store=%d", sms_setting_st.mem_store); /*lint !e26*/
+
+ if (0 == strcmp(validity_period, "twelve_hours")) { //according to 3GPP technical specification
+ sms_setting_st.tp_validity_period = 143;
+ } else if (0 == strcmp(validity_period, "one_day")) {
+ sms_setting_st.tp_validity_period = 167;
+ } else if (0 == strcmp(validity_period, "one_week")) {
+ sms_setting_st.tp_validity_period = 173;
+ } else if (0 == strcmp(validity_period, "largest")) {
+ sms_setting_st.tp_validity_period = 255;
+ } else if (0 == strcmp(validity_period, "cdma_largest")) {
+ sms_setting_st.tp_validity_period = 244;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "zte_sms_set_message_center: invalid validity_period.\n"); /*lint !e26*/
+ sms_setting_st.tp_validity_period = 255;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, " sms_setting_st.tp_validity_period=%d", sms_setting_st.tp_validity_period); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_sms_set_message_center:The center number is:[%s].\n", sms_setting_st.sca); /*lint !e26*/
+
+ /* mc interface */
+ if (ZTE_MC_OK_S == zte_mc_relay_sms_set_parameter((T_zUfiSms_ParaInfo*)(&sms_setting_st))) {
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_sms_set_message_center: send msg to mc success.\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "zte_sms_set_message_center: send msg to mc fail.\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+ //zte_write_result_to_web(wp,SUCCESS);
+}
+
+/**********************************************************************
+* Function: zte_sms_view_msg_process
+* Description: to set the viewed msg as read
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2011/11/16 V1.0 chenyi first version
+**********************************************************************/
+
+void zte_sms_view_msg_process(webs_t wp)
+{
+ char_t *msg_id = NULL;
+ char_t *tag = NULL;
+ T_zUfiSms_ModifyFlag modify_tag_ptr;
+
+ unsigned int total_id = 0;
+ unsigned char id[WMS_MODULE_ID_LEN] = {0};
+ int i = 0;
+ int index = 0;
+
+ memset(&modify_tag_ptr, 0, sizeof(T_zUfiSms_ModifyFlag));
+
+ /* get value from web */
+ msg_id = websGetVar(wp, "msg_id", T(""));
+ tag = websGetVar(wp, "tag", T(""));
+
+ if (('\0' == (*msg_id)) || ('\0' == (*tag))) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ modify_tag_ptr.tags = (unsigned char)atoi(tag);
+ //parse id list
+ for (i = 0; i < strlen(msg_id); i++) {
+ if (';' == msg_id[i]) {
+ if (total_id < (sizeof(modify_tag_ptr.id) / sizeof(unsigned long))) {
+ modify_tag_ptr.id[total_id] = atoi(id);
+ }
+ total_id++;
+ index = 0;
+ memset(id, 0, sizeof(id)); //reset
+ continue;
+ }
+
+ if (index < (sizeof(id) - 1)) {
+ id[index++] = msg_id[i];
+ }
+ }
+
+ modify_tag_ptr.total_id = total_id;
+
+ slog(MISC_PRINT, SLOG_DEBUG, " modify_tag_ptr.tags=%d", modify_tag_ptr.tags); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, " modify_tag_ptr.total_id =%d", modify_tag_ptr.total_id); /*lint !e26*/
+
+#if 0
+ //msg print
+ for (i = 0 ; i < total_id; i++) {
+ WebSms_LOG(LOG_INFO, "view msg id[%d]= [%lu]\n", i, modify_tag_ptr.id[i]); /*lint !e26*/
+ }
+
+ WebSms_LOG(LOG_INFO, "view msg:tag[%c],total_id[%lu]\n", modify_tag_ptr.tags, modify_tag_ptr.total_id); /*lint !e26*/
+
+ WebSms_LOG(LOG_INFO, "view size:[%d]", (sizeof(modify_tag_ptr.id) / sizeof(unsigned long))); /*lint !e26*/
+#endif
+
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ modify_tag_ptr.type = 1;
+ } else {
+ modify_tag_ptr.type = 0;
+ }
+ /* mc interface */
+ if (ZTE_MC_OK_S == zte_mc_relay_sms_modify_tag(&modify_tag_ptr)) {
+ slog(MISC_PRINT, SLOG_NORMAL, "web_sms:Send message to mc successful!(view message)\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "web_sms:Send message to mc fail!(view message)\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+
+ //zte_write_result_to_web(wp,SUCCESS);
+}
+
+/**********************************************************************
+* Function: zte_get_sms_data
+* Description: to get the sms data info
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+
+void zte_get_sms_data(webs_t wp)
+{
+ zte_sms_query_req sms_query_req;
+ zte_sms_query_result *p_sms_query_result = NULL;
+ int result = 0;
+ int i = 0;
+ char_t *page = NULL;
+ char_t *data_per_page = NULL;
+ char_t *mem_store = NULL;
+ char_t *tags = NULL;
+ char_t *order_by = NULL;
+ T_zUfiSms_ModifyFlag modify_tag_ptr;
+ int index = 0;
+ memset(&modify_tag_ptr, 0, sizeof(T_zUfiSms_ModifyFlag));
+ memset(&sms_query_req, 0, sizeof(zte_sms_query_req));
+
+ page = websGetVar(wp, "page", T(""));
+ data_per_page = websGetVar(wp, "data_per_page", T(""));
+ mem_store = websGetVar(wp, "mem_store", T(""));
+ tags = websGetVar(wp, "tags", T(""));
+ order_by = websGetVar(wp, "order_by", T(""));
+
+ if (('\0' == *page) || ('\0' == *data_per_page) || ('\0' == *mem_store) || ('\0' == *tags) || ('\0' == *order_by)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_get_sms_data: invalid input.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+#if 0 // kw 3
+ sms_query_req.page = (uint8)atoi(page);
+#else
+ int temp_page = atoi(page);
+ if(temp_page > 255 || temp_page < 0){
+ return;
+ }
+
+ sms_query_req.page = temp_page;
+#endif
+
+ int tmp_data_per_page = atoi(data_per_page);
+ if(tmp_data_per_page > 255 || tmp_data_per_page < 0)
+ return;
+ sms_query_req.data_per_page = (uint8)tmp_data_per_page;
+
+ sms_query_req.mem_store = (uint8)atoi(mem_store);
+ sms_query_req.tags = (uint8)atoi(tags);
+ //sms_query_req.order_by = (uint8)atoi(order_by);
+ strncpy(sms_query_req.order_by, order_by, sizeof(sms_query_req.order_by) - 1);
+
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_query_req:[%u,%u,%u,%u,%s].\n", sms_query_req.page, sms_query_req.data_per_page, sms_query_req.mem_store, \
+ sms_query_req.tags, sms_query_req.order_by); /*lint !e26*/
+
+ //handle special condition:if the @data_per_page is 0
+ if (0 == sms_query_req.data_per_page) {
+ slog(MISC_PRINT, SLOG_ERR,"to get 0 sms record.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+ p_sms_query_result = (zte_sms_query_result*)malloc(4 + sizeof(zte_sms_data) * (sms_query_req.data_per_page));
+ if (NULL == p_sms_query_result) {
+ slog(MISC_PRINT, SLOG_ERR, "malloc sms result mem fail.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+ //reset,which is important
+ memset(p_sms_query_result, 0, 4 + sizeof(zte_sms_data) * (sms_query_req.data_per_page));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "SMS_DATA GET DATA FROM DB START.\n"); /*lint !e26*/
+ result = zte_libwms_get_sms_data(&sms_query_req, p_sms_query_result);
+ slog(MISC_PRINT, SLOG_DEBUG, "SMS_DATA GET DATA FROM DB END.\n"); /*lint !e26*/
+
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_wms_db_get_sms_data fail.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+ return ;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "total query count [%u].\n", (*p_sms_query_result).count); /*lint !e26*/
+
+ if (0 == (*p_sms_query_result).count) {
+ zte_web_feed_back_empty(wp);
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+ return ;
+ }
+ //write the sms data to web
+ for (i = 0; i < (*p_sms_query_result).count; i++) {
+ if (0 == i) {
+ web_feedback_header(wp);
+ zte_rest_get_sms_data_head(wp);
+ zte_rest_get_sms_data(wp, p_sms_query_result, i, 0);
+#if 0
+ (void)websWrite(wp, T("{\"%s\":[{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\",\"%s\":\"%s\"}"), SMS_MESSAGES, SMS_ID, \
+ (*p_sms_query_result).data[i].id, SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
+ SMS_TAG, (*p_sms_query_result).data[i].tag, \
+ SMS_DATE, (*p_sms_query_result).data[i].date.year, (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, (*p_sms_query_result).data[i].date.sec, \
+ (*p_sms_query_result).data[i].date.timezone, SMS_DRAFT_GROUP_ID, (*p_sms_query_result).data[i].draft_group_id);
+#endif
+ } else {
+ zte_rest_get_sms_data(wp, p_sms_query_result, i, 1);
+#if 0
+ (void)websWrite(wp, T(",{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\",\"%s\":\"%s\"}"), SMS_ID, \
+ (*p_sms_query_result).data[i].id, SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
+ SMS_TAG, (*p_sms_query_result).data[i].tag, \
+ SMS_DATE, (*p_sms_query_result).data[i].date.year, (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, (*p_sms_query_result).data[i].date.sec, \
+ (*p_sms_query_result).data[i].date.timezone, SMS_DRAFT_GROUP_ID, (*p_sms_query_result).data[i].draft_group_id);
+#endif
+ }
+ /*
+ if(sms_query_req.mem_store == 0 && atoi(p_sms_query_result->data[i].tag) == 1)
+ {
+ modify_tag_ptr.id[index] = atoi(p_sms_query_result->data[i].id);
+ modify_tag_ptr.total_id ++;
+ index ++;
+ }
+ */
+ }
+ /*
+ if(sms_query_req.mem_store == 0 && modify_tag_ptr.total_id > 0)
+ {
+ modify_tag_ptr.tags = 0;
+ zte_mc_relay_sms_modify_tag(&modify_tag_ptr);
+ }
+ */
+ zte_rest_get_sms_data_foot(wp);
+ //(void)websWrite(wp, T("]}"));
+
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+}
+
+/**********************************************************************
+* Function: zte_get_sms_data_total
+* Description: to get the total sms
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+
+void zte_get_sms_data_total(webs_t wp)
+{
+ zte_sms_query_req sms_query_req;
+ zte_sms_query_result *p_sms_query_result = NULL;
+ int result = 0;
+ int i = 0;
+ char_t *page = NULL;
+ char_t *data_per_page = NULL;
+ char_t *mem_store = NULL;
+ char_t *tags = NULL;
+ char_t *order_by = NULL;
+
+ int idata_per_page = 0;
+
+ int total_pages = 0;
+ int leave_nums = 0;
+ int curr_page = 0;
+ int total_sms = 0;
+ T_zUfiSms_ModifyFlag modify_tag_ptr;
+ int index = 0;
+ memset(&sms_query_req, 0, sizeof(zte_sms_query_req));
+
+ page = websGetVar(wp, "page", T(""));
+ data_per_page = websGetVar(wp, "data_per_page", T(""));
+ mem_store = websGetVar(wp, "mem_store", T(""));
+ tags = websGetVar(wp, "tags", T(""));
+ order_by = websGetVar(wp, "order_by", T(""));
+
+ if (('\0' == *page) || ('\0' == *data_per_page) || ('\0' == *mem_store) || ('\0' == *tags) || ('\0' == *order_by)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_get_sms_data: invalid input.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+#if 0
+ //calculate the total pages
+ total_pages = (atoi(data_per_page)) / SMS_READ_RECORD_MAX_NUM;
+ leave_nums = (atoi(data_per_page)) % SMS_READ_RECORD_MAX_NUM;
+
+ if (0 != leave_nums) {
+ total_pages++;
+ }
+
+#else
+ idata_per_page = atoi(data_per_page);
+ if(idata_per_page < 0 || idata_per_page > INT_MAX-1)
+ {
+ total_pages = 1;
+ leave_nums = 0;
+ }
+ else
+ {
+ //calculate the total pages
+ total_pages = idata_per_page / SMS_READ_RECORD_MAX_NUM;
+ leave_nums = idata_per_page % SMS_READ_RECORD_MAX_NUM;
+
+ if (0 != leave_nums) {
+ total_pages++;
+ }
+ }
+#endif
+
+ slog(MISC_PRINT, SLOG_DEBUG, "total_pages,leave_nums:[%d][%d]", total_pages, leave_nums); /*lint !e26*/
+
+ p_sms_query_result = (zte_sms_query_result*)malloc(4 + sizeof(zte_sms_data) * SMS_READ_RECORD_MAX_NUM);
+ if (NULL == p_sms_query_result) {
+ slog(MISC_PRINT, SLOG_ERR, "malloc sms result mem fail.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+ for (curr_page = 0; curr_page < total_pages; curr_page++) {
+
+ //reset
+ index = 0;
+ memset(&modify_tag_ptr, 0, sizeof(T_zUfiSms_ModifyFlag));
+ memset(&sms_query_req, 0, sizeof(zte_sms_query_req));
+ sms_query_req.page = curr_page;
+#if 0
+ if (((total_pages - 1) == curr_page) && (0 != leave_nums)) {
+ sms_query_req.data_per_page = leave_nums;//last page
+ } else {
+ sms_query_req.data_per_page = SMS_READ_RECORD_MAX_NUM;
+ }
+#endif
+ sms_query_req.data_per_page = SMS_READ_RECORD_MAX_NUM;
+ sms_query_req.mem_store = (uint8)atoi(mem_store);
+ sms_query_req.tags = (uint8)atoi(tags);
+ //sms_query_req.order_by = (uint8)atoi(order_by);
+ strncpy(sms_query_req.order_by, order_by, sizeof(sms_query_req.order_by) - 1);
+
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_query_req:[%u,%u,%u,%u,%s].\n", sms_query_req.page, sms_query_req.data_per_page, sms_query_req.mem_store, \
+ sms_query_req.tags, sms_query_req.order_by); /*lint !e26*/
+
+ //reset,which is important
+ memset(p_sms_query_result, 0, 4 + sizeof(zte_sms_data)*SMS_READ_RECORD_MAX_NUM);
+
+ slog(MISC_PRINT, SLOG_NORMAL, "SMS_DATA_TOTAL GET DATA FROM DB START.\n"); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "curr_page[%d]", sms_query_req.page); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "total_sms[%d]", total_sms); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, " atoi(data_per_page)=%d", atoi(data_per_page)); /*lint !e26*/
+
+ result = zte_libwms_get_sms_data(&sms_query_req, p_sms_query_result);
+
+ slog(MISC_PRINT, SLOG_DEBUG, "SMS_DATA_TOTAL GET DATA FROM DB END.\n"); /*lint !e26*/
+
+ if (-1 == result) {
+ WebSms_LOG(LOG_DEBUG, "read sms page [%d] fail.\n", curr_page); /*lint !e26*/
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+
+ if (0 == curr_page) {
+ zte_web_feed_back_empty(wp);
+ return ;
+ } else {
+ break;
+ }
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "total query count [%u].\n", (*p_sms_query_result).count); /*lint !e26*/
+
+ if (0 == (*p_sms_query_result).count) {
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+
+ if (0 == curr_page) {
+ zte_web_feed_back_empty(wp);
+ return ;
+ } else {
+ break;
+ }
+ }
+
+ //write the sms data to web
+ for (i = 0; (i < (*p_sms_query_result).count) && (total_sms < atoi(data_per_page)); i++) {
+ if ((0 == i) && (0 == curr_page)) {
+ web_feedback_header(wp);
+ zte_rest_get_sms_data_head(wp);
+ zte_rest_get_sms_data(wp, p_sms_query_result, i, 0);
+#if 0
+ (void)websWrite(wp, T("{\"%s\":[{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\",\"%s\":\"%s\"}"), SMS_MESSAGES, SMS_ID, \
+ (*p_sms_query_result).data[i].id, SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
+ SMS_TAG, (*p_sms_query_result).data[i].tag, \
+ SMS_DATE, (*p_sms_query_result).data[i].date.year, (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, (*p_sms_query_result).data[i].date.sec, \
+ (*p_sms_query_result).data[i].date.timezone, SMS_DRAFT_GROUP_ID, (*p_sms_query_result).data[i].draft_group_id);
+ total_sms ++;
+#endif
+ } else {
+ zte_rest_get_sms_data(wp, p_sms_query_result, i, 1);
+#if 0
+ (void)websWrite(wp, T(",{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\",\"%s\":\"%s\"}"), SMS_ID, \
+ (*p_sms_query_result).data[i].id, SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
+ SMS_TAG, (*p_sms_query_result).data[i].tag, \
+ SMS_DATE, (*p_sms_query_result).data[i].date.year, (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, (*p_sms_query_result).data[i].date.sec, \
+ (*p_sms_query_result).data[i].date.timezone, SMS_DRAFT_GROUP_ID, (*p_sms_query_result).data[i].draft_group_id);
+ total_sms ++;
+#endif
+ }
+ /*
+ if(sms_query_req.mem_store == 0 && atoi(p_sms_query_result->data[i].tag) == 1)
+ {
+ modify_tag_ptr.id[index] = atoi(p_sms_query_result->data[i].id);
+ modify_tag_ptr.total_id ++;
+ index ++;
+ }
+ */
+ }
+ /*
+ if(sms_query_req.mem_store == 0 && modify_tag_ptr.total_id > 0
+ && !(wp->flags & WEBS_XML_CLIENT_REQUEST))
+ {
+ modify_tag_ptr.tags = 0;
+ zte_mc_relay_sms_modify_tag(&modify_tag_ptr);
+ }
+ */
+ }
+ zte_rest_get_sms_data_foot(wp);
+ //(void)websWrite(wp, T("]}"));
+
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+}
+
+/**********************************************************************
+* Function: zte_get_sms_parameter_info
+* Description: to get the sms parameter info
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+
+void zte_get_sms_parameter_info(webs_t wp)
+{
+ T_zUfiSms_ParaInfo sms_parameter_info;
+ int result = 0;
+
+ memset(&sms_parameter_info, 0, sizeof(T_zUfiSms_ParaInfo));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "SMS_PARAMETER_INFO GET DATA FROM DB START.\n"); /*lint !e26*/
+ result = zte_libwms_get_parameter(&sms_parameter_info);
+ slog(MISC_PRINT, SLOG_DEBUG, "SMS_PARAMETER_INFO GET DATA FROM DB END.\n"); /*lint !e26*/
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_libwms_get_parameter fail.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+ web_feedback_header(wp);
+ zte_rest_sms_parameter(wp, sms_parameter_info);
+#if 0
+ (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%d\",\"%s\":\"%u\",\"%s\":\"%u\"}"), SMS_PARAMETER_SCA, sms_parameter_info.sca, SMS_PARAMETER_MEM_STORE, sms_parameter_info.mem_store, \
+ SMS_PARAMETER_VALIDITY_PERIOD, sms_parameter_info.tp_validity_period, \
+ SMS_PARAMETER_STATUS_REPORT, sms_parameter_info.status_report_on);
+#endif
+}
+
+
+/**********************************************************************
+* Function: zte_get_sms_cmd_status_info
+* Description: to get the sms cmd status info
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+
+void zte_get_sms_cmd_status_info(webs_t wp)
+{
+ T_zUfiSms_StatusInfo cmd_status_info;
+ int result = 0;
+ char *sms_cmd = NULL;
+
+ memset(&cmd_status_info, 0, sizeof(T_zUfiSms_StatusInfo));
+
+ //read sms_cmd
+ sms_cmd = websGetVar(wp, "sms_cmd", T(""));
+ if ('\0' == *sms_cmd) {
+ slog(MISC_PRINT, SLOG_ERR, "sms_cmd is empty.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+ /*lint -e64*/
+ int cmd = atoi(sms_cmd);
+ if(cmd >= WMS_SMS_CMD_NONE && cmd <= WMS_SMS_CMD_WMS_MAX){
+ cmd_status_info.cmd = (T_zUfiSms_CmdType)cmd;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "sms_cmd is %d.\n",cmd);
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, "sms_cmd_status_info GET DATA FROM DB START.\n"); /*lint !e26*/
+ result = zte_libwms_get_cmd_status(&cmd_status_info);
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_cmd_status_info GET DATA FROM DB END.\n"); /*lint !e26*/
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_libwms_get_cmd_status fail.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write(wp, SMS_CMD, sms_cmd, 1);
+ zte_rest_cmd_write_int(wp, SMS_CMD_STATUS_RESULT, cmd_status_info.cmd_status, 0);
+ zte_rest_cmd_write_foot(wp);
+ //(void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%d\"}"),SMS_CMD,sms_cmd,SMS_CMD_STATUS_RESULT,cmd_status_info.cmd_status);
+}
+
+
+int zte_get_sms_remain_capacity()
+{
+ int sms_remain = 0;
+ int sms_nv_total = 0;
+ int sms_sim_total = 0;
+ int sms_nv_rev_total = 0;
+ int sms_nv_send_total = 0;
+ int sms_nv_draftbox_total = 0;
+ char default_store[NV_ITEM_STRING_LEN_10] = {0};
+
+ sc_cfg_get("default_store", default_store, sizeof(default_store));
+ if (0 == strcmp(default_store, "sim")) {
+ sms_sim_total = zte_libwms_get_sms_capability(0);//sim
+ //¿¨²à´æ´¢ÈÝÁ¿ÒԶμÆË㣬ÎÞ·¨°´Ìõͳ¼Æ
+ //Òò´ËÈç¹ûжÌÐÅ´æ´¢ÔÚ¿¨²à£¬ÄÇô¾Í²»½øÐÐÅжÏ
+ //´Ë´¦¸³ÖµÎª10£¬´óÓÚµ÷Óñ¾º¯ÊýʱÅжϵÄ5Ìõ
+ //¿¨²à¿Õ¼äÊÇ·ñ³ä×ãÄܽÓÊÕÁ÷Á¿Ð£×¼¶ÌÐŵÄÅжÏ
+ //½»ÓÉÐÒéÕ»Åжϴ¦Àí
+ sms_remain = 10;
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_get_sms_remain_capacity, default_store = %s, total = %d!\n", default_store, sms_sim_total);
+ } else {
+ sms_nv_total = zte_libwms_get_sms_capability(1);//nv
+ sms_nv_rev_total = zte_libwms_get_sms_used(1, 0); //nv rev read
+ sms_nv_rev_total += zte_libwms_get_sms_used(1, 1); //nv rev not read
+ sms_nv_send_total = zte_libwms_get_sms_used(1, 2); //nv send
+ sms_nv_draftbox_total = zte_libwms_get_sms_used(1, 3); //nv draftbox 1,not send
+ sms_nv_draftbox_total += zte_libwms_get_sms_used(1, 4); //nv draftbox 2,write
+
+ if(sms_nv_total < 0 || sms_nv_total > INT_MAX -1){
+ sms_nv_total = INT_MAX;
+ }
+
+ sms_remain = sms_nv_total - sms_nv_rev_total - sms_nv_send_total - sms_nv_draftbox_total;
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_get_sms_remain_capacity, default_store = %s, total = %d, rev= %d, send= %d, draft= %d!\n", default_store, sms_nv_total, sms_nv_rev_total, sms_nv_send_total, sms_nv_draftbox_total);
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"[traffic] zte_get_sms_remain_capacity, default_store = %s, sms_remain = %d!\n", default_store, sms_remain);
+ return sms_remain;
+}
+
+
+/**********************************************************************
+* Function: zte_get_sms_capacity_info
+* Description: to get the sms capacity info
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+
+void zte_get_sms_capacity_info(webs_t wp)
+{
+ int sms_nv_total = 0;
+ int sms_sim_total = 0;
+
+ //int sms_nv_used = 0;
+ //int sms_sim_used = 0;
+
+ int sms_nv_rev_total = 0;
+ int sms_nv_send_total = 0;
+ int sms_nv_draftbox_total = 0;
+ int sms_sim_rev_total = 0;
+ int sms_sim_send_total = 0;
+ int sms_sim_draftbox_total = 0;
+
+ //WebSms_LOG(LOG_INFO,"sms_capacity_info GET DATA FROM DB START.\n");
+
+
+ sms_nv_total = zte_libwms_get_sms_capability(1);//nv
+ sms_sim_total = zte_libwms_get_sms_capability(0);//sim
+
+ sms_nv_rev_total = zte_libwms_get_sms_used(1, 0); //nv rev read
+ sms_nv_rev_total += zte_libwms_get_sms_used(1, 1); //nv rev not read
+ sms_nv_send_total = zte_libwms_get_sms_used(1, 2); //nv send
+ sms_nv_draftbox_total = zte_libwms_get_sms_used(1, 3); //nv draftbox 1,not send
+ sms_nv_draftbox_total += zte_libwms_get_sms_used(1, 4); //nv draftbox 2,write
+
+ sms_sim_rev_total = zte_libwms_get_sms_used(0, 0); //sim rev read
+ sms_sim_rev_total += zte_libwms_get_sms_used(0, 1); //sim rev not read
+ sms_sim_send_total = zte_libwms_get_sms_used(0, 2); //sim send
+ sms_sim_draftbox_total = zte_libwms_get_sms_used(0, 3); //sim draftbox 1,not send
+ sms_sim_draftbox_total += zte_libwms_get_sms_used(0, 4); //sim draftbox 2,write
+
+ //WebSms_LOG(LOG_INFO,"sms_capacity_info GET DATA FROM DB END.\n");/*lint !e26*/
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+ zte_rest_cmd_write_int(wp, SMS_NV_TOTAL, sms_nv_total, 1);
+ zte_rest_cmd_write_int(wp, SMS_SIM_TOTAL, sms_sim_total, 1);
+ zte_rest_cmd_write_int(wp, SMS_NV_REV_TOTAL, sms_nv_rev_total, 1);
+ zte_rest_cmd_write_int(wp, SMS_NV_SEND_TOTAL, sms_nv_send_total, 1);
+ zte_rest_cmd_write_int(wp, SMS_NV_DRAFTBOX_TOTAL, sms_nv_draftbox_total, 1);
+ zte_rest_cmd_write_int(wp, SMS_SIM_REV_TOTAL, sms_sim_rev_total, 1);
+ zte_rest_cmd_write_int(wp, SMS_SIM_SEND_TOTAL, sms_sim_send_total, 1);
+ zte_rest_cmd_write_int(wp, SMS_SIM_DRAFTBOX_TOTAL, sms_sim_draftbox_total, 0);
+ zte_rest_cmd_write_foot(wp);
+
+ sc_cfg_set("sms_db_change", "0");
+ slog(MISC_PRINT, SLOG_DEBUG, "nv set sms_db_change=0.\n"); /*lint !e26*/
+#if 0
+ (void)websWrite(wp, T("{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\"}"), \
+ SMS_NV_TOTAL, sms_nv_total, SMS_SIM_TOTAL, sms_sim_total, \
+ SMS_NV_REV_TOTAL, sms_nv_rev_total, SMS_NV_SEND_TOTAL, sms_nv_send_total, SMS_NV_DRAFTBOX_TOTAL, sms_nv_draftbox_total, \
+ SMS_SIM_REV_TOTAL, sms_sim_rev_total, SMS_SIM_SEND_TOTAL, sms_sim_send_total, SMS_SIM_DRAFTBOX_TOTAL, sms_sim_draftbox_total \
+ );
+#endif
+}
+
+/**********************************************************************
+* Function: zte_get_sms_status_rpt_data
+* Description: to get the sms status report data
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+void zte_get_sms_status_rpt_data(webs_t wp)
+{
+ zte_sms_query_req sms_query_req;
+ zte_sms_query_result *p_sms_query_result = NULL;
+ int result = 0;
+ int i = 0;
+ char_t *page = NULL;
+ char_t *data_per_page = NULL;
+
+ memset(&sms_query_req, 0, sizeof(zte_sms_query_req));
+
+ page = websGetVar(wp, "page", T(""));
+ data_per_page = websGetVar(wp, "data_per_page", T(""));
+
+ if (('\0' == *page) || ('\0' == *data_per_page)) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_get_sms_data: invalid input.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+ int tmp_page = atoi(page);
+ int tmp_data_per_page = atoi(data_per_page);
+ if((tmp_page > 255 || tmp_page < 0)
+ ||(tmp_data_per_page > 255 || tmp_data_per_page < 0)){
+ slog(MISC_PRINT, SLOG_ERR, "sms_query_req:err[%d,%d].\n", tmp_page, tmp_data_per_page); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+ sms_query_req.page = (uint8)tmp_page;
+ sms_query_req.data_per_page = (uint8)tmp_data_per_page;
+
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_query_req:[%u,%u].\n", sms_query_req.page, sms_query_req.data_per_page); /*lint !e26*/
+
+ p_sms_query_result = (zte_sms_query_result*)malloc(1 + sizeof(zte_sms_data) * (sms_query_req.data_per_page));
+ if (NULL == p_sms_query_result) {
+ slog(MISC_PRINT, SLOG_ERR, "malloc sms result mem fail.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ return ;
+ }
+
+ //reset,which is important
+ memset(p_sms_query_result, 0, 1 + sizeof(zte_sms_data) * (sms_query_req.data_per_page));
+ slog(MISC_PRINT, SLOG_NORMAL, "sms_status_rpt_data GET DATA FROM DB START.\n"); /*lint !e26*/
+ result = zte_libwms_get_sms_report(&sms_query_req, p_sms_query_result);
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_status_rpt_data GET DATA FROM DB END.\n"); /*lint !e26*/
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_libwms_get_sms_report fail.\n"); /*lint !e26*/
+ zte_web_feed_back_empty(wp);
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+ return ;
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG, "total query count for status rpt: [%u].\n", (*p_sms_query_result).count); /*lint !e26*/
+
+ if (0 == (*p_sms_query_result).count) {
+ zte_web_feed_back_empty(wp);
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+ return ;
+ }
+ //write the sms data to web
+ for (i = 0; i < (*p_sms_query_result).count; i++) {
+ if (0 == i) {
+ web_feedback_header(wp);
+ zte_rest_get_sms_data_head(wp);
+ zte_rest_sms_status_rpt(wp, p_sms_query_result, i, 0);
+#if 0
+ (void)websWrite(wp, T("{\"%s\":[{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\"}"), SMS_MESSAGES, SMS_ID, \
+ (*p_sms_query_result).data[i].id, SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
+ SMS_DATE, (*p_sms_query_result).data[i].date.year, (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, (*p_sms_query_result).data[i].date.sec, \
+ (*p_sms_query_result).data[i].date.timezone);
+#endif
+
+ } else {
+ zte_rest_sms_status_rpt(wp, p_sms_query_result, i, 1);
+#if 0
+ (void)websWrite(wp, T(",{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\"}"), SMS_ID, \
+ (*p_sms_query_result).data[i].id, SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
+ SMS_DATE, (*p_sms_query_result).data[i].date.year, (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
+ (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, (*p_sms_query_result).data[i].date.sec, \
+ (*p_sms_query_result).data[i].date.timezone);
+#endif
+
+ }
+ }
+ zte_rest_get_sms_data_foot(wp);
+ //(void)websWrite(wp, T("]}"));
+
+ //free
+// if (NULL != p_sms_query_result) { // kw 3
+ free(p_sms_query_result);
+ p_sms_query_result = NULL;
+// }
+}
+
+/**********************************************************************
+* Function: zte_get_sms_unread_count
+* Description: to get the unread sms count
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+void zte_get_sms_unread_count(webs_t wp)
+{
+ int sms_dev_unread_count = 0;
+ int sms_sim_unread_count = 0;
+ slog(MISC_PRINT, SLOG_NORMAL, "sms_unread_count GET DATA FROM DB START.\n"); /*lint !e26*/
+ sms_dev_unread_count = zte_libwms_get_sms_used(1, 1); //nv unread
+ sms_sim_unread_count = zte_libwms_get_sms_used(0, 1); //sim unread
+ slog(MISC_PRINT, SLOG_DEBUG, "sms_unread_count GET DATA FROM DB END.\n"); /*lint !e26*/
+
+
+ web_feedback_header(wp);
+ zte_rest_cmd_write_head(wp);
+
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ zte_rest_cmd_write_int(wp, CMD_SMS_UNREAD_COUNT, sms_dev_unread_count, 0);
+ zte_rest_cmd_write_int(wp, SMS_DEV_UNREAD_COUNT, sms_dev_unread_count, 1);
+ zte_rest_cmd_write_int(wp, SMS_SIM_UNREAD_COUNT, sms_sim_unread_count, 0);
+ } else {
+ (void)websWrite(wp, T("\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\""), \
+ CMD_SMS_UNREAD_COUNT, sms_dev_unread_count, \
+ SMS_DEV_UNREAD_COUNT, sms_dev_unread_count, \
+ SMS_SIM_UNREAD_COUNT, sms_sim_unread_count);
+ }
+
+ zte_rest_cmd_write_foot(wp);
+
+}
+
+/**********************************************************************
+* Function: zte_get_sms_unread_num
+* Description: to get the unread sms num
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+void zte_get_sms_unread_num(webs_t wp)
+{
+ int sms_dev_unread_count = 0;
+ sms_dev_unread_count = zte_libwms_get_sms_used(1, 1); //nv unread
+
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ zte_rest_cmd_write_int(wp, NV_SMS_UNREAD_NUM, sms_dev_unread_count, 0);
+ } else {
+ (void)websWrite(wp, T("\"%s\":\"%d\""), NV_SMS_UNREAD_NUM, sms_dev_unread_count);
+ }
+}
+
+/**********************************************************************
+* Function: zte_web_feed_back_empty
+* Description: to write empty info to web
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/03 V1.0 liuyingnan first version
+**********************************************************************/
+
+static void zte_web_feed_back_empty(webs_t wp)
+{
+ if (NULL == wp) {
+ return;
+ }
+
+ web_feedback_header(wp);
+ if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
+ websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
+ websWrite(wp, T("<%s>empty</%s>\n"), SMS_MESSAGES, SMS_MESSAGES);
+ } else {
+ (void)websWrite(wp, T("{\"%s\":[]}"), SMS_MESSAGES);
+ }
+
+}
+
+/******************************************************
+* Function: parseStrBySeparator()
+* Description: separate the string by a specific character
+* Input:
+* Output:
+* Return: -1--->failed, 0--->successful
+* Others:
+* Modify Date Version Author Modification
+* 2010/10/27 V1.0 huangmin create
+2012/06/20 v2.0 chenyi modify
+*******************************************************/
+static unsigned int parseStrBySeparator
+(
+ unsigned char* input,
+ unsigned char* output,
+ int destLen,
+ unsigned char separator
+)
+{
+ int i, j, k;
+ int srcLen = 0;
+ i = j = k = 0;
+
+ if (NULL == input || NULL == output || destLen == 0 || strlen(input) == 0) {
+ slog(MISC_PRINT, SLOG_ERR, "parseStrBySemicolon: param is null!\n"); /*lint !e26*/
+ return 0;
+ }
+
+ srcLen = strlen(input) + 1;//which contains the '\0'
+
+ for (i = 0; i < srcLen; i++) {
+ if ('\0' == input[i]) {
+ if (k <= (destLen - 1)) {
+ *(output + destLen * j + k) = '\0';
+ } else {
+ *(output + destLen * j + (destLen - 1)) = '\0';
+ }
+
+ return j + 1;
+ }
+
+ if (separator == input[i]) {
+ if (k <= (destLen - 1)) {
+ *(output + destLen * j + k) = '\0';
+ } else {
+ *(output + destLen * j + (destLen - 1)) = '\0';
+ }
+
+ if ('\0' != input[i + 1]) {
+ k = 0;
+ j++;
+ }
+ } else {
+ if (k < (destLen - 1)) {
+ *(output + destLen * j + k) = input[i];
+ k++;
+ }
+ }
+ }
+
+ return j;
+}
+
+#if 0
+/******************************************************
+* Function: sms_util_asc_to_hex()
+* Description: transform the ASCII string of SMS code to hex
+* Input:
+* Output:
+* Return: -1--->failed, 0--->successful
+* Others:
+* Modify Date Version Author Modification
+* 2010/10/27 V1.0 huangmin create
+*******************************************************/
+static int sms_util_asc_to_hex /*lint !e528*/
+(
+ unsigned char *in_ptr, /* IN: Pointer to the Hex data (in ASCII format) */
+ unsigned char *out_ptr, /* OUT: Pointer to the result buffer(converted data) */
+ int len /* IN: Length of the input data pointer (Hex data) */
+)
+{
+ unsigned char *str;
+ unsigned char temp_buf[3];
+ int i;
+ unsigned int num_val;
+ int result = 0;
+
+ str = in_ptr;
+
+ len = len * 2;
+
+ //WebSms_LOG(LOG_INFO,"in sms_util_asc_to_hex\n");/*lint !e26*/
+ while (len > 0) {
+ for (i = 0; (i < 2) && (*str != '\0'); i++) {
+ temp_buf[i] = *str++;
+ }
+ temp_buf[i] = '\0';
+ if (asc_util_atoi(&num_val, temp_buf, 16) != 0) {
+ /* We got a out of range value */
+ result = -1;
+ }
+ *out_ptr++ = (unsigned char)num_val;
+ // WebSms_LOG(LOG_INFO,"goahead=====middle===out_ptr===%s",out_ptr);/*lint !e26*/
+ len -= i;
+ }
+ WebSms_LOG(LOG_INFO, "leave sms_util_asc_to_hex\n"); /*lint !e26*/
+
+ return result;
+} /* ZTE_dsat707sms_asscii_to_is637_data */
+
+
+/******************************************************
+* Function: asc_util_atoi()
+* Description: transform the ASCII string to integer
+* Input:
+* Output:
+* Return: -1--->failed, 0--->successful
+* Others:
+* Modify Date Version Author Modification
+* 2010/10/27 V1.0 huangmin create
+*******************************************************/
+static int asc_util_atoi
+(
+ unsigned int *val_arg_ptr, /* value returned */
+ const unsigned char *s, /* points to string to eval */
+ unsigned int r /* radix */
+)
+{
+ int err_ret = 0;
+ unsigned char c;
+ unsigned int val, val_lim, dig_lim;
+
+ val = 0;
+ val_lim = (unsigned int)((unsigned int)0xFFFFFFFF / r);
+ dig_lim = (unsigned int)((unsigned int)0xFFFFFFFF % r);
+
+ while ((c = *s++) != '\0') {
+ if (c != ' ') {
+ c = (unsigned char) UPCASE(c);
+ if (c >= '0' && c <= '9') {
+ c -= '0';
+ } else if (c >= 'A') {
+ c -= 'A' - 10;
+ } else {
+ err_ret = -1; /* char code too small */
+ break;
+ }
+
+ if (c >= r || val > val_lim
+ || (val == val_lim && c > dig_lim)) {
+ err_ret = -1; /* char code too large */
+ break;
+ } else {
+ err_ret = 0; /* arg found: OK so far*/
+ val = (unsigned int)(val * r + c);
+ }
+ }
+ *val_arg_ptr = val;
+ }
+
+ return err_ret;
+}
+#endif
+void zte_get_boradcast_data(webs_t wp)
+{
+ zte_wms_cell_bro_s_type *p_bro_query_result = NULL;
+
+ int result = 0;
+
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_get_boradcast_data GET DATA FROM DB START.\n");
+ p_bro_query_result = (zte_wms_cell_bro_s_type*)malloc(1 + sizeof(zte_wms_cell_bro_s_type));
+ if(p_bro_query_result == NULL) return;
+ result = zte_libwms_get_cell_bro(p_bro_query_result);
+
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_get_boradcast_data GET DATA FROM DB END.\n");
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_libwms_get_cell_bro fail.\n");
+ zte_web_feed_back_empty(wp);
+ //cov
+ free(p_bro_query_result);
+ p_bro_query_result = NULL;
+ return ;
+ }
+ web_feedback_header(wp);
+ zte_rest_get_bro_data_head(wp);
+ zte_rest_boradcast_data(wp, p_bro_query_result);
+ zte_rest_get_bro_data_foot(wp);
+
+
+
+
+ //if (NULL != p_bro_query_result) {
+ free(p_bro_query_result);
+ p_bro_query_result = NULL;
+ //}
+
+}
diff --git a/ap/app/goahead/interface5.0/zte_web_sms.h b/ap/app/goahead/interface5.0/zte_web_sms.h
new file mode 100644
index 0000000..0ab7fa6
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_sms.h
@@ -0,0 +1,153 @@
+#include "message.h"
+
+
+#define ZTE_WMS_MESSAGE_LIST_MAX 255
+#define ZTE_WMS_DB_EXECSQL_LEN 1024
+#define ZTE_WMS_ADDRESS_LEN_MAX 32
+
+/*support MAX COUNT NUMBER*/
+#define ZTE_WMS_RECEIVER_NUM_MAX (50)
+#define ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX (2 * ZTE_WMS_SMS_MSG_CONTENT_LEN_MAX)
+#define ZTE_WMS_SMS_COUNT_MAX (10)
+//#define ZTE_WMS_CONCAT_SMS_COUNT_MAX (1)
+//#define ZTE_WMS_SMS_CONCAT_CONTENT_LEN_MAX (2 * ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX * ZTE_WMS_CONCAT_SMS_COUNT_MAX)
+
+
+#define ZTE_WMS_TP_SCTS_LEN_MAX (50) /*modified by crw*/
+#define ZTE_WMS_SMS_UD_HEADER_LEN_MAX (30)
+#define ZTE_WMS_SMS_CONCAT_ELEMNT_MAX (3)
+#define ZTE_WMS_SMS_CONCAT_ELEMNT_ASC_LEN (153)
+#define ZTE_WMS_SMS_CONCAT_ELEMNT_UCS_LEN (67)
+
+#define DCS_ASC 1
+#define DCS_USC 2
+#define DCS_UNKNOW 0
+#define DCS_UNICODE 2
+#define DCS_SPANISH 3
+#define DCS_GSM7_DEFAULT 4
+#define DCS_TURKISH 6
+
+#define SEPARATOR_CHARACTER ';'
+#define WMS_MODULE_ID_LEN 11
+
+#define SMS_READ_RECORD_MAX_NUM 10
+
+#define SMS_CMD_STATUS_RESULT "sms_cmd_status_result"
+#define SMS_CMD "sms_cmd"
+
+#define SMS_PARAMETER_SCA "sms_para_sca"
+#define SMS_PARAMETER_MEM_STORE "sms_para_mem_store"
+#define SMS_PARAMETER_VALIDITY_PERIOD "sms_para_validity_period"
+#define SMS_PARAMETER_STATUS_REPORT "sms_para_status_report"
+#define SMS_PARAMETER_SEND_RETRY "sendfail_retry"
+#define SMS_PARAMETER_OUTDATE_DELETE "outdate_delete"
+#define SMS_PARAMETER_DEFAULT_STORE "default_store"
+
+#define SMS_MESSAGES "messages"
+
+#define SMS_ID "id"
+#define SMS_NUMBER "number"
+#define SMS_NAME "name"
+#define SMS_CONTENT "content"
+#define SMS_TAG "tag"
+#define SMS_DATE "date"
+#define SMS_DRAFT_GROUP_ID "draft_group_id"
+//capacity info
+#define SMS_NV_TOTAL "sms_nv_total"
+#define SMS_SIM_TOTAL "sms_sim_total"
+#define SMS_NV_REV_TOTAL "sms_nv_rev_total"
+#define SMS_NV_SEND_TOTAL "sms_nv_send_total"
+#define SMS_NV_DRAFTBOX_TOTAL "sms_nv_draftbox_total"
+#define SMS_SIM_REV_TOTAL "sms_sim_rev_total"
+#define SMS_SIM_SEND_TOTAL "sms_sim_send_total"
+#define SMS_SIM_DRAFTBOX_TOTAL "sms_sim_draftbox_total"
+
+//#define ZTE_WMS_SEND_NUM_MAX (1)
+#define SMS_DEV_UNREAD_COUNT "sms_dev_unread_num"
+#define SMS_SIM_UNREAD_COUNT "sms_sim_unread_num"
+#define NUMBER_SIZE 8
+
+typedef struct {
+ unsigned char page;
+ unsigned char data_per_page;
+ unsigned char mem_store;
+ unsigned char tags;
+ unsigned char order_by[256];
+} zte_sms_query_req ;
+
+typedef struct {
+ unsigned char year[5];
+ unsigned char month[3];
+ unsigned char day[3];
+ unsigned char hour[3];
+ unsigned char min[3];
+ unsigned char sec[3];
+ unsigned char timezone[4];
+} zte_wms_sms_date;
+
+//CONCAT_SMS
+typedef struct {
+ char id[10];
+ char number [ZTE_WMS_ADDRESS_LEN_MAX + 1];
+ char sms_content[2 * ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX * ZTE_WMS_CONCAT_SMS_COUNT_MAX + 1];
+ char tag[10];
+ zte_wms_sms_date date;
+ char draft_group_id[32];
+} zte_sms_data;
+#if 0 // ÔÀ´²»Ö§³Ö¼¶Áª¶ÌÐŵĴúÂë
+typedef struct {
+ char id[10];
+ char number [ZTE_WMS_ADDRESS_LEN_MAX + 1];
+ char sms_content[2 * ZTE_WMS_SMS_MSG_CONTENT_STORE_LEN_MAX + 1];
+ char tag[10];
+ zte_wms_sms_date date;
+ char draft_group_id[32];
+} zte_sms_data;
+#endif
+#if 0
+//¶ÌÏûÏ¢ÊÕ¼þÏä¡¢·¢¼þÏä¡¢²Ý¸åÏä¡¢Ô¤Éè¶ÌÏûÏ¢µÄö¾Ù
+typedef enum _SMS_BOX_NAME {
+ SMS_ALLBOX = 1,
+ SMS_INBOX,
+ SMS_OUTBOX,
+ SMS_DRAFTBOX,
+ SMS_PRESETBOX
+} SMS_BOX_NAME;
+#endif
+
+/*¶ÌÐÅ´æ·ÅµÄλÖÃ*/
+typedef enum _SMS_LOCATION {
+ SMS_LOCATION_SIM = 0, //¿¨²à
+ SMS_LOCATION_ME, //É豸²à
+ SMS_LOCATION_PC, //PC²à
+} SMS_LOCATION;
+
+typedef enum _SMS_BOX_NAME {
+ SMS_ALLBOX = 1,
+ SMS_INBOX,
+ SMS_OUTBOX,
+ SMS_DRAFTBOX,
+ SMS_PRESETBOX
+} SMS_BOX_NAME;
+
+/*Ò³ÃæÇëÇóɾ³ýijһÀà¶ÌÐÅ*/
+typedef struct tagWEB_DEL_SMS_BY_TYPE {
+ SMS_BOX_NAME eBoxName; /*´ýɾ³ýµÄBOX*/
+ SMS_LOCATION eLocation; /*¶ÌÐÅ´æ·ÅµÄλÖÃ*/
+} WEB_DEL_SMS_BY_TYPE;
+
+
+typedef struct {
+ unsigned char count;
+ zte_sms_data data[0]; /*lint !e1501*/
+} zte_sms_query_result;
+
+
+typedef struct {
+ unsigned char content[1024];
+} zte_wms_cell_bro_s_type;
+
+
+
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_ussd.c b/ap/app/goahead/interface5.0/zte_web_ussd.c
new file mode 100644
index 0000000..e65ab24
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_ussd.c
@@ -0,0 +1,303 @@
+/******************************************************************
+* Description: provide functions about the ussd management
+* Modify Date Version Author Modification
+* 2012/04/06 V1.0 chenyi create
+******************************************************************/
+
+//header file
+#include "zte_web_interface.h"
+//#include "zte_topsw_ussd.h"
+//#include "libzte_ussd.h"
+//constant
+
+#define USSD_ACTION "ussd_action"
+#define USSD_DCS "ussd_dcs"
+#define USSD_DATA "ussd_data"
+
+#define ZTE_WEB_USSD_SEND "ussd_send"
+#define ZTE_WEB_USSD_CANCEL "ussd_cancel"
+#define ZTE_WEB_USSD_REPLY "ussd_reply"
+#define ZTE_WEB_USSD_FIRST "ussd"
+#define ZTE_WEB_USSD_OVER "ussd_over"
+
+#ifndef ZTE_USSD_NV
+#define ZTE_USSD_NV "ussd_write_flag"
+#endif
+
+#ifndef ZTE_MAX_USSD_CHAR
+#define ZTE_MAX_USSD_CHAR 160
+#endif
+
+#define USSD_OPERATING "15"
+#define USSD_FIRST_CANCEL "17"
+#define USSD_OVER ""
+
+typedef struct {
+ int ussd_action;
+ int ussd_dcs;
+ unsigned char ussd_data[ZTE_USSD_DATA_TO_WEB_LEN];
+} zte_ussd_data_to_web_type;
+static void zte_web_ussd_cancel(webs_t wp);
+static void zte_web_ussd_send(webs_t wp);
+static void zte_web_ussd_reply(webs_t wp);
+void zte_web_ussd(webs_t wp);
+static void zte_web_ussd_over(webs_t wp);
+
+//functions
+
+/**********************************************************************
+* Function: zte_goform_ussd_process
+* Description:
+* Input: web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120406 V1.0 chenyi first version
+**********************************************************************/
+void zte_goform_ussd_process(webs_t wp)
+{
+ char_t *ussd_operator = NULL;
+
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd-> invalid input..\n"); /*lint !e26*/
+ return;
+ }
+
+ ussd_operator = websGetVar(wp, T("USSD_operator"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "ussd_operator is [%s].\n", ussd_operator); /*lint !e26*/
+
+ if (0 == strcmp(ussd_operator, ZTE_WEB_USSD_SEND)) {
+ zte_web_ussd_send(wp);
+ } else if (0 == strcmp(ussd_operator, ZTE_WEB_USSD_CANCEL)) {
+ zte_web_ussd_cancel(wp);
+ } else if (0 == strcmp(ussd_operator, ZTE_WEB_USSD_REPLY)) {
+ zte_web_ussd_reply(wp);
+ } else if (0 == strcmp(ussd_operator, ZTE_WEB_USSD_FIRST)) {
+ zte_web_ussd(wp);
+ } else if (0 == strcmp(ussd_operator, ZTE_WEB_USSD_OVER)) {
+ zte_web_ussd_over(wp);
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "invalid ussd_operator[%s].\n", ussd_operator); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+}
+/**********************************************************************
+* Function: zte_web_ussd_send(webs_t wp)
+* Description:
+* Input: web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120406 V1.0 chenyi first version
+**********************************************************************/
+static void zte_web_ussd_send(webs_t wp)
+{
+ unsigned char ussd_data[ZTE_MAX_USSD_CHAR] = {0};
+ unsigned char *ussd_send_number = NULL;
+
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd_send: invalid input..\n"); /*lint !e26*/
+ return;
+ }
+
+ ussd_send_number = websGetVar(wp, T("USSD_send_number"), T(""));
+ slog(MISC_PRINT, SLOG_DEBUG, "ussd_send_number is [%s].\n", ussd_send_number); /*lint !e26*/
+
+ if (0 == strcmp(ussd_send_number, "")) {
+ slog(MISC_PRINT, SLOG_ERR, "ussd number is empty.\n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ strncpy(ussd_data, ussd_send_number, sizeof(ussd_data) - 1);
+ slog(MISC_PRINT, SLOG_DEBUG, "ussd_data is [%s].\n", ussd_data); /*lint !e26*/
+
+ //update the current state
+ (void)zte_web_write(ZTE_USSD_NV, USSD_OPERATING);
+ (void)zte_web_write("ussd_operater", "send");
+ (void)zte_web_write("ussd_string", ussd_data);
+
+ /*handler to mc*/
+ if (0 == ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_USSD_SET_REQ, 0, NULL, 0)) {
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_web_ussd_send: successful.\n"); /*lint !e26*/
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd_send: failed.\n"); /*lint !e26*/
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+/**********************************************************************
+* Function: zte_web_ussd_cancel(webs_t wp)
+* Description: to cancel the ussd operation
+* Input: web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120406 V1.0 chenyi first version
+**********************************************************************/
+static void zte_web_ussd_cancel(webs_t wp)
+{
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd_cancel invalid input..\n"); /*lint !e26*/
+ return;
+ }
+
+ (void)zte_web_write(ZTE_USSD_NV, USSD_OPERATING);
+
+ (void)zte_web_write("ussd_operater", "cancel");
+
+ /*handler to mc*/
+ if (0 == ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_USSD_CANCEL_REQ, 0, NULL, 0)) {
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_web_ussd_cancel: zte_topsw_mc_ussd_send successful.\n"); /*lint !e26*/
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd_cancel: zte_topsw_mc_ussd_send failed.\n"); /*lint !e26*/
+ }
+
+ zte_write_result_to_web(wp, SUCCESS);
+}
+/**********************************************************************
+* Function: zte_web_ussd_over(webs_t wp)
+* Description: to reset the ussd_write_flag
+* Input: web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120406 V1.0 chenyi first version
+**********************************************************************/
+static void zte_web_ussd_over(webs_t wp)
+{
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd_over invalid input..\n"); /*lint !e26*/
+ return;
+ }
+
+ (void)zte_web_write(ZTE_USSD_NV, USSD_OVER);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+/**********************************************************************
+* Function: zte_web_ussd_reply(webs_t wp)
+* Description: to reply(send) the ussd cmd
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120406 V1.0 chenyi first version
+**********************************************************************/
+static void zte_web_ussd_reply(webs_t wp)
+{
+ /*data get from page*/
+ unsigned char ussd_data_reply[ZTE_MAX_USSD_CHAR] = {0};
+
+ /*check input*/
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd_reply: invalid input..\n"); /*lint !e26*/
+ return;
+ }
+
+ /*set data */
+ strncpy(ussd_data_reply, websGetVar(wp, T("USSD_reply_number"), T("")), sizeof(ussd_data_reply) - 1);
+
+ /*handler to mc*/
+ (void)zte_web_write(ZTE_USSD_NV, USSD_OPERATING);
+ (void)zte_web_write("ussd_string", ussd_data_reply);
+
+ (void)zte_web_write("ussd_operater", "send");
+
+ if (0 == ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_USSD_SET_REQ, 0, NULL, 0)) {
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_web_ussd_reply: successful.\n"); /*lint !e26*/
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd_reply: failed.\n"); /*lint !e26*/
+ }
+ zte_write_result_to_web(wp, SUCCESS);
+}
+/**********************************************************************
+* Function: zte_web_ussd(webs_t wp)
+* Description: to cancel the ussd cmd
+* Input: web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 20120406 V1.0 chenyi first version
+**********************************************************************/
+
+void zte_web_ussd(webs_t wp)
+{
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_web_ussd: invalid input..\n"); /*lint !e26*/
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_web_ussd: ok\n"); /*lint !e26*/
+
+ (void)zte_web_write(ZTE_USSD_NV, USSD_FIRST_CANCEL);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+int zte_ussd_get_to_web_data(zte_ussd_data_to_web_type *para)
+{
+ char buf[NV_ITEM_STRING_LEN_20] = {0};
+
+ if (NULL == para) {
+ slog(MISC_PRINT, SLOG_DEBUG, "para is null\n"); /*lint !e26*/
+ return -1;
+ }
+
+ sc_cfg_get("ussd_mode", buf, sizeof(buf));
+ para->ussd_action = atoi(buf);
+ slog(MISC_PRINT, SLOG_DEBUG, "ussd_operater is %d\n", para->ussd_action); /*lint !e26*/
+
+ memset(&buf, 0, sizeof(buf));
+ sc_cfg_get("ussd_dcs", buf, sizeof(buf));
+ para->ussd_dcs = atoi(buf);
+ slog(MISC_PRINT, SLOG_DEBUG, "ussd_dcs is %d\n", para->ussd_dcs); /*lint !e26*/
+
+ sc_cfg_get("ussd_content", (para->ussd_data), sizeof(para->ussd_data));
+
+ slog(MISC_PRINT, SLOG_DEBUG, "ussd_data is %s\n", para->ussd_data); /*lint !e26*/
+
+ return 0;
+
+}
+/**********************************************************************
+* Function: zte_get_ussd_data_info
+* Description: to get the ussd data info
+* Input: the web para
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/04/16 V1.0 chenyi first version
+**********************************************************************/
+void zte_get_ussd_data_info(webs_t wp)
+{
+ zte_ussd_data_to_web_type ussd_data_info;
+ int result = 0;
+
+ memset(&ussd_data_info, 0, sizeof(zte_ussd_data_to_web_type));
+ result = zte_ussd_get_to_web_data(&ussd_data_info);
+#if 0 // kw 3 return -1 branch is unreachable
+ if (-1 == result) {
+ slog(MISC_PRINT, SLOG_ERR, "call zte_ussd_get_to_web_data fail.\n"); /*lint !e26*/
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("[]"));
+ return ;
+ }
+#endif
+
+ web_feedback_header(wp);
+ (void)websWrite(wp, T("{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\"}"), USSD_ACTION, ussd_data_info.ussd_action, USSD_DCS, ussd_data_info.ussd_dcs, \
+ USSD_DATA, ussd_data_info.ussd_data);
+}
diff --git a/ap/app/goahead/interface5.0/zte_web_util.c b/ap/app/goahead/interface5.0/zte_web_util.c
new file mode 100755
index 0000000..a4c0056
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_util.c
@@ -0,0 +1,860 @@
+/**
+ * @file zte_web_util.c
+ * @brief goform mesage processing
+ *
+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.
+ * @author Hong Wu <wu.hong@sanechips.com.cn>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <net/route.h>
+#ifdef CONFIG_DEFAULTS_KERNEL_2_6_21
+#include <linux/types.h>
+#include <linux/socket.h>
+#endif
+#include <string.h>
+#include <dirent.h>
+#include "webs.h"
+//#include "linux/autoconf.h"
+#include <sys/time.h>
+#include <signal.h>
+#include "zte_web_interface.h"
+#include "zte_web_get_fw_para.h"
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+#define MAX_MOBILE_KEY_WORD_SIZE 20 /*¹Ø¼ü×Ö³¤¶ÈÔݶ¨20*/
+#define MAX_PAGE_PATH_SIZE 128
+//#define MAX_GOFORM_TABLE_SIZE 256
+
+/*******************************************************************************
+ * Local function declarations *
+ ******************************************************************************/
+static int getSysUptime(int eid, webs_t wp, int argc, char_t **argv);
+static int zte_goform_whitelist_check(webs_t wp);
+static int zte_goform_blacklist_check(webs_t wp);
+/*******************************************************************************
+ * Local variable definitions *
+ ******************************************************************************/
+/****Define the HEADER and FOOTER of web page****/
+static const char * const zte_web_page_header =
+ "<head>"
+ "<title>-</title>"
+ "</head>"
+ "<body bgcolor=white>"
+ "<p>"
+ "<font size=3 face=arial>"
+ "<p>"
+ "<font size=2 face=arial>"
+ ;
+
+static const char * const zte_web_page_footer =
+ "<p>"
+ "<p>"
+ "<font face=arial></b></font><br>"
+ "<script> "
+ " timer = setTimeout('location.replace(\"%s\")', 100) "
+ "</script> "
+ "<p>"
+ "</body>"
+ ;
+
+static const char * const zte_web_page_top =
+ "<p>"
+ "<p>"
+ "<font face=arial></b></font><br>"
+ "<script> "
+ " timer = setTimeout('top.location.replace(\"%s\")', 100) "
+ "</script> "
+ "<p>"
+ "</body>"
+ ;
+//multi_dataΪ¿Õ£¬ÇÒÒѵǽ²ÅÄÜ»ñÈ¡µ½,¸ÃÁÐ±í²»¿ÉËæÒâÔö¼Ó¾¡Á¿ÓÃNV
+static web_goform_type web_goform_get_cmd_table[] = {
+ /********** ¹²Í¬ ***********/
+ //{CMD_GET_DEVICE_MODE, zte_get_device_mode},//debug_enable
+ //{CMD_GET_POWERON_TIME, zte_get_poweron_time},//¿ª»úʱ¼ä
+ //{CMD_GET_LAN_DEV_INFO, zte_get_lan_dev_info},//»ñÈ¡ÄÚÍøÐÅÏ¢
+ {CMD_GET_USER_MAC_ADDR, zte_lan_user_mac_get},
+ {CMD_CONNECTION_MODE, zte_get_connection_mode},
+ /********** PBM module ***********/
+ {CMD_PBM_DATA_INFO, zte_get_pbm_data},
+ {CMD_PBM_DATA_TOTAL, zte_get_pbm_data_total},
+ {CMD_PBM_CAPACITY_INFO, zte_get_pbm_parameter_info},
+ /********** sms module ***********/
+ {CMD_SMS_PAGE_DATA, zte_get_sms_data},
+ {CMD_SMS_DATA_TOTAL, zte_get_sms_data_total},
+ {CMD_SMS_PARAMETER_INFO, zte_get_sms_parameter_info},
+ {CMD_SMS_STATUS_INFO, zte_get_sms_cmd_status_info},
+ {CMD_SMS_CAPACITY_INFO, zte_get_sms_capacity_info},
+ {CMD_SMS_STATUS_RPT_DATA, zte_get_sms_status_rpt_data},
+ {CMD_SMS_UNREAD_COUNT, zte_get_sms_unread_count},
+ {CMD_BROADCAST_DATA, zte_get_boradcast_data},
+ /********** wifi module ***********/
+ {CMD_WIFI_STATION_LIST, zte_wlan_get_station_list},
+ {CMD_WIFI_WPS_AP_PIN, zte_wlan_get_wps_pin},
+ {CMD_WIFI_WPS_AP_DEF_PIN, zte_wlan_get_wps_defpin},
+ /********** net module ***********/
+ {CMD_HOSTNAME_LIST, zte_get_hostnamelist},
+ {CMD_CURRENT_STATICADDR_LIST, zte_get_current_static_addr_list},
+ {CMD_LAN_STATION_LIST, zte_get_lan_station_list},
+ {CMD_CHILDREN_DEVICE_LIST, zte_get_children_device_list},
+ {CMD_WHITE_SITE_LIST, zte_get_white_site_list},
+ /********** DDNS ***********/
+ //{CMD_GETDDNS_STATUS, zte_get_ddns_status},
+ /********** USSD ***********/
+ {CMD_USSD_DATA_INFO, zte_get_ussd_data_info},
+ /********** FOTA ***********/
+ {FOTA_UPGRADE_RESULT, zte_fota_get_upgrade_result}, //¶ÁÈ¡ºóÐèÒªÌØÊâ´¦Àí £¬ËùÒÔ²»ÄܸijÉÖ±½Ó¶ÁNV
+
+ /********** httpshare ***********/
+ {CMD_HTTPSHARE_GETCARD_VAULE, zte_httpShare_getcard_value},
+ {CMD_HTTPSHARE_GETCARD_NMEA, zte_httpShare_getcard_name},
+ {CMD_HTTPSHARE_AUTH_GET, zte_httpShare_auth_get},
+};
+
+
+/*******************************************************************************
+* Global variable definitions *
+******************************************************************************/
+//extern web_goform_type web_goform_set_cmd_table[MAX_GOFORM_TABLE_SIZE];
+web_goform_type web_goform_set_cmd_table[] = {
+ /********** management module ***********/
+ {GOFORM_MGMT_SET_WEB_LANGUAGE, zte_mgmt_set_language}, //webuiÓïÑÔÏÔʾÉèÖÃ
+#ifndef WEBS_SECURITY
+ {GOFORM_MGMT_SET_DEVICEMODE, zte_mgmt_set_devicemode}, //¹¤×÷ģʽ
+#endif
+ {GOFORM_MGMT_LOGIN_IP, zte_mgmt_login}, //怫
+ {GOFORM_MGMT_LOGOUT_IP, zte_mgmt_logout}, //µÇ³ö
+ {GOFORM_MGMT_CHANGE_PASSWORD, zte_mgmt_change_password}, //ÃÜÂëÐÞ¸Ä
+ {GOFORM_MGMT_CHANGE_ACCOUNT, zte_mgmt_change_account}, //Õ˺ÅÐÞ¸Ä
+ {GOFORM_MGMT_QUICK_SETUP, zte_quick_setup}, //¿ìËÙÉèÖÃ
+ {GOFORM_MGMT_RESTORE_FACTORY_SETTINGS, zte_mgmt_restore}, //»Ö¸´³ö³¡ÉèÖÃ
+ {GOFORM_MGMT_REBOOT, zte_goform_mgmt_reboot_process}, //REBOOT
+ {GOFORM_MGMT_POWEROFF, zte_mgmt_poweroff}, //poweroff
+ {GOFORM_MGMT_POWER_ON_SPEED, zte_mgmt_control_power_on_speed}, //¿ìËÙ¿ª¹Ø»úÉèÖÃ
+ //{GOFORM_MGMT_SET_EXTERNAL_NV, zte_goform_set_external_nv},
+ {GOFORM_MGMT_SNTP, zte_goform_mgmt_sntp_process}, //SNTPÉèÖÃ
+ {GOFORM_SNTP_GETDATASTATIC, zte_goform_sntp_getdatastatic_process}, //´¥·¢serverУ׼ʱ¼ä
+ //{GOFORM_MGMT_SYSLOG, zte_goform_mgmt_syslog_process}, //ϵͳLOG
+
+ /********** wan module start***********/
+ {GOFORM_WAN_SET_NETWORK, zte_wan_set_network}, //ÊÖ¶¯ËÑÍø×¢²á
+ {GOFORM_WAN_SET_CONNECTION_MODE, zte_wan_set_connection_mode}, //ÉèÖò¦ºÅģʽ
+ {GOFORM_WAN_CONNECT_NETWORK, zte_wan_connect_network}, //PDP ²¦ºÅÇëÇó
+ {GOFORM_WAN_DISCONNECT_NETWORK, zte_wan_disconnect_network}, //PDP ²¦ºÅ¶Ï¿ªÇëÇó
+ {GOFORM_WAN_SET_BEARER_PREFERENCE, zte_wan_network_select}, //ÉèÖÃÕÒÍø·½Ê½MSG_CMD_NET_SELECT_REQ
+ {GOFORM_WAN_SCAN_NETWORK, zte_wan_scan_network}, //ÊÖ¶¯ËÑÍø
+ {GOFORM_WAN_UNLOCK_NETWORK, zte_mgmt_unlock_network}, //½âËøÍøÂç
+ //{GOFORM_WAN_LOCK_FREQUENCY, zte_wan_lock_frequency_process}, //LTEÏÂËø»ò½âËøÆµÇëÇó£¬ATÔÝδ´¦Àí
+ /********** apn module ***********/
+ {GOFORM_WAN_APN_PROC_EX, zte_form_multi_apn_proc_ex}, //APNÉèÖÃ
+ /********** pin,puk module ***********/
+ {GOFORM_MGMT_ENTER_PIN, zte_mgmt_pin_input}, //ÑéÖ¤PINÂëÊäÈë
+ {GOFORM_MGMT_DISABLE_PIN, zte_mgmt_disable_pin}, //¹Ø±ÕPIN
+ {GOFORM_MGMT_ENABLE_PIN, zte_mgmt_pin_enable_or_modify}, //¿ªÆô»òÐÞ¸ÄPIN
+ {GOFORM_MGMT_ENTER_PUK, zte_mgmt_puk_input}, //PUK
+ {GOFORM_MGMT_AUTO_PIN, zte_mgmt_auto_pin}, //×Ô¶¯PIN
+ /********** statistics module ***********/
+ {GOFORM_WAN_DATA_LIMIT_SETTING, zte_wan_data_limit_setting}, //Á÷Á¿¹ÜÀíÉèÖÃ
+ {GOFORM_WAN_DATA_FLOW_CALIBRATION_MANUAL, zte_wan_data_flow_calibration_manual},//ÊÖ¶¯Ð£×¼Á÷Á¿
+ {GOFORM_WAN_RESET_DATA_COUNTER, zte_wan_data_statistics_clear_process}, //Çå³ýÁ÷Á¿ÐÅÏ¢
+ /********** ussd module ***********/
+ {GOFORM_USSD_PROCESS, zte_goform_ussd_process}, //USSDÉèÖÃ
+ /********** wan module end***********/
+
+ /********** wifi module ***********/
+ {GOFORM_WLAN_SET, zte_wlan_basic_set}, //WIFI »ù´¡ÉèÖÃ
+ {GOFORM_WLAN_MAC_FILTER, zte_wlan_mac_filter_set}, //ÉèÖÃmac¹ýÂ˹¦ÄÜ
+ {GOFORM_WLAN_WPS_SET, zte_wlan_wps_mode_set}, //WPS
+ {GOFORM_WLAN_SSID1_SET, zte_wlan_web_ssid1_set}, //SSID1
+ {GOFORM_WLAN_SSID2_SET, zte_wlan_ssid2_set}, //SSID2
+ {GOFORM_WLAN_WIFI_SLEEP_SET, zte_wlan_sleep_set}, //ÐÝÃß
+ {GOFORM_WLAN_SET_TSW, zte_wlan_set_tsw}, //¶¨Ê±ÐÝÃß»½ÐÑ
+ {GOFORM_WLAN_WIFI_COVERAGE_SET, zte_wlan_coverage_set}, //¸²¸Ç·¶Î§
+ {GOFORM_WLAN_WIFI_STA_CONTROL, zte_wlan_station_set}, //wifi station
+ {GOFORM_WLAN_WIFI_SPOT_PROFILE_UPDATE, zte_wlan_station_spot_profile_update}, //wifi station
+ {GOFORM_WLAN_SET_STA_CON, zte_wlan_station_connect}, //wifi station
+ {GOFORM_WLAN_SET_STA_DISCON, zte_wlan_station_disconnect}, //wifi station
+ {GOFORM_WLAN_SET_STA_REFRESH, zte_wlan_station_refresh}, //wifi station
+
+ /********** router module ***********/
+ {GOFORM_ROUTER_DEL_IP_PORT_FILETER, zte_fw_ipport_filter_del},
+ {GOFORM_ROUTER_ADD_IP_PORT_FILETER_V4V6, zte_fw_ipport_filter_add}, /*for v4 and v6*/
+ {GOFORM_ROUTER_DEL_IP_PORT_FILETER_V4V6, zte_fw_ipport_filter_del_v4_v6}, /*for v4 and v6*/
+ {GOFORM_ROUTER_ADD_PORT_FORWARE, zte_fw_port_forward_add},
+ {GOFORM_ROUTER_DEL_PORT_FORWARE, zte_fw_port_forward_del},
+ {GOFORM_ROUTER_ADD_PORT_MAP, zte_fw_port_map_add},
+ {GOFORM_ROUTER_DEL_PORT_MAP, zte_fw_port_map_del},
+ {GOFORM_ROUTER_BASIC_SETTING, zte_fw_basic_setting},
+ {GOFORM_ROUTER_FORWARD_SETTING, zte_fw_forward_setting},
+ {GOFORM_ROUTER_SYSTEM_SECURITY, zte_fw_sys_security_setting},
+ {GOFORM_ROUTER_DHCP_SETTING, zte_dhcp_set},
+ {GOFORM_ROUTER_STATIC_DHCP_SETTING, zte_static_dhcp_set},
+ {GOFORM_ROUTER_UPNP_SETTING, zte_fw_upnp_set}, //CPEÈÚºÏÔÚ·ÓÉÉèÖÃÖÐ
+ {GOFORM_ROUTER_DMZ_SETTING, zte_fw_dmz},
+ {GOFORM_ROUTER_EDIT_HOSTNAME, zte_edit_hostname},
+ {GOFORM_URL_FILTER_DELETE, zte_goform_url_filter_delete_process}, //URL ¹ýÂË
+ {GOFORM_URL_FILTER_ADD, zte_goform_url_filter_add_process},
+ {GOFORM_BIND_STATIC_ADDRESS_SET, zte_set_bind_static_address},
+ {GOFORM_BIND_STATIC_ADDRESS_ADD, zte_bind_static_address_add},
+ {GOFORM_BIND_STATIC_ADDRESS_DEL, zte_bind_static_address_del},
+ {GOFORM_ADD_CHILDREN_DEVICE, zte_add_children_device}, //¼Ò³¤¿ØÖÆ
+ {GOFORM_DEL_CHILDREN_DEVICE, zte_del_children_device},
+ {GOFORM_ADD_WHITE_SITE, zte_add_white_site},
+ {GOFORM_REMOVE_WHITE_SITE, zte_remove_white_site},
+ {GOFORM_PARENT_CONTROL_SET, zte_parent_control_set},
+ //{GOFORM_DDNS, zte_goform_ddns},
+ //{GOFORM_DNS_MODE_SET, zte_dns_mode_set}, //ÉèÖÃÊÖ¶¯DNS mode
+ //{GOFORM_DNS_SERVER_SET, zte_dns_server_set}, //ÉèÖÃÊÖ¶¯DNS server
+ /********** wan pppoe ***********/
+ {GOFORM_SET_OPERATION_MODE, zte_goform_set_operation_mode}, //RJ45ģʽÇл»ÉèÖÃ
+ {GOFORM_SET_WAN_GATEWAYMODE_PPPOE, zte_goform_set_wan_gatewaymode_PPPOE},
+ {GOFORM_SET_WAN_GATEWAYMODE_DHCP, zte_goform_set_wan_gatewaymode_DHCP},
+ {GOFORM_SET_WAN_GATEWAYMODE_STATIC, zte_goform_set_wan_gatewaymode_STATIC},
+ {GOFORM_SET_WAN_GATEWAYMODE_AUTO, zte_goform_set_wan_gatewaymode_AUTO},
+
+ /********** httpShare module ***********/
+ {GOFORM_HTTPSHARE_ENTERFOLD, zte_httpShare_enterFold}, //get SD's filelist
+ {GOFORM_HTTPSHARE_NEW, zte_httpShare_new}, //creat a new folder
+ {GOFORM_HTTPSHARE_DEL, zte_httpShare_del}, //delete file or folder
+ {GOFORM_HTTPSHARE_AUTH_SET, zte_httpShare_auth_set}, //httpshare setting
+ {GOFORM_HTTPSHARE_MODE_SET, zte_httpShare_modeset}, //set SD card's mode:usb mode or httpshare mode
+ {GOFORM_HTTPSHARE_FILE_RENAME, zte_httpShare_rename}, //rename the file
+ {GOFORM_HTTPSHARE_CHECK_FILE, zte_httpShare_check_file}, //check file exists
+
+ /********** PBM module ***********/
+ {GOFORM_PBM_CONTACT_ADD, zte_goform_pbm_contact_add_process},
+ {GOFORM_PBM_CONTACT_DEL, zte_goform_pbm_contact_del_process},
+
+ /********** sms module ***********/
+ {GOFORM_SMS_SET_MSG_CENTER, zte_sms_set_message_center},
+ {GOFORM_SMS_DELETE_SMS, zte_sms_delete_msg_process},
+ {GOFORM_SMS_DELETE_SMS_ALL, zte_goform_sms_alldel_msg_process},
+ {GOFORM_SMS_MOVE_TO_SIM, zte_sms_move_to_sim_msg_process},
+ {GOFORM_SMS_SAVE_SMS, zte_sms_save_msg_process},
+ {GOFORM_SMS_SEND_SMS, zte_sms_send_msg_process},
+ {GOFORM_SMS_SET_MSG_READ, zte_sms_view_msg_process},
+
+ /********** fota module ***********/
+ {GOFORM_SET_FOTAAUTOUPDATE, zte_fota_update}, //Óû§Ñ¡ÔñÊÇ·ñ½øÐÐÉý¼¶ºÍÉý¼¶ÖÐÈ¡Ïû
+ {GOFORM_SET_FOTASETTINGS, zte_fota_settings}, //×Ô¶¯¼ì²â
+
+ /********** ping test ***********/
+ //{GOFORM_PING_DIAGNOSTICS_START, zte_ping_diagnostics_start}, // ping°ü¼ì²â¹¦ÄÜ¿ªÆô
+ //{GOFORM_PING_DIAGNOSTICS_STOP, zte_ping_diagnostics_stop}, // ping°ü¼ì²â¹¦ÄܹرÕ
+
+ /********** ¿Í»§¶þ´Î¿ª·¢½Ó¿ÚÇëÔÚÏÂÃæÌí¼Ó ***********/
+ {GOFORM_SET_SAMPLE, zte_goform_set_sample}, //¿Í»§¶þ´Î¿ª·¢½Ó¿ÚʾÀý
+};
+
+/*******************************************************************************
+ * Local function implementations *
+ ******************************************************************************/
+
+//WH://»ñȡϵͳ×î½üÒ»´ÎÉϵçºó³ÖÐøÔËÐÐʱ¼ä
+static int getSysUptime(int eid, webs_t wp, int argc, char_t **argv)
+{
+ struct tm *utime;
+ time_t usecs;
+
+ char syn_system_total[20] = {0};
+ char syn_after_time[20] = {0};
+ int ltime = 0;
+ int ntime = 0;
+
+ sc_cfg_get("syn_system_total", syn_system_total, sizeof(syn_system_total));
+
+ sscanf(syn_system_total, "%d", <ime);
+ if(ltime < 0 || ltime > INT_MAX-1) // kw 3
+ {
+ ltime = 0;
+ }
+ ltime += JAN_2000;
+
+ sc_cfg_get("syn_after_time", syn_after_time, sizeof(syn_after_time));
+
+ sscanf(syn_after_time, "%d", &ntime);
+ if(ntime < 0 || ntime > INT_MAX-1) // kw 3
+ {
+ ntime = 0;
+ }
+ time(&usecs);
+ if (ntime == 0) {
+ utime = localtime(&usecs);
+ } else {
+ time_t use;
+ use = (time_t)(usecs - ntime + ltime);
+ utime = localtime(&use);
+ }
+ if(utime == NULL)
+ return -1;
+ if (utime->tm_yday > 0) {
+ return websWrite(wp, T("%d day%s, %d hour%s, %d min%s, %d sec%s"),
+ utime->tm_yday, (utime->tm_yday == 1) ? "" : "s",
+ utime->tm_hour, ((utime->tm_hour == 1) || (utime->tm_hour == 0)) ? "" : "s",
+ utime->tm_min, ((utime->tm_min == 1) || (utime->tm_min == 0)) ? "" : "s",
+ utime->tm_sec, ((utime->tm_sec == 1) || (utime->tm_sec == 0)) ? "" : "s");
+ } else if (utime->tm_hour > 0) {
+ return websWrite(wp, T("%d hour%s, %d min%s, %d sec%s"),
+ utime->tm_hour, (utime->tm_hour == 1) ? "" : "s",
+ utime->tm_min, ((utime->tm_min == 1) || (utime->tm_min == 0)) ? "" : "s",
+ utime->tm_sec, ((utime->tm_sec == 1) || (utime->tm_sec == 0)) ? "" : "s");
+ } else if (utime->tm_min > 0) {
+ return websWrite(wp, T("%d min%s, %d sec%s"),
+ utime->tm_min, (utime->tm_min == 1) ? "" : "s",
+ utime->tm_sec, ((utime->tm_sec == 1) || (utime->tm_sec == 0)) ? "" : "s");
+ } else {
+ return websWrite(wp, T("%d sec%s"),
+ utime->tm_sec, ((utime->tm_sec == 1) || (utime->tm_sec == 0)) ? "" : "s");
+ }
+
+}
+
+static int zte_goform_whitelist_check(webs_t wp)
+{
+
+ char login_info[NV_ITEM_STRING_LEN_20] = {0};
+ char_t nv_ipaddr[40] = {0};
+ //zte_topsw_state_e_type status = ZTE_NVIO_MAX;
+ char_t *ip_address = NULL;
+
+ int result = FALSE;
+
+ zte_web_read(NV_LOGINFO, login_info);
+
+ //get request ip addr
+ ip_address = websGetRequestIpaddr(wp);
+#if 0 // kw 3 NVARIANT_CONDITION.UNREACH
+ if (NULL == ip_address) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_goform_whitelist_check: ip_address is null.\n"); /*lint !e26*/
+ return FALSE;
+ }
+#endif
+ (void)zte_web_read(NV_USER_IP_ADDR, nv_ipaddr);
+ if ((0 == strncmp(login_info, "ok", sizeof(login_info))) && (0 == strncmp(ip_address, nv_ipaddr, sizeof(nv_ipaddr)))) {
+ result = TRUE; //to update the timemark
+ }
+ if (result == TRUE) {
+ if (!zte_mgmt_login_timemark_set()) {
+ slog(MISC_PRINT, SLOG_ERR, "[ERROR]zte_goform_whitelist_check -> timemark set error .\n"); /*lint !e26*/
+ }
+ }
+
+ return result;
+}
+
+/******************************************************
+* Function: zte_goform_blacklist_check
+* Description:goform entry for handling set cmd
+* Input: HTTP Request Info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2013/01/21 V1.0 Liuyingnan create
+*******************************************************/
+static int zte_goform_blacklist_check(webs_t wp)
+{
+ //char login_info[NV_ITEM_STRING_LEN_20] = {0};
+ char_t *zte_goform_id = NULL;
+ //zte_web_read(NV_LOGINFO, login_info);
+
+ zte_goform_id = websGetVar(wp, T("goformId"), T(""));
+ if (zte_goform_id == NULL) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_goform_whitelist_check: zte_goform_id is null.\n"); /*lint !e26*/
+ return -1;
+ }
+
+ if ((0 == strncmp(GOFORM_MGMT_SET_WEB_LANGUAGE, zte_goform_id, strlen(GOFORM_MGMT_SET_WEB_LANGUAGE)))
+ || (0 == strncmp(GOFORM_MGMT_LOGIN_IP, zte_goform_id, strlen(GOFORM_MGMT_LOGIN_IP)))
+ || (0 == strncmp(GOFORM_MGMT_ENTER_PIN, zte_goform_id, strlen(GOFORM_MGMT_ENTER_PIN)))
+ || (0 == strncmp(GOFORM_MGMT_ENTER_PUK, zte_goform_id, strlen(GOFORM_MGMT_ENTER_PUK)))
+ || (0 == strncmp(GOFORM_HTTPSHARE_CHECK_FILE, zte_goform_id, strlen(GOFORM_HTTPSHARE_CHECK_FILE)))
+ || (0 == strncmp(GOFORM_HTTPSHARE_ENTERFOLD, zte_goform_id, strlen(GOFORM_HTTPSHARE_ENTERFOLD)))
+ || (0 == strncmp(GOFORM_HTTPSHARE_FILE_RENAME, zte_goform_id, strlen(GOFORM_HTTPSHARE_FILE_RENAME)))
+ || (0 == strncmp(GOFORM_HTTPSHARE_NEW, zte_goform_id, strlen(GOFORM_HTTPSHARE_NEW)))
+ || (0 == strncmp(GOFORM_HTTPSHARE_DEL, zte_goform_id, strlen(GOFORM_HTTPSHARE_DEL)))
+#ifndef WEBS_SECURITY
+ || (0 == strncmp(GOFORM_MGMT_LOGOUT_IP, zte_goform_id, strlen(GOFORM_MGMT_LOGOUT_IP)))
+ || (0 == strncmp(GOFORM_MGMT_SET_DEVICEMODE, zte_goform_id, strlen(GOFORM_MGMT_SET_DEVICEMODE)))
+ || (0 == strncmp(GOFORM_MGMT_REBOOT, zte_goform_id, strlen(GOFORM_MGMT_REBOOT)))
+#endif
+ ) {
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_goform_whitelist_check: zte_goform_id:[%s] is OK.\n", zte_goform_id); /*lint !e26*/
+ return 1;
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "zte_goform_whitelist_check: zte_goform_id:[%s] is black.\n", zte_goform_id); /*lint !e26*/
+ return -1;
+ }
+
+}
+
+static int isMobileReq(webs_t wp)
+{
+ int iMobileKW = 0;
+ const char MOBILE_KEYWORD[][MAX_MOBILE_KEY_WORD_SIZE] = {"Mobile", "mobile", "MOBILE"};
+
+ if (wp->userAgent == NULL) {
+ return 0;
+ }
+ for (iMobileKW = 0; iMobileKW < sizeof(MOBILE_KEYWORD) / MAX_MOBILE_KEY_WORD_SIZE; iMobileKW++) {
+ if (strstr(wp->userAgent, MOBILE_KEYWORD[iMobileKW]) != NULL) {
+ return 1;
+ }
+ }
+ return 0;
+}
+static int isPageExist(char *page)
+{
+ char *defaultDir = websGetDefaultDir();
+ char *fullPagePath = NULL;
+ int fullPathSize = 0;
+ int hasPageExist = 0;
+
+ if (defaultDir == NULL || page == NULL) {
+ return 0;
+ }
+ fullPathSize = strlen(defaultDir) + strlen(page) + 2;
+ fmtAlloc(&fullPagePath, fullPathSize, T("%s/%s"), defaultDir, page);
+ hasPageExist = (access(fullPagePath, F_OK) == 0);
+ bfreeSafe(B_L, fullPagePath);
+ return hasPageExist;
+}
+
+int is_print_str(char *str, int len)
+{
+ int i = 0;
+ if (str == NULL || len <= 0 || strlen(str) < len) {
+ return 0;
+ }
+ for (i = 0; i < len; i++) {
+ if (!isprint(str[i])) {
+ return 0;
+ }
+ if(str[i] == '%' && (i+2) < len && isxdigit(str[i+1]) && isxdigit(str[i+2]))
+ {
+ if(str[i+1] < '2' || str[i+1] > '7' ||(str[i+1] == '7' && (str[i+2] == 'f' || str[i+2] == 'F')))
+ {
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+
+/*******************************************************************************
+ * Global function implementations *
+ ******************************************************************************/
+
+/******************************************************
+* Function: void zte_web_init()
+* Description: the entry of zte code in goahead
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2010/8/5 V1.0 LiuWei create
+* 2010/11/4 V1.1 ZYT modify
+*******************************************************/
+void zte_web_init()
+{
+ sc_cfg_set(NV_LOGINFO, "");
+ websFormDefine(T("proc_get"), zte_goform_get_cmd_process);
+ websFormDefine(T("proc_post"), zte_goform_set_cmd_process);
+ zte_init_login_psw_time(); //WH:³õʼ»¯×î´óµÇ½´ÎÊý
+}
+
+/*
+ * description: parse va and do system
+ */
+#if 0
+int doSystem(char_t *fmt, ...)
+{
+ va_list vargs;
+ char_t *cmd = NULL;
+ int rc = 0;
+
+ va_start(vargs, fmt);/*lint !e530*/
+ if (fmtValloc(&cmd, WEBS_BUFSIZE, fmt, vargs) >= WEBS_BUFSIZE) {
+ trace(0, T("doSystem: lost data, buffer overflow\n"));
+ }
+ va_end(vargs);
+
+ if (cmd) {
+ trace(0, T("%s\n"), cmd);
+ rc = system(cmd);
+ bfree(B_L, cmd);
+ }
+ return rc;
+}
+#endif
+/******************************************************
+* Function: void zte_webs_feedback_top(webs_t wp, char *fileName)
+* Description: feed back web page at top location
+* Input:
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2010/9/10 V1.0 LiuWei create
+* 2010/11/15 V1.1 zyt modify
+*******************************************************/
+void zte_webs_feedback_top(webs_t i_wp, char *i_pageName)
+{
+ char dest_page[64] = {0};
+ char language[64] = {0};
+
+ if (NULL == i_pageName) {
+ slog(MISC_PRINT, SLOG_ERR, "zte_webs_feedback_top para null.\n"); /*lint !e26*/
+ return;
+ }
+
+ sc_cfg_get(NV_LANGUAGE, language, sizeof(language));
+ websWrite(i_wp, T("HTTP/1.1 200 OK\n"));
+ websWrite(i_wp, T("Pragma: no-cache\n"));
+ websWrite(i_wp, T("Cache-control: no-cache\n"));
+ websWrite(i_wp, T("Connection: Close\n"));
+ websWrite(i_wp, T("Content-Type: text/html\n"));
+ websWrite(i_wp, T("Set-Cookie: mLangage=%s;"" path=/;"" Expires=Mon, 1 Jan 2050 00:00:00 GMT\n"), language);
+ websWrite(i_wp, T("\n"));
+ websWrite(i_wp, T("<html>\n"));
+ websWrite(i_wp, T(zte_web_page_header));
+ websWrite(i_wp, T(zte_web_page_top), i_pageName);
+ websWrite(i_wp, T("</html>"));
+}
+
+
+
+/******************************************************
+* Function: zte_goform_get_cmd_process()
+* Description:goform entry from web pages to get fw para, call the related functions according to the cmd
+* Input: HTTP Request Info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/08/08 V1.0 liuyingnan create
+*******************************************************/
+void zte_goform_get_cmd_process(webs_t wp, char *path, char *query)
+{
+ char_t *cmd = NULL;
+ char_t *multi_data = NULL;
+ char login_info[NV_ITEM_STRING_LEN_20] = {0};
+ UINT32 ticks = 0;
+ int goform_index = 0;
+ int max_goform_index = (int)(sizeof(web_goform_get_cmd_table) / sizeof(web_goform_type));
+
+ zte_get_login_status_value(wp, login_info);
+
+ cmd = websGetVar(wp, T("cmd"), T(""));
+ multi_data = websGetVar(wp, T("multi_data"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG, "[goahead] zte_goform_get_cmd_process multi_data = %s, cmd = %s\n", multi_data, cmd);
+
+ zte_mgmt_login_timeout_check();
+
+ if (0 == strcmp(cmd, "")) {
+ websDone(wp, 0);
+ return;
+ }
+#ifdef WEBINSPECT_FIX
+ if (query && (strstr(query, "%3d%2f")
+ || strstr(query, "%3c%2f")
+ || strstr(query, "=/")
+ || strstr(query, "</")
+ || strstr(query, "%27")
+ || strstr(query, "'")
+#ifdef WEBS_SECURITY
+ || strstr(query, "%2f")
+ || strstr(query, "/")
+ || strstr(query, "%5c")
+ || strstr(query, "\\")
+ || strstr(query, "%3c")
+ || strstr(query, "<")
+ || strstr(query, "%3e")
+ || strstr(query, ">")
+ || strstr(query, "%28")
+ || strstr(query, "(")
+ || strstr(query, "%29")
+ || strstr(query, ")")
+ || strstr(query, "%25")
+#endif
+ )) {
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e qry:%s\n",query);
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]e 1\n");
+ websDone(wp, 0);
+ return;
+ }
+ if (strstr(cmd, "=/") || strstr(cmd, "</")
+#ifdef WEBS_SECURITY
+ || strstr(cmd, "/") || strstr(cmd, "\\") || strstr(cmd, "<") || strstr(cmd, ">")
+#endif
+ || strstr(cmd, "'")) {
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e cmd:%s\n",cmd);
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]e 2\n");
+ websDone(wp, 0);
+ return;
+ }
+#ifdef WEBS_SECURITY
+ char token[COOKIE_SESSION_SIZE+1] = {0};
+ char cook_id[COOKIE_SESSION_SIZE+1] = {0};
+ (void)zte_web_read(NV_COOKIE_ID, cook_id);
+ (void)zte_web_read(NV_WEB_TOKEN, token);
+ if (strlen(cook_id) && wp->cookie && strlen(wp->cookie) > strlen(token)
+ && (strstr(wp->cookie, token) == NULL)) {
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e cmd:%s\n",cmd);
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e token:%s\n",token);
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e cookie:%s\n",wp->cookie);
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]e 3\n");
+ websDone(wp, 0);
+ sc_cfg_set(NV_WEB_TOKEN, "");
+ return;
+ }
+ if(query && !is_print_str(query,strlen(query)))
+ {
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]g print_str\n");
+ websDone(wp, 0);
+ return;
+ }
+#endif
+#endif
+ if ((0 == strcmp("ok", login_info)) || (0 == strcmp(GOFORM_HTTPSHARE_GETCARD_VAULE, cmd))) {
+ if (0 == strcmp(multi_data, "")) {
+ for (goform_index = 0; goform_index < max_goform_index; goform_index++) {
+ if (0 == strcmp(web_goform_get_cmd_table[goform_index].goform_id, cmd)) {
+ (*(web_goform_get_cmd_table[goform_index].proc_func))(wp);
+ websDone(wp, 200);
+ return;
+ }
+ }
+ zte_web_get_para_xml(wp, (char_t *)cmd);
+ } else {
+ zte_get_request_process_xml(wp, cmd);
+ }
+ } else {
+ if (0 == strcmp(multi_data, "")) {
+ zte_web_get_para_nologin(wp, (char_t *)cmd);
+ } else {
+ zte_get_request_process_nologin(wp, (char_t *)cmd);
+ }
+ }
+ websDone(wp, 0);
+ return;
+
+}
+
+/******************************************************
+* Function: zte_goform_set_cmd_process()
+* Description:goform entry from web pages to set firmware para
+* Input: HTTP Request Info
+* Output:
+* Return:
+* Others:
+* Modify Date Version Author Modification
+* 2012/08/08 V1.0 liuyingnan create
+*******************************************************/
+
+void zte_goform_set_cmd_process(webs_t wp, char *path, char *query)
+{
+ char_t *zte_goform_id = NULL;
+ int goform_index = 0;
+ int max_goform_index = (int)(sizeof(web_goform_set_cmd_table) / sizeof(web_goform_type));
+ int blacklist_result = 0;
+ char login_info[NV_ITEM_STRING_LEN_20] = {0};
+
+ zte_get_login_status_value(wp, login_info);
+ zte_goform_id = websGetVar(wp, T("goformId"), T(""));
+
+ slog(MISC_PRINT, SLOG_DEBUG,"[goahead] zte_goform_set_cmd_process zte_goform_id = %s,login_info=%s!\n", zte_goform_id, login_info);
+#ifdef WEBINSPECT_FIX
+ if (query && (strstr(query, ")(")
+/* || strstr(query, "%26%26")
+ || strstr(query, "&&")
+ || strstr(query, "%7C%7C")
+ || strstr(query, "||")
+ || strstr(query, "%3B")
+ || strstr(query, ";")*/
+ )) {
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e sqry:%s\n",query);
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]e 4\n");
+ websDone(wp, 0);
+ return;
+ }
+#ifdef WEBS_SECURITY
+ if (!(wp->flags & WEBS_POST_REQUEST)||(query && (strstr(query, "%2f")
+ || strstr(query, "/")
+ || strstr(query, "%5c")
+ || strstr(query, "\\")
+ || strstr(query, "%3c")
+ || strstr(query, "<")
+ || strstr(query, "%3e")
+ || strstr(query, ">")
+ || strstr(query, "%27")
+ || strstr(query, "'")
+ || strstr(query, "%28")
+ || strstr(query, "(")
+ || strstr(query, "%29")
+ || strstr(query, ")")
+ || strstr(query, "%25")
+ ))) {
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e qry:%s\n",query);
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]e 5\n");
+ websDone(wp, 0);
+ return;
+ }
+ char token[COOKIE_SESSION_SIZE+1] = {0};
+ char cook_id[COOKIE_SESSION_SIZE+1] = {0};
+ (void)zte_web_read(NV_COOKIE_ID, cook_id);
+ (void)zte_web_read(NV_WEB_TOKEN, token);
+ if (strlen(cook_id) && wp->cookie && strlen(wp->cookie) > strlen(token)
+ && (strstr(wp->cookie, token) == NULL)) {
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e goform:%s\n",zte_goform_id);
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e token:%s\n",token);
+ //slog(MISC_PRINT, SLOG_ERR,"[goahead]e cookie:%s\n",wp->cookie);
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]e 6\n");
+ websDone(wp, 0);
+ sc_cfg_set(NV_WEB_TOKEN, "");
+ return;
+ }
+ if(query && !is_print_str(query,strlen(query)))
+ {
+ slog(MISC_PRINT, SLOG_ERR,"[goahead]s print_str\n");
+ zte_write_result_to_web(wp, FAILURE);
+ websDone(wp, 200);
+ return;
+ }
+#endif
+#endif
+
+ if (0 != strcmp("ok", login_info)) {
+ blacklist_result = zte_goform_blacklist_check(wp);
+ if (blacklist_result < 0) {
+ slog(MISC_PRINT, SLOG_ERR,"[ERROR]zte_goform_blacklist_check -> black goform id:[%s].\n", zte_goform_id);
+ zte_write_result_to_web(wp, FAILURE);
+ websDone(wp, 200);
+ return;
+ }
+ }
+
+ zte_mgmt_login_timemark_set();
+
+ for (goform_index = 0; goform_index < max_goform_index; goform_index++) {
+ if (0 == strcmp(web_goform_set_cmd_table[goform_index].goform_id, zte_goform_id)) {
+ (void)zte_goform_whitelist_check(wp);//not to check the return value, only A has logged in,then update the timemark
+ (*(web_goform_set_cmd_table[goform_index].proc_func))(wp);
+ break;
+ }
+ }
+
+ if (goform_index == max_goform_index) {
+ slog(MISC_PRINT, SLOG_ERR,"[ERROR]zte_goform_set_cmd_process -> unknown goform id:[%s].\n", zte_goform_id);
+ zte_write_result_to_web(wp, FAILURE);
+ }
+
+ websDone(wp, 200);
+ return;
+}
+
+zte_topsw_state_e_type zte_nvconfig_read(char *item, char *data, int dataLen)
+{
+ if (NULL == item || NULL == data) {
+ slog(MISC_PRINT, SLOG_ERR, "input is NULL."); /*lint !e26*/
+ return ZTE_NVIO_FAIL;
+ }
+
+ if (dataLen > NV_ITEM_VALUE_MAX_LEN) {
+ slog(MISC_PRINT, SLOG_ERR, "data of [%s] too long.", item); /*lint !e26*/
+ return ZTE_NVIO_FAIL;
+ }
+ // kw 3
+ if(0 == sc_cfg_get(item, data, dataLen))
+ {
+ return ZTE_NVIO_DONE;
+ }
+
+ return ZTE_NVIO_FAIL;
+}
+
+zte_topsw_state_e_type zte_nvconfig_write(char *item, char *data, int dataLen)
+{
+ if (NULL == item || NULL == data) {
+ slog(MISC_PRINT, SLOG_ERR, "input is NULL."); /*lint !e26*/
+ return ZTE_NVIO_FAIL;
+ }
+
+ if ((strlen(data) + 1) > NV_ITEM_VALUE_MAX_LEN || dataLen > NV_ITEM_VALUE_MAX_LEN) {
+ slog(MISC_PRINT, SLOG_ERR, "value is too long, name=%s.", item); /*lint !e26*/
+ return ZTE_NVIO_FAIL;
+ }
+
+ if(0 == sc_cfg_set(item, data))
+ {
+ return ZTE_NVIO_DONE;
+ }
+
+ return ZTE_NVIO_FAIL;
+}
+
+void zte_init_login_psw_time(void)
+{
+ (void)zte_web_write("psw_fail_num_str", LOGIN_FAIL_TIMES);
+}
+
+void zte_goform_set_external_nv(webs_t wp)
+{
+ char_t *nv_name = NULL;
+ char_t *nv_value = NULL;
+ nv_name = websGetVar(wp, T("external_nv_name"), T(""));
+ nv_value = websGetVar(wp, T("external_nv_value"), T(""));
+
+ if (nv_value == NULL || nv_name == NULL) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (0 != strncmp(nv_name, "external", 8)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ sc_cfg_set(nv_name, nv_value);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ: zte_web_get_login_page
+* ¹¦ÄÜÃèÊö: ×ÔÊÊÓ¦ÖÕ¶Ëä¯ÀÀÆ÷
+* ²ÎÊý˵Ã÷: (IN)
+* (OUT)
+* ·µ »Ø Öµ:
+* ÆäËü˵Ã÷:
+**************************************************************************/
+const char* zte_web_get_login_page(webs_t wp)
+{
+ if (isMobileReq(wp) && isPageExist(ZTE_WEB_MOBILE_PAGE_LOGIN_NAME)) {
+ return ZTE_WEB_MOBILE_PAGE_LOGIN_NAME;
+ } else {
+ return ZTE_WEB_PAGE_LOGIN_NAME;
+ }
+}
+
+
+
diff --git a/ap/app/goahead/interface5.0/zte_web_wan.c b/ap/app/goahead/interface5.0/zte_web_wan.c
new file mode 100755
index 0000000..4004b7f
--- /dev/null
+++ b/ap/app/goahead/interface5.0/zte_web_wan.c
@@ -0,0 +1,1131 @@
+/************************************************************************
+* °æÈ¨ËùÓÐ (C)2010, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
+*
+* ÎļþÃû³Æ£º zte_web_wan.c
+* Îļþ±êʶ£º
+* ÄÚÈÝÕªÒª£º
+* ÆäËü˵Ã÷£º
+* µ±Ç°°æ±¾£º V0.1
+* ×÷ Õߣº zyt
+* Íê³ÉÈÕÆÚ£º 2010-11-06
+*
+* Ð޸ļǼ1£º
+* ÐÞ¸ÄÄÚÈÝ£º³õʼ°æ±¾
+************************************************************************/
+
+/**************************************************************************
+* Ð޸ıàºÅ : EC:617002790374
+* ÐÞ ¸Ä ÈË : chenjie10092374
+* ÐÞ¸ÄÈÕÆÚ : 2014.6.13
+* ÐÞ¸ÄÄÚÈÝ : Ìí¼ÓÓû§ÉèÖÃÊÖ¶¯²¦ºÅÇÒ´ËÊ±ÍøÂç¶Ï¿ªÊ±Äܼ°Ê±ÖÐÖ¹×Ô¶¯²¦ºÅ¹ý³ÌµÄ´úÂë
+**************************************************************************/
+
+/**************************************************************************
+* Ð޸ıàºÅ : EC:617002790374
+* ÐÞ ¸Ä ÈË : chenjie10092374
+* ÐÞ¸ÄÈÕÆÚ : 2014.6.23
+* ÐÞ¸ÄÄÚÈÝ : Ìí¼ÓÓû§È¡Ïû×Ô¶¯ÖØÁ¬¹¦ÄÜ
+**************************************************************************/
+/**************************************************************************
+* Ð޸ıàºÅ : EC:616000235589
+* ÐÞ ¸Ä ÈË : chenjie10092374
+* ÐÞ¸ÄÈÕÆÚ : 2014.7.16
+* ÐÞ¸ÄÄÚÈÝ : Ìí¼ÓÕÒÍø·½Ê½Á÷³Ì±£»¤
+**************************************************************************/
+#include "zte_web_interface.h"
+
+/************************************************************/
+#define FEATRUE_WEB_DEBUG
+#define FEATRUE_QMI_CONNECT
+
+/************ALL the WAN CFG para****************************/
+#define N_PPP_APN_MODEL "apn_select"
+#define V_PPP_APN_MODEL_AUTO "auto"
+#define V_PPP_APN_MODEL_MANUAL "manual"
+#define N_PPP_APN_NAME "wan_apn"
+#define N_PPP_DIAL_NUM "wan_dial"
+#define V_PPP_DNS_MODEL_AUTO "auto"
+#define V_PPP_DNS_MODEL_MANUAL "manual"
+#define N_PPP_PDP_TYPE "pdp_type"
+#define N_PPP_PDP_MODEL "pdp_select"
+#define V_PPP_PDP_MODEL_AUTO "auto"
+#define V_PPP_PDP_MODEL_MANUAL "manual"
+#define N_PPP_PDP_ADDR "pdp_addr"
+#define N_PPP_AUTH_MODEL "ppp_auth_mode"
+#define V_PPP_AUTH_MODEL_PAP "pap"
+#define V_PPP_AUTH_MODEL_CHAP "chap"
+#define N_PPP_USER_NAME "ppp_username"
+#define N_PPP_PASSWORD "ppp_passtmp"
+#define N_NET_SELECT "net_select"
+//#define N_NET_SELECT_NAME "net_select_name"
+#define N_NO_MODEM "modem_undetected"
+
+#define TIME_STEP 1
+#define APNCONFIG_NUM_MAX 10
+#define APNCONFIG_ELEMENT_NUM 14
+#define APNCONFIG_MEMORY 1024
+#define APNCONFIG_ELEMENT_MEMORY 64
+#define IFSTREQUAL(str1, str2) (strcmp((str1), (str2))?0:1)
+#define IFSTRNEQUAL(str1, str2, n) (strncmp((str1), (str2), (n))?0:1)
+
+
+
+typedef struct {
+ CHAR pre_mode[64];
+ CHAR net_select_mode[64];
+ CHAR net_select[64];
+ CHAR m_netselect_save[64];
+ CHAR m_netselect_contents[64];
+ CHAR m_netselect_status[64];
+} netSelectCfgNv;
+/*************************function define******************************/
+
+void apn_save_process_ex(webs_t wp);
+void apn_delete_process_ex(webs_t wp);
+void apn_set_default_with_profile_index_ex(webs_t wp);
+void apn_set_default_process_ex(webs_t wp);
+void apn_set_default_with_new_profile_ex(webs_t wp);
+static void set_apn_to_cfg(APN_PROFILE *apn_profile);
+static void set_ipv6_apn_to_cfg(IPV6_APN_PROFILE *apn_profile);
+static void set_ipv4v6_apn_to_cfg(APN_PROFILE *apn_profile, IPV6_APN_PROFILE *ipv6_apn_profile);
+static void get_apn_para_form_web(webs_t wp, APN_PROFILE *apn_profile);
+static void get_ipv6_apn_para_form_web(webs_t wp, IPV6_APN_PROFILE *apn_profile);
+static int zte_wan_auto_apn_set();
+static int zte_wan_util_set_dial_roam_switch(const char_t *roam_set);
+
+
+void zte_wan_connect_network(webs_t wp)
+{
+ char traffic_limit[NV_ITEM_STRING_LEN_10] = {0};
+ char flux_month_total[NV_ITEM_STRING_LEN_50] = {0};
+ char traffic_alined_delta[NV_ITEM_STRING_LEN_50] = {0};
+ char traffic_month_total[NV_ITEM_STRING_LEN_50] = {0};
+ long long int llflux_month_total = 0;
+ long long int lltraffic_alined_delta = 0;
+ long long int lltraffic_month_total = 0;
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User connect network!\n"));
+
+ sc_cfg_set("user_initiate_disconnect", "0"); //Óû§Ö÷¶¯Á¬½Ó״̬£¬Í˳ö¸ÉԤģʽ
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_PDP_ACT_REQ, 0, NULL, 0);
+
+ sc_cfg_get("is_traffic_limit_on", &traffic_limit, sizeof(traffic_limit));
+ sc_cfg_get("flux_month_total", &flux_month_total, sizeof(flux_month_total));
+ sc_cfg_get("traffic_alined_delta", &traffic_alined_delta, sizeof(traffic_alined_delta));
+ sc_cfg_get("traffic_month_total", &traffic_month_total, sizeof(traffic_month_total));
+
+ llflux_month_total = atoll(&flux_month_total);
+ lltraffic_alined_delta = atoll(&traffic_alined_delta);
+ lltraffic_month_total = atoll(&traffic_month_total);
+
+ if(llflux_month_total < 0 || llflux_month_total > LLONG_MAX-1){
+ llflux_month_total = LLONG_MAX;
+ }
+
+ if(lltraffic_alined_delta < 0 || lltraffic_alined_delta > LLONG_MAX-1){
+ lltraffic_alined_delta = LLONG_MAX;
+ }
+
+ if(lltraffic_month_total < 0 || lltraffic_month_total > LLONG_MAX-1){
+ lltraffic_month_total = LLONG_MAX;
+ }
+
+ if (0 == strcmp(&traffic_limit, "yes")
+ && llflux_month_total + lltraffic_alined_delta >= lltraffic_month_total * 1024 * 1024) {
+ sc_cfg_set("keep_online_when_limited", "yes");
+ }
+ zte_write_result_to_web(wp, SUCCESS); //"success"
+}
+
+/*ÊÖ¶¯¶ÏÍø*/
+void zte_wan_disconnect_network(webs_t wp)
+{
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User disconnect network!\n"));
+ sc_cfg_set("user_initiate_disconnect", "1"); //Óû§Ö÷¶¯¶Ï¿ª×´Ì¬£¬¸ÉԤģʽ
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_PDP_DEACT_REQ, 0, NULL, 0);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+/*ÊÖ¶¯ËÑÍøºóÉèÖÃÍøÂç*/
+void zte_wan_set_network(webs_t wp)
+{
+
+ CHAR *pMccmnc = NULL;
+ CHAR *pNetType = NULL;
+ CHAR *pSubType = NULL;
+ CHAR curMccmnc[20] = {0};
+ CHAR curNetType[5] = {0};
+ CHAR curSubType[5] = {0};
+
+ pMccmnc = websGetVar(wp, T("NetworkNumber"), T(""));
+ pNetType = websGetVar(wp, T("Rat"), T(""));
+ pSubType = websGetVar(wp, T("nSubrat"), T(""));
+
+ if (('\0' == (*pMccmnc)) || ('\0' == (*pNetType))) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User set network %s!\n"), pMccmnc);
+ slog(MISC_PRINT, SLOG_DEBUG,"LPC: zte_wan_set_network, pSubType = %s \n", pSubType);
+ (void)zte_web_read("current_rat", curNetType); //0:2G; 2:3G
+ (void)zte_web_read("str_num_rplmn", curMccmnc);
+ (void)zte_web_read("current_subrat", curSubType);
+
+ if ((0 == strcmp(pMccmnc, curMccmnc)) && (0 == strcmp(pNetType, curNetType)) && (0 == strcmp(pSubType, curSubType))) {
+ slog(MISC_PRINT, SLOG_DEBUG, "zte_wan_set_network: to set network is equal to registered network."); /*lint !e26*/
+ (void)zte_web_write("manual_netsel_flag", "1");
+ } else {
+ (void)zte_web_write("manual_netsel_flag", "");
+ }
+ (void)zte_web_write(NV_M_NETSELECT_CONTENTS, "");
+ (void)zte_web_write("current_rat_tmp", pNetType);
+ (void)zte_web_write("str_num_rplmn_tmp", pMccmnc);
+ (void)zte_web_write("current_subrat_tmp", pSubType);
+ //slog(MISC_PRINT,SLOG_DEBUG, "zte_wan_set_network send message:ZUFI_MODULE_ID_AT_MAIN MSG_CMD_SET_NETWORK.");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_NETWORK_SET_REQ, 0, NULL, 0);
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+
+/*ÉèÖò¦ºÅģʽ*/
+void zte_wan_set_connection_mode(webs_t wp)
+{
+ CHAR *pConnMode = NULL;
+ CHAR *pRoamOption = NULL; //dial roam
+ char_t ppp_status[CONFIG_DEFAULT_LENGTH] = {0};
+ char traffic_limit[NV_ITEM_STRING_LEN_10] = {0};
+ char flux_month_total[NV_ITEM_STRING_LEN_50] = {0};
+ char traffic_alined_delta[NV_ITEM_STRING_LEN_50] = {0};
+ char traffic_month_total[NV_ITEM_STRING_LEN_50] = {0};
+ char pdp_dial_mode[NV_ITEM_STRING_LEN_10] = {0};
+
+ long long int llflux_month_total = 0;
+ long long int lltraffic_alined_delta = 0;
+ long long int lltraffic_month_total = 0;
+
+ sc_cfg_get("ppp_status", &ppp_status, sizeof(ppp_status));
+
+
+ pConnMode = websGetVar(wp, "ConnectionMode", T(""));
+ pRoamOption = websGetVar(wp, T(NV_ROAM_SETTING_OPTION), NULL);
+
+ if ('\0' == (*pConnMode)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User set connection mode %s!\n"), pConnMode);
+ (void)zte_web_write(NV_DIAL_MODE, pConnMode);
+
+ if (IFSTREQUAL(ppp_status, "ppp_disconnected")
+ && IFSTREQUAL(pConnMode, "manual_dial")) {
+ sc_cfg_set("auto_reconnect", "0");
+ }
+
+ sc_cfg_get("is_traffic_limit_on", &traffic_limit, sizeof(traffic_limit));
+ sc_cfg_get("flux_month_total", &flux_month_total, sizeof(flux_month_total));
+ sc_cfg_get("traffic_alined_delta", &traffic_alined_delta, sizeof(traffic_alined_delta));
+ sc_cfg_get("traffic_month_total", &traffic_month_total, sizeof(traffic_month_total));
+
+ llflux_month_total = atoll(&flux_month_total);
+ lltraffic_alined_delta = atoll(&traffic_alined_delta);
+ lltraffic_month_total = atoll(&traffic_month_total);
+
+ if(llflux_month_total < 0 || llflux_month_total > LLONG_MAX-1 ){
+ llflux_month_total = LLONG_MAX;
+ }
+
+ if(lltraffic_alined_delta < 0 || lltraffic_alined_delta > LLONG_MAX-1){
+ lltraffic_alined_delta = LLONG_MAX;
+ }
+
+ if(lltraffic_month_total < 0 || lltraffic_month_total > LLONG_MAX-1){
+ lltraffic_month_total = LLONG_MAX;
+ }
+
+ if (0 == strcmp(&traffic_limit, "yes")
+ && llflux_month_total + lltraffic_alined_delta >= lltraffic_month_total * 1024 * 1024) {
+ sc_cfg_get(NV_DIAL_MODE, &pdp_dial_mode, sizeof(pdp_dial_mode));
+
+ if (0 == strcmp(&pdp_dial_mode, "manual_dial")) {
+ sc_cfg_set("auto_connect_when_limited", "no");
+ } else if (0 == strcmp(&pdp_dial_mode, "auto_dial")) {
+ sc_cfg_set("auto_connect_when_limited", "yes");
+ }
+ }
+ //set dial roam switch
+ if (-1 == zte_wan_util_set_dial_roam_switch(pRoamOption)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ //sc_cfg_save();
+ zte_write_result_to_web(wp, SUCCESS);
+ slog(MISC_PRINT, SLOG_DEBUG, "ZUFI_MODULE_ID_AT_MAIN!!!!set ppp_dial Mode:%s.\n", pConnMode);
+
+}
+
+/*ÉèÖÃ×Ô¶¯Ñ¡ÍøµÄÍøÂçÖÆÊ½*/
+void zte_wan_network_select(webs_t wp)
+{
+ char_t *netSelect = NULL;
+ char_t *pre_mode = NULL;
+ char_t ppp_status[CONFIG_DEFAULT_LENGTH] = {0};
+ int tryCount = 0;
+ netSelectCfgNv netSelectPreCfg = {0};
+ char select_result[NV_ITEM_STRING_LEN_20] = {0};
+ char buf[NV_ITEM_STRING_LEN_10] = {0};
+
+ netSelect = websGetVar(wp, T("BearerPreference"), T(""));
+ pre_mode = websGetVar(wp, T("pre_mode"), T(""));
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User set network select %s!\n"), netSelect);
+ if ('\0' == (*netSelect)) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ sc_cfg_get("ppp_status", &ppp_status, sizeof(ppp_status));
+ if (ppp_status[0] != '\0') {
+ if (!IFSTREQUAL(ppp_status, "ppp_disconnected") && !IFSTREQUAL(ppp_status, "ppp_ready")) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ }
+
+ (void)zte_web_read("pre_mode", netSelectPreCfg.pre_mode);
+ (void)zte_web_read("net_select_mode", netSelectPreCfg.net_select_mode);
+ (void)zte_web_read(N_NET_SELECT, netSelectPreCfg.net_select);
+ (void)zte_web_read("m_netselect_save", netSelectPreCfg.m_netselect_save);
+ (void)zte_web_read(NV_M_NETSELECT_CONTENTS, netSelectPreCfg.m_netselect_contents);
+ (void)zte_web_read("m_netselect_status", netSelectPreCfg.m_netselect_status);
+
+ (void)zte_web_write("pre_mode", pre_mode);
+ (void)zte_web_write("net_select_mode", "auto_select");
+ (void)zte_web_write(N_NET_SELECT, netSelect);
+ (void)zte_web_write("m_netselect_save", "");
+ (void)zte_web_write(NV_M_NETSELECT_CONTENTS, "");
+ (void)zte_web_write("m_netselect_status", "");
+ sc_cfg_set("net_select_result", "");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_NET_SELECT_REQ, 0, NULL, 0);
+
+ while (tryCount++ < 200) {
+ memset(select_result, 0, sizeof(select_result));
+ sc_cfg_get("net_select_result", select_result, sizeof(select_result));
+ if (strcmp("", select_result) != 0) {
+ break;
+ }
+
+ // 200*1000us
+ usleep(200000);
+ }
+
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wan_network_select: net_select_result = %s \n", select_result);
+ if (strcmp("sucess", select_result) == 0) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ (void)zte_web_write("pre_mode", netSelectPreCfg.pre_mode);
+ (void)zte_web_write("net_select_mode", netSelectPreCfg.net_select_mode);
+ (void)zte_web_write(N_NET_SELECT, netSelectPreCfg.net_select);
+ (void)zte_web_write("m_netselect_save", netSelectPreCfg.m_netselect_save);
+ (void)zte_web_write(NV_M_NETSELECT_CONTENTS, netSelectPreCfg.m_netselect_contents);
+ (void)zte_web_write("m_netselect_status", netSelectPreCfg.m_netselect_status);
+ zte_write_result_to_web(wp, FAILURE);
+ }
+
+}
+
+/*ÊÖ¶¯ËÑÍø*/
+void zte_wan_scan_network(webs_t wp)
+{
+ if (NULL == wp) {
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User scan network!\n"));
+
+ (void)zte_web_write("net_select_mode", "manual_select");
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_wan_scan_network send message ZUFI_MODULE_ID_AT_MAIN,MSG_CMD_WEB_REQ_NET_SELECT");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_NET_SELECT_REQ, 0, NULL, 0);
+ (void)zte_web_write("m_netselect_status", "manual_selecting");
+ zte_write_result_to_web(wp, SUCCESS);
+
+}
+
+/*Á÷Á¿¹ÜÀíÉèÖÃ*/
+void zte_wan_data_limit_setting(webs_t wp)
+{
+ char *data_limit_switch = NULL;
+ char *data_limit_type = NULL;
+ char *data_limit_size = NULL;
+ char *data_limit_percent = NULL;
+
+ if (NULL == wp) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ data_limit_switch = websGetVar(wp, T("data_volume_limit_switch"), T("")); /*0:disable;1:enable*/
+ if (0 == strcmp(data_limit_switch, "0")) {
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User disable net data statistics!\n"));
+ sc_cfg_set(NV_DATA_VOLUME_LIMIT_SWITCH, "0");
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MMI, MSG_CMD_TRAFFIC_INFO_RESET, 0, NULL, 0);
+ zte_write_result_to_web(wp, SUCCESS);
+ } else if (0 == strcmp(data_limit_switch, "1")) {
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User enable net data statistics!\n"));
+ data_limit_type = websGetVar(wp, T("data_volume_limit_unit"), T("")); /*time/data*/
+ data_limit_size = websGetVar(wp, T("data_volume_limit_size"), T(""));
+ data_limit_percent = websGetVar(wp, T("data_volume_alert_percent"), T("")); /*1-100*/
+
+ //param validation check
+ if ((0 != strcmp(data_limit_type, DATA_VOLUME_LIMIT_UNIT_TIME))
+ && (0 != strcmp(data_limit_type, DATA_VOLUME_LIMIT_UNIT_DATA))) {
+
+ slog(MISC_PRINT, SLOG_ERR, "invalid value for data_limit_type:[%s]\n", data_limit_type); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if ((0 == strcmp(data_limit_size, "")) || (0 == strcmp(data_limit_percent, ""))) {
+ slog(MISC_PRINT, SLOG_ERR, "invalid value :[%s,%s]\n", data_limit_size, data_limit_percent); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ sc_cfg_set(NV_DATA_VOLUME_LIMIT_SWITCH, "1");
+ sc_cfg_set(NV_DATA_VOLUME_LIMIT_UNIT, data_limit_type);
+ sc_cfg_set(NV_DATA_VOLUME_LIMIT_SIZE, data_limit_size);
+ sc_cfg_set(NV_DATA_VOLUME_ALERT_PERCENT, data_limit_percent);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MMI, MSG_CMD_TRAFFIC_INFO_RESET, 0, NULL, 0);
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "invalid value for data_limit_switch:[%s]\n", data_limit_switch); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ }
+}
+
+
+/**********************************************************************
+* Function: apn_save_process_ex
+* Description: save the APN
+* Input: NULL
+* Output: NULL
+* Return: 0 is invalid, 1 is valid
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2010/11/17 V1.0 maquan first version
+**********************************************************************/
+void apn_save_process_ex(webs_t wp)
+{
+ int index_apn = 0;
+ char currentApnIndex[8] = {0};
+ APN_PROFILE newApn;
+ IPV6_APN_PROFILE newIPV6Apn;
+ memset(&newApn, 0, sizeof(APN_PROFILE));
+ memset(&newIPV6Apn, 0, sizeof(IPV6_APN_PROFILE));
+
+ slog(MISC_PRINT, SLOG_NORMAL, "come get_apn_para_form_web \n"); /*lint !e26*/
+ get_apn_para_form_web(wp, &newApn);
+ get_ipv6_apn_para_form_web(wp, &newIPV6Apn);
+
+ index_apn = atoi(websGetVar(wp, "index", T("")));
+ slog(MISC_PRINT, SLOG_DEBUG, "index_apn=%d \n", index_apn); /*lint !e26*/
+ snprintf(currentApnIndex, sizeof(currentApnIndex) , "%d", index_apn);
+ slog(MISC_PRINT, SLOG_DEBUG, "come set_apn_profile_by_index \n"); /*lint !e26*/
+
+ set_apn_profile_by_index(index_apn, &newApn);
+ set_apn_prof_aes_by_index(index_apn, &newApn);
+ set_ipv6_apn_profile_by_index(index_apn, &newIPV6Apn);
+ set_ipv6_apn_prof_aes_by_index(index_apn, &newIPV6Apn);
+
+}
+
+/**********************************************************************
+* Function: apn_delete_process_ex
+* Description: delete apn
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2010/11/17 V1.0 maquan first version
+* 2011/01/15 V1.0 qiuzhenhui modify
+**********************************************************************/
+void apn_delete_process_ex(webs_t wp)
+{
+ char apn_default_index[APNCONFIG_ELEMENT_MEMORY] = {0};
+ char apn_buf[APNCONFIG_ELEMENT_MEMORY] = {0};
+ int i;
+
+ int apn_index = atoi(websGetVar(wp, "index", T("")));
+ if(apn_index<0 || apn_index> INT_MAX-1)
+ {
+ apn_index = 0;
+ }
+
+ sc_cfg_get("apn_index", &apn_buf, sizeof(apn_buf));
+ int apn_index_setdefault = atoi(&apn_buf);
+ if(apn_index_setdefault<0 || apn_index_setdefault> INT_MAX-1)
+ {
+ apn_index_setdefault = 0;
+ }
+
+ for (i = apn_index; i < APNCONFIG_NUM_MAX; i++) {
+ char profile1[APNCONFIG_MEMORY] = {0};
+ char profile2[APNCONFIG_MEMORY] = {0};
+ char ipv6profile1[APNCONFIG_MEMORY] = {0};
+ char ipv6profile2[APNCONFIG_MEMORY] = {0};
+ char next_profile[APNCONFIG_MEMORY] = {0};
+ char ipv6_next_profile[APNCONFIG_MEMORY] = {0};
+
+ sprintf(profile1, "APN_config%d", i);
+ sprintf(profile2, "APN_config%d", i + 1);
+
+ sprintf(ipv6profile1, "ipv6_APN_config%d", i);
+ sprintf(ipv6profile2, "ipv6_APN_config%d", i + 1);
+
+ sc_cfg_get(profile2, &next_profile, sizeof(next_profile));
+ sc_cfg_get(ipv6profile2, &ipv6_next_profile, sizeof(ipv6_next_profile));
+
+
+#ifdef FEATRUE_WEB_DEBUG
+ slog(MISC_PRINT, SLOG_DEBUG, "profile1=%s\n", profile1); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "profile2=%s\n", profile2); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "next_profile=%s\n", next_profile); /*lint !e26*/
+#endif
+ if (strcmp(next_profile, "")) {
+ sc_cfg_set(profile1, next_profile);
+ } else {
+ sc_cfg_set(profile1, "");
+ }
+
+
+ if (strcmp(ipv6_next_profile, "")) {
+ sc_cfg_set(ipv6profile1, ipv6_next_profile);
+ } else {
+ sc_cfg_set(ipv6profile1, "");
+ }
+
+
+ } //endof delete
+ for (i = apn_index; i < APNCONFIG_NUM_MAX; i++) {
+ char profile1[APNCONFIG_MEMORY] = {0};
+ char profile2[APNCONFIG_MEMORY] = {0};
+ char ipv6profile1[APNCONFIG_MEMORY] = {0};
+ char ipv6profile2[APNCONFIG_MEMORY] = {0};
+ char next_profile[APNCONFIG_MEMORY] = {0};
+ char ipv6_next_profile[APNCONFIG_MEMORY] = {0};
+
+ sprintf(profile1, "APN_configtmp%d", i);
+ sprintf(profile2, "APN_configtmp%d", i + 1);
+
+ sprintf(ipv6profile1, "ipv6_APN_configtmp%d", i);
+ sprintf(ipv6profile2, "ipv6_APN_configtmp%d", i + 1);
+
+ sc_cfg_get(profile2, &next_profile, sizeof(next_profile));
+ sc_cfg_get(ipv6profile2, &ipv6_next_profile, sizeof(ipv6_next_profile));
+
+
+#ifdef FEATRUE_WEB_DEBUG
+ slog(MISC_PRINT, SLOG_DEBUG, "profile1tmp=%s\n", profile1); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "profile2tmp=%s\n", profile2); /*lint !e26*/
+ slog(MISC_PRINT, SLOG_DEBUG, "next_profiletmp=%s\n", next_profile); /*lint !e26*/
+#endif
+ if (strcmp(next_profile, "")) {
+ sc_cfg_set(profile1, next_profile);
+ } else {
+ sc_cfg_set(profile1, "");
+ }
+
+
+ if (strcmp(ipv6_next_profile, "")) {
+ sc_cfg_set(ipv6profile1, ipv6_next_profile);
+ } else {
+ sc_cfg_set(ipv6profile1, "");
+ }
+
+
+ } //endof delete
+ if (0 < apn_index_setdefault - apn_index) {
+ apn_index_setdefault -= 1;
+ sprintf(apn_default_index, "%d", apn_index_setdefault);
+ sc_cfg_set("apn_index", apn_default_index);
+ } else if (apn_index_setdefault == apn_index) {
+ apn_index_setdefault = 0;
+ sprintf(apn_default_index, "%d", apn_index_setdefault);
+ sc_cfg_set("apn_index", apn_default_index);
+ }
+#ifdef FEATRUE_WEB_DEBUG
+ memset(apn_buf, 0, sizeof(apn_buf));
+ sc_cfg_get("apn_index", apn_buf, sizeof(apn_buf));
+ slog(MISC_PRINT, SLOG_DEBUG, "Del action apn_index=%s\n", apn_buf); /*lint !e26*/
+
+#endif
+
+}
+
+/**********************************************************************
+* Function: apn_delete_process
+* Description: delete apn
+* Input: NULL
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2010/11/17 V1.0 maquan first version
+* 2011/01/15 V1.0 qiuzhenhui modify
+**********************************************************************/
+void apn_set_default_with_profile_index_ex(webs_t wp)
+{
+ int index_apn = 0;
+ char_t *pdp_type = NULL;
+
+ pdp_type = websGetVar(wp, T("pdp_type"), T(""));
+
+ APN_PROFILE newProfile;
+ IPV6_APN_PROFILE newIpv6Profile;
+ memset(&newProfile, 0, sizeof(APN_PROFILE));
+ memset(&newIpv6Profile, 0, sizeof(IPV6_APN_PROFILE));
+ char_t *apn_mode = NULL;
+
+ index_apn = atoi(websGetVar(wp, "index", T("")));
+ apn_mode = websGetVar(wp, T("apn_mode"), T(""));
+
+ sc_cfg_set("auto_apn_index", websGetVar(wp, "auto_apn_index", T("0")));
+ if (0 == strcmp(apn_mode, "auto")) {
+ slog(MISC_PRINT, SLOG_DEBUG, "apn_mode=%s\n", apn_mode); /*lint !e26*/
+ get_autoapn_profile(&newProfile);
+ set_apn_to_cfg(&newProfile);
+ } else {
+ if (0 == strcmp(pdp_type, "IPv6")) {
+ slog(MISC_PRINT, SLOG_DEBUG, "come to get_ipv6apn_profile_by_index"); /*lint !e26*/
+
+ get_ipv6apn_profile_by_index(index_apn, &newIpv6Profile);
+ set_ipv6_apn_to_cfg(&newIpv6Profile);
+
+ } else if (0 == strcmp(pdp_type, "IPv4v6")) {
+
+ slog(MISC_PRINT, SLOG_DEBUG, "come to get_ipv4v6apn_profile_by_index"); /*lint !e26*/
+ get_ipv4v6apn_profile_by_index(index_apn, &newProfile, &newIpv6Profile);
+ set_ipv4v6_apn_to_cfg(&newProfile, &newIpv6Profile);
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "come to get_ipv4apn_profile_by_index"); /*lint !e26*/
+ get_apn_profile_by_index(index_apn, &newProfile);
+ set_apn_to_cfg(&newProfile);
+ }
+ sc_cfg_set("apn_index", websGetVar(wp, "index", T("")));
+ }
+
+
+ //send message to MainControl to infrom modify apn
+ //zte_send_message(ZUFI_MODULE_ID_AT_MAIN,MSG_CMD_WEB_REQ_APN_SET,0,0);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_APN_SET_REQ, 0, NULL, 0);
+}
+
+/**********************************************************************
+* Function: get_apn_para_form_web
+* Description: get apn parametre from web
+* Input: wp
+* Output: apn para struct pointer
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2010/11/17 V1.0 maquan first version
+**********************************************************************/
+static void get_apn_para_form_web(webs_t wp, APN_PROFILE *apn_profile)
+{
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "NULL para input"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (zte_apn_param_check(wp, "ipv4") < 0) {
+ slog(MISC_PRINT, SLOG_ERR, "ipv4 para input is no safe"); /*lint !e26*/
+ return;
+ }
+
+ strncpy(apn_profile->profile_name, websGetVar(wp, T("profile_name"), T("")), sizeof(apn_profile->profile_name)-1);
+ strncpy(apn_profile->apn_name, websGetVar(wp, T("wan_apn"), T("")), sizeof(apn_profile->apn_name)-1);
+ strncpy(apn_profile->apn_select, websGetVar(wp, T("apn_select"), T("")), sizeof(apn_profile->apn_select)-1);
+ strncpy(apn_profile->dial_num, websGetVar(wp, T("wan_dial"), T("")), sizeof(apn_profile->dial_num)-1);
+ strncpy(apn_profile->ppp_auth_mode, websGetVar(wp, T("ppp_auth_mode"), T("")), sizeof(apn_profile->ppp_auth_mode)-1);
+ strncpy(apn_profile->ppp_username, websGetVar(wp, T("ppp_username"), T("")), sizeof(apn_profile->ppp_username)-1);
+ strncpy(apn_profile->ppp_passwd, websGetVar(wp, T("ppp_passtmp"), T("")), sizeof(apn_profile->ppp_passwd)-1);
+ strncpy(apn_profile->pdp_type, websGetVar(wp, T("pdp_type"), T("")), sizeof(apn_profile->pdp_type)-1);
+ strncpy(apn_profile->pdp_select, websGetVar(wp, T("pdp_select"), T("")), sizeof(apn_profile->pdp_select)-1);
+ strncpy(apn_profile->pdp_addr, websGetVar(wp, T("pdp_addr"), T("")), sizeof(apn_profile->pdp_addr)-1);
+ strncpy(apn_profile->dns_mode, websGetVar(wp, T("dns_mode"), T("")), sizeof(apn_profile->dns_mode)-1);
+ strncpy(apn_profile->prefer_dns_manual, websGetVar(wp, T("prefer_dns_manual"), T("")), sizeof(apn_profile->prefer_dns_manual)-1);
+ strncpy(apn_profile->standby_dns_manual, websGetVar(wp, T("standby_dns_manual"), T("")), sizeof(apn_profile->standby_dns_manual)-1);
+
+ return;
+}
+
+
+static void get_ipv6_apn_para_form_web(webs_t wp, IPV6_APN_PROFILE *apn_profile)
+{
+ if (NULL == wp) {
+ slog(MISC_PRINT, SLOG_ERR, "NULL para input"); /*lint !e26*/
+ return;
+ }
+
+ if (zte_apn_param_check(wp, "ipv6") < 0) {
+ slog(MISC_PRINT, SLOG_ERR, "ipv6 para input is no safe"); /*lint !e26*/
+ return;
+ }
+
+ strncpy(apn_profile->profile_name, websGetVar(wp, T("profile_name"), T("")), sizeof(apn_profile->profile_name)-1);
+ strncpy(apn_profile->apn_name, websGetVar(wp, T("ipv6_wan_apn"), T("")), sizeof(apn_profile->apn_name)-1);
+ strncpy(apn_profile->apn_select, websGetVar(wp, T("apn_select"), T("")), sizeof(apn_profile->apn_select)-1);
+ strncpy(apn_profile->dial_num, websGetVar(wp, T("wan_dial"), T("")), sizeof(apn_profile->dial_num)-1);
+ strncpy(apn_profile->ppp_auth_mode, websGetVar(wp, T(NV_IPV6_PPP_AUTH_MODE), T("")), sizeof(apn_profile->ppp_auth_mode)-1);
+ strncpy(apn_profile->ppp_username, websGetVar(wp, T("ipv6_ppp_username"), T("")), sizeof(apn_profile->ppp_username)-1);
+ strncpy(apn_profile->ppp_passwd, websGetVar(wp, T("ipv6_ppp_passtmp"), T("")), sizeof(apn_profile->ppp_passwd)-1);
+ strncpy(apn_profile->pdp_type, websGetVar(wp, T("pdp_type"), T("")), sizeof(apn_profile->pdp_type)-1);
+ strncpy(apn_profile->pdp_select, websGetVar(wp, T("pdp_select"), T("")), sizeof(apn_profile->pdp_select)-1);
+ strncpy(apn_profile->pdp_addr, websGetVar(wp, T("pdp_addr"), T("")), sizeof(apn_profile->pdp_addr)-1);
+ strncpy(apn_profile->dns_mode, websGetVar(wp, T("ipv6_dns_mode"), T("")), sizeof(apn_profile->dns_mode)-1);
+ strncpy(apn_profile->prefer_dns_manual, websGetVar(wp, T("ipv6_prefer_dns_manual"), T("")), sizeof(apn_profile->prefer_dns_manual)-1);
+ strncpy(apn_profile->standby_dns_manual, websGetVar(wp, T("ipv6_standby_dns_manual"), T("")), sizeof(apn_profile->standby_dns_manual)-1);
+
+ return;
+}
+
+int zte_apn_param_check(webs_t wp, char * type)
+{
+ char *profile_name = NULL;
+ char *wan_apn = NULL;
+ char *ppp_username = NULL;
+ char *ppp_passwd = NULL;
+
+ if (0 == strcmp("ipv4", type)) {
+ profile_name = websGetVar(wp, T("profile_name"), T(""));
+ wan_apn = websGetVar(wp, T("wan_apn"), T(""));
+ ppp_username = websGetVar(wp, T("ppp_username"), T(""));
+ ppp_passwd = websGetVar(wp, T("ppp_passtmp"), T(""));
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(profile_name)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(wan_apn)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(ppp_username)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(ppp_passwd)
+ ) {
+ slog(MISC_PRINT, SLOG_ERR, "Get Data is no Safe:ivp4\n"); /*lint !e26*/
+ return -1;
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "Get Data is Safe:ivp6\n"); /*lint !e26*/
+ return 1;
+ }
+ } else if (0 == strcmp("ipv6", type)) {
+ profile_name = websGetVar(wp, T("profile_name"), T(""));
+ wan_apn = websGetVar(wp, T("ipv6_wan_apn"), T(""));
+ ppp_username = websGetVar(wp, T("ipv6_ppp_username"), T(""));
+ ppp_passwd = websGetVar(wp, T("ipv6_ppp_passtmp"), T(""));
+ if (DATA_NO_SAFE == zte_Safe_noSpecialChar(profile_name)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(wan_apn)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(ppp_username)
+ || DATA_NO_SAFE == zte_Safe_noSpecialChar(ppp_passwd)
+ ) {
+ slog(MISC_PRINT, SLOG_ERR, "Get Data is no Safe:ipv6\n"); /*lint !e26*/
+ return -1;
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "Get Data is Safe:ipv6\n"); /*lint !e26*/
+ return 1;
+ }
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "Get Data is Safe:no ipv4 or ivp6\n"); /*lint !e26*/
+ return 0;
+}
+
+
+
+/**********************************************************************
+* Function: set_apn_to_cfg
+* Description: set apn para to CFG
+* Input: apn parametre struct pointer
+* Output: NULL
+* Return: NULL
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2010/11/17 V1.0 maquan first version
+**********************************************************************/
+static void set_apn_to_cfg(APN_PROFILE *apn_profile)
+{
+
+ if (NULL == apn_profile) {
+ slog(MISC_PRINT, SLOG_ERR, " NULL para input!!"); /*lint !e26*/
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "wan_apn==%s", apn_profile->apn_name); /*lint !e26*/
+ sc_cfg_set("m_profile_name", apn_profile->profile_name);
+ sc_cfg_set("wan_apn", apn_profile->apn_name);
+ sc_cfg_set("apn_select", apn_profile->apn_select);
+ sc_cfg_set("wan_dial", apn_profile->dial_num);
+ sc_cfg_set("ppp_auth_mode", apn_profile->ppp_auth_mode);
+ sc_cfg_set("ppp_username", apn_profile->ppp_username);
+ sc_cfg_set("ppp_passtmp", apn_profile->ppp_passwd);
+ sc_cfg_set("pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("ipv6_pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("pdp_select", apn_profile->pdp_select);
+ sc_cfg_set("pdp_addr", apn_profile->pdp_addr);
+ apn_encrypt_code();
+
+ return;
+}
+
+static void set_ipv6_apn_to_cfg(IPV6_APN_PROFILE *apn_profile)
+{
+ slog(MISC_PRINT, SLOG_DEBUG, "set_ipv6_apn_to_cfg"); /*lint !e26*/
+ if (NULL == apn_profile) {
+ slog(MISC_PRINT, SLOG_ERR, " NULL para input!!"); /*lint !e26*/
+ return;
+ }
+ slog(MISC_PRINT, SLOG_DEBUG, "wan_apn==%s", apn_profile->apn_name); /*lint !e26*/
+ sc_cfg_set("m_profile_name", apn_profile->profile_name);
+ sc_cfg_set("ipv6_wan_apn", apn_profile->apn_name);
+ sc_cfg_set("apn_select", apn_profile->apn_select);
+ sc_cfg_set("wan_dial", apn_profile->dial_num);
+ sc_cfg_set(NV_IPV6_PPP_AUTH_MODE, apn_profile->ppp_auth_mode);
+ sc_cfg_set("ipv6_ppp_username", apn_profile->ppp_username);
+ sc_cfg_set("ipv6_ppp_passtmp", apn_profile->ppp_passwd);
+ sc_cfg_set("pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("ipv6_pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("pdp_select", apn_profile->pdp_select);
+ sc_cfg_set("pdp_addr", apn_profile->pdp_addr);
+ ipv6apn_encrypt_code();
+
+ return;
+}
+
+
+static void set_ipv4v6_apn_to_cfg(APN_PROFILE *apn_profile, IPV6_APN_PROFILE *ipv6_apn_profile)
+{
+
+ if (NULL == apn_profile) {
+ slog(MISC_PRINT, SLOG_ERR, " NULL para input!!"); /*lint !e26*/
+ return;
+ }
+ sc_cfg_set("m_profile_name", apn_profile->profile_name);
+ sc_cfg_set("wan_apn", apn_profile->apn_name);
+ sc_cfg_set("apn_select", apn_profile->apn_select);
+ sc_cfg_set("wan_dial", apn_profile->dial_num);
+ sc_cfg_set("ppp_auth_mode", apn_profile->ppp_auth_mode);
+ sc_cfg_set("ppp_username", apn_profile->ppp_username);
+ sc_cfg_set("ppp_passtmp", apn_profile->ppp_passwd);
+ sc_cfg_set("pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("ipv6_pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("pdp_select", apn_profile->pdp_select);
+ sc_cfg_set("pdp_addr", apn_profile->pdp_addr);
+ apn_encrypt_code();
+
+ if (NULL == ipv6_apn_profile) {
+ slog(MISC_PRINT, SLOG_ERR, " NULL para input!!"); /*lint !e26*/
+ return;
+ }
+ sc_cfg_set("m_profile_name", ipv6_apn_profile->profile_name);
+ sc_cfg_set("ipv6_wan_apn", ipv6_apn_profile->apn_name);
+ sc_cfg_set("apn_select", ipv6_apn_profile->apn_select);
+ sc_cfg_set("wan_dial", ipv6_apn_profile->dial_num);
+ sc_cfg_set(NV_IPV6_PPP_AUTH_MODE, ipv6_apn_profile->ppp_auth_mode);
+ sc_cfg_set("ipv6_ppp_username", ipv6_apn_profile->ppp_username);
+ sc_cfg_set("ipv6_ppp_passtmp", ipv6_apn_profile->ppp_passwd);
+ sc_cfg_set("pdp_type", apn_profile->pdp_type);
+ sc_cfg_set("ipv6_pdp_type", ipv6_apn_profile->pdp_type);
+ sc_cfg_set("pdp_select", ipv6_apn_profile->pdp_select);
+ sc_cfg_set("pdp_addr", ipv6_apn_profile->pdp_addr);
+ ipv6apn_encrypt_code();
+ return;
+}
+
+/**********************************************************************
+* Function: zte_wan_data_statistics_clear_process
+* Description: to clear the statistics
+* Input: the web para
+* Output:
+* Return:
+* Others: add form uFi
+* Modify Date Version Author Modification
+* -----------------------------------------------
+
+**********************************************************************/
+void zte_wan_data_statistics_clear_process(webs_t wp, char_t *path, char_t *query)
+{
+ long nowtime;
+ if (NULL == wp) {
+ return;
+ }
+
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User clear net data statistics!\n"));
+ /*start added by jhy Nov 28, 2013*/
+ (void)zte_web_write("realtime_tx_thrpt", "0");
+ (void)zte_web_write("realtime_rx_thrpt", "0");
+
+ (void)zte_web_write("realtime_tx_bytes", "0");
+ (void)zte_web_write("realtime_rx_bytes", "0");
+ (void)zte_web_write("CTotal_vol", "0");
+ (void)zte_web_write("realtime_time", "0");
+
+
+ time(&nowtime);
+ char lastConectedTimeStr[16] = {0};
+ sprintf(lastConectedTimeStr, "%d", nowtime);
+ sc_cfg_set("ppp_start_time", lastConectedTimeStr);
+ sc_cfg_set("syn_ppp_total", "0");
+
+ (void)zte_web_write("monthly_tx_bytes", "0");
+ (void)zte_web_write("monthly_rx_bytes", "0");
+ (void)zte_web_write("flux_month_total", "0");
+ (void)zte_web_write("monthly_time", "0");
+ (void)zte_web_write("MonthlyConTime_Last", "0");
+ (void)zte_web_write("traffic_alined_delta", "0");
+ (void)zte_web_write("duraConTime_before_time_modify", "0");
+
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MMI, MSG_CMD_TRAFFIC_INFO_RESET, 0, NULL, 0);
+ slog(MISC_PRINT, SLOG_NORMAL, "zte_wan_data_statistics_clear_process: send ZTE_CURR_TOTAL_WIFI_DATA to mc success."); /*lint !e26*/
+ zte_write_result_to_web(wp, SUCCESS);
+}
+
+
+/**********************************************************************
+ * Function: zte_form_multi_apn_proc_ex
+ * Description: to handle the auto or manual apn set for ipv4ipv6
+ * Input: the web para
+ * Output:
+ * Return:
+ * Others:
+ * Modify Date Version Author Modification
+ * -----------------------------------------------
+ *
+ **********************************************************************/
+
+void zte_form_multi_apn_proc_ex(webs_t wp)
+{
+ char_t *apn_mode = NULL;
+ char_t *apn_action = NULL;
+ //int result = 0;
+
+ // Get the params from pages
+ apn_mode = websGetVar(wp, T("apn_mode"), T("")); /* auto | manual */
+ apn_action = websGetVar(wp, T("apn_action"), T("")); // save | delete | set_default
+
+ slog(MISC_PRINT, SLOG_DEBUG, "apn_mode:[%s], apn_action[%s] \n", apn_mode, apn_action); /*lint !e26*/
+
+ //not to check apn_action,auto apn will not need it
+ if ('\0' == *apn_mode) {
+ slog(MISC_PRINT, SLOG_ERR, "apn_mode is empty. \n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ /* AUTO APN */
+ if (0 == strcmp(ZTE_WEB_ACT_AUTO, apn_mode)) {
+ sc_cfg_set("auto_apn_index", websGetVar(wp, "auto_apn_index", T("0")));
+ if (0 == zte_wan_auto_apn_set()) {
+ zte_write_result_to_web(wp, SUCCESS);
+ } else {
+ zte_write_result_to_web(wp, FAILURE);
+ }
+ return;
+ } else if (0 == strcmp(ZTE_WEB_ACT_MANUAL, apn_mode)) {
+ if (0 == strcmp(apn_action, ZTE_WEB_ACT_SAVE)) {
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User save apn! \n"));
+ apn_save_process_ex(wp);
+ } else if (0 == strcmp(apn_action, ZTE_WEB_ACT_SETDEFAULT)) {
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User set default apn! \n"));
+ zte_web_write("apn_mode", ZTE_WEB_ACT_MANUAL);
+ apn_set_default_process_ex(wp);
+ //apn_set_default_with_profile_index_ex(wp);
+ } else if (0 == strcmp(apn_action, ZTE_WEB_ACT_DELETE)) {
+ slog(MISC_PRINT, SLOG_NORMAL, T("UFIx User delete apn! \n"));
+ apn_delete_process_ex(wp);
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "invalid apn_action. \n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+ } else {
+ slog(MISC_PRINT, SLOG_ERR, "invalid apn_mode. \n"); /*lint !e26*/
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+
+ zte_write_result_to_web(wp, SUCCESS);
+
+ return;
+
+}
+
+
+static int zte_wan_auto_apn_set()
+{
+ //int count = 0;
+ APN_PROFILE newProfile;
+ zte_web_write("apn_mode", ZTE_WEB_ACT_AUTO);
+ memset(&newProfile, 0, sizeof(newProfile));
+ slog(MISC_PRINT, SLOG_NORMAL,"LPC: zte_wan_auto_apn_set enter! \n");
+ get_autoapn_profile(&newProfile);
+ set_apn_to_cfg(&newProfile);
+ //send message to MainControl to infrom modify apn
+#if 0 // kw 3
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_APN_SET_REQ, 0, NULL, 0);
+ return 0;
+#else
+ return ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_APN_SET_REQ, 0, NULL, 0);
+#endif
+}
+
+
+
+void apn_set_default_process_ex(webs_t wp)
+{
+ char_t *webAction = NULL;
+ webAction = websGetVar(wp, T("set_default_flag"), T(""));
+ slog(MISC_PRINT, SLOG_NORMAL, "goahead apn_set_default_process apn_action=%s.\n", webAction);
+
+ if (0 == strcmp(webAction, APN_ONLY_SET_DEFAULT)) { //profile_name
+ apn_set_default_with_profile_index_ex(wp);
+ } else if (0 == strcmp(webAction, APN_SAVE_AND_SET_DEFAULT)) {
+ apn_set_default_with_new_profile_ex(wp);
+ } else {
+ slog(MISC_PRINT, SLOG_DEBUG, "invalid set_default_flag[%s].", webAction);
+ return ;
+ }
+
+}
+void apn_set_default_with_new_profile_ex(webs_t wp)
+{
+ int index_apn = 0;
+ APN_PROFILE newApn;
+ IPV6_APN_PROFILE newIpv6Profile;
+
+ char_t *pdp_type = NULL;
+
+ pdp_type = websGetVar(wp, T("pdp_type"), T(""));
+
+
+
+ memset(&newApn, 0, sizeof(APN_PROFILE));
+ memset(&newIpv6Profile, 0, sizeof(IPV6_APN_PROFILE));
+
+ index_apn = atoi(websGetVar(wp, "index", T("")));
+
+ get_apn_para_form_web(wp, &newApn);
+ set_apn_profile_by_index(index_apn, &newApn);
+ set_apn_prof_aes_by_index(index_apn, &newApn);
+
+ get_ipv6_apn_para_form_web(wp, &newIpv6Profile);
+ set_ipv6_apn_profile_by_index(index_apn, &newIpv6Profile);
+ set_ipv6_apn_prof_aes_by_index(index_apn, &newIpv6Profile);
+
+ if (0 == strcmp(pdp_type, "IPv6")) {
+ set_ipv6_apn_to_cfg(&newIpv6Profile);
+ } else if (0 == strcmp(pdp_type, "IPv4v6")) {
+ set_ipv4v6_apn_to_cfg(&newApn, &newIpv6Profile);
+ } else {
+ set_apn_to_cfg(&newApn);
+ }
+
+
+ slog(MISC_PRINT, SLOG_NORMAL, "apn_set_default_with_new_profile_ex index_apn=%d", index_apn);
+
+ sc_cfg_set("apn_index", websGetVar(wp, "index", T("")));
+ //send message to MainControl to infrom modify apn
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_APN_SET_REQ, 0, NULL, 0);
+
+}
+
+/**********************************************************************
+* Function: zte_wan_util_set_dial_roam_switch
+* Description: to set the dial roam switch
+* Input: roam_set: to set value
+* Output:
+* Return: -1:fail;0:success
+* Others:
+* Modify Date Version Author Modification
+* -----------------------------------------------
+* 2012/09/19 V1.0 chenyi first version
+**********************************************************************/
+static int zte_wan_util_set_dial_roam_switch(const char_t *roam_set)
+{
+ if (NULL == roam_set) {
+ return 0;//user don't care it ,so return 0
+ }
+
+ if ('\0' == (*roam_set)) {
+ slog(MISC_PRINT, SLOG_ERR, "dial roam set is empty."); /*lint !e26*/
+ return -1;
+ }
+
+ if (ZTE_NVIO_DONE != zte_web_write(NV_ROAM_SETTING_OPTION, roam_set)) { /*lint !e605*/
+ slog(MISC_PRINT, SLOG_ERR, "write nv [%s] fail.", NV_ROAM_SETTING_OPTION); /*lint !e26*/
+ return -1;
+ } else {
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_AT_CTL, MSG_CMD_ROAM_SET_REQ, 0, NULL, 0);
+ return 0;
+ }
+}
+
+
+void zte_wan_data_flow_calibration_manual(webs_t wp)
+{
+ char *p_data = NULL;
+ float time = 0;
+ char buf[NV_ITEM_STRING_LEN_50] = {0};
+ unsigned long long data = 0;
+ if (NULL == wp) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ p_data = websGetVar(wp, T("calibration_way"), NULL);
+
+ slog(MISC_PRINT, SLOG_NORMAL,"zte_wan_data_flow_calibration_manual calibration_way = %s\n", p_data);
+ if (p_data == NULL) {
+ zte_write_result_to_web(wp, FAILURE);
+ return;
+ }
+
+ if (0 == strcmp(p_data, "time")) {
+ p_data = websGetVar(wp, T("time"), NULL);
+ if (p_data != NULL) {
+ time = atof(p_data);
+ sprintf(buf, "%ld", (long)(time * 60 * 60));
+ sc_cfg_set("monthly_time", buf);
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wan_data_flow_calibration_manual time:value = %f, buf = %s\n", time, buf);
+ zte_write_result_to_web(wp, SUCCESS);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MMI, MSG_CMD_TRAFFIC_INFO_RESET, 0, NULL, 0);
+ return;
+ }
+ } else if (0 == strcmp(p_data, "data")) {
+ p_data = websGetVar(wp, T("data"), NULL);
+ if (p_data != NULL) {
+ float data_tmp = 0;
+ data_tmp = atof(p_data);
+ //data = strtoll(p_data,NULL,10);
+ data = (unsigned long long)(data_tmp * 1024 * 1024);
+ errno = 0;
+ long long ret_strtoll = strtoll(p_data, NULL, 10);
+ if (errno == ERANGE)// kw ERRNO.NOT_CHECKED
+ {
+ slog(MISC_PRINT, SLOG_ERR,"strtoll errno %d: %s\n", errno, strerror(errno));
+ }
+ slog(MISC_PRINT, SLOG_DEBUG,"zte_wan_data_flow_calibration_manual data:111 data = %lld, %lld\n", data, ret_strtoll);
+ sprintf(buf, "%lld", data);
+ sc_cfg_set("monthly_tx_bytes", "0");
+ sc_cfg_set("monthly_rx_bytes", buf);
+ sc_cfg_set("flux_month_total", buf);
+ zte_write_result_to_web(wp, SUCCESS);
+ //flux_call_cb(CB_MSG_MMI_TRAFFIC_INFO_RESET, NULL ,0);
+ ipc_send_message(MODULE_ID_WEB_CGI, MODULE_ID_MMI, MSG_CMD_TRAFFIC_INFO_RESET, 0, NULL, 0);
+ return;
+ }
+ }
+
+ zte_write_result_to_web(wp, FAILURE);
+}