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