/****************************************************************************
*
* (C) 2000 by Beck IPC GmbH
*
*  Beck IPC GmbH
*  Garbenheimerstr. 36-38
*  D-35578 Wetzlar
*
*  Phone : (49)-6441-905-240
*  Fax   : (49)-6441-905-245
*
* ---------------------------------------------------------------------------
* Module        : ftp.h
*
* Function      : prototypes, constants for FTP functions
*                 functions must should be used with program memory model large!
*
* Compiler		: Tested with Borland C 5.02
*
* Author        : Detlef Gerhardt
* Date          : 20.01.01
* ---------------------------------------------------------------------------

$Header: ftp.h, 2, 16.01.2002 11:51:55, Christoph Stoidner$

$Log:
 2    IPC@CHIP  1.1         16.01.2002 11:51:55  Christoph Stoidner add starteam
      directives
 1    IPC@CHIP  1.0         08.03.2001 15:30:02  Christoph Stoidner
$


* History       :
*
*  Vx.yy                   Author  Changes
*
*             11.01.01      dg    create
*             20.01.01      dg    error handling, malloc ftp connection desc.
*****************************************************************************/
#ifndef __FTP_H__
#define __FTP_H__
/*************************************************************************/

// constants
#define FTP_CTRLPORT 21
#define FTP_CONN_MAX 2

// used FTP messages
#define FTP_MSG_DATA_CONNECTION_ALREADY_OPEN 125
#define FTP_MSG_FILE_STATUS_OK 150
#define FTP_MSG_TYPE_COMMAND_OK 200
#define FTP_MSG_SERVER_READY 220
#define FTP_MSG_GOODBYE 221
#define FTP_MSG_TRANSFER_COMPLETED 226
#define FTP_MSG_ENTERING_PASSIV_MODE 227
#define FTP_MSG_USER_LOGGED_IN 230
#define FTP_MSG_REQ_FILE_ACTION_OK 250
#define FTP_MSG_CURRENT_DIRECTORY 257
#define FTP_MSG_DIRECTORY_CREATED 257
#define FTP_MSG_USERNAME_OK 331
#define FTP_MSG_SERVICE_NOT_AVAILABLE 421
#define FTP_MSG_NOT_LOGGED_IN 530

#define FTP_ASCII 0
#define FTP_BINARY 1

// ftp connection descriptor
typedef struct
{
	int sd_ctrl;	// socket descriptor for control connection
	int sd_data;	// socket descriptor for data connection
	unsigned int local_ctrl_port;
	unsigned int local_data_port;
	unsigned int host_ctrl_port;
	unsigned int host_data_port;
	long HostIPAddr;
	char HostIPStr[20];
} ftp_desc;

//prototypes
ftp_desc *ftp_open(char *DestIPStr, unsigned int ClientCtrlPort,
				unsigned int ClientDataPort, unsigned int HostCtrlPort,
				int *stat, int *error);
int ftp_close(ftp_desc *fd, int *error);
int ftp_login(ftp_desc *fd, char *user, char *pass, int *stat, int *error);
int ftp_logout(ftp_desc *fd, int *stat, int *error);
int ftp_pwd(ftp_desc *fd, char *dirstr, int strlen, int *stat, int *error);
int ftp_cwd(ftp_desc *fd, char *cwdstr, int *stat, int *error);
int ftp_mkd(ftp_desc *fd, char *mkdstr, int *stat, int *error);
int ftp_rmd(ftp_desc *fd, char *rmdstr, int *stat, int *error);
int ftp_dele(ftp_desc *fd, char *filename, int *stat, int *error);
int ftp_sendfile(ftp_desc *fd, char *LocalName, char *RemoteName, int mode,
					int *stat, int *error);
int ftp_recvfile(ftp_desc *fd, char *RemoteName, char *LocalName, int mode,
					int *stat, int *error);

/*************************************************************************/
#endif /* __FTP_H__ */
/*************************************************************************/
//end rtos.h
/*************************************************************************/

