Merge "[Feature][S300][task-view-1920][locknet] before Implementation of enhanced network locking scheme"
diff --git a/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/Makefile b/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/Makefile
new file mode 100755
index 0000000..b1aed72
--- /dev/null
+++ b/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/Makefile
@@ -0,0 +1,43 @@
+#*******************************************************************************
+# include ZTE application makefile
+#*******************************************************************************	
+include $(COMMON_MK)
+
+##############USER COMIZE BEGIN################
+EXEC1 = zte_locknet 
+
+CPU_PUB_ROOT=$(TOPDIR_AP)/../pub
+
+OBJS1 = $(patsubst %.c,%.o,$(wildcard ./src/*.c ))
+                                   
+CFLAGS += -I.
+CFLAGS += -I./inc
+CFLAGS += -I$(zte_app_path)/include
+CFLAGS += -I$(zte_app_path)/zte_comm/at_ctl/inc
+CFLAGS += -I$(zte_lib_path)/libsqlite
+CFLAGS += -I$(LINUX_DIR)
+
+CFLAGS += -I$(CPU_PUB_ROOT)/project/zx297520v3/include/nv
+CFLAGS += -O -Dlinux=1 -DHIGH_SPEED=1
+CFLAGS += -g
+CFLAGS += -g -Werror=implicit-function-declaration
+ 
+LDLIBS  += -lnvram -L$(zte_lib_path)/libnvram
+LDLIBS  += -lsoftap -L$(zte_lib_path)/libsoftap
+LDLIBS  += -latutils -L$(zte_lib_path)/libatutils
+LDLIBS  += -lsqlite -L$(zte_lib_path)/libsqlite
+LDLIBS  += -lsoft_timer -L$(zte_lib_path)/libsoft_timer
+
+LDLIBS  += -lm
+LDLIBS  += -lpthread -L$(zte_lib_path)/libpthread
+LDLIBS  += -lcpnv -L$(zte_lib_path)/libcpnv
+##############USER COMIZE END##################
+
+#*******************************************************************************
+# targets
+#*******************************************************************************
+lib: $(OBJS1)
+	@echo Compiling zte_locknet libraries.
+	
+clean:
+	-rm -f $(OBJS1)
diff --git a/lynq/S300/BJMTN/ap/lib/libatext/ext_locknet.c b/lynq/S300/BJMTN/ap/lib/libatext/ext_locknet.c
new file mode 100755
index 0000000..60fe04c
--- /dev/null
+++ b/lynq/S300/BJMTN/ap/lib/libatext/ext_locknet.c
@@ -0,0 +1,110 @@
+// #ifndef CONFIG_MIN_8M_VERSION

+#include "at_context.h"

+

+int ext_LocklistAuth_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKLISTAUTH_REQ,strlen(at_paras), (unsigned char *)at_paras,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetList_set_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETLIST_SET_REQ,strlen(at_paras), (unsigned char *)at_paras,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetKey_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETKEY_REQ,strlen(at_paras), (unsigned char *)at_paras,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetAmtStatus_get_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETAMTSTATUS_GET_REQ, 0, NULL,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetDigest_get_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETDIGEST_GET_REQ, 0, NULL,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetSign_set_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETSIGN_SET_REQ,strlen(at_paras), (unsigned char *)at_paras,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetLevel_get_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETLEVEL_GET_REQ, 0, NULL,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetList_get_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETLIST_GET_REQ,strlen(at_paras), (unsigned char *)at_paras,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetAuth_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETAUTH_REQ, 0, NULL,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetUnlockTimes_get_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETUNLOCKTIMES_GET_REQ, 0, NULL,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetStatus_get_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETSTATUS_GET_REQ, 0, NULL,0);

+	return AT_CONTINUE;

+}

+

+int ext_LocknetUnlock_func(char *at_paras, void ** res_msg)

+{

+	ipc_send_message(MODULE_ID_AT_CTL,MODULE_ID_LOCKNET,MSG_CMD_LOCKNETUNLOCK_REQ,strlen(at_paras), (unsigned char *)at_paras,0);

+	return AT_CONTINUE;

+}

+

+//ÊÕµ½zudryÖ÷¶¯Éϱ¨ÃüÁîºó£¬Ï·¢AT+ZSCHPLMN=1ʹmodemÔÊÐíËÑÍø(¸ÃÃüÁîÊÇÔÚËøÍø¹¦ÄÜÖÐʹÓÃ)

+int zurdy_auto_act(char *at_paras ,int is_query_report)

+{

+    int appmode = 0;

+    int initresult = 0;

+    void *p[2] = {&appmode, &initresult};

+    

+    parse_param2("%d,%d", at_paras, p);

+    at_print(AT_ERR,"zurdy_auto_act appmode:%d,initresult:%d!\n",appmode,initresult);

+    if(appmode != 0 && (initresult == 30 || initresult == 31))

+    {   		

+		ipc_send_message(MODULE_ID_AT_CTL, MODULE_ID_LOCKNET, MSG_CMD_ZURDY_LOCKAUTH_REQ, 0, NULL,0);

+	}

+    return AT_END;

+}

+

+void ext_locknet_regist_init()

+{

+	register_serv_func("LOCKLISTAUTH=", MODULE_ID_LOCKNET, ext_LocklistAuth_func);

+	register_serv_func("LOCKNETLIST=", MODULE_ID_LOCKNET, ext_LocknetList_set_func);	

+	register_serv_func("UNLOCKKEY=", MODULE_ID_LOCKNET, ext_LocknetKey_func);

+	register_serv_func("UNLOCKKEY?", MODULE_ID_LOCKNET, ext_LocknetAmtStatus_get_func);

+	register_serv_func("LOCKDIGEST?", MODULE_ID_LOCKNET, ext_LocknetDigest_get_func);

+	register_serv_func("LOCKSIGN=", MODULE_ID_LOCKNET, ext_LocknetSign_set_func);

+	register_serv_func("LOCKLEVEL?", MODULE_ID_LOCKNET,ext_LocknetLevel_get_func);

+	register_serv_func("MEPCG=", MODULE_ID_LOCKNET, ext_LocknetList_get_func);

+	register_serv_func("LOCKNETAUTH", MODULE_ID_LOCKNET, ext_LocknetAuth_func);

+	register_serv_func("ZNCK?", MODULE_ID_LOCKNET, ext_LocknetUnlockTimes_get_func);

+	register_serv_func("ZSEC?", MODULE_ID_LOCKNET, ext_LocknetStatus_get_func);

+	register_serv_func("ZNCK=", MODULE_ID_LOCKNET, ext_LocknetUnlock_func);

+

+	register_inform_func("ZURDY",zurdy_auto_act);

+}

+// #endif

+