Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions

PFTPClient Class Reference

#include <ftp.h>

Inheritance diagram for PFTPClient:
Inheritance graph
[legend]
Collaboration diagram for PFTPClient:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Commands {
  USER, PASS, ACCT, CWD,
  CDUP, SMNT, QUIT, REIN,
  PORT, PASV, TYPE, STRU,
  MODE, RETR, STOR, STOU,
  APPE, ALLO, REST, RNFR,
  RNTO, ABOR, DELE, RMD,
  MKD, PWD, LIST, NLST,
  SITE, SYST, STATcmd, HELP,
  NOOP, NumCommands
}
 

FTP commands.


enum  DataChannelType { NormalPort, Passive }
 

File transfer mode on data channel.


enum  NameTypes { ShortNames, DetailedNames }
 

Listing types.


enum  PXBlockType { PXReadBlock, PXWriteBlock, PXAcceptBlock, PXConnectBlock }
enum  RepresentationType { ASCII, EBCDIC, Image }
 

Types for file transfer.


Public Member Functions

virtual BOOL Accept (PSocket &listener)
virtual BOOL Connect (const PString &address, WORD port=0)
virtual BOOL Connect (const PString &address, const PString &service)
virtual int ExecuteCommand (PINDEX cmdNumber)
virtual int ExecuteCommand (PINDEX cmdNumber, const PString &param)
const PStringGetDefaultService () const
int GetLastResponseCode () const
PString GetLastResponseInfo () const
PIPSocketGetSocket () const
 PFTPClient ()
 Declare an FTP client socket.
virtual BOOL Read (void *buf, PINDEX len)
virtual BOOL ReadCommand (PINDEX &num, PString &args)
virtual BOOL ReadLine (PString &line, BOOL allowContinuation=FALSE)
virtual BOOL ReadResponse (int &code, PString &info)
virtual BOOL ReadResponse ()
BOOL SendPORT (const PIPSocket::Address &addr, WORD port)
void SetReadLineTimeout (const PTimeInterval &t)
virtual void UnRead (const void *buffer, PINDEX len)
virtual void UnRead (const PString &str)
virtual void UnRead (int ch)
virtual BOOL Write (const void *buf, PINDEX len)
virtual BOOL WriteCommand (PINDEX cmdNumber)
virtual BOOL WriteCommand (PINDEX cmdNumber, const PString &param)
virtual BOOL WriteLine (const PString &line)
virtual BOOL WriteResponse (unsigned numericCode, const PString &info)
virtual BOOL WriteResponse (const PString &code, const PString &info)
 ~PFTPClient ()
 Delete and close the socket.
Overrides from class PSocket.
virtual BOOL Close ()
New functions for class
BOOL LogIn (const PString &username, const PString &password)
PString GetSystemType ()
BOOL SetType (RepresentationType type)
BOOL ChangeDirectory (const PString &dirPath)
PString GetCurrentDirectory ()
PStringArray GetDirectoryNames (NameTypes type=ShortNames, DataChannelType channel=Passive)
PStringArray GetDirectoryNames (const PString &path, NameTypes type=ShortNames, DataChannelType channel=Passive)
PString GetFileStatus (const PString &path, DataChannelType channel=Passive)
PTCPSocketGetFile (const PString &filename, DataChannelType channel=NormalPort)
PTCPSocketPutFile (const PString &filename, DataChannelType channel=NormalPort)
Overrides from class PObject
Comparison Compare (const PObject &obj) const
Overrides from class PChannel
virtual PString GetName () const
virtual BOOL IsOpen () const
virtual BOOL Shutdown (ShutdownValue option)
virtual PChannelGetBaseReadChannel () const
virtual PChannelGetBaseWriteChannel () const
virtual PString GetErrorText (ErrorGroup group=NumErrorGroups) const
Channel establish functions
BOOL Open (PChannel &channel)
BOOL Open (PChannel *channel, BOOL autoDelete=TRUE)
BOOL Open (PChannel *readChannel, PChannel *writeChannel, BOOL autoDeleteRead=TRUE, BOOL autoDeleteWrite=TRUE)
PChannelGetReadChannel () const
BOOL SetReadChannel (PChannel *channel, BOOL autoDelete=TRUE)
PChannelGetWriteChannel () const
BOOL SetWriteChannel (PChannel *channel, BOOL autoDelete=TRUE)
Overrides from class PObject
virtual PINDEX HashFunction () const
Information functions
int GetHandle () const
Reading functions
void SetReadTimeout (const PTimeInterval &time)
PTimeInterval GetReadTimeout () const
virtual PINDEX GetLastReadCount () const
virtual int ReadChar ()
BOOL ReadBlock (void *buf, PINDEX len)
PString ReadString (PINDEX len)
virtual BOOL ReadAsync (void *buf, PINDEX len)
virtual void OnReadComplete (void *buf, PINDEX len)
Writing functions
void SetWriteTimeout (const PTimeInterval &time)
PTimeInterval GetWriteTimeout () const
virtual PINDEX GetLastWriteCount () const
BOOL WriteChar (int c)
BOOL WriteString (const PString &str)
virtual BOOL WriteAsync (const void *buf, PINDEX len)
virtual void OnWriteComplete (const void *buf, PINDEX len)
Miscellaneous functions
virtual PObjectClone () const

