📄 rosftplib.h
字号:
/*
* ftp client,created by tongxj 2001-07-01
*/
#ifndef _ROS_FTP_LIB_H
#define _ROS_FTP_LIB_H
#include "vxWorks.h"
#include "ctype.h"
#include "dirent.h"
#include "pathLib.h"
#include "time.h"
#include "tickLib.h"
#include "sockLib.h"
#include "sysLib.h"
#include "sockLib.h"
#include "inetLib.h"
#include "semLib.h"
#include "ioLib.h"
#include "netinet\tcp.h"
#include "netinet/in.h"
#include "stdio.h"
#include "stdLib.h"
#include "string.h"
#include "logLib.h"
#include "errnoLib.h"
#include "taskLib.h"
#ifdef PRJ_BUILD
#include "prjParams.h"
#else
#include "netLib.h"
#endif
#include "inflate.h" /* for verzip */
#define CR_LF "\x0d\x0a"
#define MAX_CMD_STR_LEN 100
#define FTP_REPLY_LINE_LEN 256 /*server's return code string length*/
#define FTP_CMD_LINE_LEN 256
#define FTP_SERVER_PORT 21
#define FTP_CONNECT_TIMEO 5 /* seconds */
#define FTP_SEND_TIMEO 5
#define MAX_USER_LEN 40
#define MAX_PASSWORD_LEN 40
#define MAX_FILENAME_LEN 128
#define FTP_NONE 0x00
#define INVALID_SOCK ERROR
#define NORMAL_MODE 0x0
#define PASV_MODE 0x1
#define ZAR_MODE 0x2
#ifndef OUTBUF_SIZE
#define OUTBUF_SIZE 512
#endif
#define INBUF_SIZE 512
typedef int SOCKET;
typedef enum {
Listen,
Client,
Server
} SocketType;
typedef enum{
Initial,
Listening,
Connecting,
Active,
End, /* get EOF */
Error /* error */
} SocketState;
typedef struct FTP_SOCK_NODE_TAG
{
SOCKET sockFd;
SocketState state;
} FTP_SOCK_NODE;
typedef struct FTP_CLIENT_NODE_TAG
{
FTP_SOCK_NODE ctrlNode;
FTP_SOCK_NODE dataNode;
UINT8 mode;
char cmdBuf[FTP_CMD_LINE_LEN];
int reply;
BOOL continuedReply;
char replyBuf[FTP_REPLY_LINE_LEN];
int replyLen;
UINT32 server;
char user[MAX_USER_LEN];
char password[MAX_PASSWORD_LEN];
char sfile[MAX_FILENAME_LEN];
char dfile[MAX_FILENAME_LEN];
FILE* dfp; /* destination file */
char *dMem; /* destination memory */
int memSize;
UINT32 totalRcv;
char* pRcvBuf; /* */
/* for deflated version */
unsigned char z_outbuf[OUTBUF_SIZE];
ZAR_STREAM z_stream;
unsigned short z_checksum;
int z_state;
} FTP_CLIENT_NODE;
int FtpCopyFile(char* server,char *user,
char *psw,char *sfile,char* dfile,UINT8 mode);
int FtpGetFile(char* server, char *user,
char *psw,char *sfile,void *location,int size,UINT8 mode);
#endif
/* end of file */
/* Reply code
110 Restart marker reply.
In this case, the text is exact and not left to the
particular implementation; it must read:
MARK yyyy = mmmm
Where yyyy is User-process data stream marker, and mmmm
server's equivalent marker (note the spaces between markers
and "=").
120 Service ready in nnn minutes.
125 Data connection already open; transfer starting.
150 File status okay; about to open data connection.
200 Command okay.
202 Command not implemented, superfluous at this site.
211 System status, or system help reply.
212 Directory status.
213 File status.
214 Help message.
On how to use the server or the meaning of a particular
non-standard command. This reply is useful only to the
human user.
215 NAME system type.
Where NAME is an official system name from the list in the
Assigned Numbers document.
220 Service ready for new user.
221 Service closing control connection.
Logged out if appropriate.
225 Data connection open; no transfer in progress.
226 Closing data connection.
Requested file action successful (for example, file
transfer or file abort).
227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).
230 User logged in, proceed.
250 Requested file action okay, completed.
257 "PATHNAME" created.
331 User name okay, need password.
332 Need account for login.
350 Requested file action pending further information.
421 Service not available, closing control connection.
This may be a reply to any command if the service knows it
must shut down.
425 Can't open data connection.
426 Connection closed; transfer aborted.
450 Requested file action not taken.
File unavailable (e.g., file busy).
451 Requested action aborted: local error in processing.
452 Requested action not taken.
Insufficient storage space in system.
500 Syntax error, command unrecognized.
This may include errors such as command line too long.
501 Syntax error in parameters or arguments.
502 Command not implemented.
503 Bad sequence of commands.
504 Command not implemented for that parameter.
530 Not logged in.
532 Need account for storing files.
550 Requested action not taken.File unavailable (e.g., file not found, no access).
551 Requested action aborted: page type unknown.
552 Requested file action aborted.Exceeded storage allocation (for current directory or dataset).
553 Requested action not taken. File name not allowed.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -