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

PFTPServer Class Reference

#include <ftp.h>

Inheritance diagram for PFTPServer:

PFTP PInternetProtocol PIndirectChannel PChannel PObject

List of all members.

Detailed Description

File Transfer Protocol server channel class.

Definition at line 298 of file ftp.h.

Comparison functions

enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
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

Error functions

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

Miscellaneous functions

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

Scattered read/write functions

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

Run Time Type functions

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

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)

Public Types

enum  { MaxIllegalPasswords = 3 }
enum  Commands {
  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 AuthoriseUser (const PString &user, const PString &password, BOOL &replied)
virtual BOOL CheckLoginRequired (PINDEX cmd)
virtual BOOL Connect (const PString &address, const PString &service)
virtual BOOL Connect (const PString &address, WORD port=0)
virtual BOOL DispatchCommand (PINDEX code, const PString &args)
virtual int ExecuteCommand (PINDEX cmdNumber, const PString &param)
virtual int ExecuteCommand (PINDEX cmdNumber)
BOOL GetAllowThirdPartyPort () const
 return the thirdPartyPort flag, allowing 3 host put and get.
const PStringGetDefaultService () const
virtual PString GetGoodbyeString (const PString &user) const
 return the string printed just before exiting
virtual PString GetHelloString (const PString &user) const
int GetLastResponseCode () const
PString GetLastResponseInfo () const
PIPSocketGetSocket () const
virtual PString GetSystemTypeString () const
 return the string to be returned by the SYST command
virtual BOOL OnABOR (const PCaselessString &args)
virtual BOOL OnACCT (const PCaselessString &args)
virtual BOOL OnALLO (const PCaselessString &args)
virtual BOOL OnAPPE (const PCaselessString &args)
virtual BOOL OnCDUP (const PCaselessString &args)
virtual void OnCommandSuccessful (PINDEX cmdNum)
 Called for successful commands.
virtual BOOL OnCWD (const PCaselessString &args)
virtual BOOL OnDELE (const PCaselessString &args)
virtual void OnError (PINDEX errorCode, PINDEX cmdNum, const char *msg)
virtual BOOL OnHELP (const PCaselessString &args)
virtual BOOL OnLIST (const PCaselessString &args)
virtual BOOL OnMKD (const PCaselessString &args)
virtual BOOL OnMODE (const PCaselessString &args)
virtual BOOL OnNLST (const PCaselessString &args)
virtual BOOL OnNOOP (const PCaselessString &args)
virtual void OnNotImplemented (PINDEX cmdNum)
 Called for unimplemented commands.
virtual BOOL OnPASS (const PCaselessString &args)
virtual BOOL OnPASV (const PCaselessString &args)
virtual BOOL OnPORT (const PCaselessString &args)
virtual BOOL OnPWD (const PCaselessString &args)
virtual BOOL OnQUIT (const PCaselessString &args)
virtual BOOL OnREIN (const PCaselessString &args)
virtual BOOL OnREST (const PCaselessString &args)
virtual BOOL OnRETR (const PCaselessString &args)
virtual BOOL OnRMD (const PCaselessString &args)
virtual BOOL OnRNFR (const PCaselessString &args)
virtual BOOL OnRNTO (const PCaselessString &args)
virtual BOOL OnSITE (const PCaselessString &args)
virtual BOOL OnSMNT (const PCaselessString &args)
virtual BOOL OnSTAT (const PCaselessString &args)
virtual BOOL OnSTOR (const PCaselessString &args)
virtual BOOL OnSTOU (const PCaselessString &args)
virtual BOOL OnSTRU (const PCaselessString &args)
virtual void OnSyntaxError (PINDEX cmdNum)
 Called for syntax errors in commands.
virtual BOOL OnSYST (const PCaselessString &args)
virtual BOOL OnTYPE (const PCaselessString &args)
virtual BOOL OnUnknown (const PCaselessString &command)
virtual BOOL OnUSER (const PCaselessString &args)
 PFTPServer (const PString &readyString)
 PFTPServer ()
 declare a server socket
BOOL ProcessCommand ()
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 SendToClient (const PFilePath &filename)
 Send the specified file to the client.
void SetAllowThirdPartyPort (BOOL state)
 Set the thirdPartyPort flag.
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, const PString &param)
virtual BOOL WriteCommand (PINDEX cmdNumber)
virtual BOOL WriteLine (const PString &line)
virtual BOOL WriteResponse (const PString &code, const PString &info)
virtual BOOL WriteResponse (unsigned numericCode, const PString &info)
 ~PFTPServer ()
 Delete the server, cleaning up passive sockets.