Static Public Member Functions

static BOOL ConvertOSError (int libcReturnValue, Errors &lastError, int &osError)

Protected Types

enum  StuffState {
  DontStuff, StuffIdle, StuffCR, StuffCRLF,
  StuffCRLFdot, StuffCRLFdotCR
}

Protected Member Functions

virtual BOOL ConvertOSError (int libcReturnValue, ErrorGroup group=LastGeneralError)
PTCPSocketNormalClientTransfer (Commands cmd, const PString &args)
virtual BOOL OnOpen ()
 Call back to verify open succeeded in an PInternetProtocol class.
virtual PINDEX ParseResponse (const PString &line)
PTCPSocketPassiveClientTransfer (Commands cmd, const PString &args)
int PXClose ()
BOOL PXSetIOBlock (PXBlockType type, const PTimeInterval &timeout)
int ReadCharWithTimeout (PTimeInterval &timeout)
BOOL ReceiveCommandString (int nextChar, const PString &reply, PINDEX &pos, PINDEX start)
BOOL SetErrorValues (Errors errorCode, int osError, ErrorGroup group=LastGeneralError)

Protected Attributes

PString channelName
PReadWriteMutex channelPointerMutex
 Race condition prevention on closing channel.
PStringArray commandNames
PString defaultServiceName
Errors lastErrorCode [NumErrorGroups+1]
 The platform independant error code.
int lastErrorNumber [NumErrorGroups+1]
 The operating system error number (eg as returned by errno).
PINDEX lastReadCount
 Number of byte last read by the Read() function.
int lastResponseCode
PString lastResponseInfo
PINDEX lastWriteCount
 Number of byte last written by the Write() function.
BOOL newLineToCRLF
int os_handle
 The operating system file handle return by standard open() function.
PXBlockType px_lastBlockType
PThreadpx_readThread
PMutex px_selectMutex
PThreadpx_selectThread
PMutex px_threadMutex
PMutex px_writeMutex
PThreadpx_writeThread
BOOL readAutoDelete
 Automatically delete read channel on destruction.
PChannelreadChannel
 Channel for read operations.
PTimeInterval readLineTimeout
PTimeInterval readTimeout
 Timeout for read operations.
WORD remotePort
 Port number on remote system.
enum PInternetProtocol::StuffState stuffingState
PCharArray unReadBuffer
PINDEX unReadCount
BOOL writeAutoDelete
 Automatically delete write channel on destruction.
PChannelwriteChannel
 Channel for write operations.
PTimeInterval writeTimeout
 Timeout for write operations.

Private Member Functions

 PCLASSINFO (PFTPClient, PFTP)

Scattered read/write functions

virtual BOOL Read (const VectorOfSlice &slices)
virtual BOOL Write (const VectorOfSlice &slices)
typedef std::vector< SliceVectorOfSlice

Miscellaneous functions

BOOL SetBufferSize (PINDEX newSize)
BOOL SendCommandString (const PString &command)
void AbortCommandString ()
enum  ShutdownValue { ShutdownRead = 0, ShutdownWrite = 1, ShutdownReadAndWrite = 2 }

Error functions

Errors GetErrorCode (ErrorGroup group=NumErrorGroups) const
int GetErrorNumber (ErrorGroup group=NumErrorGroups) const
enum  Errors {
  NoError, NotFound, FileExists, DiskFull,
  AccessDenied, DeviceInUse, BadParameter, NoMemory,
  NotOpen, Timeout, Interrupted, BufferTooSmall,
  Miscellaneous, ProtocolFailure, NumNormalisedErrors
}
enum  ErrorGroup { LastReadError, LastWriteError, LastGeneralError, NumErrorGroups }
static PString GetErrorText (Errors lastError, int osError=0)

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
BOOL IsClass (const char *cls) const
virtual BOOL InternalIsDescendant (const char *clsName) const
static const char * Class ()

Comparison functions

virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator>= (const PObject &obj) const
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }

I/O functions

virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)
ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)

Detailed Description

File Transfer Protocol client channel class.

Definition at line 151 of file ftp.h.


The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index