- cleaned up the FTP module, did the API, extracted docs
[baserock-morphs:libxml2.git] / nanoftp.h
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
15 /**
16  * ftpListCallback: 
17  * A callback for the xmlNanoFTPList command
18  */
19 typedef 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);
24 /**
25  * ftpDataCallback: 
26  * A callback for the xmlNanoFTPGet command
27  */
28 typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
29
30 /*
31  * Init
32  */
33 void    xmlNanoFTPInit          (void);
34
35 /*
36  * Creating/freeing contexts
37  */
38 void *  xmlNanoFTPNewCtxt       (const char *URL);
39 void    xmlNanoFTPFreeCtxt      (void * ctx);
40 void *  xmlNanoFTPConnectTo     (const char *server,
41                                  int port);
42 /*
43  * Opening/closing session connections
44  */
45 void *  xmlNanoFTPOpen          (const char *URL);
46 int     xmlNanoFTPConnect       (void *ctx);
47 int     xmlNanoFTPClose         (void *ctx);
48 int     xmlNanoFTPQuit          (void *ctx);
49
50
51 /*
52  * Rathern internal commands
53  */
54 int     xmlNanoFTPGetResponse   (void *ctx);
55 int     xmlNanoFTPCheckResponse (void *ctx);
56
57 /*
58  * CD/DIR/GET handlers
59  */
60 int     xmlNanoFTPCwd           (void *ctx,
61                                  char *directory);
62
63 int     xmlNanoFTPGetConnection (void *ctx);
64 int     xmlNanoFTPCloseConnection(void *ctx);
65 int     xmlNanoFTPList          (void *ctx,
66                                  ftpListCallback callback,
67                                  void *userData,
68                                  char *filename);
69 int     xmlNanoFTPGetSocket     (void *ctx,
70                                  const char *filename);
71 int     xmlNanoFTPGet           (void *ctx,
72                                  ftpDataCallback callback,
73                                  void *userData,
74                                  const char *filename);
75 int     xmlNanoFTPRead          (void *ctx,
76                                  void *dest,
77                                  int len);
78
79 #ifdef __cplusplus
80 }
81 #endif
82 #endif /* __NANO_FTP_H__ */