Miscellaneous functions
virtual PObjectClone () const
Overrides from class PChannel
virtual BOOL Close ()
virtual PChannelGetBaseReadChannel () const
virtual PChannelGetBaseWriteChannel () const
virtual PString GetErrorText (ErrorGroup group=NumErrorGroups) const
virtual PString GetName () const
virtual BOOL IsOpen () const
virtual BOOL Shutdown (ShutdownValue option)
Overrides from class PObject
Comparison Compare (const PObject &obj) const
Information functions
int GetHandle () const
Reading functions
virtual PINDEX GetLastReadCount () const
PTimeInterval GetReadTimeout () const
virtual void OnReadComplete (void *buf, PINDEX len)
virtual BOOL ReadAsync (void *buf, PINDEX len)
BOOL ReadBlock (void *buf, PINDEX len)
virtual int ReadChar ()
PString ReadString (PINDEX len)
void SetReadTimeout (const PTimeInterval &time)
Writing functions
virtual PINDEX GetLastWriteCount () const
PTimeInterval GetWriteTimeout () const
virtual void OnWriteComplete (const void *buf, PINDEX len)
void SetWriteTimeout (const PTimeInterval &time)
virtual BOOL WriteAsync (const void *buf, PINDEX len)
BOOL WriteChar (int c)
BOOL WriteString (const PString &str)
Channel establish functions
PChannelGetReadChannel () const
PChannelGetWriteChannel () const
BOOL Open (PChannel *readChannel, PChannel *writeChannel, BOOL autoDeleteRead=TRUE, BOOL autoDeleteWrite=TRUE)
BOOL Open (PChannel *channel, BOOL autoDelete=TRUE)
BOOL Open (PChannel &channel)
BOOL SetReadChannel (PChannel *channel, BOOL autoDelete=TRUE)
BOOL SetWriteChannel (PChannel *channel, BOOL autoDelete=TRUE)
Overrides from class PObject
virtual PINDEX HashFunction () const

Static Public Member Functions

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

Protected Types

enum  {
  NotConnected, NeedUser, NeedPassword, Connected,
enum  StuffState {
  DontStuff, StuffIdle, StuffCR, StuffCRLF,
  StuffCRLFdot, StuffCRLFdotCR

Protected Member Functions

void Construct ()
virtual BOOL ConvertOSError (int libcReturnValue, ErrorGroup group=LastGeneralError)
BOOL OnOpen ()
 Call back to verify open succeeded in an PInternetProtocol class.
virtual PINDEX ParseResponse (const PString &line)
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
int illegalPasswordCount
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.
char mode
int os_handle
 The operating system file handle return by standard open() function.
PXBlockType px_lastBlockType
PMutex px_selectMutex
PMutex px_threadMutex
PMutex px_writeMutex
BOOL readAutoDelete
 Automatically delete read channel on destruction.
 Channel for read operations.
PTimeInterval readLineTimeout
PTimeInterval readTimeout
 Timeout for read operations.
PString readyString
PIPSocket::Address remoteHost
WORD remotePort
enum PFTPServer:: { ... }  state
char structure
enum PInternetProtocol::StuffState stuffingState
BOOL thirdPartyPort
char type
PCharArray unReadBuffer
PINDEX unReadCount
PString userName
BOOL writeAutoDelete
 Automatically delete write channel on destruction.
 Channel for write operations.
PTimeInterval writeTimeout
 Timeout for write operations.

Private Member Functions


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

Generated by  Doxygen 1.6.0   Back to index