home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
internet
/
netlite
/
NET
/
h
/
FTP
< prev
next >
Wrap
Text File
|
1993-04-01
|
3KB
|
71 lines
#define CTLZ 26 /* EOF for CP/M systems */
extern char userfile[]; /* List of user names and permissions */
#define MAXPATH 8 /* Maximum number of path/permission pairs */
/* Per-session control block */
struct ftp {
struct ftp *prev; /* Linked list pointers */
struct ftp *next;
struct tcb *control; /* TCP control connection */
char state;
#define COMMAND_STATE 0 /* Awaiting user command */
#define SENDING_FILE_STATE 1 /* Sending file data to user */
#define SENDING_DATA_STATE 2 /* Sending memory data to user */
#define RECEIVING_STATE 3 /* Storing data from user */
#define STARTUP_STATE 4 /* Starting up autologin */
#define USER_STATE 5 /* Waiting for the user name */
#define PASS_STATE 6 /* Waiting for the password */
char type; /* Transfer type */
#define IMAGE_TYPE 0
#define ASCII_TYPE 1
FILE *fp; /* File descriptor being transferred */
char *p; /* Data in memory being transferred */
char *cp; /* Data in memory current position */
struct socket port; /* Remote port for data connection */
struct tcb *data; /* Data connection */
/* The following are used only by the server */
char *username; /* Arg to USER command */
char *path[MAXPATH]; /* Allowable path prefix */
char perms[MAXPATH]; /* Permission flag bits */
#define FTP_READ 1 /* Read files */
#define FTP_CREATE 2 /* Create new files */
#define FTP_WRITE 4 /* Overwrite or delete existing files */
char *buf; /* Input command buffer */
char cnt; /* Length of input buffer */
char *cd; /* Current directory name */
/* And this is used only by the client */
struct session *session;
time_t start; /* Time transfer started */
int bytes; /* No bytes transferred */
int hash; /* Hash mark printing on/off */
int bell; /* Bell on completion */
};
#define NULLFTP (struct ftp *)0
/* In FTP */
void ftpdr(struct tcb *, int16);
void ftpdt(struct tcb *, int16);
struct ftp *ftp_create(unsigned int);
void ftp_delete(struct ftp *);
/* In FTPCLI */
void start_ftp(void);
void ftpparse(struct session *, char *, int16);
int doabort(int, char **);
void ftpccr(struct tcb *, int16);
/* In FTPSERV */
int ftp1(int, char **);
int ftp0(void);
void ftpsds(struct tcb *, char, char);
int permcheck(struct ftp *, int, char *);