Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

PFTPServer Class Reference

#include <ftp.h>

Inheritance diagram for PFTPServer:

PFTP PInternetProtocol PIndirectChannel PChannel PObject List of all members.

Public Types

enum  { MaxIllegalPasswords = 3 }

Public Member Functions

 PFTPServer ()
 declare a server socket
 PFTPServer (const PString &readyString)
 ~PFTPServer ()
 Delete the server, cleaning up passive sockets.
virtual PString GetHelloString (const PString &user) const
virtual PString GetGoodbyeString (const PString &user) const
 return the string printed just before exiting
virtual PString GetSystemTypeString () const
 return the string to be returned by the SYST command
BOOL GetAllowThirdPartyPort () const
 return the thirdPartyPort flag, allowing 3 host put and get.
void SetAllowThirdPartyPort (BOOL state)
 Set the thirdPartyPort flag.
BOOL ProcessCommand ()
virtual BOOL DispatchCommand (PINDEX code, const PString &args)
virtual BOOL CheckLoginRequired (PINDEX cmd)
virtual BOOL AuthoriseUser (const PString &user, const PString &password, BOOL &replied)
virtual BOOL OnUnknown (const PCaselessString &command)
virtual void OnError (PINDEX errorCode, PINDEX cmdNum, const char *msg)
virtual void OnSyntaxError (PINDEX cmdNum)
 Called for syntax errors in commands.
virtual void OnNotImplemented (PINDEX cmdNum)
 Called for unimplemented commands.
virtual void OnCommandSuccessful (PINDEX cmdNum)
 Called for successful commands.
virtual BOOL OnUSER (const PCaselessString &args)
virtual BOOL OnPASS (const PCaselessString &args)
virtual BOOL OnQUIT (const PCaselessString &args)
virtual BOOL OnPORT (const PCaselessString &args)
virtual BOOL OnSTRU (const PCaselessString &args)
virtual BOOL OnMODE (const PCaselessString &args)
virtual BOOL OnTYPE (const PCaselessString &args)
virtual BOOL OnNOOP (const PCaselessString &args)
virtual BOOL OnSYST (const PCaselessString &args)
virtual BOOL OnSTAT (const PCaselessString &args)
virtual BOOL OnRETR (const PCaselessString &args)
virtual BOOL OnSTOR (const PCaselessString &args)
virtual BOOL OnACCT (const PCaselessString &args)
virtual BOOL OnAPPE (const PCaselessString &args)
virtual BOOL OnRNFR (const PCaselessString &args)
virtual BOOL OnRNTO (const PCaselessString &args)
virtual BOOL OnDELE (const PCaselessString &args)
virtual BOOL OnCWD (const PCaselessString &args)
virtual BOOL OnCDUP (const PCaselessString &args)
virtual BOOL OnRMD (const PCaselessString &args)
virtual BOOL OnMKD (const PCaselessString &args)
virtual BOOL OnPWD (const PCaselessString &args)
virtual BOOL OnLIST (const PCaselessString &args)
virtual BOOL OnNLST (const PCaselessString &args)
virtual BOOL OnPASV (const PCaselessString &args)
virtual BOOL OnHELP (const PCaselessString &args)
virtual BOOL OnSITE (const PCaselessString &args)
virtual BOOL OnABOR (const PCaselessString &args)
virtual BOOL OnSMNT (const PCaselessString &args)
virtual BOOL OnREIN (const PCaselessString &args)
virtual BOOL OnSTOU (const PCaselessString &args)
virtual BOOL OnALLO (const PCaselessString &args)
virtual BOOL OnREST (const PCaselessString &args)
void SendToClient (const PFilePath &filename)
 Send the specified file to the client.

Protected Types

enum  {
  NotConnected, NeedUser, NeedPassword, Connected,
  ClientConnect
}

Protected Member Functions

BOOL OnOpen ()
 Call back to verify open succeeded in an PInternetProtocol class.
void Construct ()

Protected Attributes

PString readyString
BOOL thirdPartyPort
enum PFTPServer:: { ... }  state
PIPSocket::Address remoteHost
WORD remotePort
PTCPSocketpassiveSocket
char type
char structure
char mode
PString userName
int illegalPasswordCount

Detailed Description

File Transfer Protocol server channel class.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
MaxIllegalPasswords 

anonymous enum [protected]
 

Enumeration values:
NotConnected 
NeedUser 
NeedPassword 
Connected 
ClientConnect 


Constructor & Destructor Documentation

PFTPServer::PFTPServer  ) 
 

declare a server socket

PFTPServer::PFTPServer const PString readyString  ) 
 

Parameters:
readyString  Sign on string on connection ready.

PFTPServer::~PFTPServer  ) 
 

Delete the server, cleaning up passive sockets.


Member Function Documentation

virtual BOOL PFTPServer::AuthoriseUser const PString user,
const PString password,
BOOL &  replied
[virtual]
 

Validate the user name and password for access. After three invalid attempts, the socket will close and FALSE is returned.

Default implementation returns TRUE for all strings.

