1c2c66affSColin Finck /* 2c2c66affSColin Finck * Summary: minimal FTP implementation 3c2c66affSColin Finck * Description: minimal FTP implementation allowing to fetch resources 4*911153daSThomas Faber * like external subset. This module is DEPRECATED, do not 5*911153daSThomas Faber * use any of its functions. 6c2c66affSColin Finck * 7c2c66affSColin Finck * Copy: See Copyright for the status of this software. 8c2c66affSColin Finck * 9c2c66affSColin Finck * Author: Daniel Veillard 10c2c66affSColin Finck */ 11c2c66affSColin Finck 12c2c66affSColin Finck #ifndef __NANO_FTP_H__ 13c2c66affSColin Finck #define __NANO_FTP_H__ 14c2c66affSColin Finck 15c2c66affSColin Finck #include <libxml/xmlversion.h> 16c2c66affSColin Finck 17c2c66affSColin Finck #ifdef LIBXML_FTP_ENABLED 18c2c66affSColin Finck 19c2c66affSColin Finck /* Needed for portability to Windows 64 bits */ 20*911153daSThomas Faber #if defined(_WIN32) 21c2c66affSColin Finck #include <winsock2.h> 22c2c66affSColin Finck #else 23c2c66affSColin Finck /** 24c2c66affSColin Finck * SOCKET: 25c2c66affSColin Finck * 26c2c66affSColin Finck * macro used to provide portability of code to windows sockets 27c2c66affSColin Finck */ 28c2c66affSColin Finck #define SOCKET int 29c2c66affSColin Finck /** 30c2c66affSColin Finck * INVALID_SOCKET: 31c2c66affSColin Finck * 32c2c66affSColin Finck * macro used to provide portability of code to windows sockets 33c2c66affSColin Finck * the value to be used when the socket is not valid 34c2c66affSColin Finck */ 35c2c66affSColin Finck #undef INVALID_SOCKET 36c2c66affSColin Finck #define INVALID_SOCKET (-1) 37c2c66affSColin Finck #endif 38c2c66affSColin Finck 39c2c66affSColin Finck #ifdef __cplusplus 40c2c66affSColin Finck extern "C" { 41c2c66affSColin Finck #endif 42c2c66affSColin Finck 43c2c66affSColin Finck /** 44c2c66affSColin Finck * ftpListCallback: 45c2c66affSColin Finck * @userData: user provided data for the callback 46c2c66affSColin Finck * @filename: the file name (including "->" when links are shown) 47c2c66affSColin Finck * @attrib: the attribute string 48c2c66affSColin Finck * @owner: the owner string 49c2c66affSColin Finck * @group: the group string 50c2c66affSColin Finck * @size: the file size 51c2c66affSColin Finck * @links: the link count 52c2c66affSColin Finck * @year: the year 53c2c66affSColin Finck * @month: the month 54c2c66affSColin Finck * @day: the day 55c2c66affSColin Finck * @hour: the hour 56c2c66affSColin Finck * @minute: the minute 57c2c66affSColin Finck * 58c2c66affSColin Finck * A callback for the xmlNanoFTPList command. 59c2c66affSColin Finck * Note that only one of year and day:minute are specified. 60c2c66affSColin Finck */ 61c2c66affSColin Finck typedef void (*ftpListCallback) (void *userData, 62c2c66affSColin Finck const char *filename, const char *attrib, 63c2c66affSColin Finck const char *owner, const char *group, 64c2c66affSColin Finck unsigned long size, int links, int year, 65c2c66affSColin Finck const char *month, int day, int hour, 66c2c66affSColin Finck int minute); 67c2c66affSColin Finck /** 68c2c66affSColin Finck * ftpDataCallback: 69c2c66affSColin Finck * @userData: the user provided context 70c2c66affSColin Finck * @data: the data received 71c2c66affSColin Finck * @len: its size in bytes 72c2c66affSColin Finck * 73c2c66affSColin Finck * A callback for the xmlNanoFTPGet command. 74c2c66affSColin Finck */ 75c2c66affSColin Finck typedef void (*ftpDataCallback) (void *userData, 76c2c66affSColin Finck const char *data, 77c2c66affSColin Finck int len); 78c2c66affSColin Finck 79c2c66affSColin Finck /* 80c2c66affSColin Finck * Init 81c2c66affSColin Finck */ 82*911153daSThomas Faber XML_DEPRECATED 83c2c66affSColin Finck XMLPUBFUN void XMLCALL 84c2c66affSColin Finck xmlNanoFTPInit (void); 85*911153daSThomas Faber XML_DEPRECATED 86c2c66affSColin Finck XMLPUBFUN void XMLCALL 87c2c66affSColin Finck xmlNanoFTPCleanup (void); 88c2c66affSColin Finck 89c2c66affSColin Finck /* 90c2c66affSColin Finck * Creating/freeing contexts. 91c2c66affSColin Finck */ 92*911153daSThomas Faber XML_DEPRECATED 93c2c66affSColin Finck XMLPUBFUN void * XMLCALL 94c2c66affSColin Finck xmlNanoFTPNewCtxt (const char *URL); 95*911153daSThomas Faber XML_DEPRECATED 96c2c66affSColin Finck XMLPUBFUN void XMLCALL 97c2c66affSColin Finck xmlNanoFTPFreeCtxt (void * ctx); 98*911153daSThomas Faber XML_DEPRECATED 99c2c66affSColin Finck XMLPUBFUN void * XMLCALL 100c2c66affSColin Finck xmlNanoFTPConnectTo (const char *server, 101c2c66affSColin Finck int port); 102c2c66affSColin Finck /* 103c2c66affSColin Finck * Opening/closing session connections. 104c2c66affSColin Finck */ 105*911153daSThomas Faber XML_DEPRECATED 106c2c66affSColin Finck XMLPUBFUN void * XMLCALL 107c2c66affSColin Finck xmlNanoFTPOpen (const char *URL); 108*911153daSThomas Faber XML_DEPRECATED 109c2c66affSColin Finck XMLPUBFUN int XMLCALL 110c2c66affSColin Finck xmlNanoFTPConnect (void *ctx); 111*911153daSThomas Faber XML_DEPRECATED 112c2c66affSColin Finck XMLPUBFUN int XMLCALL 113c2c66affSColin Finck xmlNanoFTPClose (void *ctx); 114*911153daSThomas Faber XML_DEPRECATED 115c2c66affSColin Finck XMLPUBFUN int XMLCALL 116c2c66affSColin Finck xmlNanoFTPQuit (void *ctx); 117*911153daSThomas Faber XML_DEPRECATED 118c2c66affSColin Finck XMLPUBFUN void XMLCALL 119c2c66affSColin Finck xmlNanoFTPScanProxy (const char *URL); 120*911153daSThomas Faber XML_DEPRECATED 121c2c66affSColin Finck XMLPUBFUN void XMLCALL 122c2c66affSColin Finck xmlNanoFTPProxy (const char *host, 123c2c66affSColin Finck int port, 124c2c66affSColin Finck const char *user, 125c2c66affSColin Finck const char *passwd, 126c2c66affSColin Finck int type); 127*911153daSThomas Faber XML_DEPRECATED 128c2c66affSColin Finck XMLPUBFUN int XMLCALL 129c2c66affSColin Finck xmlNanoFTPUpdateURL (void *ctx, 130c2c66affSColin Finck const char *URL); 131c2c66affSColin Finck 132c2c66affSColin Finck /* 133c2c66affSColin Finck * Rather internal commands. 134c2c66affSColin Finck */ 135*911153daSThomas Faber XML_DEPRECATED 136c2c66affSColin Finck XMLPUBFUN int XMLCALL 137c2c66affSColin Finck xmlNanoFTPGetResponse (void *ctx); 138*911153daSThomas Faber XML_DEPRECATED 139c2c66affSColin Finck XMLPUBFUN int XMLCALL 140c2c66affSColin Finck xmlNanoFTPCheckResponse (void *ctx); 141c2c66affSColin Finck 142c2c66affSColin Finck /* 143c2c66affSColin Finck * CD/DIR/GET handlers. 144c2c66affSColin Finck */ 145*911153daSThomas Faber XML_DEPRECATED 146c2c66affSColin Finck XMLPUBFUN int XMLCALL 147c2c66affSColin Finck xmlNanoFTPCwd (void *ctx, 148c2c66affSColin Finck const char *directory); 149*911153daSThomas Faber XML_DEPRECATED 150c2c66affSColin Finck XMLPUBFUN int XMLCALL 151c2c66affSColin Finck xmlNanoFTPDele (void *ctx, 152c2c66affSColin Finck const char *file); 153c2c66affSColin Finck 154*911153daSThomas Faber XML_DEPRECATED 155c2c66affSColin Finck XMLPUBFUN SOCKET XMLCALL 156c2c66affSColin Finck xmlNanoFTPGetConnection (void *ctx); 157*911153daSThomas Faber XML_DEPRECATED 158c2c66affSColin Finck XMLPUBFUN int XMLCALL 159c2c66affSColin Finck xmlNanoFTPCloseConnection(void *ctx); 160*911153daSThomas Faber XML_DEPRECATED 161c2c66affSColin Finck XMLPUBFUN int XMLCALL 162c2c66affSColin Finck xmlNanoFTPList (void *ctx, 163c2c66affSColin Finck ftpListCallback callback, 164c2c66affSColin Finck void *userData, 165c2c66affSColin Finck const char *filename); 166*911153daSThomas Faber XML_DEPRECATED 167c2c66affSColin Finck XMLPUBFUN SOCKET XMLCALL 168c2c66affSColin Finck xmlNanoFTPGetSocket (void *ctx, 169c2c66affSColin Finck const char *filename); 170*911153daSThomas Faber XML_DEPRECATED 171c2c66affSColin Finck XMLPUBFUN int XMLCALL 172c2c66affSColin Finck xmlNanoFTPGet (void *ctx, 173c2c66affSColin Finck ftpDataCallback callback, 174c2c66affSColin Finck void *userData, 175c2c66affSColin Finck const char *filename); 176*911153daSThomas Faber XML_DEPRECATED 177c2c66affSColin Finck XMLPUBFUN int XMLCALL 178c2c66affSColin Finck xmlNanoFTPRead (void *ctx, 179c2c66affSColin Finck void *dest, 180c2c66affSColin Finck int len); 181c2c66affSColin Finck 182c2c66affSColin Finck #ifdef __cplusplus 183c2c66affSColin Finck } 184c2c66affSColin Finck #endif 185c2c66affSColin Finck #endif /* LIBXML_FTP_ENABLED */ 186c2c66affSColin Finck #endif /* __NANO_FTP_H__ */ 187