using System;
namespace FluentFTP {
///
/// Defines the type of encryption to use
///
public enum FtpEncryptionMode {
///
/// Plain text.
///
None,
///
/// FTPS encryption is used from the start of the connection, port 990.
///
Implicit,
///
/// Connection starts in plain text and FTPS encryption is enabled
/// with the AUTH command immediately after the server greeting.
///
Explicit
}
///
/// The type of response the server responded with
///
public enum FtpResponseType : int {
///
/// No response
///
None = 0,
///
/// Success
///
PositivePreliminary = 1,
///
/// Success
///
PositiveCompletion = 2,
///
/// Success
///
PositiveIntermediate = 3,
///
/// Temporary failure
///
TransientNegativeCompletion = 4,
///
/// Permanent failure
///
PermanentNegativeCompletion = 5
}
///
/// Server features
///
[Flags]
public enum FtpCapability : int {
///
/// This server said it doesn't support anything!
///
NONE = 0,
///
/// Supports the MLST command
///
MLSD = 1,
///
/// Supports the SIZE command
///
SIZE = 2,
///
/// Supports the MDTM command
///
MDTM = 4,
///
/// Supports download/upload stream resumes
///
REST = 8,
///
/// Supports UTF8
///
UTF8 = 16,
///
/// PRET Command used in distributed ftp server software DrFTPD
///
PRET = 32,
///
/// Server supports the MFMT command for setting the
/// modified date of an object on the server
///
MFMT = 64,
///
/// Server supports the MFCT command for setting the
/// created date of an object on the server
///
MFCT = 128,
///
/// Server supports the MFF command for setting certain facts
/// about file system objects. If you need this command, it would
/// probably be handy to query FEAT your self and have a look at
/// the FtpReply.InfoMessages property to see which facts the server
/// allows you to modify.
///
MFF = 256,
///
/// Server supports the STAT command
///
STAT = 512,
///
/// Support for the HASH command
///
HASH = 1024,
///
/// Support for the non-standard MD5 command
///
MD5 = 2048,
///
/// Support for the non-standard XMD5 command
///
XMD5 = 4096,
///
/// Support for the non-standard XCRC command
///
XCRC = 8192,
///
/// Support for the non-standard XSHA1 command
///
XSHA1 = 16384,
///
/// Support for the non-standard XSHA256 command
///
XSHA256 = 32768,
///
/// Support for the non-standard XSHA512 command
///
XSHA512 = 65536
}
///
/// Different types of hashing algorithms for computing checksums.
///
[Flags]
public enum FtpHashAlgorithm : int {
///
/// HASH command is not supported
///
NONE = 0,
///
/// SHA-1
///
SHA1 = 1,
///
/// SHA-256
///
SHA256 = 2,
///
/// SHA-512
///
SHA512 = 4,
///
/// MD5
///
MD5 = 8,
///
/// CRC
///
CRC = 16
}
///
/// IP Versions to allow when connecting
/// to a server.
///
[Flags]
public enum FtpIpVersion : int {
///
/// Internet Protocol Version 4
///
IPv4 = 1,
///
/// Internet Protocol Version 6
///
IPv6 = 2,
///
/// Allow any supported version
///
ANY = IPv4 | IPv6
}
///
/// Data connection type
///
public enum FtpDataConnectionType {
///
/// This type of data connection attempts to use the EPSV command
/// and if the server does not support EPSV it falls back to the
/// PASV command before giving up unless you are connected via IPv6
/// in which case the PASV command is not supported.
///
AutoPassive,
///
/// Passive data connection. EPSV is a better
/// option if it's supported. Passive connections
/// connect to the IP address dictated by the server
/// which may or may not be accessible by the client
/// for example a server behind a NAT device may
/// give an IP address on its local network that
/// is inaccessible to the client. Please note that IPv6
/// does not support this type data connection. If you
/// ask for PASV and are connected via IPv6 EPSV will
/// automatically be used in its place.
///
PASV,
///
/// Same as PASV except the host supplied by the server is ignored
/// and the data connection is made to the same address that the control
/// connection is connected to. This is useful in scenarios where the
/// server supplies a private/non-routable network address in the
/// PASV response. It's functionally identical to EPSV except some
/// servers may not implement the EPSV command. Please note that IPv6
/// does not support this type data connection. If you
/// ask for PASV and are connected via IPv6 EPSV will
/// automatically be used in its place.
///
PASVEX,
///
/// Extended passive data connection, recommended. Works
/// the same as a PASV connection except the server
/// does not dictate an IP address to connect to, instead
/// the passive connection goes to the same address used
/// in the control connection. This type of data connection
/// supports IPv4 and IPv6.
///
EPSV,
///
/// This type of data connection attempts to use the EPRT command
/// and if the server does not support EPRT it falls back to the
/// PORT command before giving up unless you are connected via IPv6
/// in which case the PORT command is not supported.
///
AutoActive,
///
/// Active data connection, not recommended unless
/// you have a specific reason for using this type.
/// Creates a listening socket on the client which
/// requires firewall exceptions on the client system
/// as well as client network when connecting to a
/// server outside of the client's network. In addition
/// the IP address of the interface used to connect to the
/// server is the address the server is told to connect to
/// which, if behind a NAT device, may be inaccessible to
/// the server. This type of data connection is not supported
/// by IPv6. If you specify PORT and are connected via IPv6
/// EPRT will automatically be used instead.
///
PORT,
///
/// Extended active data connection, not recommended
/// unless you have a specific reason for using this
/// type. Creates a listening socket on the client
/// which requires firewall exceptions on the client
/// as well as client network when connecting to a
/// server outside of the client's network. The server
/// connects to the IP address it sees the client coming
/// from. This type of data connection supports IPv4 and IPv6.
///
EPRT
}
///
/// Type of data transfer to do
///
public enum FtpDataType {
///
/// ASCII transfer
///
ASCII,
///
/// Binary transfer
///
Binary
}
///
/// Type of file system of object
///
public enum FtpFileSystemObjectType {
///
/// A file
///
File,
///
/// A directory
///
Directory,
///
/// A symbolic link
///
Link
}
///
/// Types of file permissions
///
[Flags]
public enum FtpPermission : uint {
///
/// No access
///
None = 0,
///
/// Executable
///
Execute = 1,
///
/// Writable
///
Write = 2,
///
/// Readable
///
Read = 4
}
///
/// Types of special UNIX permissions
///
[Flags]
public enum FtpSpecialPermissions : int {
///
/// No special permissions are set
///
None = 0,
///
/// Sticky bit is set
///
Sticky = 1,
///
/// SGID bit is set
///
SetGroupID = 2,
///
/// SUID bit is set
///
SetUserID = 4
}
///
/// The type of response the server responded with
///
public enum FtpParser : int {
///
/// Use the legacy parser (for older projects that depend on the pre-2017 parser routines).
///
Legacy = -1,
///
/// Automatically detect the file listing parser to use based on the FTP server (SYST command).
///
Auto = 0,
///
/// Machine listing parser, works on any FTP server supporting the MLST/MLSD commands.
///
Machine = 1,
///
/// File listing parser for Windows/IIS.
///
Windows = 2,
///
/// File listing parser for Unix.
///
Unix = 3,
///
/// Alternate parser for Unix. Use this if the default one does not work.
///
UnixAlt = 4,
///
/// File listing parser for Vax/VMS/OpenVMS.
///
VMS = 5,
///
/// File listing parser for IBM OS400.
///
IBM = 6,
///
/// File listing parser for Tandem/Nonstop Guardian OS.
///
NonStop = 7
}
///
/// Flags that can dictate how a file listing is performed
///
[Flags]
public enum FtpListOption {
///
/// Tries machine listings (MDTM command) if supported,
/// and if not then falls back to OS-specific listings (LIST command)
///
Auto = 0,
///
/// Load the modify date using MDTM when it could not
/// be parsed from the server listing. This only pertains
/// to servers that do not implement the MLSD command.
///
Modify = 1,
///
/// Load the file size using the SIZE command when it
/// could not be parsed from the server listing. This
/// only pertains to servers that do not support the
/// MLSD command.
///
Size = 2,
///
/// Combines the Modify and Size flags
///
SizeModify = Modify | Size,
///
/// Show hidden/dot files. This only pertains to servers
/// that do not support the MLSD command. This option
/// makes use the non standard -a parameter to LIST to
/// tell the server to show hidden files. Since it's a
/// non-standard option it may not always work. MLSD listings
/// have no such option and whether or not a hidden file is
/// shown is at the discretion of the server.
///
AllFiles = 4,
///
/// Force the use of OS-specific listings (LIST command) even if
/// machine listings (MLSD command) are supported by the server
///
ForceList = 8,
///
/// Use the NLST command instead of LIST for a reliable file listing
///
NameList = 16,
///
/// Force the use of the NLST command (the slowest mode) even if machine listings
/// and OS-specific listings are supported by the server
///
ForceNameList = ForceList | NameList,
///
/// Try to dereference symbolic links, and stored the linked file/directory in FtpListItem.LinkObject
///
DerefLinks = 32,
///
/// Sets the ForceList flag and uses `LS' instead of `LIST' as the
/// command for getting a directory listing. This option overrides
/// ForceNameList and ignores the AllFiles flag.
///
UseLS = 64 | ForceList,
///
/// Gets files within subdirectories as well. Adds the -r option to the LIST command.
/// Some servers may not support this feature.
///
Recursive = 128,
///
/// Do not retrieve path when no path is supplied to GetListing(),
/// instead just execute LIST with no path argument.
///
NoPath = 256,
///
/// Include two extra items into the listing, for the current directory (".")
/// and the parent directory (".."). Meaningless unless you want these two
/// items for some reason.
///
IncludeSelfAndParent = 512
}
///
/// Defines the behavior for uploading/downloading files that already exist
///
public enum FtpExists {
///
/// Do not check if the file exists. A bit faster than the other options. Only use this if you are SURE that the file does not exist on the server.
/// Otherwise it can cause the UploadFile method to hang due to filesize mismatch.
///
NoCheck,
///
/// Skip the file if it exists, without any more checks.
///
Skip,
///
/// Overwrite the file if it exists.
///
Overwrite,
///
/// Append to the file if it exists, by checking the length and adding the missing data.
///
Append
}
///
/// Defines the level of the tracing message. Depending on the framework version this is translated
/// to an equivalent logging level in System.Diagnostices (if available)
///
public enum FtpTraceLevel {
///
/// Used for logging Debug or Verbose level messages
///
Verbose,
///
/// Used for logging Informational messages
///
Info,
///
/// Used for logging non-fatal or ignorable error messages
///
Warn,
///
/// Used for logging Error messages that may need investigation
///
Error
}
///
/// Defines how multi-file processes should handle a processing error.
///
/// & Cannot Be Combined
[Flags]
public enum FtpError {
///
/// No action is taken upon errors. The method absorbs the error and continues.
///
None = 0,
///
/// If any files have completed successfully (or failed after a partial download/upload) then should be deleted.
/// This will simulate an all-or-nothing transaction downloading or uploading multiple files. If this option is not
/// combined with or then the method will
/// continue to process all items whether if they are successful or not and then delete everything if a failure was
/// encountered at any point.
///
DeleteProcessed = 1,
///
/// The method should stop processing any additional files and immediately return upon encountering an error.
/// Cannot be combined with
///
Stop = 2,
///
/// The method should stop processing any additional files and immediately throw the current error.
/// Cannot be combined with
///
Throw = 4,
}
///
/// Defines if additional verification and actions upon failure that
/// should be performed when uploading/downloading files using the high-level APIs. Ignored if the
/// FTP server does not support any hashing algorithms.
///
[Flags]
public enum FtpVerify {
///
/// No verification of the file is performed
///
None = 0,
///
/// The checksum of the file is verified, if supported by the server.
/// If the checksum comparison fails then we retry the download/upload
/// a specified amount of times before giving up. (See )
///
Retry = 1,
///
/// The checksum of the file is verified, if supported by the server.
/// If the checksum comparison fails then the failed file will be deleted.
/// If combined with , then
/// the deletion will occur if it fails upon the final retry.
///
Delete = 2,
///
/// The checksum of the file is verified, if supported by the server.
/// If the checksum comparison fails then an exception will be thrown.
/// If combined with , then the throw will
/// occur upon the failure of the final retry, and/or if combined with
/// the method will throw after the deletion is processed.
///
Throw = 4,
///
/// The checksum of the file is verified, if supported by the server.
/// If the checksum comparison fails then the method returns false and no other action is taken.
///
OnlyChecksum = 8,
}
///
/// Defines if additional verification and actions upon failure that
/// should be performed when uploading/downloading files using the high-level APIs. Ignored if the
/// FTP server does not support any hashing algorithms.
///
public enum FtpDate {
///
/// The date is whatever the server returns, with no conversion performed.
///
Original = 0,
#if !CORE
///
/// The date is converted to the local timezone, based on the TimeOffset property in FtpClient.
///
Local = 1,
#endif
///
/// The date is converted to UTC, based on the TimeOffset property in FtpClient.
///
UTC = 2,
}
}