ftpLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:7k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* ftpLib.h - arpa File Transfer Protocol library header */
  2. /* Copyright 1984-2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01n,06jun02,elr  Change return for ftpTransientFatalInstall()
  7. 01m,23may02,elr  added temporary global flag to bypass PASSIVE mode
  8. 01l,22may02,elr  Changed API of ftpCommandEnhanced() and ftpReplyGetEnhanced()
  9.                  for PASSIVE mode support
  10.                  Added function ftpDataConnInitPassiveMode ()
  11.                  Added ftpLibDebugOptionsSet()
  12. 01k,12mar02,elr  Added error return codes
  13.                  Replaced ftpErrorSuppress with ftplDebug (SPR 71496)
  14. 01j,22sep92,rrr  added support for c++
  15. 01i,11sep92,jmm  added external definition for ftpErrorSupress (for spr #1257)
  16. 01h,04jul92,jcf  cleaned up.
  17. 01g,26may92,rrr  the tree shuffle
  18. 01f,04oct91,rrr  passed through the ansification filter
  19.   -fixed #else and #endif
  20.   -changed copyright notice
  21. 01e,19oct90,shl  changed ftpCommand() to use variable length argument list.
  22. 01d,05oct90,shl  added ANSI function prototypes.
  23.                  made #endif ANSI style.
  24.                  added copyright notice.
  25. 01c,07aug90,shl  added INCftpLibh to #endif.
  26. 01b,20mar87,dnw  prepended FTP_ to reply codes.
  27. 01a,07nov86,dnw  written
  28. */
  29. #ifndef __INCftpLibh
  30. #define __INCftpLibh
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* For debugging options */
  35. #define FTPL_DEBUG_OFF          0 /* No debugging messages */
  36. #define FTPL_DEBUG_INCOMING     1 /* Show all incoming responses */
  37. #define FTPL_DEBUG_OUTGOING     2 /* Show all outgoing commands */
  38. #define FTPL_DEBUG_ERRORS       4 /* Display all errors and warnings that occur */
  39. /* For FTP specification see RFC-765 */
  40. /* Reply codes for ftpReplyGet(). (Major numbers 1xx-5xx) */
  41. #define FTP_PRELIM              1 /* positive preliminary */
  42. #define FTP_COMPLETE            2 /* positive completion */
  43. #define FTP_CONTINUE            3 /* positive intermediate */
  44. #define FTP_TRANSIENT           4 /* transient negative completion */
  45. #define FTP_ERROR               5 /* permanent negative completion */
  46. /* Detailed reply codes for ftpReplyGetEnhanced() */
  47. #define FTP_PASSIVE_REPLY            227 /* Command not supported */
  48. #define FTP_COMMAND_NOT_SUPPORTED    502 /* Command not supported */
  49. #define FTP_NOACTION    550       /* requested action not taken */
  50. /* Type codes */
  51. #define TYPE_A 1 /* ASCII */
  52. #define TYPE_E 2 /* EBCDIC */
  53. #define TYPE_I 3 /* image */
  54. #define TYPE_L 4 /* local byte size */
  55. /* Form codes */
  56. #define FORM_N 1 /* non-print */
  57. #define FORM_T 2 /* telnet format effectors */
  58. #define FORM_C 3 /* carriage control (ASA) */
  59. /* Structure codes */
  60. #define STRU_F 1 /* file (no record structure) */
  61. #define STRU_R 2 /* record structure */
  62. #define STRU_P 3 /* page structure */
  63. /* Mode types */
  64. #define MODE_S 1 /* stream */
  65. #define MODE_B 2 /* block */
  66. #define MODE_C 3 /* compressed */
  67. /* Record Tokens */
  68. #define REC_ESC '377' /* Record-mode Escape */
  69. #define REC_EOR '01' /* Record-mode End-of-Record */
  70. #define REC_EOF '02' /* Record-mode End-of-File */
  71. /* Block Header */
  72. #define BLK_EOR 0x80 /* Block is End-of-Record */
  73. #define BLK_EOF 0x40 /* Block is End-of-File */
  74. #define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
  75. #define BLK_RESTART 0x10 /* Block is Restart Marker */
  76. #define BLK_BYTECOUNT 2 /* Bytes in this block */
  77. /* error values */
  78. /* 
  79.  * Note that for unexpected responses, the low-order byte of the eror code 
  80.  * contains the reponse code.
  81.  */
  82. #define S_ftpLib_ILLEGAL_VALUE                  (M_ftpLib | 1)
  83. #define S_ftpLib_TRANSIENT_RETRY_LIMIT_EXCEEDED (M_ftpLib | 2)
  84. #define S_ftpLib_FATAL_TRANSIENT_RESPONSE       (M_ftpLib | 3)
  85. #define S_ftpLib_REMOTE_SERVER_STATUS_221       (M_ftpLib | 221)
  86. #define S_ftpLib_REMOTE_SERVER_STATUS_226       (M_ftpLib | 226)
  87. #define S_ftpLib_REMOTE_SERVER_STATUS_257       (M_ftpLib | 257)
  88. #define S_ftpLib_REMOTE_SERVER_ERROR_422        (M_ftpLib | 422)
  89. #define S_ftpLib_REMOTE_SERVER_ERROR_425        (M_ftpLib | 425)
  90. #define S_ftpLib_REMOTE_SERVER_ERROR_450        (M_ftpLib | 450)
  91. #define S_ftpLib_REMOTE_SERVER_ERROR_451        (M_ftpLib | 451)
  92. #define S_ftpLib_REMOTE_SERVER_ERROR_452        (M_ftpLib | 452)
  93. #define S_ftpLib_REMOTE_SERVER_ERROR_500        (M_ftpLib | 500)
  94. #define S_ftpLib_REMOTE_SERVER_ERROR_501        (M_ftpLib | 501)
  95. #define S_ftpLib_REMOTE_SERVER_ERROR_502        (M_ftpLib | 502)
  96. #define S_ftpLib_REMOTE_SERVER_ERROR_503        (M_ftpLib | 503)
  97. #define S_ftpLib_REMOTE_SERVER_ERROR_504        (M_ftpLib | 504)
  98. #define S_ftpLib_REMOTE_SERVER_ERROR_520        (M_ftpLib | 520)
  99. #define S_ftpLib_REMOTE_SERVER_ERROR_521        (M_ftpLib | 521)
  100. #define S_ftpLib_REMOTE_SERVER_ERROR_530        (M_ftpLib | 530)
  101. #define S_ftpLib_REMOTE_SERVER_ERROR_550        (M_ftpLib | 550)
  102. #define S_ftpLib_REMOTE_SERVER_ERROR_551        (M_ftpLib | 551)
  103. #define S_ftpLib_REMOTE_SERVER_ERROR_552        (M_ftpLib | 552)
  104. #define S_ftpLib_REMOTE_SERVER_ERROR_553        (M_ftpLib | 553)
  105. #define S_ftpLib_REMOTE_SERVER_ERROR_554        (M_ftpLib | 554)
  106. /* externals */
  107. extern BOOL ftplDebug;        /*  print error message, defined in funcBind.c */
  108. /* disable passive mode - XXX this will be removed in the next release XXX */
  109. extern BOOL ftplPasvModeDisable; 
  110. /* function declarations */
  111. #if defined(__STDC__) || defined(__cplusplus)
  112. extern STATUS ftpLogin (int ctrlSock, char *user, char *passwd, char *account);
  113. extern STATUS ftpXfer (char *host, char *user, char *passwd, char *acct,
  114.                        char *cmd, char *dirname, char *filename,
  115.                        int *pCtrlSock, int *pDataSock);
  116. extern int ftpCommand (int ctrlSock, char *fmt, int arg1, int arg2,
  117.                        int arg3, int arg4, int arg5, int arg6);
  118. extern int ftpCommandEnhanced (int ctrlSock, char *fmt, int arg1, int arg2,
  119.                                int arg3, int arg4, int arg5, int arg6,
  120.                                char *replyString,
  121.                                int replyStringLength);
  122. extern int ftpDataConnGet (int dataSock);
  123. extern int ftpDataConnInit (int ctrlSock);
  124. extern int ftpDataConnInitPassiveMode (int ctrlSock);
  125. extern int ftpHookup (char *host);
  126. extern void ftpLibDebugOptionsSet (UINT32 options);
  127. extern int ftpReplyGet (int ctrlSock, BOOL expecteof);
  128. extern int ftpReplyGetEnhanced (int ctrlSock, BOOL expecteof, char *replyString,
  129.                                 int replyStringLength);
  130. extern STATUS ftpTransientConfigSet (UINT32 maxRetryCount, UINT32 retryInterval);
  131. extern STATUS ftpTransientConfigGet (UINT32 *maxRetryCount, UINT32 *retryInterval);
  132. extern STATUS ftpTransientFatalInstall (FUNCPTR configlette);
  133. #else  /* __STDC__ */
  134. extern STATUS ftpLogin ();
  135. extern STATUS ftpXfer ();
  136. extern int ftpCommand ();
  137. extern int ftpCommandEnhanced ();
  138. extern int ftpDataConnGet ();
  139. extern int ftpDataConnInit ();
  140. extern int ftpDataConnInitPassiveMode ();
  141. extern int ftpHookup ();
  142. extern void ftpLibDebugOptionsSet ();
  143. extern int ftpReplyGet ();
  144. extern int ftpReplyGetEnhanced ();
  145. extern STATUS ftpPrelimConfigSet ();
  146. extern STATUS ftpTransientConfigSet ();
  147. extern STATUS ftpLogin ();
  148. extern STATUS ftpXfer ();
  149. extern STATUS ftpTransientFatalInstall ();
  150. #endif /* __STDC__ */
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154. #endif /* __INCftpLibh */