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