📄 idftpcommon.pas
字号:
{ $HDR$}
{**********************************************************************}
{ Unit archived using Team Coherence }
{ Team Coherence is Copyright 2002 by Quality Software Components }
{ }
{ For further information / comments, visit our WEB site at }
{ http://www.TeamCoherence.com }
{**********************************************************************}
{}
{ $Log: 11860: IdFTPCommon.pas
{
{ Rev 1.35 10/27/2004 1:05:08 AM JPMugaas
{ "SungDong Kim" <infi@acrosoft.pe.kr> indicated a problem with Korean in
{ IsTotalLine. He suggested specifically testing for multibyte characters.
{
{ This is tentative.
}
{
{ Rev 1.34 10/26/2004 9:19:12 PM JPMugaas
{ Fixed references.
}
{
{ Rev 1.33 9/7/2004 10:01:12 AM JPMugaas
{ FIxed problem parsing:
{
{ drwx------ 1 user group 0 Sep 07 09:20 xxx
{
{ It was mistakenly being detected as Windows NT because there was a - in the
{ fifth and eigth position in the string. The fix is to detect to see if the
{ other chactors in thbat column are numbers.
{
{ I did the same thing to the another part of the detection so that something
{ similar doesn't happen there with "-" in Unix listings causing false
{ WindowsNT detection.
}
{
{ Rev 1.32 8/1/2004 1:07:36 AM JPMugaas
{ Fix for XBox dir listing problem seen in Unix-xbox-MediaCenter.txt
}
{
{ Rev 1.31 7/30/2004 5:50:54 AM JPMugaas
{ Fix for UnquotedChar. It was returning nothing instead of what the string
{ without quotes.
}
{
{ Rev 1.30 7/29/2004 1:33:08 AM JPMugaas
{ Reordered AUTH command values for a new property under development. This
{ should make things more logical.
}
{
{ Rev 1.29 6/29/2004 4:09:02 PM JPMugaas
{ OPTS MODE Z now supported as per draft-preston-ftpext-deflate-02.txt. This
{ should keep FTP Voyager 11 happy.
}
{
{ Rev 1.28 6/17/2004 3:38:42 PM JPMugaas
{ Removed Transfer Mode's dmBlock and dmCompressed since we did not support
{ those at all.
}
{
{ Rev 1.27 6/15/2004 7:18:58 PM JPMugaas
{ Compiler defines removed.
}
{
{ Rev 1.26 6/15/2004 6:35:30 PM JPMugaas
{ Change in ZLib parameter values. Window Bits is now positive. We make it
{ negative as part of a workaround and then upload with the ZLib headers.
}
{
{ Rev 1.25 6/7/2004 3:47:50 PM JPMugaas
{ VMS Recursive Dir listings now supported. This is done with a [...]. Note
{ that VMS does have some strange syntaxes with their file system.
}
{
{ Rev 1.24 6/5/2004 7:39:58 AM JPMugaas
{ Exposes Posix constants because I need them for something else in my private
{ work.
}
{
{ Rev 1.23 6/4/2004 4:15:42 PM JPMugaas
{ A ChModNumber conversion function wasn't returning anything.
{ Added an overloaded function for cases where all of the permissions should be
{ in one string (such as displaying in a ListView column).
}
{
{ Rev 1.22 2/17/2004 12:25:38 PM JPMugaas
{ The client now supports MODE Z (deflate) uploads and downloads as specified
{ by http://www.ietf.org/internet-drafts/draft-preston-ftpext-deflate-00.txt
}
{
{ Rev 1.21 2/12/2004 11:34:26 PM JPMugaas
{ FTP Deflate preliminary support. Work still needs to be done for upload and
{ downloading.
}
{
{ Rev 1.20 2004.02.03 5:44:42 PM czhower
{ Name changes
}
{
{ Rev 1.19 2004.02.03 2:12:08 PM czhower
{ $I path change
}
{
{ Rev 1.18 2004.01.23 2:37:24 AM czhower
{ DCCIL compile fix.
}
{
{ Rev 1.17 2004.01.22 5:27:24 PM czhower
{ Fixed compile errors.
}
{
{ Rev 1.16 1/22/2004 4:16:46 PM SPerry
{ fixed set problems
}
{
{ Rev 1.15 1/19/2004 8:57:20 PM JPMugaas
{ Rearranged functions to be in a more sensible way.
}
{
{ Rev 1.14 1/19/2004 4:35:30 AM JPMugaas
{ FTPDateTimeToMDTMD was created for converting a TDateTime into a time value
{ for MDTM.
{ MinutesFromGMT was moved from IdFTPServer because the client now may use it.
}
{
{ Rev 1.13 1/17/2004 7:37:32 PM JPMugaas
{ Removed some warnings.
}
{
{ Rev 1.12 1/16/2004 12:23:52 AM JPMugaas
{ New functions for MDTM set date functionality.
}
{
{ Rev 1.11 10/26/2003 9:18:10 PM BGooijen
{ Compiles in DotNet, and partially works there
}
{
Rev 1.10 10/19/2003 1:11:06 PM DSiders
Added localization comments.
}
{
{ Rev 1.9 10/7/2003 05:46:34 AM JPMugaas
{ SSCN Support added.
}
{
{ Rev 1.8 10/1/2003 05:29:50 PM JPMugaas
{ Y2KDate will now adjust date if there's 3 diigits instead of 4. This is
{ required for the OS/2 FTP LIST parser.
}
{
{ Rev 1.7 10/1/2003 12:57:12 AM JPMugaas
{ Routines for Sterling Commerce FTP Server support.
}
{
{ Rev 1.6 6/27/2003 06:06:50 AM JPMugaas
{ Should now compile with the IsNumeric code move.
}
{
{ Rev 1.5 3/12/2003 03:22:32 PM JPMugaas
{ The FTP Server can now handle masks better including file extensions.
}
{
{ Rev 1.4 2/24/2003 07:19:32 AM JPMugaas
{ Added routine for determining if a Unix file is "hidden". This is determined
{ by a "." starting a filename.
}
{
{ Rev 1.3 2/19/2003 02:04:24 AM JPMugaas
{ Added more routines from IdFTPList for the new framework.
}
{
{ Rev 1.2 2/17/2003 04:43:38 PM JPMugaas
{ TOPS20 support
}
{
{ Rev 1.1 2/14/2003 05:41:36 PM JPMugaas
{ Moved everything from IdFTPUtils to IdFTPCommon at Kudzu's suggestion.
}
{
{ Rev 1.0 11/13/2002 08:28:38 AM JPMugaas
{ Initial import from FTP VC.
}
unit IdFTPCommon;
interface
uses
Classes,
IdGlobal,
IdGlobalProtocols,
IdTStrings;
type
TIdFTPTransferType = (ftASCII, ftBinary);
TIdFTPDataStructure = (dsFile, dsRecord, dsPage);
//dmBlock, dmCompressed were removed because we don't use them and they aren't supported on most
//FTP Servers anyway.
TIdFTPTransferMode = (dmStream, dmDeflate); // (dmBlock, dmCompressed, dmStream, dmDeflate);
{Note that some FTP extensions might use some data port protection values that
are defined but not used. For memoment, I commented those out. Leave the comments
in just in case someone may need those later }
TIdFTPDataPortSecurity = ( ftpdpsClear, //'C' - Clear - neither Integrity nor Privacy
//NOT USED - 'S' - Safe - Integrity without Privacy
//NOT USED - 'E' - Confidential - Privacy without Integrity
ftpdpsPrivate //'P' - Private - Integrity and Privacy
);
{From:
http://www.ford-hutchinson.com/~fh-1-pfh/ftps-ext.html#bad
}
const
TLS_AUTH_NAMES : Array [0..3] of string =
('TLS', {implies clear data port in some implementations} {Do not translate}
'SSL', {implies private data port in some implementations} {Do not translate}
'TLS-C', {implies clear data port in some implementations} {Do not translate}
'TLS-P'); {implies private data port in some implementations} {Do not translate}
{
We hard-code these path specifiers because they are used for specific servers
irregardless of what the client's Operating system is. It's based on the server.
}
const
// based on http://www.raidenftpd.com/kb/kb000000037.htm
// entry in FEAT response indicating SSCN is supported
SCCN_FEAT = 'SSCN'; {do not localize}
// client method - SSL Connect
// turn on SSCN client method in FTP Server - secure server-to-server transfer
SSCN_ON = 'SSCN ON'; {do not localize}
//server mthod - SSL Accept method
// turn off SSCN client method in FTP Server - secure server-to-server transfer
SSCN_OFF = 'SSCN OFF'; {do not localize}
SSCN_OK_REPLY = 200;
SSCN_ERR_NEGOTIATION_REPLY = 421;
{
VMS Stuff from http://www.djesys.com/vms/freevms/mentor/vms_path.html
Path/filename separators, which could be different from path/subpath separators on
some systems
}
const
PATH_FILENAME_SEP_UNIX = '/';
PATH_FILENAME_SEP_DOS = '\';
PATH_FILENAME_SEP_VMS = ']';
{dir/subdir separators}
const
PATH_SUBDIR_SEP_UNIX = PATH_FILENAME_SEP_UNIX;
PATH_SUBDIR_SEP_DOS = PATH_FILENAME_SEP_DOS;
PATH_SUBDIR_SEP_VMS = '.';
{device/dir separator}
const
PATH_DEVICE_SEP_UNIX = ''; //Unix treats devices as part of one big hierarchy as part of the file system - leave emtpy
PATH_DEVICE_SEP_DOS = ':';
PATH_DEVICE_SEP_VMS = ':[';
{
sample VMS fully qualified filename:
DKA0:[MYDIR.SUBDIR1.SUBDIR2]MYFILE.TXT;1
Note VMS uses 39 chars for name and type
valid chars are:
letters A through Z
numbers 0 through 9
underscore ( _ )
hyphen ( -)
dollar sign ( $ )
See: http://www.uh.edu/infotech/services/documentation/vms/v0505.html
}
{ global file specification for all files }
UNIX_ALL_FILES = '*';
MS_DOS_ALL_FILES = '*.*';
VMS_ALL_FILES = '*.*;*';
CUR_DIR = '.';
PARENT_DIR = '..';
VMS_RELPATH_PREFIX = '[.';
MS_DOS_CURDIR = CUR_DIR + PATH_FILENAME_SEP_DOS;
UNIX_CURDIR = CUR_DIR + PATH_FILENAME_SEP_UNIX;
UNIX_DIR_SIZE = 512;
VMS_BLOCK_SIZE = 512;
//1/1/1970 - EPL time stamps are based on this value
const EPLF_BASE_DATE = 25569;
const
//Settings specified by
// http://www.ietf.org/internet-drafts/draft-preston-ftpext-deflate-00.txt
{
DEF_ZLIB_COMP_LEVEL = 7;
DEF_ZLIB_WINDOW_BITS = -15; //-15 - no extra headers
DEF_ZLIB_MEM_LEVEL = 8;
DEF_ZLIB_STRATAGY = 0; // - default
}
{
Settings specified by
//http://www1.ietf.org/internet-drafts/draft-preston-ftpext-deflate-02.txt
//and for some compatibility with one version of Noisette Software Corporation's ShareIt
//FTP Server
}
DEF_ZLIB_COMP_LEVEL = 7;
DEF_ZLIB_WINDOW_BITS = 15; //-15 - no extra headers
DEF_ZLIB_MEM_LEVEL = 8; // Z_DEFLATED
DEF_ZLIB_STRATAGY = 0; //Z_DEFAULT_STRATEGY - default
DEF_ZLIB_METHOD = 8; // Z_DEFLATED
type
TIdVSEPQDisposition = (
IdPQAppendable,
IdPQProcessAndDelete,
IdPQHoldUntilReleased,
IdPQProcessAndKeep,
IdPQLeaveUntilReleased,
IdPQErrorHoldUntilDK,
IdPQGetOrErrorHoldUntilDK,
IdPQJobProcessing,
IdPQSpoolOutputToInputD,
IdPQSurpressOutputSpooling,
IdPQSpoolOutputToTape);
const
VSERootDirItemTypes : array [0..5] of String =
('<Directory>', {do not localize} // treat as dir
'<VSE VTOC>', {do not localize} // treat as dir
'<Library>', {do not localize} // treat as dir
'<Power Queues>', {do not localize} // treat as dir
'<VSAM Catalog>', {do not localize} // treat as dir
'Entry Seq VSAM'); {do not localize} // treat as file
{From: http://groups.google.com/groups?q=MVS+JES+FTP+DIR+Output&hl=en&lr=&ie=UTF-8&oe=utf-8&selm=4qf4b8%246i7%40dsk92.itg.ti.com&rnum=1}
MVS_JES_Status : array [0..3] of string =
('INPUT', {do not localize} //job received but not run yet
'HELD', {do not localize} //job is in hold status
'ACTIVE', {do not localize} //job is running
'OUTPUT'); {do not localize} //job has finished and has output available
{ Note from stame article:
To retrieve the entire job issue the GET command with the .x:
get j26494.x f:/job26494
To retrieve only the third output file of your job:
get j26494.3 f:job26494.3
}
{ From:
http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/IESPME20/A.0?DT=20010927093004#HDRDISPX
}
VSE_PowerQueue_Dispositions : array [1..11] of char = (
'A', {do not localize} // (Local only) Appendable. Spool data may be added to the job via spool-access support.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -