Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * nanohttp.c: minimalist FTP implementation to fetch external subsets. |
| 3 | * |
| 4 | * See Copyright for the status of this software. |
| 5 | * |
Daniel Veillard | c5d6434 | 2001-06-24 12:13:24 +0000 | [diff] [blame] | 6 | * daniel@veillard.com |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __NANO_FTP_H__ |
| 10 | #define __NANO_FTP_H__ |
| 11 | |
Daniel Veillard | c5d6434 | 2001-06-24 12:13:24 +0000 | [diff] [blame] | 12 | #if defined(WIN32) && defined(_MSC_VER) |
| 13 | #include <libxml/xmlwin32version.h> |
| 14 | #else |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 15 | #include <libxml/xmlversion.h> |
Daniel Veillard | c5d6434 | 2001-06-24 12:13:24 +0000 | [diff] [blame] | 16 | #endif |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 17 | #ifdef LIBXML_FTP_ENABLED |
| 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | /** |
| 24 | * ftpListCallback: |
| 25 | * @userData: user provided data for the callback |
| 26 | * @filename: the file name (including "->" when links are shown) |
| 27 | * @attrib: the attribute string |
| 28 | * @owner: the owner string |
| 29 | * @group: the group string |
| 30 | * @size: the file size |
| 31 | * @links: the link count |
| 32 | * @year: the year |
| 33 | * @month: the month |
| 34 | * @day: the day |
| 35 | * @hour: the hour |
| 36 | * @minute: the minute |
| 37 | * |
| 38 | * A callback for the xmlNanoFTPList command |
| 39 | * Note that only one of year and day:minute are specified |
| 40 | */ |
| 41 | typedef void (*ftpListCallback) (void *userData, |
Daniel Veillard | 963d2ae | 2002-01-20 22:08:18 +0000 | [diff] [blame^] | 42 | const char *filename, const char *attrib, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 43 | const char *owner, const char *group, |
| 44 | unsigned long size, int links, int year, |
| 45 | const char *month, int day, int hour, |
| 46 | int minute); |
| 47 | /** |
| 48 | * ftpDataCallback: |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 49 | * @userData: the user provided context |
| 50 | * @data: the data received |
| 51 | * @len: its size in bytes |
| 52 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 53 | * A callback for the xmlNanoFTPGet command |
| 54 | */ |
Daniel Veillard | 963d2ae | 2002-01-20 22:08:18 +0000 | [diff] [blame^] | 55 | typedef void (*ftpDataCallback) (void *userData, |
| 56 | const char *data, |
| 57 | int len); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 58 | |
| 59 | /* |
| 60 | * Init |
| 61 | */ |
| 62 | void xmlNanoFTPInit (void); |
| 63 | void xmlNanoFTPCleanup (void); |
| 64 | |
| 65 | /* |
| 66 | * Creating/freeing contexts |
| 67 | */ |
| 68 | void * xmlNanoFTPNewCtxt (const char *URL); |
| 69 | void xmlNanoFTPFreeCtxt (void * ctx); |
| 70 | void * xmlNanoFTPConnectTo (const char *server, |
| 71 | int port); |
| 72 | /* |
| 73 | * Opening/closing session connections |
| 74 | */ |
| 75 | void * xmlNanoFTPOpen (const char *URL); |
| 76 | int xmlNanoFTPConnect (void *ctx); |
| 77 | int xmlNanoFTPClose (void *ctx); |
| 78 | int xmlNanoFTPQuit (void *ctx); |
| 79 | void xmlNanoFTPScanProxy (const char *URL); |
| 80 | void xmlNanoFTPProxy (const char *host, |
| 81 | int port, |
| 82 | const char *user, |
| 83 | const char *passwd, |
| 84 | int type); |
| 85 | int xmlNanoFTPUpdateURL (void *ctx, |
| 86 | const char *URL); |
| 87 | |
| 88 | /* |
| 89 | * Rathern internal commands |
| 90 | */ |
| 91 | int xmlNanoFTPGetResponse (void *ctx); |
| 92 | int xmlNanoFTPCheckResponse (void *ctx); |
| 93 | |
| 94 | /* |
| 95 | * CD/DIR/GET handlers |
| 96 | */ |
| 97 | int xmlNanoFTPCwd (void *ctx, |
| 98 | char *directory); |
| 99 | |
| 100 | int xmlNanoFTPGetConnection (void *ctx); |
| 101 | int xmlNanoFTPCloseConnection(void *ctx); |
| 102 | int xmlNanoFTPList (void *ctx, |
| 103 | ftpListCallback callback, |
| 104 | void *userData, |
| 105 | char *filename); |
| 106 | int xmlNanoFTPGetSocket (void *ctx, |
| 107 | const char *filename); |
| 108 | int xmlNanoFTPGet (void *ctx, |
| 109 | ftpDataCallback callback, |
| 110 | void *userData, |
| 111 | const char *filename); |
| 112 | int xmlNanoFTPRead (void *ctx, |
| 113 | void *dest, |
| 114 | int len); |
| 115 | |
| 116 | #ifdef __cplusplus |
| 117 | } |
| 118 | #endif /* LIBXML_FTP_ENABLED */ |
| 119 | #endif |
| 120 | #endif /* __NANO_FTP_H__ */ |