2 * Summary: minimal FTP implementation
3 * Description: minimal FTP implementation allowing to fetch resources
4 * like external subset.
6 * Copy: See Copyright for the status of this software.
8 * Author: Daniel Veillard
11 #ifndef __NANO_FTP_H__
12 #define __NANO_FTP_H__
14 #include <libxml/xmlversion.h>
16 #ifdef LIBXML_FTP_ENABLED
18 /* Needed for portability to Windows 64 bits */
19 #if defined(__MINGW32__) || defined(_WIN32_WCE)
25 * macro used to provide portability of code to windows sockets
31 * macro used to provide portability of code to windows sockets
32 * the value to be used when the socket is not valid
34 #define INVALID_SOCKET (-1)
43 * @userData: user provided data for the callback
44 * @filename: the file name (including "->" when links are shown)
45 * @attrib: the attribute string
46 * @owner: the owner string
47 * @group: the group string
48 * @size: the file size
49 * @links: the link count
56 * A callback for the xmlNanoFTPList command.
57 * Note that only one of year and day:minute are specified.
59 typedef void (*ftpListCallback) (void *userData,
60 const char *filename, const char *attrib,
61 const char *owner, const char *group,
62 unsigned long size, int links, int year,
63 const char *month, int day, int hour,
67 * @userData: the user provided context
68 * @data: the data received
69 * @len: its size in bytes
71 * A callback for the xmlNanoFTPGet command.
73 typedef void (*ftpDataCallback) (void *userData,
80 XMLPUBFUN void XMLCALL
81 xmlNanoFTPInit (void);
82 XMLPUBFUN void XMLCALL
83 xmlNanoFTPCleanup (void);
86 * Creating/freeing contexts.
88 XMLPUBFUN void * XMLCALL
89 xmlNanoFTPNewCtxt (const char *URL);
90 XMLPUBFUN void XMLCALL
91 xmlNanoFTPFreeCtxt (void * ctx);
92 XMLPUBFUN void * XMLCALL
93 xmlNanoFTPConnectTo (const char *server,
96 * Opening/closing session connections.
98 XMLPUBFUN void * XMLCALL
99 xmlNanoFTPOpen (const char *URL);
100 XMLPUBFUN int XMLCALL
101 xmlNanoFTPConnect (void *ctx);
102 XMLPUBFUN int XMLCALL
103 xmlNanoFTPClose (void *ctx);
104 XMLPUBFUN int XMLCALL
105 xmlNanoFTPQuit (void *ctx);
106 XMLPUBFUN void XMLCALL
107 xmlNanoFTPScanProxy (const char *URL);
108 XMLPUBFUN void XMLCALL
109 xmlNanoFTPProxy (const char *host,
114 XMLPUBFUN int XMLCALL
115 xmlNanoFTPUpdateURL (void *ctx,
119 * Rather internal commands.
121 XMLPUBFUN int XMLCALL
122 xmlNanoFTPGetResponse (void *ctx);
123 XMLPUBFUN int XMLCALL
124 xmlNanoFTPCheckResponse (void *ctx);
127 * CD/DIR/GET handlers.
129 XMLPUBFUN int XMLCALL
130 xmlNanoFTPCwd (void *ctx,
131 const char *directory);
132 XMLPUBFUN int XMLCALL
133 xmlNanoFTPDele (void *ctx,
136 XMLPUBFUN SOCKET XMLCALL
137 xmlNanoFTPGetConnection (void *ctx);
138 XMLPUBFUN int XMLCALL
139 xmlNanoFTPCloseConnection(void *ctx);
140 XMLPUBFUN int XMLCALL
141 xmlNanoFTPList (void *ctx,
142 ftpListCallback callback,
144 const char *filename);
145 XMLPUBFUN SOCKET XMLCALL
146 xmlNanoFTPGetSocket (void *ctx,
147 const char *filename);
148 XMLPUBFUN int XMLCALL
149 xmlNanoFTPGet (void *ctx,
150 ftpDataCallback callback,
152 const char *filename);
153 XMLPUBFUN int XMLCALL
154 xmlNanoFTPRead (void *ctx,
161 #endif /* LIBXML_FTP_ENABLED */
162 #endif /* __NANO_FTP_H__ */