Returns:
TRUE if user can access, otherwise FALSE
Parameters:
password  User name to authorise.
replied  Password supplied for the user. Indication that a reply was sent to client.

virtual BOOL PFTPServer::CheckLoginRequired PINDEX  cmd  )  [virtual]
 

Check to see if the command requires the server to be logged in before it may be processed.

Returns:
TRUE if the command required the user to be logged in.
Parameters:
cmd  Command to check if log in required.

void PFTPServer::Construct  )  [protected]
 

Reimplemented from PChannel.

virtual BOOL PFTPServer::DispatchCommand PINDEX  code,
const PString args
[virtual]
 

Dispatching to the appropriate virtual function. This is used when the socket is acting as a server.

Returns:
TRUE if more processing may be done, FALSE if the QUIT command was received or the OnUnknown()# function returns FALSE.
Parameters:
args  Parsed command code. Arguments to command.

BOOL PFTPServer::GetAllowThirdPartyPort  )  const [inline]
 

return the thirdPartyPort flag, allowing 3 host put and get.

virtual PString PFTPServer::GetGoodbyeString const PString user  )  const [virtual]
 

return the string printed just before exiting

virtual PString PFTPServer::GetHelloString const PString user  )  const [virtual]
 

Get the string printed when a user logs in default value is a string giving the user name

virtual PString PFTPServer::GetSystemTypeString  )  const [virtual]
 

return the string to be returned by the SYST command

virtual BOOL PFTPServer::OnABOR const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnACCT const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnALLO const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnAPPE const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnCDUP const PCaselessString args  )  [virtual]
 

virtual void PFTPServer::OnCommandSuccessful PINDEX  cmdNum  )  [virtual]
 

Called for successful commands.

Parameters:
cmdNum  Command that had was successful.

virtual BOOL PFTPServer::OnCWD const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnDELE const PCaselessString args  )  [virtual]
 

virtual void PFTPServer::OnError PINDEX  errorCode,
PINDEX  cmdNum,
const char *  msg
[virtual]
 

Handle an error in command.

Returns:
TRUE if more processing may be done, FALSE if the ProcessCommand()# function is to return FALSE.
Parameters:
cmdNum  Error code to use
msg  Command that had the error. Error message.

virtual BOOL PFTPServer::OnHELP const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnLIST const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnMKD const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnMODE const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnNLST const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnNOOP const PCaselessString args  )  [virtual]
 

virtual void PFTPServer::OnNotImplemented PINDEX  cmdNum  )  [virtual]
 

Called for unimplemented commands.

Parameters:
cmdNum  Command that was not implemented.

BOOL PFTPServer::OnOpen  )  [protected, virtual]
 

Call back to verify open succeeded in an PInternetProtocol class.

Reimplemented from PIndirectChannel.

virtual BOOL PFTPServer::OnPASS const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnPASV const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnPORT const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnPWD const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnQUIT const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnREIN const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnREST const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnRETR const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnRMD const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnRNFR const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnRNTO const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnSITE const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnSMNT const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnSTAT const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnSTOR const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnSTOU const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnSTRU const PCaselessString args  )  [virtual]
 

virtual void PFTPServer::OnSyntaxError PINDEX  cmdNum  )  [virtual]
 

Called for syntax errors in commands.

Parameters:
cmdNum  Command that had the syntax error.

virtual BOOL PFTPServer::OnSYST const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnTYPE const PCaselessString args  )  [virtual]
 

virtual BOOL PFTPServer::OnUnknown const PCaselessString command  )  [virtual]
 

Handle an unknown command.

Returns:
TRUE if more processing may be done, FALSE if the ProcessCommand()# function is to return FALSE.
Parameters:
command  Complete command line received.

virtual BOOL PFTPServer::OnUSER const PCaselessString args  )  [virtual]
 

BOOL PFTPServer::ProcessCommand  ) 
 

Process commands, dispatching to the appropriate virtual function. This is used when the socket is acting as a server.

Returns:
TRUE if more processing may be done, FALSE if the QUIT command was received or the OnUnknown()# function returns FALSE.

void PFTPServer::SendToClient const PFilePath filename  ) 
 

Send the specified file to the client.

Parameters:
filename  File name to send.

void PFTPServer::SetAllowThirdPartyPort BOOL  state  )  [inline]
 

Set the thirdPartyPort flag.


Member Data Documentation

int PFTPServer::illegalPasswordCount [protected]
 

char PFTPServer::mode [protected]
 

PTCPSocket* PFTPServer::passiveSocket [protected]
 

PString PFTPServer::readyString [protected]
 

PIPSocket::Address PFTPServer::remoteHost [protected]
 

WORD PFTPServer::remotePort [protected]
 

enum { ... } PFTPServer::state [protected]
 

char PFTPServer::structure [protected]
 

BOOL PFTPServer::thirdPartyPort [protected]
 

char PFTPServer::type [protected]
 

PString PFTPServer::userName [protected]
 


The documentation for this class was generated from the following file:
Generated on Tue Mar 15 10:44:53 2005 for PWLib by  doxygen 1.4.0