Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

clib/ftp.c File Reference

#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <alloc.h>
#include "ftp.h"
#include "tcpip.h"
#include "rtos.h"

Go to the source code of this file.

Defines

#define BYTE   unsigned char
#define WORD   unsigned int
#define FTP_BUF_LEN   512

Functions

char * strip_crlf (char *s)
int ftp_send (int sd, char *buffer, int buflen)
int ftp_recv (int sd, char *recv_buf, int recv_len, int *error)
int ftp_recv_msg (int sd, char *buffer, int buflen, int *error)
int ftp_command (int sd, char *cmd, char *response, int resp_len, int *error)
int ftp_connect (char *DestIPStr, unsigned int ClientPort, unsigned int HostPort, int *error)
ftp_descftp_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 dirlen, 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)

Variables

char ftp_buf [FTP_BUF_LEN+1]


Define Documentation

#define BYTE   unsigned char
 

Definition at line 56 of file ftp.c.

#define FTP_BUF_LEN   512
 

Definition at line 59 of file ftp.c.

Referenced by ftp_cwd(), ftp_dele(), ftp_login(), ftp_logout(), ftp_mkd(), ftp_open(), ftp_pwd(), ftp_recvfile(), ftp_rmd(), and ftp_sendfile().

#define WORD   unsigned int
 

Definition at line 57 of file ftp.c.


Function Documentation

int ftp_close ftp_desc   fd,
int *    error
 

Definition at line 331 of file ftp.c.

References closesocket(), and ftp_desc::sd_ctrl.

int ftp_command int    sd,
char *    cmd,
char *    response,
int    resp_len,
int *    error
 

Definition at line 143 of file ftp.c.

References ftp_buf, ftp_recv_msg(), ftp_send(), and strip_crlf().

Referenced by ftp_cwd(), ftp_dele(), ftp_login(), ftp_logout(), ftp_mkd(), ftp_open(), ftp_pwd(), ftp_recvfile(), ftp_rmd(), and ftp_sendfile().

int ftp_connect char *    DestIPStr,
unsigned int    ClientPort,
unsigned int    HostPort,
int *    error
 

Definition at line 174 of file ftp.c.

References bind(), connect(), htons(), inet_addr(), opensocket(), PF_INET, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, and SOCK_STREAM.

Referenced by ftp_open(), ftp_recvfile(), and ftp_sendfile().

int ftp_cwd ftp_desc   fd,
char *    cwdstr,
int *    stat,
int *    error
 

Definition at line 492 of file ftp.c.

References ftp_buf, FTP_BUF_LEN, ftp_command(), FTP_MSG_REQ_FILE_ACTION_OK, and ftp_desc::sd_ctrl.

int ftp_dele ftp_desc   fd,
char *    filename,
int *    stat,
int *    error
 

Definition at line 606 of file ftp.c.

References ftp_buf, FTP_BUF_LEN, ftp_command(), FTP_MSG_REQ_FILE_ACTION_OK, and ftp_desc::sd_ctrl.

int ftp_login ftp_desc   fd,
char *    user,
char *    pass,
int *    stat,
int *    error
 

Definition at line 361 of file ftp.c.

References ftp_buf, FTP_BUF_LEN, ftp_command(), FTP_MSG_USER_LOGGED_IN, FTP_MSG_USERNAME_OK, and ftp_desc::sd_ctrl.

int ftp_logout ftp_desc   fd,
int *    stat,
int *    error
 

Definition at line 414 of file ftp.c.

References ftp_buf, FTP_BUF_LEN, ftp_command(), FTP_MSG_USERNAME_OK, and ftp_desc::sd_ctrl.

int ftp_mkd ftp_desc   fd,
char *    mkdstr,
int *    stat,
int *    error
 

Definition at line 531 of file ftp.c.

References ftp_buf, FTP_BUF_LEN, ftp_command(), FTP_MSG_DIRECTORY_CREATED, and ftp_desc::sd_ctrl.

ftp_desc* ftp_open char *    DestIPStr,
unsigned int    ClientCtrlPort,
unsigned int    ClientDataPort,
unsigned int    HostCtrlPort,
int *    stat,
int *    error
 

