This software is provided 'as-is', without any express or
implied warranty. In no event will the author be held liable
for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it
and redistribute it freely, subject to the following
restrictions:
1. The origin of this software must not be misrepresented,
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is
not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
History:
Apr 29, 1998 V0.90 released for beta testing.
May 01, 1998 V0.92 Adapted for Delphi 1.0
May 03, 1998 V0.93 Adapted for Delphi 2.0 and C++Builder
May 04, 1998 V0.94 Use '/' or '\' as path delimiter. Expose only '/' to the
outside. Stripped any telnet options (IE send two !). Handled
absolute path. Implemented SIZE and REST commands.
Added support for UNC (not finished !)
May 06, 1998 V0.95 Corrected spurious 226 message on PASV mode STOR.
Made GetInteger retunrs a LongInt.
Use a LongInt for N in CommandPORT (needed for 16 bits)
Added slash substitution in BuildFilePath command.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TFtpCtrlSocketClass -
TFtpServer -
Register - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
TFtpSrvAnswerToClientEvent
TFtpSrvAuthenticateEvent
TFtpSrvBuildDirectoryEvent
TFtpSrvChangeDirectoryEvent
TFtpSrvClientCommandEvent
TFtpSrvClientConnectEvent
TFtpSrvCommandProc
TFtpSrvCommandTableItem
TFtpSrvDataAvailableEvent
TFtpSrvDataSessionConnectedEvent
TFtpSrvRetrDataSentEvent
TFtpSrvValidateXferEvent
TFtpString
FtpServerVersion
WM_FTPSRV_ABORT_TRANSFER
WM_FTPSRV_CLIENT_CLOSED
WM_FTPSRV_CLOSE_DATA
WM_FTPSRV_CLOSE_REQUEST
procedure Register;
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
TFtpSrvAnswerToClientEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
var Answer : TFtpString) of object
TFtpSrvAuthenticateEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
UserName : TFtpString;
Password : TFtpString;
var Authenticated : Boolean) of object
TFtpSrvBuildDirectoryEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
var Directory : TFtpString;
Detailed : Boolean) of object
TFtpSrvChangeDirectoryEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
Directory : TFtpString;
var Allowed : Boolean) of object
TFtpSrvClientCommandEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
var Keyword : TFtpString;
var Params : TFtpString;
var Answer : TFtpString) of object
TFtpSrvClientConnectEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
Error : Word) of object
TFtpSrvCommandProc = procedure (Client : TFtpCtrlSocket;
var Keyword : TFtpString;
var Params : TFtpString;
var Answer : TFtpString) of object
TFtpSrvCommandTableItem = record
KeyWord : String;
Proc : TFtpSrvCommandProc;
end;
TFtpSrvDataAvailableEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
Data : TWSocket;
Buf : PChar;
Len : LongInt;
Error : Word) of object
TFtpSrvDataSessionConnectedEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
Data : TWSocket;
Error : Word) of object
TFtpSrvRetrDataSentEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
Data : TWSocket;
Error : Word) of object
TFtpSrvValidateXferEvent = procedure (Sender : TObject;
Client : TFtpCtrlSocket;
var FilePath : TFtpString;
var Allowed : Boolean) of object
TFtpString = String
Various Delphi and C++Builder version handle string parameter passed as var } { differently. To get application code compatible across all versions, we } { need to define our own string type. We use the larger we can with the given } { compiler version. btw: the 255 limit is not a problem because it applies to } { the command laines sent to the server and 255 should be enough except if } { you use incredibly long file names. } {$IFDEF VER100} { Delphi 3
FtpServerVersion = 095
Enable partial boolean evaluation } {$T-} { Untyped pointers } {$IFNDEF VER80} {$J+} { Allow typed constant to be modified } {$ENDIF
WM_FTPSRV_ABORT_TRANSFER = WM_USER + 3
WM_FTPSRV_CLIENT_CLOSED = WM_USER + 2
WM_FTPSRV_CLOSE_DATA = WM_USER + 4
WM_FTPSRV_CLOSE_REQUEST = WM_USER + 1