FTP cyuyan

  1. /***************************************************************************/  
  2. /*                                     */  
  3. /* ftplib.h - header file for callable ftp access routines                 */  
  4. /* Copyright (C) 1996, 1997 Thomas Pfau, pfau@cnj.digex.net                */  
  5. /*  73 Catherine Street, South Bound Brook, NJ, 08880          */  
  6. /*                                     */  
  7. /* This library is free software; you can redistribute it and/or       */  
  8. /* modify it under the terms of the GNU Library General Public         */  
  9. /* License as published by the Free Software Foundation; either        */  
  10. /* version 2 of the License, or (at your option) any later version.    */  
  11. /*                                     */  
  12. /* This library is distributed in the hope that it will be useful,     */  
  13. /* but WITHOUT ANY WARRANTY; without even the implied warranty of      */  
  14. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       */  
  15. /* Library General Public License for more details.            */  
  16. /*                                     */  
  17. /* You should have received a copy of the GNU Library General Public       */  
  18. /* License along with this progam; if not, write to the            */  
  19. /* Free Software Foundation, Inc., 59 Temple Place - Suite 330,        */  
  20. /* Boston, MA 02111-1307, USA.                         */  
  21. /*                                     */  
  22. /***************************************************************************/  
  23.   
  24. #if !defined(__FTPLIB_H)  
  25. #define __FTPLIB_H  
  26.   
  27. #if defined(__unix__) || defined(VMS)  
  28. #define GLOBALDEF  
  29. #define GLOBALREF extern  
  30. #elif defined(_WIN32)  
  31. #if defined BUILDING_LIBRARY  
  32. #define GLOBALDEF __declspec(dllexport)  
  33. #define GLOBALREF __declspec(dllexport)  
  34. #else  
  35. #define GLOBALREF __declspec(dllimport)  
  36. #endif  
  37. #endif  
  38.   
  39. /* FtpAccess() type codes */  
  40. #define FTPLIB_DIR 1  
  41. #define FTPLIB_DIR_VERBOSE 2  
  42. #define FTPLIB_FILE_READ 3  
  43. #define FTPLIB_FILE_WRITE 4  
  44.   
  45. /* FtpAccess() mode codes */  
  46. #define FTPLIB_ASCII 'A'  
  47. #define FTPLIB_IMAGE 'I'  
  48. #define FTPLIB_TEXT FTPLIB_ASCII  
  49. #define FTPLIB_BINARY FTPLIB_IMAGE  
  50.   
  51. /* connection modes */  
  52. #define FTPLIB_PASSIVE 1  
  53. #define FTPLIB_PORT 2  
  54.   
  55. /* connection option names */  
  56. #define FTPLIB_CONNMODE 1  
  57. #define FTPLIB_CALLBACK 2  
  58. #define FTPLIB_IDLETIME 3  
  59. #define FTPLIB_CALLBACKARG 4  
  60. #define FTPLIB_CALLBACKBYTES 5  
  61.   
  62. #ifdef __cplusplus  
  63. extern "C" {  
  64. #endif  
  65.   
  66. typedef struct NetBuf netbuf;  
  67. typedef int (*FtpCallback)(netbuf *nControl, int xfered, void *arg);  
  68.   
  69. /* v1 compatibility stuff */  
  70. #if !defined(_FTPLIB_NO_COMPAT)  
  71. netbuf *DefaultNetbuf;  
  72.   
  73. #define ftplib_lastresp FtpLastResponse(DefaultNetbuf)  
  74. #define ftpInit FtpInit  
  75. #define ftpOpen(x) FtpConnect(x, &DefaultNetbuf)  
  76. #define ftpLogin(x,y) FtpLogin(x, y, DefaultNetbuf)  
  77. #define ftpSite(x) FtpSite(x, DefaultNetbuf)  
  78. #define ftpMkdir(x) FtpMkdir(x, DefaultNetbuf)  
  79. #define ftpChdir(x) FtpChdir(x, DefaultNetbuf)  
  80. #define ftpRmdir(x) FtpRmdir(x, DefaultNetbuf)  
  81. #define ftpNlst(x, y) FtpNlst(x, y, DefaultNetbuf)  
  82. #define ftpDir(x, y) FtpDir(x, y, DefaultNetbuf)  
  83. #define ftpGet(x, y, z) FtpGet(x, y, z, DefaultNetbuf)  
  84. #define ftpPut(x, y, z) FtpPut(x, y, z, DefaultNetbuf)  
  85. #define ftpRename(x, y) FtpRename(x, y, DefaultNetbuf)  
  86. #define ftpDelete(x) FtpDelete(x, DefaultNetbuf)  
  87. #define ftpQuit() FtpQuit(DefaultNetbuf)  
  88. #endif /* (_FTPLIB_NO_COMPAT) */  
  89. /* end v1 compatibility stuff */  
  90.   
  91. GLOBALREF int ftplib_debug;  
  92. GLOBALREF void FtpInit(void);  
  93. GLOBALREF char *FtpLastResponse(netbuf *nControl);  
  94. GLOBALREF int FtpConnect(const char *host, netbuf **nControl);  
  95. GLOBALREF int FtpOptions(int opt, long val, netbuf *nControl);  
  96. GLOBALREF int FtpLogin(const char *user, const char *pass, netbuf *nControl);  
  97. GLOBALREF int FtpAccess(const char *path, int typ, int mode, netbuf *nControl, netbuf **nData);  
  98. GLOBALREF int FtpRead(void *buf, int max, netbuf *nData);  
  99. GLOBALREF int FtpWrite(void *buf, int len, netbuf *nData);  
  100. GLOBALREF int FtpClose(netbuf *nData);  
  101. GLOBALREF int FtpSite(const char *cmd, netbuf *nControl);  
  102. GLOBALREF int FtpSysType(char *buf, int max, netbuf *nControl);  
  103. GLOBALREF int FtpMkdir(const char *path, netbuf *nControl);  
  104. GLOBALREF int FtpChdir(const char *path, netbuf *nControl);  
  105. GLOBALREF int FtpCDUp(netbuf *nControl);  
  106. GLOBALREF int FtpRmdir(const char *path, netbuf *nControl);  
  107. GLOBALREF int FtpPwd(char *path, int max, netbuf *nControl);  
  108. GLOBALREF int FtpNlst(const char *output, const char *path, netbuf *nControl);  
  109. GLOBALREF int FtpDir(const char *output, const char *path, netbuf *nControl);  
  110. GLOBALREF int FtpSize(const char *path, int *size, char mode, netbuf *nControl);  
  111. GLOBALREF int FtpModDate(const char *path, char *dt, int max, netbuf *nControl);  
  112. GLOBALREF int FtpGet(const char *output, const char *path, char mode, netbuf *nControl);  
  113. GLOBALREF int FtpPut(const char *input, const char *path, char mode, netbuf *nControl);  
  114. GLOBALREF int FtpRename(const char *src, const char *dst, netbuf *nControl);  
  115. GLOBALREF int FtpDelete(const char *fnm, netbuf *nControl);  
  116. GLOBALREF void FtpQuit(netbuf *nControl);  
  117.   
  118. #ifdef __cplusplus  
  119. };  
  120. #endif  
  121.   
  122. #endif /* __FTPLIB_H */ 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值