Definition at line 254 of file ftp.c.

References api_sleep(), closesocket(), ftp_buf, FTP_BUF_LEN, ftp_command(), ftp_connect(), FTP_MSG_SERVER_READY, ftp_desc::host_ctrl_port, ftp_desc::host_data_port, ftp_desc::HostIPAddr, ftp_desc::HostIPStr, inet_addr(), ftp_desc::local_ctrl_port, ftp_desc::local_data_port, ftp_desc::sd_ctrl, and ftp_desc::sd_data.

int ftp_pwd ftp_desc   fd,
char *    dirstr,
int    dirlen,
int *    stat,
int *    error
 

Definition at line 450 of file ftp.c.

References ftp_buf, FTP_BUF_LEN, ftp_command(), FTP_MSG_CURRENT_DIRECTORY, and ftp_desc::sd_ctrl.

int ftp_recv int    sd,
char *    recv_buf,
int    recv_len,
int *    error
 

Definition at line 98 of file ftp.c.

References MSG_TIMEOUT, and recv().

Referenced by ftp_recvfile().

int ftp_recv_msg int    sd,
char *    buffer,
int    buflen,
int *    error
 

Definition at line 110 of file ftp.c.

References GetWaitingBytes(), MSG_TIMEOUT, and recv().

Referenced by ftp_command().

int ftp_recvfile ftp_desc   fd,
char *    RemoteName,
char *    LocalName,
int    mode,
int *    stat,
int *    error
 

Definition at line 829 of file ftp.c.

References api_sleep(), closesocket(), FTP_ASCII, ftp_buf, FTP_BUF_LEN, ftp_command(), ftp_connect(), FTP_MSG_DATA_CONNECTION_ALREADY_OPEN, FTP_MSG_ENTERING_PASSIV_MODE, FTP_MSG_FILE_STATUS_OK, FTP_MSG_TRANSFER_COMPLETED, FTP_MSG_TYPE_COMMAND_OK, ftp_recv(), ftp_desc::host_data_port, ftp_desc::HostIPStr, ftp_desc::local_data_port, ftp_desc::sd_ctrl, and ftp_desc::sd_data.

int ftp_rmd ftp_desc   fd,
char *    rmdstr,
int *    stat,
int *    error
 

Definition at line 570 of file ftp.c.

References ftp_buf, FTP_BUF_LEN, ftp_command(), FTP_MSG_REQ_FILE_ACTION_OK, and ftp_desc::sd_ctrl.

int ftp_send int    sd,
char *    buffer,
int    buflen
 

Definition at line 81 of file ftp.c.

References send().

Referenced by ftp_command(), and ftp_sendfile().

int ftp_sendfile ftp_desc   fd,
char *    LocalName,
char *    RemoteName,
int    mode,
int *    stat,
int *    error
 

Definition at line 659 of file ftp.c.

References closesocket(), FTP_ASCII, ftp_buf, FTP_BUF_LEN, ftp_command(), ftp_connect(), FTP_MSG_DATA_CONNECTION_ALREADY_OPEN, FTP_MSG_ENTERING_PASSIV_MODE, FTP_MSG_FILE_STATUS_OK, FTP_MSG_TRANSFER_COMPLETED, FTP_MSG_TYPE_COMMAND_OK, ftp_send(), ftp_desc::host_data_port, ftp_desc::HostIPStr, ftp_desc::local_data_port, ftp_desc::sd_ctrl, and ftp_desc::sd_data.

char* strip_crlf char *    s
 

Definition at line 64 of file ftp.c.

Referenced by ftp_command().


Variable Documentation

char ftp_buf[FTP_BUF_LEN+1]
 

Definition at line 60 of file ftp.c.

Referenced by ftp_command(), ftp_cwd(), ftp_dele(), ftp_login(), ftp_logout(), ftp_mkd(), ftp_open(), ftp_pwd(), ftp_recvfile(), ftp_rmd(), and ftp_sendfile().


Generated on Sun Aug 4 21:47:31 2002 for k/os mp3v2 by doxygen1.2.16