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
PBoolean GetAllowThirdPartyPort () const
 return the thirdPartyPort flag, allowing 3 host put and get.
void SetAllowThirdPartyPort (PBoolean state)
 Set the thirdPartyPort flag.
PBoolean ProcessCommand ()
virtual PBoolean DispatchCommand (PINDEX code, const PString &args)
virtual PBoolean CheckLoginRequired (PINDEX cmd)
virtual PBoolean AuthoriseUser (const PString &user, const PString &password, PBoolean &replied)
virtual PBoolean 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 PBoolean OnUSER (const PCaselessString &args)
virtual PBoolean OnPASS (const PCaselessString &args)
virtual PBoolean OnQUIT (const PCaselessString &args)
virtual PBoolean OnPORT (const PCaselessString &args)
virtual PBoolean OnSTRU (const PCaselessString &args)
virtual PBoolean OnMODE (const PCaselessString &args)
virtual PBoolean OnTYPE (const PCaselessString &args)
virtual PBoolean OnNOOP (const PCaselessString &args)
virtual PBoolean OnSYST (const PCaselessString &args)
virtual PBoolean OnSTAT (const PCaselessString &args)
virtual PBoolean OnRETR (const PCaselessString &args)
virtual PBoolean OnSTOR (const PCaselessString &args)
virtual PBoolean OnACCT (const PCaselessString &args)
virtual PBoolean OnAPPE (const PCaselessString &args)
virtual PBoolean OnRNFR (const PCaselessString &args)
virtual PBoolean OnRNTO (const PCaselessString &args)
virtual PBoolean OnDELE (const PCaselessString &args)
virtual PBoolean OnCWD (const PCaselessString &args)
virtual PBoolean OnCDUP (const PCaselessString &args)
virtual PBoolean OnRMD (const PCaselessString &args)
virtual PBoolean OnMKD (const PCaselessString &args)
virtual PBoolean OnPWD (const PCaselessString &args)
virtual PBoolean OnLIST (const PCaselessString &args)
virtual PBoolean OnNLST (const PCaselessString &args)
virtual PBoolean OnPASV (const PCaselessString &args)
virtual PBoolean OnHELP (const PCaselessString &args)
virtual PBoolean OnSITE (const PCaselessString &args)
virtual PBoolean OnABOR (const PCaselessString &args)
virtual PBoolean OnSMNT (const PCaselessString &args)
virtual PBoolean OnREIN (const PCaselessString &args)
virtual PBoolean OnSTOU (const PCaselessString &args)
virtual PBoolean OnALLO (const PCaselessString &args)
virtual PBoolean 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

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

Protected Attributes

PString readyString
PBoolean 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

Enumerator:
MaxIllegalPasswords 

anonymous enum [protected]

Enumerator:
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 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::GetGoodbyeString ( const PString user  )  const [virtual]

return the string printed just before exiting

virtual PString PFTPServer::GetSystemTypeString (  )  const [virtual]

return the string to be returned by the SYST command

PBoolean PFTPServer::GetAllowThirdPartyPort (  )  const [inline]

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

void PFTPServer::SetAllowThirdPartyPort ( PBoolean  state  )  [inline]

Set the thirdPartyPort flag.

PBoolean PFTPServer::ProcessCommand (  ) 

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

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

virtual PBoolean 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:
PTrue if more processing may be done, PFalse if the QUIT command was received or the OnUnknown()# function returns PFalse.
Parameters:
code  Parsed command code.
args  Arguments to command.

virtual PBoolean PFTPServer::CheckLoginRequired ( PINDEX  cmd  )  [virtual]

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

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

virtual PBoolean PFTPServer::AuthoriseUser ( const PString user,
const PString password,
PBoolean replied 
) [virtual]

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

Default implementation returns PTrue for all strings.

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

virtual PBoolean PFTPServer::OnUnknown ( const PCaselessString command  )  [virtual]

Handle an unknown command.

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

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

Handle an error in command.

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

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

Called for syntax errors in commands.

Parameters:
cmdNum  Command that had the syntax error.

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

Called for unimplemented commands.

Parameters:
cmdNum  Command that was not implemented.

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

Called for successful commands.

Parameters:
cmdNum  Command that had was successful.

virtual PBoolean PFTPServer::OnUSER ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnPASS ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnQUIT ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnPORT ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnSTRU ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnMODE ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnTYPE ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnNOOP ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnSYST ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnSTAT ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnRETR ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnSTOR ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnACCT ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnAPPE ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnRNFR ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnRNTO ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnDELE ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnCWD ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnCDUP ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnRMD ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnMKD ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnPWD ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnLIST ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnNLST ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnPASV ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnHELP ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnSITE ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnABOR ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnSMNT ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnREIN ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnSTOU ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnALLO ( const PCaselessString args  )  [virtual]

virtual PBoolean PFTPServer::OnREST ( const PCaselessString args  )  [virtual]

void PFTPServer::SendToClient ( const PFilePath filename  ) 

Send the specified file to the client.

Parameters:
filename  File name to send.

PBoolean PFTPServer::OnOpen (  )  [protected, virtual]

Call back to verify open succeeded in an PInternetProtocol class.

Reimplemented from PIndirectChannel.

void PFTPServer::Construct (  )  [protected]

Reimplemented from PChannel.


Member Data Documentation

PString PFTPServer::readyString [protected]

PBoolean PFTPServer::thirdPartyPort [protected]

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

PIPSocket::Address PFTPServer::remoteHost [protected]

WORD PFTPServer::remotePort [protected]

PTCPSocket* PFTPServer::passiveSocket [protected]

char PFTPServer::type [protected]

char PFTPServer::structure [protected]

char PFTPServer::mode [protected]

PString PFTPServer::userName [protected]

int PFTPServer::illegalPasswordCount [protected]


The documentation for this class was generated from the following file:
Generated on Mon Feb 23 01:57:56 2009 for PTLib by  doxygen 1.5.1