blob: 84ee18df4e637888aa4242953ad2d9ba95e5565c [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:
17 * A callback for the xmlNanoFTPList command
18 */
Daniel Veillardda07c342000-01-25 18:31:22 +000019typedef void (*ftpListCallback) (void *userData,
20 const char *filename, const char* attrib,
21 const char *owner, const char *group,
22 unsigned long size, int links, int year,
23 const char *month, int day, int minute);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000024/**
25 * ftpDataCallback:
26 * A callback for the xmlNanoFTPGet command
27 */
Daniel Veillardda07c342000-01-25 18:31:22 +000028typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
29
Daniel Veillardaeea04f2000-01-25 19:27:27 +000030/*
31 * Init
32 */
33void xmlNanoFTPInit (void);
Daniel Veillardda07c342000-01-25 18:31:22 +000034
Daniel Veillardaeea04f2000-01-25 19:27:27 +000035/*
36 * Creating/freeing contexts
37 */
38void * xmlNanoFTPNewCtxt (const char *URL);
39void xmlNanoFTPFreeCtxt (void * ctx);
40void * xmlNanoFTPConnectTo (const char *server,
41 int port);
42/*
43 * Opening/closing session connections
44 */
45void * xmlNanoFTPOpen (const char *URL);
46int xmlNanoFTPConnect (void *ctx);
Daniel Veillardda07c342000-01-25 18:31:22 +000047int xmlNanoFTPClose (void *ctx);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000048int xmlNanoFTPQuit (void *ctx);
49
50
51/*
52 * Rathern internal commands
53 */
54int xmlNanoFTPGetResponse (void *ctx);
55int xmlNanoFTPCheckResponse (void *ctx);
56
57/*
58 * CD/DIR/GET handlers
59 */
60int xmlNanoFTPCwd (void *ctx,
61 char *directory);
62
63int xmlNanoFTPGetConnection (void *ctx);
64int xmlNanoFTPCloseConnection(void *ctx);
65int xmlNanoFTPList (void *ctx,
66 ftpListCallback callback,
67 void *userData,
68 char *filename);
69int xmlNanoFTPGetSocket (void *ctx,
70 const char *filename);
71int xmlNanoFTPGet (void *ctx,
72 ftpDataCallback callback,
73 void *userData,
Daniel Veillardda07c342000-01-25 18:31:22 +000074 const char *filename);
75int xmlNanoFTPRead (void *ctx,
76 void *dest,
77 int len);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000078
Daniel Veillardda07c342000-01-25 18:31:22 +000079#ifdef __cplusplus
80}
81#endif
82#endif /* __NANO_FTP_H__ */