FtpEnums.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. using System;
  2. namespace System.Net.FtpClient {
  3. /// <summary>
  4. /// 定义要使用的加密类型
  5. /// </summary>
  6. public enum FtpEncryptionMode {
  7. /// <summary>
  8. /// 纯文本.
  9. /// </summary>
  10. None,
  11. /// <summary>
  12. /// 从连接开始使用加密,端口990
  13. /// Encryption is used from the start of the connection, port 990
  14. /// </summary>
  15. Implicit,
  16. /// <summary>
  17. /// 连接以纯文本开始,并在服务器问候后立即使用AUTH命令启用加密。
  18. /// Connection starts in plain text and encryption is enabled
  19. /// with the AUTH command immediately after the server greeting.
  20. /// </summary>
  21. Explicit
  22. }
  23. /// <summary>
  24. /// 服务器响应的响应类型
  25. /// The type of response the server responded with
  26. /// </summary>
  27. public enum FtpResponseType : int {
  28. /// <summary>
  29. /// No response
  30. /// </summary>
  31. None = 0,
  32. /// <summary>
  33. /// Success
  34. /// </summary>
  35. PositivePreliminary = 1,
  36. /// <summary>
  37. /// Successs
  38. /// </summary>
  39. PositiveCompletion = 2,
  40. /// <summary>
  41. /// Succcess
  42. /// </summary>
  43. PositiveIntermediate = 3,
  44. /// <summary>
  45. /// Temporary failure
  46. /// </summary>
  47. TransientNegativeCompletion = 4,
  48. /// <summary>
  49. /// Permanent failure
  50. /// </summary>
  51. PermanentNegativeCompletion = 5
  52. }
  53. /// <summary>
  54. /// Server features
  55. /// </summary>
  56. [Flags]
  57. public enum FtpCapability : int {
  58. /// <summary>
  59. /// This server said it doesn't support anything!
  60. /// </summary>
  61. NONE = 0,
  62. /// <summary>
  63. /// Supports the MLST command
  64. /// </summary>
  65. MLSD = 1,
  66. /// <summary>
  67. /// Supports the SIZE command
  68. /// </summary>
  69. SIZE = 2,
  70. /// <summary>
  71. /// Supports the MDTM command
  72. /// </summary>
  73. MDTM = 4,
  74. /// <summary>
  75. /// Supports download/upload stream resumes
  76. /// </summary>
  77. REST = 8,
  78. /// <summary>
  79. /// Supports UTF8
  80. /// </summary>
  81. UTF8 = 16,
  82. /// <summary>
  83. /// PRET Command used in distributed ftp server software DrFTPD
  84. /// </summary>
  85. PRET = 32,
  86. /// <summary>
  87. /// Server supports the MFMT command for setting the
  88. /// modifid date of an object on the server
  89. /// </summary>
  90. MFMT = 64,
  91. /// <summary>
  92. /// Server supports the MFCT command for setting the
  93. /// created date of an object on the server
  94. /// </summary>
  95. MFCT = 128,
  96. /// <summary>
  97. /// Server supports the MFF command for setting certain facts
  98. /// about file sytem objects. If you need this command, it would
  99. /// probably be handy to query FEAT your self and have a look at
  100. /// the FtpReply.InfoMessages property to see which facts the server
  101. /// allows you to modify.
  102. /// </summary>
  103. MFF = 256,
  104. /// <summary>
  105. /// Server supports the STAT command
  106. /// </summary>
  107. STAT = 512,
  108. /// <summary>
  109. /// Support for the HASH command
  110. /// </summary>
  111. HASH = 1024,
  112. /// <summary>
  113. /// Support for the non-standard MD5 command
  114. /// </summary>
  115. MD5 = 2048,
  116. /// <summary>
  117. /// Support for the non-standard XMD5 command
  118. /// </summary>
  119. XMD5 = 4096,
  120. /// <summary>
  121. /// Support for the non-standard XCRC command
  122. /// </summary>
  123. XCRC = 8192,
  124. /// <summary>
  125. /// Support for the non-standard XSHA1 command
  126. /// </summary>
  127. XSHA1 = 16384,
  128. /// <summary>
  129. /// Support for the non-standard XSHA256 command
  130. /// </summary>
  131. XSHA256 = 32768,
  132. /// <summary>
  133. /// Support for the non-standard XSHA512 command
  134. /// </summary>
  135. XSHA512 = 65536
  136. }
  137. /// <summary>
  138. /// Different types of hashing algorithms for computing checksums.
  139. /// </summary>
  140. [Flags]
  141. public enum FtpHashAlgorithm : int {
  142. /// <summary>
  143. /// HASH command is not supported
  144. /// </summary>
  145. NONE = 0,
  146. /// <summary>
  147. /// SHA-1
  148. /// </summary>
  149. SHA1 = 1,
  150. /// <summary>
  151. /// SHA-256
  152. /// </summary>
  153. SHA256 = 2,
  154. /// <summary>
  155. /// SHA-512
  156. /// </summary>
  157. SHA512 = 4,
  158. /// <summary>
  159. /// MD5
  160. /// </summary>
  161. MD5 = 8,
  162. /// <summary>
  163. /// CRC
  164. /// </summary>
  165. CRC = 16
  166. }
  167. /// <summary>
  168. /// IP Versions to allow when connecting
  169. /// to a server.
  170. /// </summary>
  171. [Flags]
  172. public enum FtpIpVersion : int {
  173. /// <summary>
  174. /// Internet Protocol Version 4
  175. /// </summary>
  176. IPv4 = 1,
  177. /// <summary>
  178. /// Internet Protocol Version 6
  179. /// </summary>
  180. IPv6 = 2,
  181. /// <summary>
  182. /// Allow any supported version
  183. /// </summary>
  184. ANY = IPv4 | IPv6
  185. }
  186. /// <summary>
  187. /// 数据连接类型
  188. /// Data connection type
  189. /// </summary>
  190. public enum FtpDataConnectionType {
  191. /// <summary>
  192. /// 这种类型的数据连接的尝试使用EPSV命令
  193.         ///如果服务器不支持EPSV它属于回放弃,除非你是通过IPv6连接之前
  194. /// PASV命令
  195.         ///在这种情况下,不支持PASV命令。
  196. /// </summary>
  197. AutoPassive,
  198. /// <summary>
  199. ///被动数据连接。 EPSV是一个更好的
  200. ///如果支持选项。被动连接
  201. ///连接到由服务器dicated的IP地址
  202. ///其可以是或可以不是由客户端可访问的
  203. ///例如NAT设备后面的服务器可能
  204. ///其本地网络上得到的IP地址,该地址
  205. ///是不可访问的客户端。请注意,IPv6的
  206. ///不支持这种类型的数据连接。 如果你
  207. ///要求PASV并通过IPv6 EPSV连接会
  208. ///自动在它的位置被使用。
  209. /// </summary>
  210. PASV,
  211. /// <summary>
  212. ///同PASV除由服务器提供的主机被忽略
  213. ///和数据conncetion是到同一个地址时,该控制
  214. ///连接被连接到。这在情景如在
  215. ///服务器在提供私人/不可路由的网络地址
  216. /// PASV响应。这是功能上等同于EPSV除了一些
  217. ///服务器可能无法实现EPSV命令。请注意,IPv6的
  218. ///不支持这种类型的数据连接。 如果你
  219. ///要求PASV并通过IPv6 EPSV连接会
  220. ///自动在它的位置被使用。
  221. /// </summary>
  222. PASVEX,
  223. /// <summary>
  224. ///被动扩展的数据连接,推荐。 作品
  225. ///相同,除了与服务器的PASV连接
  226. ///没有规定以连接到一个IP地址,而不是
  227. ///被动连接去使用相同的地址
  228. ///在控制连接。这种类型的数据连接的
  229. ///支持IPv4和IPv6。
  230. /// </summary>
  231. EPSV,
  232. /// <summary>
  233. ///这种类型的数据连接的尝试使用EPRT命令
  234.         ///如果服务器不支持EPRT它属于回放弃,除非你是通过IPv6连接之前
  235. /// PORT命令
  236.         ///在这种情况下不支持PORT命令。
  237. /// </summary>
  238. AutoActive,
  239. /// <summary>
  240. ///有效的数据连接,不推荐,除非
  241. ///你有使用这种类型的具体原因。
  242. ///创建客户端上的监听套接字其中
  243. ///需要在客户端系统上的防火墙例外
  244. ///连接到时以及客户端网络
  245. ///客户端的网络之外的服务器。 此外
  246. ///使用的接口的IP地址,连接到
  247. ///服务器是服务器被告知连接到地址
  248. ///,如果后面的NAT设备,可能无法访问
  249. ///服务器。这种类型的数据连接的不支持
  250. ///通过了IPv6。如果指定端口,并通过IPv6连接
  251. /// EPRT将自动替代使用。
  252. /// </summary>
  253. PORT,
  254. /// <summary>
  255. ///扩展有效的数据连接,不推荐
  256. ///除非你有使用此特定的原因
  257. ///类型。创建客户端上的监听套接字
  258. ///这需要在客户端防火墙例外
  259. ///连接到时以及客户端网络
  260. ///客户端的网络之外的服务器。服务器
  261. ///连接到IP地址它看到客户正在添加
  262. ///而来。这种类型的数据连接的支持IPv4和IPv6。
  263. /// </summary>
  264. EPRT
  265. }
  266. /// <summary>
  267. /// 数据传输类型
  268. /// Type of data transfer to do
  269. /// </summary>
  270. public enum FtpDataType {
  271. /// <summary>
  272. /// ASCII transfer
  273. /// </summary>
  274. ASCII,
  275. /// <summary>
  276. /// Binary transfer
  277. /// </summary>
  278. Binary
  279. }
  280. /// <summary>
  281. /// Type of file system of object
  282. /// </summary>
  283. public enum FtpFileSystemObjectType {
  284. /// <summary>
  285. /// A file
  286. /// </summary>
  287. File,
  288. /// <summary>
  289. /// A directory
  290. /// </summary>
  291. Directory,
  292. /// <summary>
  293. /// A symbolic link
  294. /// </summary>
  295. Link
  296. }
  297. /// <summary>
  298. /// Types of file permissions
  299. /// </summary>
  300. [Flags]
  301. public enum FtpPermission : uint {
  302. /// <summary>
  303. /// No access
  304. /// </summary>
  305. None = 0,
  306. /// <summary>
  307. /// Executable
  308. /// </summary>
  309. Execute = 1,
  310. /// <summary>
  311. /// Writeable
  312. /// </summary>
  313. Write = 2,
  314. /// <summary>
  315. /// Readable
  316. /// </summary>
  317. Read = 4
  318. }
  319. /// <summary>
  320. /// Types of special UNIX permissions
  321. /// </summary>
  322. [Flags]
  323. public enum FtpSpecialPermissions : int {
  324. /// <summary>
  325. /// No special permissions are set
  326. /// </summary>
  327. None = 0,
  328. /// <summary>
  329. /// Sticky bit is set
  330. /// </summary>
  331. Sticky = 1,
  332. /// <summary>
  333. /// SGID bit is set
  334. /// </summary>
  335. SetGroupID = 2,
  336. /// <summary>
  337. /// SUID bit is set
  338. /// </summary>
  339. SetUserID = 4
  340. }
  341. /// <summary>
  342. /// Flags that can dicate how a file listing is performed
  343. /// </summary>
  344. [Flags]
  345. public enum FtpListOption {
  346. /// <summary>
  347. /// Load the modify date using MDTM when it could not
  348. /// be parsed from the server listing. This only pertains
  349. /// to servers that do not implement the MLSD command.
  350. /// </summary>
  351. Modify = 1,
  352. /// <summary>
  353. /// Load the file size using the SIZE command when it
  354. /// could not be parsed from the server listing. This
  355. /// only pertains to servers that do not support the
  356. /// MLSD command.
  357. /// </summary>
  358. Size = 2,
  359. /// <summary>
  360. /// Combines the Modify and Size flags
  361. /// </summary>
  362. SizeModify = Modify | Size,
  363. /// <summary>
  364. /// Show hidden/dot files. This only pertains to servers
  365. /// that do not support the MLSD command. This option
  366. /// makes use the non standard -a parameter to LIST to
  367. /// tell the server to show hidden files. Since it's a
  368. /// non-standard option it may not always work. MLSD listings
  369. /// have no such option and whether or not a hidden file is
  370. /// shown is at the discretion of the server.
  371. /// </summary>
  372. AllFiles = 4,
  373. /// <summary>
  374. /// Force the use of the NLST command even if MLSD
  375. /// is supported by the server
  376. /// </summary>
  377. ForceList = 8,
  378. /// <summary>
  379. /// Use the NLST command instead of LIST for a reliable file listing
  380. /// </summary>
  381. NameList = 16,
  382. /// <summary>
  383. /// Combines the ForceList and NameList flags
  384. /// </summary>
  385. ForceNameList = ForceList | NameList,
  386. /// <summary>
  387. /// Try to dereference symbolic links
  388. /// </summary>
  389. DerefLinks = 32,
  390. /// <summary>
  391. /// Sets the ForceList flag and uses `LS' instead of `LIST' as the
  392. /// command for getting a directory listing. This option overrides
  393. /// ForceNameList and ignores the AllFiles flag.
  394. /// </summary>
  395. UseLS = 64 | ForceList,
  396. /// <summary>
  397. /// Adds the -r option to the list command. Some servers may not
  398. /// support this feature.
  399. /// </summary>
  400. Recursive = 128,
  401. /// <summary>
  402. /// Do not retrieve path when no path is supplied to GetListing(),
  403. /// instead just execute LIST with no path argument.
  404. /// </summary>
  405. NoPath = 256
  406. }
  407. }