class PFTPServer

File Transfer Protocol server channel class

Inheritance:


Public Methods

[more] PFTPServer ()
declare a server socket
[more] ~PFTPServer ()
Delete the server, cleaning up passive sockets
[more]virtual PString GetHelloString (const PString & user) const
Get the string printed when a user logs in default value is a string giving the user name
[more]virtual PString GetGoodbyeString (const PString & user) const
return the string printed just before exiting
[more]virtual PString GetSystemTypeString () const
return the string to be returned by the SYST command
[more]BOOL GetAllowThirdPartyPort () const
return the thirdPartyPort flag, allowing 3 host put and get
[more]void SetAllowThirdPartyPort (BOOL state)
Set the thirdPartyPort flag
[more]BOOL ProcessCommand ()
Process commands, dispatching to the appropriate virtual function.
[more]virtual BOOL DispatchCommand ( PINDEX code, const PString & args )
Dispatching to the appropriate virtual function.
[more]virtual BOOL CheckLoginRequired ( PINDEX cmd )
Check to see if the command requires the server to be logged in before it may be processed.
[more]virtual BOOL AuthoriseUser ( const PString & user, const PString & password, BOOL & replied )
Validate the user name and password for access.
[more]virtual BOOL OnUnknown ( const PCaselessString & command )
Handle an unknown command.
[more]virtual void OnError ( PINDEX errorCode, PINDEX cmdNum, const char* msg )
Handle an error in command.
[more]virtual void OnSyntaxError ( PINDEX cmdNum )
Called for syntax errors in commands.
[more]virtual void OnNotImplemented ( PINDEX cmdNum )
Called for unimplemented commands.
[more]virtual void OnCommandSuccessful ( PINDEX cmdNum )
Called for successful commands.
[more]void SendToClient ( const PFilePath & filename )
Send the specified file to the client.

Protected Methods

[more]BOOL OnOpen ()
Call back to verify open succeeded in an PInternetProtocol class


Inherited from PFTP:

Public Methods

oBOOL SendPORT( const PIPSocket::Address & addr, WORD port )

Public Members

oenum Commands
oenum RepresentationType
oenum DataChannelType
oenum NameTypes


Inherited from PInternetProtocol:

Public Methods

ovirtual BOOL Read( void* buf, PINDEX len )
ovirtual BOOL Write( const void* buf, PINDEX len )
ovoid SetReadLineTimeout( const PTimeInterval & t )
ovirtual BOOL Connect( const PString & address, WORD port = 0 )
ovirtual BOOL Accept( PSocket & listener )
oconst PString& GetDefaultService() const
oPIPSocket* GetSocket() const
ovirtual BOOL WriteLine( const PString & line )
ovirtual BOOL ReadLine( PString & line, BOOL allowContinuation = FALSE )
ovirtual void UnRead( int ch )
ovirtual BOOL WriteCommand( PINDEX cmdNumber )
ovirtual BOOL ReadCommand( PINDEX & num, PString & args )
ovirtual BOOL WriteResponse( unsigned numericCode, const PString & info )
ovirtual BOOL ReadResponse()
ovirtual int ExecuteCommand( PINDEX cmdNumber )
oint GetLastResponseCode() const
oPString GetLastResponseInfo() const

Protected Methods

ovirtual PINDEX ParseResponse( const PString & line )


Inherited from PIndirectChannel:

Public Methods

Construction

Overrides from class PObject

Overrides from class PChannel

Channel establish functions

Protected Fields

oPChannel* readChannel
oBOOL readAutoDelete
oPChannel* writeChannel
oBOOL writeAutoDelete
oPReadWriteMutex channelPointerMutex


Inherited from PChannel:

Public Methods

Information functions

Reading functions

Writing functions

Miscellaneous functions

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

Public Members

Error functions

Protected Fields

oint os_handle
oErrors lastErrorCode[NumErrorGroups+1]
oint lastErrorNumber[NumErrorGroups+1]
oPINDEX lastReadCount
oPINDEX lastWriteCount
oPTimeInterval readTimeout
oPTimeInterval writeTimeout

Protected Methods

ovirtual BOOL ConvertOSError( int libcReturnValue, ErrorGroup group = LastGeneralError )
oBOOL SetErrorValues( Errors errorCode, int osError, ErrorGroup group = LastGeneralError )
oint ReadCharWithTimeout( PTimeInterval & timeout )


Inherited from PObject:

Public Methods

Run Time Type functions

I/O functions

Public Members

Comparison functions


Documentation

File Transfer Protocol server channel class
o PFTPServer()
declare a server socket

o ~PFTPServer()
Delete the server, cleaning up passive sockets

ovirtual PString GetHelloString(const PString & user) const
Get the string printed when a user logs in default value is a string giving the user name

ovirtual PString GetGoodbyeString(const PString & user) const
return the string printed just before exiting

ovirtual PString GetSystemTypeString() const
return the string to be returned by the SYST command

oBOOL GetAllowThirdPartyPort() const
return the thirdPartyPort flag, allowing 3 host put and get

ovoid SetAllowThirdPartyPort(BOOL state)
Set the thirdPartyPort flag

oBOOL 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.

ovirtual BOOL DispatchCommand( PINDEX code, const PString & args )
Dispatching to the appropriate virtual function. This is used when the socket is acting as a server.

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

ovirtual BOOL CheckLoginRequired( PINDEX cmd )
Check to see if the command requires the server to be logged in before it may be processed.

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

ovirtual BOOL AuthoriseUser( const PString & user, const PString & password, BOOL & replied )
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.

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

ovirtual BOOL OnUnknown( const PCaselessString & command )
Handle an unknown command.

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

ovirtual void OnError( PINDEX errorCode, PINDEX cmdNum, const char* msg )
Handle an error in command.

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

ovirtual void OnSyntaxError( PINDEX cmdNum )
Called for syntax errors in commands.
Parameters:
cmdNum - Command that had the syntax error.

ovirtual void OnNotImplemented( PINDEX cmdNum )
Called for unimplemented commands.
Parameters:
cmdNum - Command that was not implemented.

ovirtual void OnCommandSuccessful( PINDEX cmdNum )
Called for successful commands.
Parameters:
cmdNum - Command that had was successful.

ovoid SendToClient( const PFilePath & filename )
Send the specified file to the client.
Parameters:
filename - File name to send.

oBOOL OnOpen()
Call back to verify open succeeded in an PInternetProtocol class


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.