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
35 #define INVALID_SOCKET (-1)
44 * @userData: user provided data for the callback
45 * @filename: the file name (including "->" when links are shown)
46 * @attrib: the attribute string
47 * @owner: the owner string
48 * @group: the group string
49 * @size: the file size
50 * @links: the link count
57 * A callback for the xmlNanoFTPList command.
58 * Note that only one of year and day:minute are specified.
60 typedef void (*ftpListCallback) (void *userData,
61 const char *filename, const char *attrib,
62 const char *owner, const char *group,
63 unsigned long size, int links, int year,
64 const char *month, int day, int hour,
68 * @userData: the user provided context
69 * @data: the data received
70 * @len: its size in bytes
72 * A callback for the xmlNanoFTPGet command.
74 typedef void (*ftpDataCallback) (void *userData,
81 XMLPUBFUN void XMLCALL
82 xmlNanoFTPInit (void);
83 XMLPUBFUN void XMLCALL
84 xmlNanoFTPCleanup (void);
87 * Creating/freeing contexts.
89 XMLPUBFUN void * XMLCALL
90 xmlNanoFTPNewCtxt (const char *URL);
91 XMLPUBFUN void XMLCALL
92 xmlNanoFTPFreeCtxt (void * ctx);
93 XMLPUBFUN void * XMLCALL
94 xmlNanoFTPConnectTo (const char *server,
97 * Opening/closing session connections.
99 XMLPUBFUN void * XMLCALL
100 xmlNanoFTPOpen (const char *URL);
101 XMLPUBFUN int XMLCALL
102 xmlNanoFTPConnect (void *ctx);
103 XMLPUBFUN int XMLCALL
104 xmlNanoFTPClose (void *ctx);
105 XMLPUBFUN int XMLCALL
106 xmlNanoFTPQuit (void *ctx);
107 XMLPUBFUN void XMLCALL
108 xmlNanoFTPScanProxy (const char *URL);
109 XMLPUBFUN void XMLCALL
110 xmlNanoFTPProxy (const char *host,
115 XMLPUBFUN int XMLCALL
116 xmlNanoFTPUpdateURL (void *ctx,
120 * Rather internal commands.
122 XMLPUBFUN int XMLCALL
123 xmlNanoFTPGetResponse (void *ctx);
124 XMLPUBFUN int XMLCALL
125 xmlNanoFTPCheckResponse (void *ctx);
128 * CD/DIR/GET handlers.
130 XMLPUBFUN int XMLCALL
131 xmlNanoFTPCwd (void *ctx,
132 const char *directory);
133 XMLPUBFUN int XMLCALL
134 xmlNanoFTPDele (void *ctx,
137 XMLPUBFUN SOCKET XMLCALL
138 xmlNanoFTPGetConnection (void *ctx);
139 XMLPUBFUN int XMLCALL
140 xmlNanoFTPCloseConnection(void *ctx);
141 XMLPUBFUN int XMLCALL
142 xmlNanoFTPList (void *ctx,
143 ftpListCallback callback,
145 const char *filename);
146 XMLPUBFUN SOCKET XMLCALL
147 xmlNanoFTPGetSocket (void *ctx,
148 const char *filename);
149 XMLPUBFUN int XMLCALL
150 xmlNanoFTPGet (void *ctx,
151 ftpDataCallback callback,
153 const char *filename);
154 XMLPUBFUN int XMLCALL
155 xmlNanoFTPRead (void *ctx,
162 #endif /* LIBXML_FTP_ENABLED */
163 #endif /* __NANO_FTP_H__ */