ftplib.h

00001 /***************************************************************************/
00002 /* ftplib.h - header file for callable ftp access routines                 */
00003 /* Copyright (C) 1996, 1997 Thomas Pfau, pfau@cnj.digex.net                */
00004 /*  73 Catherine Street, South Bound Brook, NJ, 08880      */
00005 /*                     */
00006 /* This library is free software; you can redistribute it and/or     */
00007 /* modify it under the terms of the GNU Library General Public       */
00008 /* License as published by the Free Software Foundation; either      */
00009 /* version 2 of the License, or (at your option) any later version.    */
00010 /*                     */
00011 /* This library is distributed in the hope that it will be useful,     */
00012 /* but WITHOUT ANY WARRANTY; without even the implied warranty of    */
00013 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     */
00014 /* Library General Public License for more details.        */
00015 /*                     */
00016 /* You should have received a copy of the GNU Library General Public     */
00017 /* License along with this progam; if not, write to the        */
00018 /* Free Software Foundation, Inc., 59 Temple Place - Suite 330,      */
00019 /* Boston, MA 02111-1307, USA.               */
00020 /*                     */
00021 /***************************************************************************/
00022 
00023 #if !defined(__FTPLIB_H)
00024 #define __FTPLIB_H
00025 
00026 #if defined(__unix__) || defined(VMS)
00027 #define GLOBALDEF
00028 #define GLOBALREF extern
00029 #elif defined(_WIN32)
00030 #if defined BUILDING_LIBRARY
00031 #define GLOBALDEF __declspec(dllexport)
00032 #define GLOBALREF __declspec(dllexport)
00033 #else
00034 #define GLOBALREF __declspec(dllimport)
00035 #endif
00036 #endif
00037 
00038 /* FtpAccess() type codes */
00039 #define FTPLIB_DIR 1
00040 #define FTPLIB_DIR_VERBOSE 2
00041 #define FTPLIB_FILE_READ 3
00042 #define FTPLIB_FILE_WRITE 4
00043 
00044 /* FtpAccess() mode codes */
00045 #define FTPLIB_ASCII 'A'
00046 #define FTPLIB_IMAGE 'I'
00047 #define FTPLIB_TEXT FTPLIB_ASCII
00048 #define FTPLIB_BINARY FTPLIB_IMAGE
00049 
00050 /* connection modes */
00051 #define FTPLIB_PASSIVE 1
00052 #define FTPLIB_PORT 2
00053 
00054 /* connection option names */
00055 #define FTPLIB_CONNMODE 1
00056 #define FTPLIB_CALLBACK 2
00057 #define FTPLIB_IDLETIME 3
00058 #define FTPLIB_CALLBACKARG 4
00059 #define FTPLIB_CALLBACKBYTES 5
00060 
00061 #ifdef __cplusplus
00062 extern "C" {
00063 #endif
00064 
00065 typedef struct NetBuf netbuf;
00066 typedef int (*FtpCallback)(netbuf *nControl, int xfered, void *arg);
00067 
00068 /* v1 compatibility stuff */
00069 #if !defined(_FTPLIB_NO_COMPAT)
00070 netbuf *DefaultNetbuf;
00071 
00072 #define ftplib_lastresp FtpLastResponse(DefaultNetbuf)
00073 #define ftpInit FtpInit
00074 #define ftpOpen(x) FtpConnect(x, &DefaultNetbuf)
00075 #define ftpLogin(x,y) FtpLogin(x, y, DefaultNetbuf)
00076 #define ftpSite(x) FtpSite(x, DefaultNetbuf)
00077 #define ftpMkdir(x) FtpMkdir(x, DefaultNetbuf)
00078 #define ftpChdir(x) FtpChdir(x, DefaultNetbuf)
00079 #define ftpRmdir(x) FtpRmdir(x, DefaultNetbuf)
00080 #define ftpNlst(x, y) FtpNlst(x, y, DefaultNetbuf)
00081 #define ftpDir(x, y) FtpDir(x, y, DefaultNetbuf)
00082 #define ftpGet(x, y, z) FtpGet(x, y, z, DefaultNetbuf)
00083 #define ftpPut(x, y, z) FtpPut(x, y, z, DefaultNetbuf)
00084 #define ftpRename(x, y) FtpRename(x, y, DefaultNetbuf)
00085 #define ftpDelete(x) FtpDelete(x, DefaultNetbuf)
00086 #define ftpQuit() FtpQuit(DefaultNetbuf)
00087 #endif /* (_FTPLIB_NO_COMPAT) */
00088 /* end v1 compatibility stuff */
00089 
00090 GLOBALREF int ftplib_debug;
00091 GLOBALREF void FtpInit(void);
00092 GLOBALREF char *FtpLastResponse(netbuf *nControl);
00093 GLOBALREF int FtpConnect(const char *host, netbuf **nControl);
00094 GLOBALREF int FtpOptions(int opt, long val, netbuf *nControl);
00095 GLOBALREF int FtpLogin(const char *user, const char *pass, netbuf *nControl);
00096 GLOBALREF int FtpAccess(const char *path, int typ, int mode, netbuf *nControl,
00097     netbuf **nData);
00098 GLOBALREF int FtpRead(void *buf, int max, netbuf *nData);
00099 GLOBALREF int FtpWrite(void *buf, int len, netbuf *nData);
00100 GLOBALREF int FtpClose(netbuf *nData);
00101 GLOBALREF int FtpSite(const char *cmd, netbuf *nControl);
00102 GLOBALREF int FtpSysType(char *buf, int max, netbuf *nControl);
00103 GLOBALREF int FtpMkdir(const char *path, netbuf *nControl);
00104 GLOBALREF int FtpChdir(const char *path, netbuf *nControl);
00105 GLOBALREF int FtpCDUp(netbuf *nControl);
00106 GLOBALREF int FtpRmdir(const char *path, netbuf *nControl);
00107 GLOBALREF int FtpPwd(char *path, int max, netbuf *nControl);
00108 GLOBALREF int FtpNlst(const char *output, const char *path, netbuf *nControl);
00109 GLOBALREF int FtpDir(const char *output, const char *path, netbuf *nControl);
00110 GLOBALREF int FtpSize(const char *path, int *size, char mode, netbuf *nControl);
00111 GLOBALREF int FtpModDate(const char *path, char *dt, int max, netbuf *nControl);
00112 GLOBALREF int FtpGet(const char *output, const char *path, char mode,
00113   netbuf *nControl);
00114 GLOBALREF int FtpPut(const char *input, const char *path, char mode,
00115   netbuf *nControl);
00116 GLOBALREF int FtpRename(const char *src, const char *dst, netbuf *nControl);
00117 GLOBALREF int FtpDelete(const char *fnm, netbuf *nControl);
00118 GLOBALREF void FtpQuit(netbuf *nControl);
00119 
00120 #ifdef __cplusplus
00121 };
00122 #endif
00123 
00124 #endif /* __FTPLIB_H */