blob: 0a41b975bac0528881b2dc706e8911ab2cfdf7de [file] [log] [blame]
Daniel Veillardda07c342000-01-25 18:31:22 +00001/*
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
12extern "C" {
13#endif
14
Daniel Veillardaeea04f2000-01-25 19:27:27 +000015/**
16 * ftpListCallback:
Daniel Veillarde41f2b72000-01-30 20:00:07 +000017 * @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 Veillardaeea04f2000-01-25 19:27:27 +000030 * A callback for the xmlNanoFTPList command
Daniel Veillarde41f2b72000-01-30 20:00:07 +000031 * Note that only one of year and day:minute are specified
Daniel Veillardaeea04f2000-01-25 19:27:27 +000032 */
Daniel Veillardda07c342000-01-25 18:31:22 +000033typedef 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 Veillarde41f2b72000-01-30 20:00:07 +000037 const char *month, int day, int hour,
38 int minute);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000039/**
40 * ftpDataCallback:
41 * A callback for the xmlNanoFTPGet command
42 */
Daniel Veillardda07c342000-01-25 18:31:22 +000043typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
44
Daniel Veillardaeea04f2000-01-25 19:27:27 +000045/*
46 * Init
47 */
48void xmlNanoFTPInit (void);
Daniel Veillarde41f2b72000-01-30 20:00:07 +000049void xmlNanoFTPCleanup (void);
Daniel Veillardda07c342000-01-25 18:31:22 +000050
Daniel Veillardaeea04f2000-01-25 19:27:27 +000051/*
52 * Creating/freeing contexts
53 */
54void * xmlNanoFTPNewCtxt (const char *URL);
55void xmlNanoFTPFreeCtxt (void * ctx);
56void * xmlNanoFTPConnectTo (const char *server,
57 int port);
58/*
59 * Opening/closing session connections
60 */
61void * xmlNanoFTPOpen (const char *URL);
62int xmlNanoFTPConnect (void *ctx);
Daniel Veillardda07c342000-01-25 18:31:22 +000063int xmlNanoFTPClose (void *ctx);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000064int xmlNanoFTPQuit (void *ctx);
Daniel Veillarde41f2b72000-01-30 20:00:07 +000065void xmlNanoFTPScanProxy (const char *URL);
66void xmlNanoFTPProxy (const char *host,
67 int port,
68 const char *user,
69 const char *passwd,
70 int type);
71int xmlNanoFTPUpdateURL (void *ctx,
72 const char *URL);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000073
74/*
75 * Rathern internal commands
76 */
77int xmlNanoFTPGetResponse (void *ctx);
78int xmlNanoFTPCheckResponse (void *ctx);
79
80/*
81 * CD/DIR/GET handlers
82 */
83int xmlNanoFTPCwd (void *ctx,
84 char *directory);
85
86int xmlNanoFTPGetConnection (void *ctx);
87int xmlNanoFTPCloseConnection(void *ctx);
88int xmlNanoFTPList (void *ctx,
89 ftpListCallback callback,
90 void *userData,
91 char *filename);
92int xmlNanoFTPGetSocket (void *ctx,
93 const char *filename);
94int xmlNanoFTPGet (void *ctx,
95 ftpDataCallback callback,
96 void *userData,
Daniel Veillardda07c342000-01-25 18:31:22 +000097 const char *filename);
98int xmlNanoFTPRead (void *ctx,
99 void *dest,
100 int len);
Daniel Veillardaeea04f2000-01-25 19:27:27 +0000101
Daniel Veillardda07c342000-01-25 18:31:22 +0000102#ifdef __cplusplus
103}
104#endif
105#endif /* __NANO_FTP_H__ */