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