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