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