[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/lynq/lib/liblynq-protcl/include/ftp/lynq_ftp.h b/src/lynq/lib/liblynq-protcl/include/ftp/lynq_ftp.h
new file mode 100644
index 0000000..12e3f09
--- /dev/null
+++ b/src/lynq/lib/liblynq-protcl/include/ftp/lynq_ftp.h
@@ -0,0 +1,171 @@
+#include<stdio.h>
+#include<sys/socket.h>
+#include<stdlib.h>
+#include<string.h>
+#include<strings.h>
+#include<unistd.h>
+#include<netinet/in.h>
+#include<netdb.h>
+#include<errno.h>
+#include<sys/types.h>
+#include<sys/stat.h>
+#include<fcntl.h>
+#include "liblog/liblog.h"
+#include "liblog/lynq_deflog.h"
+
+
+#define SERV_PORT 21
+#define MAXSIZE 1024
+//#define MAXBUF 1024
+#define FTP_FILE_TYPE_LEN 4
+#define FTP_MAX_ASCII_LEN 1024
+#define FTPSHMPATH "/"
+#define FTPSHMID  'K'
+
+
+int error;
+char errorbuf[10];
+
+#if 1
+/*log error info */
+
+#define FTP_NET_ERROR                  	31	//network
+#define FTP_DNS_ERROR                 	32	//DNS
+#define FTP_CONNECT_ERROR           	33	//connect
+#define FTP_TIMEROUT                    34	//time out
+#define FTP_SERVER_ERROR             	35	//server
+#define FTP_OPERATION_NOT_ALLOW         36	//operation not allow
+#define FTP_REPLAY_ERROR               	37	//replay
+#define FTP_USER_ERROR                 	38	//user
+#define FTP_PASSWORD_ERROR              39	//pwd
+#define FTP_TYPE_ERROR                 	40	//type
+#define FTP_REST_ERROR                 	41	//rest
+#define FTP_PASSIVE_ERROR              	42	//passive
+#define FTP_ACTIVE_ERROR               	43	//active
+#define FTP_OPERATE_ERROR              	44	//operate
+#define FTP_UPLOAD_ERROR               	45	//upload
+#define FTP_DOWNLOAD_ERROR              46	//download
+#define FTP_FILE_ACTION_ERROR	        47	//action error
+#define FTP_MANUAL_QUIT                	48	//manual quit
+#define FTP_ERROR_FLAG                 	49
+#define FTP_SOCK_ERROR                 	50	//socket error
+#define FTP_RCV_ERROR                 	51	//rcv error
+#define FTP_SEND_ERROR                 	52	//send error 
+#define FTP_CLOSE_ERROR                 53    //close error
+#define FTP_READ_ERROR                 	54    //read error
+#define FTP_WRITE_ERROR                 55    //write error
+#define FTP_LS_ERROR                 55    //ls error
+
+#endif
+
+#if 1
+/***********ftp return vauil******************/
+
+#define FTP_100_INIT_WAIT_LAST_CMD			100
+#define FTP_125_TRANSFER_START				125
+#define FTP_150_OPEN_DATA_CONNECT			150
+
+#define FTP_200_COMMAND_SUCCESSFUL			200
+#define FTP_213_FILE_STATUS				213
+#define FTP_220_SERVER_READY_FOR_NEW_USER		220
+#define FTP_221_CLOSE_CONTROL_CONNECT			221
+#define FTP_226_TRANSFER_COMPLATE			226
+#define FTP_227_ENTRY_PASV_MODE				227
+#define FTP_230_USER_LOGGED_IN				230
+#define FTP_250_REQUEST_FILE_ACTION_OK			250
+#define FTP_257_PATH_NAME				257
+
+
+#define FTP_331_NAMEOK_PASS_REQUIRE			331
+#define FTP_350_FILE_OPER_OK_WAIT_NEXT			350
+
+#define FTP_421_CONTROL_LINK_SHUTDOWN 			421
+#define FTP_425_CANNOT_OPEN_DATA_CONNECT		425
+
+
+#define FTP_500_COMMAND_ERROR				500
+#define FTP_501_PARAMETER_ERROR				501
+#define FTP_502_COMMAND_NOT_IMP				502
+#define FTP_503_BAD_SEQUENCE_OF_CMD			503
+
+#define FTP_530_CANNOT_LOG_IN				530
+#define FTP_532_NEED_ACCOUNT				532
+#define FTP_534_CANNOT_CONN_CAUSE_SSL			534
+#define FTP_550_FILE_CANT_FIND				550
+
+
+#endif
+
+typedef struct ftp_socket_info
+{
+	int id;
+	int index;
+	char protocol[10];
+	int  session;
+	char action[10];
+
+	int control_sockfd;
+	int portnum;//port num 1~65535
+	char is_pasv_mode[225];//0:initiative 1:pasv
+	char file_type[FTP_FILE_TYPE_LEN+1];//type "A" or "I"
+	char put_opt[FTP_FILE_TYPE_LEN+1];// "APPE", "STOU", "STOR"
+	int rest; //xu chuan wei zhi;
+	char sevname[FTP_MAX_ASCII_LEN + 1];//addr :192.168.1.89;
+	char username[FTP_MAX_ASCII_LEN + 1];//user
+	char pw[FTP_MAX_ASCII_LEN + 1];//password
+	char getfilename[FTP_MAX_ASCII_LEN + 1];//get file  name;
+	char getfilename_path[FTP_MAX_ASCII_LEN + 1];//get file path;
+	char putfilename[FTP_MAX_ASCII_LEN + 1];//put file name;
+	char putfilename_path[FTP_MAX_ASCII_LEN + 1];//put file path;
+	//char conmd[255];
+	char dir[1024];
+	char del_mkr_filename[1024];
+	char respond[1024];
+	int flag;
+	int flag1;
+	int modify_thread;
+	int add_thread;
+}lynq_ftp_socker_info;
+
+
+int control_sockfd;
+int login_yes;
+int f;
+char putpathname[225];
+char hoster[255];
+struct sockaddr_in servaddr;
+char rbuf[1024],rbuf1[1024],wbuf[1024],wbuf1[1024];
+int ftpshm_id;
+lynq_ftp_socker_info *FTP;
+
+int uartfd;
+int usbfd;
+//char BUF[1024];
+
+
+
+int  lynq_ftp_put(int sck,char *pUploadFileName_s);
+extern int lynq_ftp_login(lynq_ftp_socker_info *FTP);
+extern void zeromery(char *a,int len);
+extern char *itoa(int value, char *string, int radix);
+extern void lynq_ftp_pwd(int control_sockfd);
+extern int strtosrv(char *str);
+extern void lynq_ftp_get(int sck, char *pDownloadFileName, int session);
+extern void lynq_ftp_rest(int control_sockfd);
+extern int cliopen(char *hoster, int port);
+extern int lynq_ftp_download(lynq_ftp_socker_info* FTP);
+extern int lynq_ftp_up(lynq_ftp_socker_info* FTP);
+int lynq_ftp_ls(lynq_ftp_socker_info* FTP);
+void lynq_ftp_cd(lynq_ftp_socker_info* FTP);
+void lynq_ftp_creat_mkd(lynq_ftp_socker_info* FTP);
+void lynq_ftp_delete_mkd(lynq_ftp_socker_info* FTP);
+void ftp_list(int sockfd, int session);
+void lynq_ftp_quit(lynq_ftp_socker_info* FTP);
+void lynq_ftp_deletefile_mkd(lynq_ftp_socker_info* FTP);
+
+
+extern void init(lynq_ftp_socker_info* FTP);
+extern int lynq_ftpshm_create( void );
+extern lynq_ftp_socker_info *ftpshm_act(int shmid);
+extern void lynq_ftpshm_deact(lynq_ftp_socker_info *shm);
+extern void lynq_ftpshm_del(int shmid);